The IBM developerWorks site brings us yet another fine PHP-related article with this new tutorial today, a look at five common design patterns (and how to use them).
It's difficult to demonstrate the value of patterns using small examples. They often look like overkill because they really come into play in large code bases.
This article can't show huge applications, so you need to think about ways to apply the principles of the example -- and not necessarily this exact code -- in your larger applications. That's not to say that you shouldn't use patterns in small applications. Most good applications start small and become big, so there is no reason not to start with solid coding practices like these.
The five patterns they cover are:
- the Factory pattern
- the Singleton pattern
- the Observer pattern
- the Chain-of-Command pattern
- the Strategy pattern