Nesting Modules in a hierarchy
Ahmet Dogramaci
1 post
|
I am coming from Java to Ruby. I actually used Ruby on Rails in one of my client’s projects, but I did not understand it well at the time. Now I am trying to understand the language well so that I can create better and bigger programs. One of the things that I did not understand well was namespaces and modules. In Programming Ruby it says that modules give you a namespace, but it never mentions that you can actually nest modules to create module hierarchies. Without the nesting, I was thinking you would have a flat namespace and end up with very long module names, or name clashes with the libraries that you use. The nesting actually gives you a facility similar to packages in Java. I think mentioning this in the new version of the book would help programmers. |
1 post, 1 voice
