You are here: Re: Object Oriented PHP « PHP Programming Language « IT news, forums, messages
Re: Object Oriented PHP

Posted by Tony Marston on 12/18/99 11:51

"Jerry Stuckle" <jstucklex@attglobal.net> wrote in message
news:oMSdndxexPBAjzzZnZ2dnUVZ_tidnZ2d@comcast.com...
> 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.

No, I won't give it up. Both those articles clearly state that private
declarations (data hiding) is *not* one of the key concepts of OO.
Encapsulation is about *implementation* hiding, not information* hiding.

--
Tony Marston
http://www.tonymarston.net
http://www.radicore.org

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация