Re: everything as classes

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

 



On Thursday 03 April 2008, robert wrote:
> Along the lines of a previous post "How to get a code review", I am
> curious if it is overkill to create everything in classes. For
> example, a movie website where there is a class for the movie
> datatype, class for getting/adding/deleting/updating movie's data to
> the database, and class for displaying the data. (Of course there are
> classes for  general functionality like sql database connection etc.)
> For listing movies alone there are at least 4 different inheritance
> classes for chronological, alphabetic, category and keyword. Anyway
> this is how I coded something similar but for Flash/Actionscript site
> but I'm not sure about a PHP site. I appreciate your comments.
> - robert

Procedural code is a hack saw.

OOP is a table saw.

Sometimes, all you need is a hack saw.  It's simple, straightforward, easy to 
learn how to use, and you can pick it up and use it in various ways and 
places.  It's harder to get wrong, and when you do you can usually just turn 
your hand at a weird angle for a bit and make it work.

Other times, you really need a table saw.  It takes longer to build and setup 
and can be more difficult to understand if you're not used to it, but if done 
properly will slice and dice wood in ways you couldn't even think of with a 
hack saw.  Of course, if you build it wrong then you're now out a very 
expensive table.

Use whichever makes sense for your use case.  In a language like PHP that has 
strong support for both, both the "everything is an object" and "never use 
objects" viewpoints are, well, ignorant. :-)

-- 
Larry Garfield			AIM: LOLG42
larry@xxxxxxxxxxxxxxxx		ICQ: 6817012

"If nature has made any one thing less susceptible than all others of 
exclusive property, it is the action of the thinking power called an idea, 
which an individual may exclusively possess as long as he keeps it to 
himself; but the moment it is divulged, it forces itself into the possession 
of every one, and the receiver cannot dispossess himself of it."  -- Thomas 
Jefferson

-- 
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