[UPHPU] Article 2

Kenneth Burgener kenneth at uvlug.org
Mon Jun 20 17:05:04 MDT 2005

John wrote:
> I am one that could learn some more about objects so I'll check out your
> article, thanks.  But I would also like to understand from anyone, why
> folks like OOP so much in PHP.
> It seems to me that there is a "LOT" of structure needed when you begin an
>  OOP project.  And that you really need to have your program outline
> pretty detailed, thats understandable.  But what I don't really get is
> when folks who like OOP, say that its reusable.  But then so is a
> function.

Here is my stab at it...

I think the main reason for OOP is because of the benefits that OOP brings.

1. Organization
2. Encapsulation
3. Inheritance
4. Polymorphisms
5. Abstraction

Functions are organized, but Objects are more organized. Functions are 
not meant to for data hiding, but for performing actions on the data, 
but objects are built for encapsulation.  Inheritance is a nice benefit 
of objects, can't think of any comparison with functions.

Now it is true that this can all be done with functions and other low 
methods, but the same could be said for a function.  A function is just 
repeated code, so why not just duplicate the code everywhere in your 

Working backwards, you can group lines of code in to functions.  This 
makes reading and using the code easier.  You can group functions and 
data into objects.  This makes reading and using the code easier.

The whole point is to try to bring the programming real from 1s and 0s 
to a human understandable language.  Most of the time ease of use and 
organization beat out performance every time.  The larger your project 
gets, the more using objects will make sense.

And that is my stab at it.


More information about the UPHPU mailing list