A few month’s ago I read Design Patterns In Ruby by Russ Olsen which is one of the best software engineering books I have read. I didn’t think Russ could top himself with his next book Eloquent Ruby but he has!
About five years ago when I started writing Ruby I stumbled and bounced my way around different resources to learn the language. If only I could of had Eloquent Ruby way back when, then the whole process would have been a lot quicker and easier.
Eloquent Ruby is a one stop shop to learn everything from how you should structure your code all the way through to writing DSL’s. Russ takes each subject matter and splits them into small manageable sections of around 10 pages with a thorough explanation followed by pointers to real world implementations. I believe this is a great way to learn, theory plus application makes things stick (well at least in my mind).
So what is covered? Well basically everything you will need to know to write well rounded ruby code.
- Write Code That Looks Like Ruby
- Choose The Right Control Structure
- Take Advantage Of Ruby’s Smart Collections
- Take Advantage Of Ruby’s Smart Strings
- Find The Right String With Regular Expressions
- Use Symbols To Stand For Something
- Treat Everything Like An Object - Because It Is
- Embrace Dynamic Typing
- Write Specs!
- Construct Your Classes From Short, Focused Methods
- Define Operators Respectfully
- Create Classes That Understand Equality
- Get The Behavior You Need With Singleton And Class Methods
- Use Class Instance Variables
- Use Modules As Name spaces
- Use Modules As Mixins
- Use Blocks To Iterate
- Execute Around With A Block
- Save Blocks To Execute Later
- Use Hooks To Keep Your Program Informed
- Use method_missing For Flexible Error Handling
- Use method_missing For Delegation
- Use method_missing To Build Flexible APIs
- Update Existing Classes With Monkey Patching
- Create Self Modifying Classes
- Create Classes That Modify Their Subclasses
- Invent Internal DSLs
- Build External DSLs For Flexible Syntax
- Package Your Programs As Gems
- Know Your Ruby Implementation
- Keep An Open Mind To Go With Those Open Classes
If you’re a novice programmer or season software engineer there will be something in this book for you so you better go and buy it.