note 85589 added to language.namespaces.definition
| From: | DavidDrakard at osu1 dot php dot net | Date: | Sun, 07 Sep 2008 12:56:02 +0000 |
| Subject: | note 85589 added to language.namespaces.definition | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-144214@lists.php.net to get a copy of this message | ||
I agree with SR, the new namespaces feature has solved a number of problems for me which would have
required horrible coding to solve otherwise.
An example use:
Say you are making a small script, and write a class to connect to a database, calling it
'connection'. If you find your script useful and gradually expand it into a large
application, you may want to rename the class. Without namespaces, you have to change the name and
every reference to it (say in inheriting objects), possibly creating a load of bugs. With namespaces
you can drop the related classes into a namespace with one line of code, and less chance of errors.
This is by no means one of the biggest problems namespaces solve; I would suggest reading about
their advantages before citicising them. They provide an elegant solutions to several problems
involved in creating complex systems.
----
Server IP: 92.48.100.16
Probable Submitter: 88.106.210.252
----
Manual Page -- http://www.php.net/manual/en/language.namespaces.definition.php
Edit -- https://master.php.net/note/edit/85589
Del: integrated -- https://master.php.net/note/delete/85589/integrated
Del: useless -- https://master.php.net/note/delete/85589/useless
Del: bad code -- https://master.php.net/note/delete/85589/bad+code
Del: spam -- https://master.php.net/note/delete/85589/spam
Del: non-english -- https://master.php.net/note/delete/85589/non-english
Del: in docs -- https://master.php.net/note/delete/85589/in+docs
Del: other reasons-- https://master.php.net/note/delete/85589
Reject -- https://master.php.net/note/reject/85589
Search -- https://master.php.net/manage/user-notes.php