Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

Re^2: Should I use Fields, InsideOuts, or Properties?

by stvn (Monsignor)
on Jul 06, 2005 at 16:56 UTC ( #472876=note: print w/replies, xml ) Need Help??

in reply to Re: Should I use Fields, InsideOuts, or Properties?
in thread Should I use Fields, InsideOuts, or Properties?

Encapsulation of an object means you should never access attributes directly but use accessors and mutators(getters and setters).

This is only partially true. Encapsulation means that you have private data which is not accessible from the "outside" (or more specifically, you can control the accessibility). What you are doing with AUTOLOAD is no better then just accessing the underlying hash directly.

IMO accessors and mutators should only be created when a truly valid need exists for them. Objects are meant to be a collection of (encapsulated) data and behaviors, but if all your behaviors are simply accessors/mutators, then you might as well just have a struct/record-type.

  • Comment on Re^2: Should I use Fields, InsideOuts, or Properties?

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://472876]
[Discipulus]: shmem the first time I was in germany I was so smart to learn by heart the address of the hostel: Einbahnstraße..
[Discipulus]: james28909 you are welcome
james28909 doesnt drink much alcohol
james28909 does enjoy blazing up though
james28909 also walks around hunting for his cell phone while using its flashlight function

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (5)
As of 2018-05-20 16:14 GMT
Find Nodes?
    Voting Booth?