From: Philipp Hofmann Date: 2008-02-13T13:50:53+09:00 Subject: Re: @var = change to accessor method? Why? On Mon, Feb 04, 2008 at 06:57:21PM +0900, Ryan Davis wrote: > > On Feb 3, 2008, at 18:18 , Philipp Hofmann wrote: > >> basicly it's a 2nd encapsulation of an attribute within an object that >> undermines the encapsulation that comes with oo design. > > How exactly does making/using an accessor method "undermine the > encapsulation"? what i meant is: accessors are meant to make the instance variables of an object to be accessible from outside. creating accessors for every variable used in an object (in order to get rid of @s) makes every variable accessible from outside the object. therefore the data is not encapsulated any more. so what you get is the encapsulation of a variable within an object and at the same time exposing it to the rest of your system. (of course you could set your accessors private, but that's even more code.) g phil