Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Getter and Setter Function Names

by Biker (Priest)
on Apr 10, 2003 at 14:14 UTC ( #249619=note: print w/replies, xml ) Need Help??


in reply to Getter and Setter Function Names

I dislike "getters" but like "setters".

A method called salary() indicates a "thing", a noun. Well, what is this "thing", you may ask. The logical (in my humble opinion) answer is that the salary() method tells you what the "salary thing" is. Implementation: salary() returns the salary. No need for a "get_salary()".

It all becomes different when we want to apply a verb to your "thing". This is when I start working with the method name. Like increase_salary(), set_salary() or (sob) decrease_salary().

As a result, I end up with one method that represents the thing and zero or more methods that affects the thing.


Everything went worng, just as foreseen.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://249619]
help
Chatterbox?
[karlgoethebier]: choroba: This: https://www. paludan-cafe.dk ???
[karlgoethebier]: I get "You are using an outdated version of Internet Explorer. For a faster, safer browsing experienceUpgrade" Ouch! i got safari...
[karlgoethebier]: ...well, outdated

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (6)
As of 2017-11-19 12:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:













    Results (280 votes). Check out past polls.

    Notices?