Transformation Thursday - More on Modules from a Pro
I was going to write some more about Modules today but after reading Practicing Ruby for some inspiration I don’t think I could do better than Gregory Brown done with his series of posts.
Uses for Modules, Part 1
Uses for Modules, Part 2
Uses for Modules, Part 3
Addendum to Uses For Modules, Part 3
Uses for Modules, Part 4
There are some extremely smart people in the Ruby Community and Gregory Brown is one of them.
- Part 1 deals with the use of modules as namespaces for your libraries and applications.
- Part 2 is about mixins as an alternative to multiple inheritance to augment class definitions.
- In part 3 you will see how modules can be used as namespaced function bags, and as singleton objects.
- In the addendum to part 3 you learn about the subtle differences between “extend self”, “def self.method”, and “module_function”.
- Part 4 ends the series by exploring the use of mixins for customizing individual objects.
You might say this is a cop-out on my side by these articles on Modules do much more justice to an advance topic made easy by a knowledgeable author.
So happy reading I enjoyed the articles and I hope you do too.