Re: Classes or functions
| From: | Brent Baisley | Date: | Wed, 19 Oct 2005 20:46:18 +0000 |
| Subject: | Re: Classes or functions | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-224349@lists.php.net to get a copy of this message | ||
It's really a matter of comfort level and opinion. There can be strong arguments either way. Using just functions will be faster, although the speed difference may be minimal and not noticeable. Using just functions can be easier and quicker to develop, especially for small projects.
But, using classes will allow your project to scale much better, if only by giving you the ability to create variable scopes so that variable and function names don't conflict. Classes will also allow you to standardize your function names. For instance, you can have multiple functions called getList(), but in different classes. Then any time you need to retrieve a list of data, you call the getList() function from the appropriate class (i.e. companies, contacts, phones, etc).
That's a very basic example. My personal opinion is that you cannot build a large scale project that will be easily maintainable without using classes and object oriented concepts. That's not to say it can't or hasn't been done (it has).
On Oct 19, 2005, at 12:42 PM, Khorosh Irani wrote:
What this methods are better for php4? classes or functions Does it better to use classes when I can write the codes with functions? Excuseme for my bad english-- Brent Baisley Systems Architect Landover Associates, Inc. Search & Advisory Services for Advanced Technology Environments p: 212.759.6400/800.759.0577