PHP OOD (27) | Composition & Coupling

In PHP OOD (Object Oriented Design) we want our objects to be singular, and serve a specific role. In this example I show you how easy it is to couple things up because it feels right, but you should re-consider what you're doing or things can get hairy. By making simple objects rely on other simple objects all over the place your library becomes a spider web - you don't want to get tangled!

It's not always wrong to couple things (Which means objects require one-another, but you should do it as little as possible for flexibility). In many cases I think we are tempted to over-do it, so I am giving some advice based on that.



Thanks for watching my video tutorials! I hope they help and make your learning easier.