Skip to content

Instantly share code, notes, and snippets.

@ecoologic
Last active December 31, 2015 11:29
Show Gist options
  • Save ecoologic/7979668 to your computer and use it in GitHub Desktop.
Save ecoologic/7979668 to your computer and use it in GitHub Desktop.

POODIR (Sandi Metz)

In this post I'm going to answer the question: Why should every ruby developer read Practical Object Oriented Design In Ruby by Sandi Metz?

In short: two reasons:

  1. As correctly suggested by the title, it's about useful everyday choices of design, arguably your most important skill as a developer

  2. It's easy and useful to read cover to cover

If you're a rubyist you can stop reading this post right now and start reading the book instead. You're still reading. You don't trust me. Fine. I'll be more specific.

A common misconception

Back at uni the lecturer (L) was interviewing a friend of mine (F):

  • L: What's the average line number in a well designed method?
  • F: In the real word?
  • L: Please go back to your seat...

Although the question itself is arguable, my friend assumption was that there's a difference between what is taught and what is cost/effective in the coding industry. Long complex methods are preferable because are quicker to write and therefor cheaper. Wrong. I particularrly enjoyed this book for it's constant focus on productivity and minimizing costs. Good design will increase your productivity. Effective tests will reduce your costs. Making yourself replaceable by writing understandable, easy to change code will make you invaluable to your company. Improve your skills will make you a happier developer.

What did impress me the most?
  • Designing classes with single responsibility. Isolating behaviour will allow reuse and facilitate change
  • Managing dependencies: choose to depend on more stable code than the dependent one
  • Correct use of modules, so misused in OOD, in particular the rule of implementing every message which the module sends and testing interfaces
  • Advantages of testing and how to do it effectively
In conclusion

I want to thank Sandi Metz for this book, which I believe sensibly improved my skilled, I reckon this 2012 book will become an evergreen in our nieche.

Fail to plan is plan to fail — Benjamin Franklin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment