Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

Re: RFC - Parameter Objects

by fruiture (Curate)
on May 14, 2003 at 18:08 UTC ( [id://258186]=note: print w/replies, xml ) Need Help??

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.


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.


    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 ;)


Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://258186]
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (6)
As of 2024-06-22 08:51 GMT
Find Nodes?
    Voting Booth?

    No recent polls found

    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.