Re: [PW-dev] Widget factory
Status: Alpha
Brought to you by:
spadkins
|
From: Stephen A. <ste...@of...> - 2001-06-11 21:15:05
|
At 01:43 PM 6/11/2001 -0500, you wrote:
>Many of the examples have Widget -> method() for making a widget. I don't
>think this is as good an idea as creating an instance of a factory class and
>using that to create widgets.
Can you clarify what examples you are talking about?
>In a threaded environment, we don't want to rely on globals for
configuration
>if the configuration might be different in different threads. This only
might
>come into play in a threaded Perl or in mod_perl 2.0. Not sure exactly
how it
>plays out, but better to be thread-safe just in case.
There are no globals in the code.
Perhaps you mean static methods in the Widget package?
(This doesn't suffer from any threading problems I am aware of.)
>We might want two different configurations in one script. Not sure exactly
>why, but better to allow it while not understanding why than to disallow
>because we can't see a reason for allowing. There's no *good* reason
(that I
>can think of) for not allowing it.
>
>Instead of:
>
> $widget = Widget -> new("Widget::Type");
I don't know what you're getting at.
All of the examples and the code use the controller as the factory.
$widget = $wc->widget($wname);
>have
>
> $controller = new Widget::Controller;
> $controller -> state(new Widget::State);
> # etc...
> $widget = $controller -> widget("Type");
>
>
>These are the reasons I went with an instance of Widget::Controller being
the
>factory in my development code instead of Widget -> method. Just thought
I'd
>throw it out there for possible discussion. :)
James, you're giving good input and obviously putting some good thought into
the topic.
I just don't know what you're talking about in this email.
>James Smith <JG...@TA...>, 979-862-3725
>Texas A&M CIS Operating Systems Group, Unix
Stephen
|