mardi 24 février 2015

Dependency inversion principle: trying to understand

I'm learning design patterns and things around it (like SOLID and Dependency inversion principle in particular) and it looks like I'm loosing something:


Following the DIP rule I should be able to make classes less fragile by not creating an object in the class (composition) but sending the object reference/pointer to the class constructor (aggregation). But this means that I have to make an instance somewhere else: so the more flexible one class with aggregation is, the more fragile the other.


Please explain me where am I wrong.


Aucun commentaire:

Enregistrer un commentaire