Newsgroups: comp.lang.smalltalk Path: utzoo!utgpu!cunews!knight From: knight@mrco.carleton.ca (Alan Knight) Subject: Re: Access methods - New feature ? Message-ID: <1991Apr23.010026.25098@ccs.carleton.ca> Summary: They aren't always bad Sender: news@ccs.carleton.ca (news) Organization: Carleton University, Ottawa, Canada References: <1991Apr21.221149.8057@vuse.vanderbilt.edu> Date: Tue, 23 Apr 1991 01:00:26 GMT -- A couple of people have talked about the undesirability of access methods for instance variables, including: In article voss@cs.uiuc.edu (Bill Voss) writes: >My objection is not an algorithm, but it is in my experience a very good heuristic. >When I call another class's access methods, I almost always find I should have >opened another browser, and started adding methods to the other class instead. > >Thus as a "purist" on this question, I consider access methods similar to >the goto statement. Occasionally needed, but usually abused. > >Bill Voss - the purist - I think that this is a rather extreme position. Gratuitously accessing the representation of another class is undesirable, but often that representation corresponds to information about the class that a client might legitimately want to know. If access methods are usually an indication that the programmer has goofed then what about Point x, y Rectangle origin, corner, extent Line slope, or Line coefficients All of these represent information that I might reasonably want to know about an object, but they may easily correspond to pieces of the representation. Then again, they may not, and that's the point of encapsulation. -- -- Alan Knight knight@mrco.carleton.ca +1 613 788 5783 Support Dept. of Mechanical and Aeronautical Engineering the Carleton University, Ottawa, Ontario, Canada, K1S 5B6 LPF