http://qs321.pair.com?node_id=512388


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.