samedi 27 juin 2015

Design pattern with task processor

Currently I am working on piece of code which takes data and process it using processor and version. Eg

IProcessor aProcessor = new AProcessor(new AProcessorVersion1Translator());
aProcessor.GetResult("sample data");

Currently I am using Factory method to get processor according to type:

IProcessor aProcessor = processorFactory.GetProcessor("A");

Each processor will have various number of version translators, and there is my problem. Where should I use the version translator factory, should I pass it to processor factory object? Or maybe should I create separate factories for each individual processor?

Aucun commentaire:

Enregistrer un commentaire