I read a book awhile back called PHP Design Patterns and Practice, and ever since then I have been using design patterns whenever I think they are needed. However it just occurred to me that maybe most companies do not use design patterns very often for PHP, or at all. What I was wondering is, do most companies use design patterns to help improve code flexibility? And if so, what are the best design patterns to learn for PHP?
Thanks for any help on this, Metropolis
Thanks for all of your great answers on this!
The conclusion I can take from this is: Patterns are used in almost all work places with PHP, and the most common ones need to be understood and memorized. Also, the MVC architectural pattern is very important and everyone will expect you to know it.
In my experience, the answer is: very often. Almost every place I’ve worked at uses design (and architectural) patterns. These are larger projects and it helps in implementation, maintenance and analysis to use known solutions to common problems.
You’ll want to learn all the biggies (because you’ll both use and run into them) starting with: Factory, Singleton, Observer, Strategy.
MVC is an architectural pattern that you should know well.