[thelist] PHP resource...

Michael Kimsal michael at tapinternet.com
Thu May 30 20:22:02 CDT 2002


Beau Hartshorne wrote:

>So, I like OO programming. I learnt how to program with Java. But I
>understand that PHP is not designed form the ground up to be OO. I have
>written some OO PHP code, but it seems hack-ish. With PHP, I'm never
>sure when I should create an object, or when I should make an API.
>
>After reading those three articles at Zend, I'm thinking that I should
>simply program in PHP the same way that you'd program in C.
>
>Thoughts, comments?
>

I can't speak to the author of those particular articles, but sometimes
the refrain of 'don't use OO in PHP' is from people who don't understand
it very well.

Yes, most things are possible in PHP in multiple ways - OO is possibly
not the fastest execution time, but what the author is missing out is that
things are always improving.  Better OO support is being developed for
future
versions of PHP, and if you continue writing 100% 'procedurally' you're
missing
out on some good coding practices and benefits for the sake of a few
milliseconds.

It's kinda like (tho not really) people complaining about MySQL not
being fully 'ACID'.
There are times when you don't need 100% ACID, and people certainly learn
to live without triggers and stored procedures enough to make MySQL a very
popular DB.  We aren't all coding the proverbial ATM application.  :)
 Likewise,
although PHP doesn't support all OO concepts, the object support is
adequate
enough to provide you the developer some benefits.  And as more OO features
are added, you'll be poised to take advantage of them.

I prefer to say PHP is 'object accomodating' rather than 'object
oriented'.  The language
itself certainly isn't *oriented* towards objects - everything is a
function.  But it
does accomodate the basic usage of objects which is probably sufficient
for most people to get most projects done.

Michael Kimsal
http://www.phphelpdesk.com
734-480-9961





More information about the thelist mailing list