Reply to Re: php 5 classes: public, protected and private

Your name:

Reply:


Posted by Moot on 12/06/06 17:06

Tony Marston wrote:
> In PHP interfaces are NOT necessary.
>
> > They are how you interact with the object, and
>
> Wrong. You interact with an object by calling an object's method. The fact
> that a method may have an optional interface declaration has nothing to do
> with it.
>

I think what's happening here is the unfortunate result of one word
having two different meanings. In this whole argument back and forth
between you two (Tony and Jerry), you each keep using the opposite
definition. Tony interprets "interface" to be the PHP language
construct, while Jerry uses the term "interface" in its object-oriented
context. Neither are wrong, but to have an intelligent, reasonable,
(and hopefully friendly) debate, one needs to define the terms used
beforehand to clear up any confusion.

- PHP language construct "interface": a construct defined which
declares a set of functions and parameters which must be implemented if
an object claims to use that interface.
- OO concept "interface": an abstract idea that the member functions
which an object exposes to the outside (ie: public, but not private
functions), comprise the interface to that object through which other
objects may interact with it.

The language construct interface is indeed optional and requires
seperate code specifically written for this purpose. The OO concept of
an interface is *implicit to an object* and requires no additional code
to be written. Any public function of an object is automatically a
part of this interface.

For a physical world example, think of your car stereo. Its interface
(in the OO context) consists of buttons, dials, and a screen (the
public functions which you use to interact with it), while the laser
which reads the CD's and it's power adapter are not part of the
interface (they would be private functions which are used only inside
the class). Now say that it has an iPod connector. In order to make
sure that is sends and receives the correct signals to your iPod, it
must implement some kind of standard, defined by Apple in the (language
construct context) iPod Interface.

So you see? You're both right in your own context. Everybody wins.
Cookies and punch are available in the next room for anyone who wants
to put this semantic pissing match to rest.

- Moot

[Back to original 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

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