Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

new idea - please comment on this

by uwevoelker (Pilgrim)
on Jan 14, 2002 at 21:14 UTC ( [id://138619]=note: print w/replies, xml ) Need Help??


in reply to OO - problem with inheritance

I have a new idea:
Because the only goal for this $parameter_config hashref is to validate the parameters given to the constructor new() I could write a class ValidateNewParameter.pm. The base_class creates a new ValidateNewParameter object and stores lots of parameters in it. And all the derived datatypes clone this object and add only there changes. I think this could work!

And I can even reuse this behaviour in other modules. Also, base_class gets cleaner.

What do you think about this idea? Have I overseen something important?

Thank you very much

Replies are listed 'Best First'.
Re: new idea - please comment on this
by IlyaM (Parson) on Jan 14, 2002 at 21:30 UTC
    It is similar to your original idea to store parameters data in a hash (instead of hashes you have objects which stores same information). So it is not really new idea :) Anyway it could be more cleaner approach if you move all your validation code into that class and replace hash manupulations with cleaner interface provided by that class. IMHO it is good approach.

    --
    Ilya Martynov (http://martynov.org/)

      You are right. I thought cloning of objects is much easier (because I have heard of the common clone-method in new/copy constructors), but actually it isn't very different from copying an hash. But I also like the idea of moving all my validation code into that class.

      Thank you for your comment.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (3)
As of 2024-04-25 04:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found