Re: OOP vs Functions and includes]
| From: | Jonel Rienton | Date: | Wed, 17 Nov 2004 01:06:39 +0000 |
| Subject: | Re: OOP vs Functions and includes] | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-202255@lists.php.net to get a copy of this message | ||
-------- Original Message --------
Subject: Re: [PHP-DB] OOP vs Functions and includes
From: "Jonel Rienton" <jonel@road14.com>
Date: Tue, November 16, 2004 7:04 pm
To: <pablo@fernandezstearns.com.ar>
Hi again Pablo,
not sure how the inner workings of PHP are as far as instantiating new
classes. other languages i've used only (jit-)compile methods/member
functions as they are called thus reducing the amount of memory in
instantiating objects.
regards,
Jonel
> Thanks for your response Jonel.
> I mistakenly posted this in the PHP-DB list, I wanted to do it in the
> General list instead.
> Anyway, I heard those words you mention in several OOP introduction
> sites but I guess never understood it.
> I'll try to re-read that focsing in them.
>
> One question tho, I saw classes use functions within them... dont they
> require more "memory" on the server side ?
> Thanks !
>
> Pablo.
>
>
>
> On Tue, 16 Nov 2004 18:40:51 -0600 (CST), Jonel Rienton
> <jonel@road14.com> wrote:
>
>> Hi Pablo,
>>
>> The 3 main strong points of using OOP are:
>>
>> 1. Encapsulation
>> 2. Inheritance
>> 3. Polymorphism
>>
>> I like using OOP instead of includes because of these points. It
>> helps me
>> alot in doing maintenance releases using this technique instead of
>> having to deal with thousands of codes which can be abstracted from
>> me with encapsulation for instance.
>>
>> regards,
>> Jonel
>>
>>> Hi, This is my first post. English is my 2nd language so I apologize
>>> for
>>> any mistakes I might have.
>>>
>>> I would describe myself as an intermediate self-thaught PHP
>>> programmer,
>>> which means I can do lots of stuff but probly my coding techniques
>>> sucks :P
>>>
>>> Anyway, Im reading a lot about OOP lately, and I've fixing other's
>>> people scripts which use OOP for "small" stuff that could have
>>> been acomplished with simple functions or includes maybe... so I
>>> started wondering, why use OOP when you can use something
>>> simpler...
>>>
>>> Imagine the following example:
>>> A table of MySQL on a simple classifieds site holds the info for
>>> each Ad
>>> posted ( timestamp, user who posted it, title, description,
>>> location,
>>> country, etc).
>>> A php page called ads.php gets the ad ID via $_GET and prints out
>>> its information in a nicely formated page.
>>>
>>> What I usually do is to put all the "echo-ing" part of this page in
>>> a separate include (ie: ads_details.php ), so that if I need to also
>>> show
>>> this in another page, I call the same include. If I decide to do a
>>> change later, I only have to change it in one part of the script
>>> alone.
>>>
>>> What I've seen a lot lately is that people do the same with classes
>>> (they write a class that will output the same thing I output thru
>>> an include)... so I guess there must be pros and cons regarding
>>> using both methods...
>>>
>>> Could anyone point me to a good reading (free, internet) material to
>>> read about this or any other advice so I continue learning about
>>> OOP and when to use it ?
>>>
>>> If you read it all the way down here THANKS ! :D
>>>
>>> Pablo Fernandez-Stearns
>>> BA. Argentina.
>>>
>>> --
>>> PHP Database Mailing List (http://www.php.net/)
>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>
>
>
> --
> Using Opera's revolutionary e-mail client:
> http://www.opera.com/m2/
--
--