I have a class "MyClass". Object creation of MyClass is complex as it has 6 steps and some of them are dependent on previous steps. Is builder pattern a good use case for this scenario ? If yes, how do i do it ? Please advise.
Kindly reply if question is not clear and you need more inputs.
Code, (I have reduced the steps to 3 in sample code, in reality i have 6 steps where some are dependent on previous steps and has a total of 40 lines of code. So I am trying to see if I can build the object in a cleaner way).
public class MyClass{
private SomeObject3 obj3;
private SomeObject1 obj1;
public MyClass(ParamObject param)
{
obj1 = new SomeObject1(param);
SomeObject2 obj2 = new SomeObject2(obj1);
obj3 = new SomeObject3(obj2);
}
}