php 5 classes: public, protected and private

This is a discussion on php 5 classes: public, protected and private within the PHP Language forums, part of the PHP Programming Forums category; Tony Marston wrote: > In PHP interfaces are NOT necessary. > > > They are how you interact with the ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #81 (permalink)  
Old 12-06-2006
Moot
 
Posts: n/a
Default Re: php 5 classes: public, protected and private

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

Reply With Quote
  #82 (permalink)  
Old 12-07-2006
Jerry Stuckle
 
Posts: n/a
Default Re: php 5 classes: public, protected and private

Moot wrote:
> 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
>


Moot,

The problem is the original discussion was about interface in the OO
concept. But Tony knows nothing about OO, other than what he's read in
a few blogs by unknown authors of dubious credibility. So he tries to
take it into something he has never used, but can look up easily - the
PHP interface keyword.

I'm just not letting him change the subject.

It would be refreshing if he knew anything. But he obviously has no
clue what he's talking about - even in the case of a PHP interface.

He's just a troll with delusions of competency.


--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Reply With Quote
  #83 (permalink)  
Old 12-07-2006
Tony Marston
 
Posts: n/a
Default Re: php 5 classes: public, protected and private


"Jerry Stuckle" <jstucklex@attglobal.net> wrote in message
news:uKCdnemKmvXicOvYnZ2dnUVZ_oOdnZ2d@comcast.com. ..
> Tony Marston wrote:
>> "Jerry Stuckle" <jstucklex@attglobal.net> wrote in message
>> news:heudnY0tgPFj7-jYnZ2dnUVZ_rCdnZ2d@comcast.com...
>>
>>>Tony Marston wrote:
>>>
>>>>"Michael Fesser" <netizen@gmx.de> wrote in message
>>>>news:4ud8n2dcgrj80p0c9dske38l4othi3c631@4ax.co m...

<snip>
>>>>I am not wrong. I have made two simple statements that you cannot
>>>>disprove:
>>>>
>>>>(a) In PHP interfaces are not necessary.
>>>>(b) Enapsulation does not mean that all variables must be declared
>>>>private or protected.
>>>>
>>>>What's so difficult to understand about that?
>>>>
>>>
>>>You're wrong because:
>>>
>>> (a) Interfaces, as defined in OO terms (which is what we were
>>> discussing, and PHP is an OO language) are necessary.

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

>
> And in OO terms that is the INTERFACE! But you don't know anything about
> OO, that's obvious.


You are confusing the term inetrface (as in Application Programming
Interface or API) with the construct that uses the word "interface" and
"implements". An API is simply a function name with a list of arguments,
while interfaces are hings which exist in addition to the function
definition.

It is a simple fact that I can access an object's method by using the
function definition (API) and NOT tghe piece of code which contains the word
"interface".

The terms API and interface in OO terminology do not mean the same thing.

>>
>>> (b) Proper encapsulation means that all variables are defined as
>>> private,

>>
>>
>> Wrong. Encapsulation simply means putting all the data for an object, and
>> the operations which act upon that data, into a single class. There is no
>> requirement to make all the data private, as there is no requirement to
>> make any methods private.

>
> Wrong again, Troll Tony.


My definition of encapsulation is not wrong What is your definition?

I still stick to my original statements:

(a) In PHP interfaces are not necessary.
(b) Encapsulation does not mean that all variables must be declared private
or protected.

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


Reply With Quote
  #84 (permalink)  
Old 12-07-2006
Tony Marston
 
Posts: n/a
Default Re: php 5 classes: public, protected and private

There is a big difference between interface as in API (Application
Programming Interface) and interface as an OO construct which contains the
words "interface" and "implements".

In PHP I can access an object's method through its API, and I do not need
that additional declaration that contains the word "interface".

Simple, isn't it?

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

"Moot" <mootmail-googlegroups@yahoo.com> wrote in message
news:1165424803.261177.164870@73g2000cwn.googlegro ups.com...
> 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
>



Reply With Quote
  #85 (permalink)  
Old 12-07-2006
Jerry Stuckle
 
Posts: n/a
Default Re: php 5 classes: public, protected and private

