Eloquent Ruby (Book Review)
Recently, I’ve read Oslen Russ’s “Eloquent Ruby” and it was delightful read overall.
The book has a considerable reputation among the community. It is divided into (4) units about Ruby foundations, and the software process practices.
Part (1) and (2) form the first half of the book. They start with the language basics, types, and features. In addition, It covers OOP methodologies in Ruby (classes, modules, blocks).
In Part (3), we see the language metaprogramming capabilities and techniques. First chapter introduces the concept and some hook methods like included
, inherited
, and at_exit
which keep the application life cycle more interactive and informed. Three consecutive chapters talk about the valuable dynamic programming function method_missing
and its use cases for better error handling, delegation, and building flexible APIs. Last chapters discuss monkey patching and self modifying code. For me this was the most interesting part of the book.
Putting the discussed topics in action is what Part (4) is concerned about. The subjects in this part are internal and external DSLs constructions, and publishing Gems (packages), along with a brief tour of some of the popular runtime implementations of ruby.
I liked the writing style the author followed, which was example driven and kind of story telling. Each chapter starts with a motivational situation or by raising question, then it goes on by building up the solution and revisiting it for improvements in an iterative way (dominant example is the document class). Each chapter also has bits of real ruby code from libraries or actual projects in a subsection tilted “In the Wild”.
Conclusion
Albeit there is a small portion of the book that’s outdated, I would argue that the majority of its content is still relevant now and times to come.
If you are looking for eloquently written materials that explore and explain many key aspects of Ruby without going into lengthy documentation details, then go with Eloquent Ruby!