Could any expert here please give some guideline? I am planning to implement something and considering using either Abstract Factory or Builder pattern based on what I read about both. However, I am unable to determine which one would be best used in this situation. Here is what I have -
1. I have a Object "MyObject" that contains some fields.
2. I need to use helper class/classes to set another "CallObject" based on fields in "MyObject". This helper class(es) reads values from "MyObject" and further compute it and set fields in "CallObject".
3. This "CallObjects" gets passed to external sdk method, which performs certain operation and returns "ResponseCallObject".
4. This "ResponseCallObject" then needs to be converted into "ResponseMyObject". Here I have to use again helper class(es) to read "ResponseCallObject" and further computer it and then set fields in "ResponseMyObject"
For steps 2 and 4, I would have to execute multiple methods in helper class(es) to set object correctly.
I hope I was able to explain the problem properly above. Based on what I read, I believe Abstract Factory or Builder Pattern would be a good choice to implement. But I am not sure which one would be the best solution as it seems when multiple steps are required to "build" object, the builder pattern would be good to use.
I need help on two things from anyone generous enough to help here :-)
1.) Is Builder pattern best to implement here?
2.) If I have to use either Builder Pattern (or Abstract Factory), could someone provide a hint on how my class structure would look like. (i.e. what goes in Director, Builder, Product etc.)
I will appreciate if anyone can throw some light on it.
Doesn't require a pattern and it unlikely one should be used unless there are multiple types of MyObect and/or CallObject.
There might be a different problem in dealing with the Response but again only if there are multiple types.
Thank you for your reply. There will be multiple types of MyObject and CallObject. I just wanted to give a simplistic example. The MyObject will be different depending on certain type of requests and CallObject would also be constructed differently and depending on the type of request different helper classes are called to construct this. Any suggestions based on this?