note 35706 deleted from ref.classobj by nlopess
| From: | nlopess@php.net | Date: | Tue, 13 Jan 2004 14:43:41 +0000 |
| Subject: | note 35706 deleted from ref.classobj by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-63418@lists.php.net to get a copy of this message | ||
Note Submitter: rs98101@yahoo.com
----
Just a note on good object programming technique...
...a couple of users above have shown ways to split your classes into different files and have them
load correctly at runtime, the reason given as something like "to get your classes down to
manageable chunks". This in general is a very BAD idea.
1) Good design means lightweight objects. If you find your objects are getting so big that it seems
it would make it easier to split them into different files, well, your objects have gotten too
complex. Consider breaking that object into a couple of different ones. Each object should have 1
clear defined reason to exist, it is a common problem of objects taking on too much responsibility
as code evolves over time. This is often called the "God object", or the "boat
anchor".
2) 99% of the time good programming means writing code that can be easily read and maintained, not
code that runs extremely fast in convoluted, obfuscated lines. Splitting code for 1 object into
multiple files would be a maintenance/readability nightmare that would cause any veteran developer
to scream in horror.
Happy coding...