Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

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]
[Eily]: do you pronunce that /xju:mən/ then ?
[Eily]: that's not what I'd call a silent h :)
[LanX]: see soundfile https://en. wiki/human# Pronunciation
[Your Mother]: Just Another Perl 'Acker.
[LanX]: I pronounce it 'juːmən'
[Your Mother]: Hey, let's not bring antisemitism into the conversation.
[LanX]: for centuries posh English speakers tried to approach French, that's where all the trouble starts
[Eily]: Just another Perl coeurs
[Eily]: (perl with hearts, 'Acker with a French accent is pronunced like coeurs)
[LanX]: IMHO 'ju' for 'u' happens in English where they can't pronounce the French u (or German )

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (9)
As of 2017-03-27 17:11 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (320 votes). Check out past polls.