|  | Posted by Jerry Stuckle on 06/17/23 11:51 
Tony Marston wrote:> "Jerry Stuckle" <jstucklex@attglobal.net> wrote in message
 > news:IrOdnQkOaac8Gz3ZnZ2dnUVZ_omdnZ2d@comcast.com...
 >
 >>Henk Verhoeven wrote:
 >>
 >>>Jerry Stuckle wrote:
 >>> > Actually, things like private declarations are very important.
 >>>
 >>>IMHO private declarations are too rigid and therfore decrease
 >>>reusability. I agree that it can be very usefull to know the intentions
 >>>of the developer of some code one is  evaluating to call or some member
 >>>variable one is avaluating to access. But every now and then there are
 >>>good reasons to do it anyway, even if it was intended to be private. For
 >>>example lazy initialization and default reasoning both are often
 >>>implemented using direct access to member variables. Another example is
 >>>using a visitor to implement persistency.
 >>>
 >>>Now maybe you would say that i should change these member variables to
 >>>protected or public. There are two problems with this:
 >>>1. It may not be my own code. Then if i get an upgrade of this code,
 >>>these member variables will once again be private, unless i re-apply my
 >>>changes. This is uneccessary overhead.
 >>>2. By changing the private declaration the intension of the other
 >>>developer gets lost. Now i could put a comment in that it was intended to
 >>>be private, but in that case: why not put the @private marker in the
 >>>comment in the first place?
 >>>
 >>>The fundamental point is: With these private and protected declarations
 >>>you get stuck with the uneccessarily limitations introduced by the
 >>>author. Object-orientation can lead to more reusability then conventional
 >>>parameterized code exactly because the code can be overridden and
 >>>extended in ways the original author did not provide for. private and
 >>>protected declarations are a step backwards that is only reasonable if
 >>>you assume that future developers that will maintain or reuse your code
 >>>will ignore your intentions becuase they are fools. If this is the case,
 >>>i think you should tell your boss that you are limiting the reusability
 >>>of your code because you are aniticipating him to hire fools and let them
 >>>work on/with your code ;-)
 >>>
 >>>Greetings,
 >>>
 >>>Henk Verhoeven,
 >>>www.phpPeanuts.org.
 >>
 >>Henk,
 >>
 >>Private declarations are key to OO programming.
 >
 >
 > No they are not. Encapsulation is not the same as data hiding. Please refer
 > to:
 > http://www.javaworld.com/javaworld/jw-05-2001/jw-0518-encapsulation.html
 > http://www.itmweb.com/essay550.htm
 >
 
 Give it up, Tony.  You obviously can't even understand the information you
 reference.
 
 
 
 --
 ==================
 Remove the "x" from my email address
 Jerry Stuckle
 JDS Computer Training Corp.
 jstucklex@attglobal.net
 ==================
  Navigation: [Reply to this message] |