You are here: Re: php 5 classes: public, protected and private « PHP Programming Language « IT news, forums, messages
Re: php 5 classes: public, protected and private

Posted by Tony Marston on 11/30/06 10:52

"Jerry Stuckle" <jstucklex@attglobal.net> wrote in message
news:2aadnScWrfowF_DYnZ2dnUVZ_sadnZ2d@comcast.com...
> Tony Marston wrote:
>> "Jerry Stuckle" <jstucklex@attglobal.net> wrote in message
>> news:VomdnXOSpecHdvHYnZ2dnUVZ_oadnZ2d@comcast.com...
>>
>>>Michael Fesser wrote:
>>>
>>>>.oO(Tony Marston)
>>>>
>>>>
>>>>
>>>>>I disagree. it is *not* necessary for the simple reason that the code
>>>>>will perform exactly the same function whether methods and properties
>>>>>are marked as public/private/protected or not.
>>>>
>>>>
>>>>Then why do we use OOP and high-level languages like PHP at all? Pure
>>>>hand-written assembler code will perform exactly the same function.
>>>>
>>>>
>>>>
>>>>>>It prevents developers from doing things that shouldn't be done, for
>>>>>>example calling an internal method out of context. I don't want all my
>>>>>>methods being publicly available, simply in order to avoid errors and
>>>>>>unpredictable results.
>>>>>
>>>>>That is a matter for programmer discipline, it is not a matter of
>>>>>additional functionality. The code will do exactly the same with or
>>>>>without it.
>>>>
>>>>
>>>>The code written in a language like Delphi for example will also do
>>>>exactly the same with all type checks, range checks, overflow checks
>>>>etc. turned off. But does it make sense to do that and just rely on
>>>>"programmer discipline"? No, it doesn't, because it will lead to
>>>>erroneous code on the long run.
>>>>
>>>>Compilers are able to automatically check a lot of things and warn the
>>>>developer if he made a mistake. Such checks and restrictions don't add
>>>>any functionality, but are necessary in order to write reliable code.
>>>>
>>>>The same goes for visibility declarations. I don't rely on discipline or
>>>>a comment like "please don't call this method". If a method is not meant
>>>>to be called directly then it's declared as such - problem solved.
>>>>
>>>>Micha
>>>
>>>Micha,
>>>
>>>Tony and I have been into this before. He breaks into conversations
>>>trying to spout his version of OO, with a few blogs from people no one
>>>every heard of to back him up.
>>
>>
>> I see. So in your opinion Martin Fowler is of of these "people no one
>> ever heard of "? He says, like I do, that "Encapsulation Wasn't Meant To
>> Mean Data Hiding" at http://homepage.mac.com/keithray/blog/2006/02/22/
>>
>> Are you saying that YOU are more of an expert than Martin Fowler? What
>> arrogance!
>>
>
> No, I'm saying Booch, Rumbaugh and Jacobson, among others, are more expert
> than Martin Fowler. And yes, I've heard of him.
>
> But you're not quoting Martin Fowler. You're quoting Keith Ray's
> INTERPRETATION if Martin Fowler.

If you bothered to follow the link to Martn Fowler's page at
http://martinfowler.com/bliki/GetterEradicator.html you would see in
paragraph 4 tha it is a direct quotation, not an interpretation.

>>
>>>It's not worth getting into the argument. He's just a troll with
>>>delusions of competency.
>>
>>
>> If everyone who disagrees with you is incompetent then the world is full
>> of idiots. Your opinion is not the only opinion, and there are plenty of
>> "experts" who have opposing views.
>>
>
> No, I disagree with a lot of competent people. It's YOU who are an
> incompetent troll. And you continue to prove it.
>
> Try these - with direct quotes from recognized experts, and examples:
>
> http://www.research.umbc.edu/~tarr/dp/lectures/OOPrinciples-2pp.pdf
> http://www.nnwj.de/encapsulation.html
>
> Or better yet, read the real books by these authors.
>
> But I know you won't, because you disagree with what they say, and don't
> want to burst your little bubble.
>
> Troll.

Whether you like it or not there is no such thing as a single opinion as to
what OOP is and is not, and there are multiple interpretations as to the
real meaning of encapsulation, inheritance, polymorphism, implementation
hiding and information hiding. Just because you quote sources who agree with
you does not mean you are right and everybody else is wrong. Here are
sources with the opinion that "Encapsulation is NOT information hiding":

http://homepage.mac.com/keithray/blog/2006/02/22/
http://martinfowler.com/bliki/GetterEradicator.html
http://www.javaworld.com/javaworld/jw-05-2001/jw-0518-encapsulation.html?page=1
http://www.itmweb.com/essay550.htm
http://nat.truemesh.com/archives/000498.html

The world is full of different opinions, so who is to say which ones are
right and which ones are wrong?

--
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

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