On 2011.10.26 12:55 PM, Eric Wilhelm wrote:
> To be specific, I picture the interface as one of:
>
> a) subtest_start() must return the subtest handler object
> (might be a new object, or just $self)
>
> or:
> b) subtest_start() must return the $invocant, $method, %args for
> construction of the subtest handler object
> (might be [$classname,'new', foo => 'bar'] or [$self, sub{shift}])
>
> (Where "return" might be in some way besides return() if warranted.)
>
> I think b is a better way to go if you want to keep more flexibility at
> the framework level. It might seem like a trivial difference, but it's
> really sausage or bacon. By deferring the execution, you will be able
> to put things before the construction/swap, add arguments to the method
> call, and other fun stuff within the framework's scope. If you go with
> a, the constructor already executed and the sausage is already ground.
Given that the event coordinator can't know anything about the interface of
the method they're calling on $classname, the event coordinator can't add
arguments. So I don't see the utility of B.
And given that the logic inside the event coordinator will look something like:
my $subtest_handler = $handler->accept_subtest_start;
The coordinator can do whatever it likes before triggering the handler as well
as after. And the handler can do whatever it likes to generate the subtest
handler.
I don't see the utility of the extra complexity of B in this case. It seems
it adds no extra flexibility, potential or real.
>> That's... almost Orwellian. Strictures are flexibility!
>
> For a long-term framework design, I think what you have seen with
> e.g. 'ok or diag' vs stop-on-failure is very telling. If the execution
> is ceded to the caller (sausage), you limit what features the framework
> can add in the future. But, whenever the "do this" is brought back
> into the scope of the framework in some composable fashion (i.e.
> deferred execution), the framework can add before/after/around (or even
> skip?) features later because you have that extra bit of control.
Sure, I get what you're saying. I couldn't help the 1984 dig. :-)
--
170. Not allowed to "defect" to OPFOR during training missions.
-- The 213 Things Skippy Is No Longer Allowed To Do In The U.S. Army
http://skippyslist.com/list/