Re: Classes vs. Functions
| From: | Chris Crane | Date: | Tue, 16 Jul 2002 15:27:02 +0000 |
| Subject: | Re: Classes vs. Functions | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-107905@lists.php.net to get a copy of this message | ||
thanks Jay.
"Jay Blanchard" <jay.blanchard@niicommunications.com> wrote in message
news:000e01c22cdd$0d0c7530$8102a8c0@niigziuo4ohhdt...
> [snip]
> This helps quite a bit Thank you.
> I am just wondering if I should make classes instead of functions? What
> would be the benefit of that? Do you know?
> [/snip]
>
> You should keep classes and functions seperate in your thought process,
they
> are not the same and not meant to do or be the same thing. Here is a good
> thought process to apply to classes...
>
> 1. Is this an object?
>
> If the answer is no, you do not need a class.
>
> 2. Do I need to do something (have an action or set of actions performed),
> perhaps over and over again?
>
> If the answer is yes, this is a function.
>
> A method is a function that applies to a specific class of objects. If you
> created a class and methods for each item you code would be bloated, slow,
> and hard to maintain.
>
> Do not think of functions and classes in the same light, you will make
> yourself more confused. One is definitely not the other.
>
> Jay
>
> *************************************
> * Want to meet other PHP developers *
> * in your area? Check out: *
> * http://php.meetup.com/ *
> * No developer is an island ... *
> *************************************
>
>