Considering a class A that instantiates from a class B. Class B requires certain values from an instance of class A. What is best-practice, in terms of the SOLID or other design principles, for passing these values from A to B:
- by passing the whole instance of A to the constructor of B
- by just passing the necessary attribute values from an instance of A to the constructor of B
- depends on the situation?
In case of (3), which criteria would favour one or the other solution?
(I do not know if this has an effect on the possible answers, but I am coding in Python)
Aucun commentaire:
Enregistrer un commentaire