Re: Classes or functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux