Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^5: OOP's setter/getter method - is there a way to avoid them?

by BrowserUk (Patriarch)
on Nov 05, 2015 at 15:27 UTC ( #1146997=note: print w/replies, xml ) Need Help??


in reply to Re^4: OOP's setter/getter method - is there a way to avoid them?
in thread OOP's setter/getter method - is there a way to avoid them?

Indeed. There are always going to be some attributes that need to be queried. Further, there are some attributes that need to be set directly and in isolation. Eg. If you move the address need to be updated. If you change your pin. Etc.

Of course, the former is likely a part of a Customer Class; and validation of the address is likely performed by a different processing application long before that information is wrapped up in a transaction and applied to the actual Customer record.

And the latter is likely part of a CreditCard class; and again validation and verification checks performed outside of the process that updated the master records.

But the point holds; accessor and mutator methods should be added deliberately as a designed requirement for those attributes that require them for the functional operation of the class; not generated automatically regardless of the need.


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority". I knew I was on the right track :)
In the absence of evidence, opinion is indistinguishable from prejudice.
  • Comment on Re^5: OOP's setter/getter method - is there a way to avoid them?

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (6)
As of 2023-02-02 12:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I prefer not to run the latest version of Perl because:







    Results (17 votes). Check out past polls.

    Notices?