If I have a factory that creates an object that needs an instance of another object should i use another factory responsible for this second's object creation or should the original factory handle this?
As is the answer to most design question, it depends. If virtually any instance of the other object can be used to initialize the first object then probably yes. That will make them more independent, but your code will grow (usual tradeoff). On the other hand, if specific objects require specific other objects then this should be one factory (or an abstract factory)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With