lundi 28 mai 2018

design pattern create object from several object

hi can someone give me advice, what design pattern or best practice that good for my problem, in my service layer i have many method which construct object from several object. such as:

Order order = toOrder(A a, B b, C c);
Order order = toOrder(D d, A a)

it become bloated in my service layer, i read about converter and mapper, but is it limited about 2 object ? like create or mapping to object A to object B only

workaround that i can think is create a constructorHelper class that will consist of static method, but it will can cause a issue like dao pattern other developer will put many method without restriction

Aucun commentaire:

Enregistrer un commentaire