Path: utzoo!mnetor!uunet!husc6!cmcl2!nrl-cmf!ames!ucsd!sdcsvax!ucsdhub!hp-sdd!hplabs!hp-pcd!hplsla!jima From: jima@hplsla.HP.COM ( Jim Adcock) Newsgroups: comp.lang.c++ Subject: Re: Critique of Wiener/Pinson Message-ID: <6590039@hplsla.HP.COM> Date: 20 Apr 88 01:32:19 GMT References: <8063@apple.Apple.Com> Organization: HP Lake Stevens, WA Lines: 36 |1) Access functions allow you to change the internal representation. |You might someday want to represent complex numbers in polar |coordinates. Admittedly, rectangular coordinates are usually |preferred, but there undoubtedly are applications in which polar |coordinates would be better. Use access functions and all your code |will continue to run. If you refuse to stick to your original definition of blah, and you make blah public, and someone uses blah, and then you change your definition of what blah means, then that user of your class is going to be hosed. BUT this is true whether or not blah is an access function or a public instance variable. If you change your definition of what a public anything means, you will hose your users. So the penalty for using access functions "everywhere" comes down to: 1) "Needlessly" writing access methods to instance variables that you, the class writer, are committed to never changing. 2) The class user gets more exposure to the use of the "noise characters" () And like other cases of "noise characters" in computer languages this is stuff that is easy to forget, since its meaningless. Meaning more failed compiles. And a few more characters to type. 3) The obscuring of an important, practical engineering issue -- namely that if a class designer changes the meaning of ANY PART of his/her public interface, in general that class's users are going to be hosed -- by the use of a blanket "religious" statement: "Use access functions everywhere and you can change your class without your users." Again, not true -- the issue is public vs non-public, it is not an issue of access functions or not access functions. Change the meaning of any part of your public interface, either instance variable or function, and your class's users will be hosed.