Re: single class instance question
Mark Levison <mark-r0EpITdELjZWk0Htik3J/[email protected]>
| Newsgroups | gmane.comp.windows.off-topic |
|---|---|
| Message-ID | <[email protected]> |
On Sat, Jun 19, 2010 at 11:03 PM, Stuart Laughlin (Lists) < [email protected]> wrote: > > > On Sat, Jun 19, 2010 at 8:11 PM, Alan Baljeu <alanbaljeu-/[email protected]<alanbaljeu%40yahoo.com>> > 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. > Stuart - you're of course right, however first you have to know the Singleton and misuse it, before you can come to hate it. We can't help the poster skip the learning stages otherwise the lesson won't stick :-) Cheers Mark Levison *Mark Levison* | Agile Pain Relief Consulting<http://agilepainrelief.com/>| Agile Editor @ InfoQ <http://www.infoq.com/about.jsp> Blog <http://www.notesfromatooluser.com/> | Twitter<http://twitter.com/mlevison>| Office: (613) 862-2538 Recent Entries: Self Inflicted Agile Injuries<http://www.notesfromatooluser.com/2009/12/self-inflicted-agile-injuries.html>, Why use an Agile Coach<http://www.notesfromatooluser.com/2009/11/why-use-an-agile-coach.html>