note 86647 deleted from language.oop5 by danbrown
| From: | danbrown@php.net | Date: | Sun, 02 Nov 2008 21:21:27 +0000 |
| Subject: | note 86647 deleted from language.oop5 by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-146067@lists.php.net to get a copy of this message | ||
Note Submitter: Marceaux
----
@Jeffrey: may I point out that taking a 5-line script and quadrupling its size merely for the sake
of "doing OOP" may not be desirable in all cases. There is such a thing as abusing OOP.
There is a time and place to resort to classes and objects. Usually that's when (put in a
simplistic way) you either need variables that carry their own state and functionality with them
and/or you need those variables to be defined and to interact in a rigurous manner.
Of course, there's more to OOP than this, but the basic gist of it, and useful as a rule of
thumb, is to only use it when you actually need what it has to offer.
Taking your example, it's not obvious whether the operations described there would benefit from
being defined as a single entity (OOP object) and/or if there's a need for this dataset to
interact with others in a certain manner. If these needs are not there, you don't need OOP.