Understanding namespaces
qooxdoo organizes all JavaScript classes in namespaces just like Java does. Each class has a namespace which corresponds to its path name relative to the source/class directory and a class name which corresponds to its file name. In the qooxdoo SDK for example the button class is qx.ui.form.Button which means that it is in the directory qx/ui/form and has the filename Button.js. This is how the files are organized in the skeletons as well.
The browser loads all JavaScript into one flat namespace. Without namespaces it would be possible to have naming conflicts between functions or classes from different files. Since qooxdoo consists of nearly 300 JavaScript classes namespaces are a good method to organize the classes and avoid naming conflicts.
Namespaces become even more important if you use JavaScript libraries from different sources. Furtunately it has become good JavaScript practice to put as few variables as possible into the global namespace. qooxdoo defines just the variable qx in the global namespace. qx is the root namespace for all qooxdoo classes. Other big JavaScript libraries like dojo or Yahoo UI use namespaces to organize their code as well.
For example, Bill works for company X and his employee ID is 123. John works for company Y and his employee ID is also 123. The reason Bill and John can be identified by the same ID number is because they work for different companies. The different companies in this case would symbolize different namespaces. If the two men worked for the same company, and still had the same employee ID, there may be serious errors when it comes time to pay them.
This characteristic is the primary motivation for the use of namespaces. In large computer programs or documents it is not uncommon to have hundreds or thousands of identifiers. Without namespaces [...] it is hard to ensure uniqueness of identifiers in these cases. Namespaces provide an easy means to group logically related identifiers into corresponding namespaces, thereby making the system more modular.
In programming languages, namespaces are scopes that use the enclosing nature of the scope to group logically related identifiers under a single identifier. Many modern computer languages provide support for namespaces. In some programming languages (eg. C++, Python), these identifiers naming namespaces are themselves associated with an enclosing namespace. Thus, in these languages namespaces can nest, forming a namespace tree. At the root of this tree is the unnamed global namespace.
