Re: Beginner Tutorials for using CLASSES in PHP4

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



""Nathan Nobbe"" <quickshiftin@xxxxxxxxx> wrote in message 
news:7dd2dc0b0710090612u5cb3c263u43530219f04c8bb2@xxxxxxxxxxxxxxxxx
> On 10/7/07, Robert Cummings <robert@xxxxxxxxxxxxx> wrote:
>>
>> >  it just so happens i
>> > have a good friend with a very strong php background who tells me
>> > practically the same thing, ppp isnt that big of a deal.
>>
>> It isn't.
>
> i disagree.

And I disagree with you. Marking variables, or even methods, as anything 
other than public is purely OPTIONAL. If it were a requirement then the 
"public" keyword simply would not exist.

>> i disagree, why,
>> > is it because ive had a classical education in oop
>>
>> What the heck is a classical education in OOP? Are you saying your old
>> and therefore smarter? Young and therefor smarter? WTF?
>
> just saying i studied oop in college.  i started w/ c++; moved on to java
> and then took a brief look
> at .net and delphi (very brief :))  anyway coming from those languages to
> php4,

Just because it is what you were taught does not necessarily make it the 
gospel truth. Different teachers teach different things, and they cannot all 
be right.

> well php4 looks minimalistic.
> age has nothing to do with it; i provided 4 definitions from 4 books
> on oop; they all conicide w/ what ive been saying about encapsualtion;
> infact they practically
> say encapsulation is data hiding.
> i would like to see an example of encapsulation where data hiding isnt
> required to conceal the implementation.

Encapsulation is NOT data hiding. Take a look at

http://www.javaworld.com/javaworld/jw-05-2001/jw-0518-encapsulation.html
http://www.itmweb.com/essay550.htm
http://c2.com/cgi/wiki?EncapsulationIsNotInformationHiding

Encapsulation is about *implementation* hiding and implementation is *code*, 
not *data*. Data is information, and encapsulation does NOT mean 
*information hiding.

>>> because ive worked with
>>> a number of languages that dont allow you to create class members
>>> without specifying an access level?
>>
>> Many of us have done this. Your point?
>
> php4 is the first language i encountered that didnt offer ppp.

So what? PHP is the first language I have use in the past 30 years which 
supported OOP. None of the languages I have *ever* used have supported the 
notion of private or protected access - apart from the permissions system in 
the underlying database, of course.

I have learned to program without PPP, so I do not see any signifcant 
advantage in using it.

>>>  for those reasons and because ive had the
>>> misfortune of working in places that have tightly coupled code.  im
>>> talking about hundreds of thousands of lines of madness.  ppp could have
>>> saved these systems greatly.
>>
>> Once again, just because someone writes bad programs doesn't make PPP
>> the superior choice. A shitty programmer faced with PPP will more than
>> likely declare all of their member variables as public and as such will
>> have gained nothing.
>>
<snip>

>> (tony)
>>>> I strongly disagree. It *IS* possible to write perfectly adequate OO
>>>> programs using PHP 4. If you cannot then you have been taught some bad 
>>>> habits.
>>
>> Hear hear.
>
> on the contrary, im trying to emphasize what i have learned to be bad 
> habits
> so others
> might not use them in the first place.  one of which i have mentioned
> is allowing direct access to class members.  and i was never taught to do
> that, because as
> i mentioned, i worked with languages that require use of ppp in the past,
> and one of the first
> things thats covered is marking member variables private, and certain 
> member
> functions of course.

Just because YOU were taught to always make variables private does not mean 
that everybody else should do the same. A competent programmer can produce 
perfectly functional programs without using ppp at all, so it is not 
necessary.

<snip>

> again; all the books ive ever read on oop, show class member variables 
> being
> marked private.

So what? None of the books or articles I have ever read on OOP have shown 
any such thing. They simply point out where it MAY be used to stop an 
incompetent programmer from screwing things up, but whatever obstacles you 
put in their way will only cause them to find other ways to screw up.

> also, they emphasize protecting certain methods as well.  php4 doesnt 
> offer
> ppp, so it opens
> the door to bad habits.

In your opinion.

> you can however protect your underlying codebase from misuse.  how 
> practical
> is it to get a company that consists entirely of excellent programmers?

It is simply not possible to protect ANY program from misuse. As soon as 
someone thinks that they have made something idiot proof the universe 
esponds by creating a better class of idiot.

>> ive studied oop for years and worked with a number of oop languages; many
>> of
>> > the bad habits i had at one point or another have been removed.  guess
>> what
>> > the first one was, not letting client code access member variables
>> directly

Then how come these languages still offer PUBLIC access as an option?

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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux