http://www.perlmonks.org?node_id=258186


in reply to RFC - Parameter Objects

Being into OO in general, i'd say a certain collection of data that is used more than once should be made an object anyway, so i'd create a class supporting only accessors and mutators and no further methods. That's already close to your idea, only that each object is it's own class. That's where Class::Object and Class::Classless cross my thoughts, but these are too general for Paramtereobjects. So I'd suppose not Sub::ParamObject but Class::(Object|Classless)::ParamObject as name, although it might make people think it's built on top of one of the two. It could be, somehow.

--
http://fruiture.de

Replies are listed 'Best First'.
Re: Re: RFC - Parameter Objects
by Ovid (Cardinal) on May 14, 2003 at 18:34 UTC

    Each in its own class? Aack! Why didn't I see that bug coming? If more than one parameter object is used, identically named parameters would conflict. To get around this, the simplest thing that could possibly work could be for me to just auto-increment the class name of the parameter object. However, building this on top of Class::Object does look like a nice way to go. However, I might have a problem with the resulting object already having new() and sub() methods.

    Cheers,
    Ovid

    New address of my CGI Course.
    Silence is Evil (feel free to copy and distribute widely - note copyright text)

      Yep, a counter is also Class::Object's method to create unique classnames. As for the new() and sub() methods: I don't think they'd conflict with the purpose of the parameter object, even more they are very usefull for introducing hossman's validation methods (why limit this to one isValid, why not isValidForPurposeA and isValidForPurposeB ...) and to derive objects from objects. To me, it's just fulfillment of concept ;)

      --
      http://fruiture.de