[Catalyst] Re: using Plugin::Singleton and testing

Daniel McBrearty danielmcbrearty at gmail.com
Thu Nov 16 00:30:11 GMT 2006


a wonderful rant. except : he doesn't answer one basic question - what
do you do when you genuinely do want only one instance to ever exist?

"print spooler" is a crap example. A much better one is an audio
player - you can only listen to one audio track at a time, you really
don't want a second one to EVER happen. This is a reasonabvle design
decision to make early for some systems. If you want to change the
behaviour one day, that's irrelevant. That stuff about "maybe one day
you'll want a print spooler with different behaviour" misses the point
by miles. The point is - you only want one INSTANCE a truntime.
Whether there are different variations of behaviour available is a
completely different issue.

I've seen these kinds of things before. No doubt the idea is overused,
but it reeks of dogmatism, and many of the reasons given against are
actually not much more than hand waving ("it's a memory leak"
...right. There will only ever be one. Your leak can never get bigger
than the amount of memory used by one instance, unless the instance
itself is leaky. Maybe, sometimes, that isn't a problem?)

back on the original topic : fine that the plugin is "not
recommended", I'l take Matt's word as he knows a shitload more than I
do about what's going on inside cat. But maybe, it would be a good
idea, somewhere, to have a list of "recommended" and "not recommended"
modules, so that we could avoid this, if we choose to?

I'll take a look at Cat::Component when I've a chance, and ask back if
I can't see the better alternative.

On 11/15/06, A. Pagaltzis <pagaltzis at gmx.de> wrote:
> * Matt S Trout <dbix-class at trout.me.uk> [2006-11-15 12:25]:
> > Plugin::Singleton considered a really, really, really bad idea.
> >
> > Don't use it.
>
> While I'm in link-lobbing mode:
>
> http://steve.yegge.googlepages.com/singleton-considered-stupid
>
> Regards,
> --
> Aristotle Pagaltzis // <http://plasmasturm.org/>
>
> _______________________________________________
> List: Catalyst at lists.rawmode.org
> Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
> Dev site: http://dev.catalyst.perl.org/
>


-- 
Daniel McBrearty
email : danielmcbrearty at gmail.com
www.engoi.com : the multi - language vocab trainer
BTW : 0873928131



More information about the Catalyst mailing list