Re: single class instance question
"Stuart Laughlin (Lists)" <[email protected]>
| Newsgroups | gmane.comp.windows.off-topic |
|---|---|
| Message-ID | <[email protected]> |
On Sat, Jun 19, 2010 at 8:11 PM, Alan Baljeu <alanbaljeu-/[email protected]> wrote: > > This is called the singleton pattern. Details depend on the language, but you should be able to Google that. > If my experience is an indicator, after you use the singleton pattern for a while, you will grow to hate it. I could write a treatise, but you would be better off googling "singletons are evil" and reading (with a grain of salt, of course) what other people have already said. In my opinion, the remedy to the singleton pattern (and what you really want for your scenario) is an inversion of control container. I recommend Castle Windsor, but there are others. It might be a bigger bite than you wish to chew at the moment, but tuck it away in your memory for the day you are looking at your code and ruing the day you learned the singleton pattern. Regards, --Stuart