note 76442 added to language.oop5.patterns
| From: | anonymous at world4ch dot org | Date: | Mon, 16 Jul 2007 08:37:52 +0000 |
| Subject: | note 76442 added to language.oop5.patterns | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-128609@lists.php.net to get a copy of this message | ||
A singleton is the "enterprise professional scalable business solution" version of a
global variable. It'd be a good idea if this were the IOCCC, but since it isn't, it's
better to simply say:
global $lol;
It's also faster and more maintainable, and has the same advantages and disadvantages.
Also, I'll advise against all "enterprise object-oriented industry-standard design
patterns". Some of these patterns are correct, but their existence is not. Programming is not
about copypasta. It's about thinking, abstracting and combinating. If you can't think of
these patterns for yourself when you need them â and in the case of needing them, manage to
abstract them so that your code doesn't become a copypasta fest, then you shouldn't be
programming in the first place.
Furthermore, the existence of software patterns is a proof of the object-oriented model
shortcomings. You shouldn't ever need to do any copypasta in your code. If something is done
two or more times, you abstract it. And the language should support a way for you to. There's
no reason for a "design pattern" to exist more than once, and since they are trivial (they
better be trivial to you, if you are programming), you don't need to study them.
The best advice I can give you is that instead of reading "design patterns", you read
Structure and Interpretation of Computer Programs (SICP), a book freely available from MIT where you
will learn what you need to program properly in any programming language.
----
Server IP: 69.147.83.197
Probable Submitter: 217.125.117.197
----
Manual Page -- http://www.php.net/manual/en/language.oop5.patterns.php
Edit -- https://master.php.net/note/edit/76442
Del: integrated -- https://master.php.net/note/delete/76442/integrated
Del: useless -- https://master.php.net/note/delete/76442/useless
Del: bad code -- https://master.php.net/note/delete/76442/bad+code
Del: spam -- https://master.php.net/note/delete/76442/spam
Del: non-english -- https://master.php.net/note/delete/76442/non-english
Del: in docs -- https://master.php.net/note/delete/76442/in+docs
Del: other reasons-- https://master.php.net/note/delete/76442
Reject -- https://master.php.net/note/reject/76442
Search -- https://master.php.net/manage/user-notes.php