The Singleton Pattern Is Not Evil

At the recent PHP UK Conference in London, one speaker described the Singleton Pattern as being evil. The main point brought up was that it brought global variables in through the back door, including all the problems associated with them.

Well, this is true, but only to a point. Just like eating ice-cream or junk food all the time would be bad for you, so would relying on the Singleton Pattern. However, it is still a very good pattern when used in specific instances, and when used sparingly, with discipline.

So, when could we consider using it?

Continue reading “The Singleton Pattern Is Not Evil”