CHAPTER 3Singleton and Factory Patterns
Patterns are like recipes for OOP developers, with each pattern providing the required ingredients. You will customize the elements of the pattern to solve your particular programming challenges.
Patterns are useful to OOP developers because they can help you create a stable API but still maintain a desired level of flexibility. A pattern can help you define which object is responsible for a specific task, or even allow you to change a class completely without changing any of the code that interacts with your class. The former is called responsibility, and the latter polymorphism. You're probably already aware of these concepts in theory, but this chapter will help yo u understand the PHP syntax required ...
Get Pro PHP: Patterns, Frameworks, Testing and More now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.