Internal Apparatus:
Generated Singletons

By Edward Barnard

This month we study the Singleton Design Pattern, but with a twist. We start with a correct implementation but get it wrong by refactoring. We’ll examine the PHP generated code, each step of the way, to understand what went wrong. We’ll observe at least two reasons the Singleton Design Pattern is now considered an anti-pattern. We’re preparing to learn useful variations next month by seeing precisely how it works under the hood.

This article was originally published in the August 2019 issue of php[architect] magazine. To read the complete article please subscribe or purchase the complete issue.

Related Articles

Leave a comment

Use the form below to leave a comment: