"proper" OO
Eric Wilhelm
scratchcomputing at gmail.com
Fri Oct 5 00:22:32 BST 2007
# from Ovid
# on Thursday 04 October 2007 16:11:
>> ( App::Prove::Plugins->can('switches')
>> ? App::Prove::Plugins->switches
>> : ()
>> ),
>
>Side note regarding proper OO.
>
>In the above case, inheritance is warranted with an abstract base
> class for plugins:
>
> package App::Prove::Plugins::Base;
>
> sub switches {}
>
>And all plugins inherit from that and you can just properly call the
>switches method without the ternary operator.
That *sounds* nice and proper, but the conditional is on whether or not
the class has been loaded, but more precisely on whether or not the
method exists. So, an abstract base class might be proper, but
incorrect in this case. Yes, the conditional should be on
defined(%App::Prove::Plugins::), but that seems a bit ugly.
--Eric
--
Consumers want choice, consumers want openness.
--Rob Glaser
---------------------------------------------------
http://scratchcomputing.com
---------------------------------------------------
More information about the tapx-dev
mailing list