Objects

Update To Singleton

When this article was written I forgot to provide a warning about this pattern.  Use it sparingly if not at all!  The reason I say this now is because there are so many good patterns that will solve the same problems I used this pattern in.  Like many programmers I was lured to the ease of use of the singleton pattern because it was easy to understand and even easier to implament.  Take some time and do a little more research into different patterns.  You may find some that will perform better for your problem.

You may be wondering what a singleton, or single reference object is?  Well they are objects that once their initialized they can only have one reference. When your working with a normal class to create and object from that you would write:

What are objects and why would I ever use them?

 This was a big question on my mind two years ago when PHP 5 just started getting popular.  Now today I can truly say there isn't a piece of code I write that doesn't look a using objects. But let's not get ahead of ourselves.  PHP added OOP, thats a fancy acronym for Object Orientated Programming.  I've struggled with this term for years and when it was first introduced to me in C++ it didn't make any sense.  What I failed to see was how my base parent class could build a foundation that my program would thrive on.