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

Re: Getter and Setter Function Names

by zby (Vicar)
on Apr 10, 2003 at 15:04 UTC ( [id://249636]=note: print w/replies, xml ) Need Help??


in reply to Getter and Setter Function Names

When you can do both get and set on a property, then I personally like to have direct access to the variable. For me this is the clearest way:
$obj->{property} = 'something'; # for setting $somevar = $obj->{property}; # to get the value
I just don't see the any advantage in using a specialized functions for it. Getting and setting values of variables is something so basic for programming that I find it the most intuitive way for the task.

Replies are listed 'Best First'.
Re: Re: Getter and Setter Function Names
by Biker (Priest) on Apr 10, 2003 at 15:39 UTC

    Until the maintainer of the class decides to add something to the "getter" or the "setter" method. Like data checking, or persistance or some such. You'll be left out.


    Everything went worng, just as foreseen.

      Of course it is always a matter of tradeoff. You can't program against all possible future changes. You just need to forsee the most probable.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (3)
As of 2024-04-26 00:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found