Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^2: The Accessor Heresy

by Roy Johnson (Monsignor)
on Nov 28, 2005 at 21:32 UTC ( #512388=note: print w/replies, xml ) Need Help??


in reply to Re: The Accessor Heresy
in thread The Accessor Heresy

The reason the Circle::Radius object exists is that it is part of the Circle object model. It is not an implementation detail, any more than Circle itself is. It is the portion of the Circle public interface that deals with radius-related property fiddling. Instead of embedding the name of a property in the method name, you would have an object by that name that has a simple method name. For example, you prefer:
$myCircle->operate_on_Radius;
Inherent in that name is the fact that there is a Radius property, a sort of implicit object. All else being equal, I would prefer to see
$myCircle->Radius->operate;
If either of us got rid of the concept of Radius, we would have to change our API. There is no benefit of either API over the other as far as that goes. If you change the object model, you have to change the API. Because the API is supposed to reflect the object model.

Caution: Contents may have been coded under pressure.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (5)
As of 2020-01-29 10:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?