note 86647 added to language.oop5
| From: | Marceaux at osu1 dot php dot net | Date: | Tue, 28 Oct 2008 09:31:46 +0000 |
| Subject: | note 86647 added to language.oop5 | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-145857@lists.php.net to get a copy of this message | ||
@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.
----
Server IP: 69.147.83.197
Probable Submitter: 194.88.148.1
----
Manual Page -- http://www.php.net/manual/en/language.oop5.php
Edit -- https://master.php.net/note/edit/86647
Del: integrated -- https://master.php.net/note/delete/86647/integrated
Del: useless -- https://master.php.net/note/delete/86647/useless
Del: bad code -- https://master.php.net/note/delete/86647/bad+code
Del: spam -- https://master.php.net/note/delete/86647/spam
Del: non-english -- https://master.php.net/note/delete/86647/non-english
Del: in docs -- https://master.php.net/note/delete/86647/in+docs
Del: other reasons-- https://master.php.net/note/delete/86647
Reject -- https://master.php.net/note/reject/86647
Search -- https://master.php.net/manage/user-notes.php