Re: everything as classes
| From: | Nathan Nobbe | Date: | Thu, 03 Apr 2008 16:51:25 +0000 |
| Subject: | Re: everything as classes | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-272500@lists.php.net to get a copy of this message | ||
On Thu, Apr 3, 2008 at 10:33 AM, robert <roadtested@gmail.com> 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
to each his own; i am somewhat of an oop zealot, but i will advise u to heed
the reality that php affords the use of functions in the global namespace
and this feature is often useful even if an application is oop-centric.
sometimes being able to just crank out a function and be done w/ it is nice
:) and other times it makes sense from a design perspective to offer
'convenience' functions in the global scope, which often times may actually
dip into functionality implemented in a class. this sort of stuff will be
getting a twist in days to come (php 5.3+) when we will be able to write
functions (that arent class members) and segregate them from the global
scope albiet namespaces.
-nathan