mercredi 30 septembre 2015

Design Pattern for specific business partners, vendors, accounts etc

So I am thinking about a proper way to tackle this problem as far as a naming classes and a design pattern perspective is concerned. Think of a solution which is a engine - it gets input, does processing and produces an output.

Here is my interface to start with.

 public interface IFileProcessing
    {
    string InputFilePath { get; set;} 
    string OutputFilePath { get; set;}
    string ProcessedFilePath { get; set; }
    string ExtractionFieldsFromWebService{ get; set; }
    void ProcessFile(string FileName, string FilePath);
    }

BusinessModel: This is my business model, I have a ice cream shop and I designed classes to do my supplier based financials based on industry types(Lines of business). I sell ice creams of many types, which I buy from different suppliers, and at the end of the month I try to reconcile my account by line of business using classes I created for cost calculation purposes.Method Process file contains the algorithm specific to LOB calculation.

All this is happening based on 5 different models(line of businesses), aka classes I defined. Lets say for example, My classes handle my calculation of my costs

public class IceCreamLOB : IFileProcessing
public class FrozenCustardLOB : IFileProcessing
public class GelatoLOB: IFileProcessing
public class FrozenCustard: IFileProcessing

So far everything is generic to the line of businesses mentioned above. The complexity comes when I am being asked to design classes specifically for suppliers, aka example, BreyersLOB, or KlondikeLOB, which is say my biggest account and these accounts need special processing specifics. I don't know if I should be naming my classes specific to supply vendors. How can I maintain logical processing specific to a supplier in a class without naming the class a specific vendor. Is there a good pattern when you come across a situation like this.

How would I go about scaling this without using inheritance, or do I need to go there? So would you ever name your classes specific to the vendor/business partner you work with? Like Klondike and Breyers

Aucun commentaire:

Enregistrer un commentaire