note 83147 deleted from language.namespaces.definition by philip

From: Date: Fri, 28 Nov 2008 18:54:32 +0000
Subject: note 83147 deleted from language.namespaces.definition by philip
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-147108@lists.php.net to get a copy of this message
Note Submitter: SR ---- RS: Please go read a book on object oriented programming so you understand why namespaces are important, instead of actively discouraging their use through bad examples that show your lack of basic understanding towards them. First of all a well designed reusable module would use a better namespace than something as simple and useless as "Gizmo". They are plenty of ways of handling this, for example if you look at the Java* world you'll notice the norm here is the "reverse URL" way, ie. all Apache Foundation projects are contained in "org.apache.<project name>" namespaces (in PHP the :: is used as namespace seperator so the PHP equivalent would be "org::apache::<project name>") Also keep in mind that a project can have multiple namespaces inside it, which is not obligatory but provides an additionnal way of cleanly seperating code in distinct units. Secondly, when using tokens from external namespaces, you are meant to export them through the "use" keyword at the top of your code. This allows you to maintain tight control over external interfaces. It also avoids repeating the same "base name" of your class over and over and over in your code, which makes it cleaner and easier to refactor. Namespaces were the missing link preventing PHP 5 from becoming a real object oriented language. Even if YOU are not interested in using them in your projects, you may want to not be so quick at dissing them. * Java namespaces go by the cheesy name of "packages" but they basically work as you'd expect namespaces to do in any other language

« previous php.notes (#147108) next »