More Notes on “Well Grounded Rubyist”

Modules in Ruby are sort of like interfaces in Java. They sort of allow multiple inheritance, and you can mix-in mulitple modules, just as a class in Java can implement multiple interfaces. But the methods in a Ruby module actually do stuff, whereas methods in Java interfaces are just the signatures. In Ruby, class names are nouns, and module names are adjectives. You can also contain classes within modules, which allows namespacing in Ruby.

Constants in Ruby begin with a capital letter, and are usually written in all caps. They are like class-level variables. Even though they are called “constants”, he showed that they can be changed. If you need to change class-level data, it might be better to have a constant point to an object, and change the object the constant points to.

Image from Eberhard Psalter, an early 11th century Bavarian manuscript housed at Bavarian State Library, webpage information here, image from World Document Library, image assumed allowed under Fair Use.