Tony Marston wrote:
> "Jerry Stuckle" <jstucklex@attglobal.net> wrote in message
> news:uKCdnemKmvXicOvYnZ2dnUVZ_oOdnZ2d@comcast.com. ..
>
>>Tony Marston wrote:
>>
>>>"Jerry Stuckle" <jstucklex@attglobal.net> wrote in message
>>>news:heudnY0tgPFj7-jYnZ2dnUVZ_rCdnZ2d@comcast.com...
>>>
>>>
>>>>Tony Marston wrote:
>>>>
>>>>
>>>>>"Michael Fesser" <netizen@gmx.de> wrote in message
>>>>>news:4ud8n2dcgrj80p0c9dske38l4othi3c631@4ax.c om...

>
> <snip>
>
>>>>>I am not wrong. I have made two simple statements that you cannot
>>>>>disprove:
>>>>>
>>>>>(a) In PHP interfaces are not necessary.
>>>>>(b) Enapsulation does not mean that all variables must be declared
>>>>>private or protected.
>>>>>
>>>>>What's so difficult to understand about that?
>>>>>
>>>>
>>>>You're wrong because:
>>>>
>>>>(a) Interfaces, as defined in OO terms (which is what we were
>>>>discussing, and PHP is an OO language) are necessary.
>>>
>>>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.

>>
>>And in OO terms that is the INTERFACE! But you don't know anything about
>>OO, that's obvious.

>
>
> You are confusing the term inetrface (as in Application Programming
> Interface or API) with the construct that uses the word "interface" and
> "implements". An API is simply a function name with a list of arguments,
> while interfaces are hings which exist in addition to the function
> definition.
>


You really don't know anything about OO, do you, Tony. Not even the
most basic terminology.

> It is a simple fact that I can access an object's method by using the
> function definition (API) and NOT tghe piece of code which contains the word
> "interface".
>


Stupid troll doesn't understand basic OO.

> The terms API and interface in OO terminology do not mean the same thing.
>


You really don't know OO terminology, Tony. I suggest you at least read
up on the basics of OO - from a RESPECTED SOURCE, not your favorite blog
entries.

You only continue to make a huge fool of yourself. But you're only a
stupid troll, so that's only to be expected.

>
>>>>(b) Proper encapsulation means that all variables are defined as
>>>>private,
>>>
>>>
>>>Wrong. Encapsulation simply means putting all the data for an object, and
>>>the operations which act upon that data, into a single class. There is no
>>>requirement to make all the data private, as there is no requirement to
>>>make any methods private.

>>
>>Wrong again, Troll Tony.

>
>
> My definition of encapsulation is not wrong What is your definition?
>
> I still stick to my original statements:
>
> (a) In PHP interfaces are not necessary.
> (b) Encapsulation does not mean that all variables must be declared private
> or protected.
>


You really don't understand even the most basic elements of OO
programming, Tony. You're just a troll.

Read from RESPECTED RESOURCES. Then open your mouth. You're only
making a bigger fool of yourself, and people are laughing at you.

What little credibility you ever had in the newsgroup is virtually all
gone now. You've made too much of an ass of yourself for anyone to take
you seriously.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Reply With Quote
  #86 (permalink)  
Old 12-07-2006
Jerry Stuckle
 
Posts: n/a
Default Re: php 5 classes: public, protected and private

Tony Marston wrote:
> There is a big difference between interface as in API (Application
> Programming Interface) and interface as an OO construct which contains the
> words "interface" and "implements".
>
> In PHP I can access an object's method through its API, and I do not need
> that additional declaration that contains the word "interface".
>
> Simple, isn't it?
>


Yep, you've once again shown you don't understand even the basic
terminology of OO programming, Tony.

Tony the Troll once again makes a complete ass of himself.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Reply With Quote
  #87 (permalink)  
Old 12-07-2006
Moot
 
Posts: n/a
Default Re: php 5 classes: public, protected and private

Jerry Stuckle wrote:
>
> Tony the Troll once again makes a complete ass of himself.



I don't mean to be rude, but you aren't showing yourself in too good of
a light right now, either, by prolonging this argument.

If I didn't believe you way back in the beginning when you said he was
just trolling, I sure do now. But what's the #1 rule for trolls?
Don't feed them.

I'd like to thank the both of you for making my workday a slight bit
more entertaining the past week or so, but I've just about had my fill
of this thread. I suggest that you stop caring about getting the last
word and just let it die. At this point, I think everyone realizes who
knows what he's talking about and who doesn't.

- Moot

Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 03:26 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0