vendredi 13 mars 2015

Extracting client specific code. refactoring possibilities required

I am facing a Design problem. I have a set of classes which writes data in XML,JSON or HTML formates for different clients.


I have a class which receives Data and a XML, JSON or HTML writer as it parameter.


And these Writer have a common Interface, Writer uses the Data to create Data in speficied format. The writes have methods like writeHead, writeBody, WriteImages, writeFooter, writeDescriptions


Now my problem is that Descriptions part of the Documents is very client specific. Only that specific part looks completly different for each client but the rest of the Document is same.


Should I use writeDescriptions as a factory which calls clientSpefic writeDescriptions function? then I have another problem that I have many different formates like JSON,HTML,XML....


What will be the best possible way to hanlde is sitution?


Aucun commentaire:

Enregistrer un commentaire