Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

new idea - please comment on this

by uwevoelker (Pilgrim)
on Jan 14, 2002 at 21:14 UTC ( #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? | Other CB clients
Other Users?
Others exploiting the Monastery: (3)
As of 2022-05-19 22:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (72 votes). Check out past polls.

    Notices?