To instantiate or not to instantiate, that is the question!
Differences between classes and modules.
08/12/2014
What are the differences between classes and modules? Well, let's start with classes, shall we?
So when should we use classes? Classes are about objects. You should use them to model and create objects mostly.
What about modules?
When should we use modules? Modules are about methods. You should use them to provide methods to multiple classes. Modules are VERY important because ruby doesn't allow multiple inheritance. If you are familiar with other languages it might help you to consider modules as libs or static classes.
The main thing to consider is that even though they are both a collection of methods, constants, etc. you can instantiate classes but not modules. Since Ruby has no multiple inheritance you need modules to "emulate" it.
Quiz time... Which came first, the class or the object?
This is really confusing, but the object came first! An Object inherits from BasicObject and includes the Kernel module, so it has the instance methods of the Kernel, like puts!