[openbeos] Re: Keyboard Preferences Beta.

  • From: "Graham Gilmore" <grahamg@xxxxxxxxxxxx>
  • To: openbeos@xxxxxxxxxxxxx
  • Date: Wed, 30 Jan 2002 21:53:16 -0500

>>>o Tidy my code up with accessor funtions rather than sticking objects 

>in 
>>>the public sections of classes;
>>
>>Tsk Tsk. :-)
>
>Don't laugh, but it was only after reading François Revol code for 
>Workspaces and trying to implement reading and writing of the 
>preferences file I thought "Ahhh that was what my lecturer was on about 

>in C++ while I slept.....". I can see a point to protecting objects 
>now... but wait, who needs to do that when you can just presume that 
>nothing bads ever going to happen!?!


        It's not simply a matter of protecting yourself in the present.  The 
major advantage of using accessors is that you aren't committed to 
exporting data symbols in the future.  To maintain binary compatibility, 
you'd have to keep those data symbols exported (and, one would hope, 
make sure they are correct ;) even if you completely change the way your 
class is implemented and don't actually need those variables anymore for 
your implementation!  By using accessors, you can more easily change the 
implementation again and again without accumulating a lot of useless 
baggage.  
        

        Graham



Other related posts: