Jeśli jesteś właścicielem tej strony, możesz wyłączyć reklamę poniżej zmieniając pakiet na PRO lub VIP w panelu naszego hostingu już od 4zł!

RubySource.com: Confessions of a Converted PHP Developer: Namespace Superhero!

RubySource.com: Confessions of a Converted PHP Developer: Namespace Superhero!

RubySource.com has posted another in their “confessions of a converted PHP developer” series (more here) with a new article comparing namespacing between the two languages.

The moment you start writing code that grows beyond a few classes, you start to realise that you need a way to group files and logic. While this is easy to do, it can become quite difficult to ensure that you have class names that are unique and don’t end up accidentally clashing with other classes in your own code, or classes in other people’s code that you are using.

He talks about PHP’s namespacing, a relatively recent addition, and how pre-5.3 “pseudo-namespacing” was done through class and directory names with autoloading. He compares this to Ruby’s module support that provides a sort of built in namespacing support. He includes a multiple namespace Ruby example and shows how to nest modules for even more fine-grained separation.

Source: http://www.phpdeveloper.org/news/16654

<!–
var d = new Date();
r = escape(d.getTime()*Math.random());
document.writeln('’);
//–>

Posted Lipiec 31st, 2011 in WEB and PHP Development.

Leave a response: