On Fri, 19 Jan 2007 00:50:30 -0800
Eric Wilhelm <[EMAIL PROTECTED]> wrote:

> Taking away the new_instance bit for a second, and doing less under the 
> hood, couldn't it also be expressed as something like:
> 
>   my $factory = Class::ClassFactory->new(...);
>   my $foo_class = $factory->class_for(...);
>   # $foo_class is now a string like "GTK::Window"
>   # or the name of a dtRdr::Book subclass of some sort, no?
>   my $foo = $foo_class->new(...);
> 
> But, ClassFactory implies that some sort of dynamic class composition or 
> construction is going on behind the scenes.  Maybe that's the plan.

That wasn't the intention, it's really just looking to find a class that
is already installed and usable, that itself declares ability to be what
you asked for.

> If not, maybe it really isn't a factory, but more of a finder?  
> Class::PluginFinder, Class::ClassFinder, Class::ClassChooser, 
> Class::PluginPicker, or something along those lines perhaps?

Yes, I'm starting to like those ideas, and your suggestion of a
->class_for() method.

Maybe I'll ignore the "factory" part of the name, and go for something
like finder, or chooser.

Thinking some more - if it does support a ->class_for() method, there's
no actual requirement that the class we've found be a class that can be
->new()ed, maybe it just has some static methods in it. At which point,
are we really finding classes, or plugins?

Maybe something like

  Module::PluginFinder

-- 
Paul "LeoNerd" Evans

[EMAIL PROTECTED]
ICQ# 4135350       |  Registered Linux# 179460
http://www.leonerd.org.uk/

Reply via email to