• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
Curious, Healing

Curious, Healing

Books about healing, business, and fun

  • About Sonia Connolly

“Practical Object-Oriented Design in Ruby” by Sandi Metz

February 19, 2022 by Sonia Connolly Leave a Comment

book cover

Subtitle: An Agile Primer

Recommended to me by: Sam Livingston-Gray

I first read this back in 2012. It struck me as friendly rather than condescending this time, which is an interesting shift.

In 2012 I was just learning Ruby and focused on deciphering the example code as I read. Coming back to it after having programmed in Ruby for three years, I could read the examples fluently and focus more on the general points in the book, even though I haven’t looked at Ruby code in a while.

Some points that stuck with me this time:

  • The purpose of design is to allow future changes in code, since requirements and circumstances keep changing.
  • In object-oriented design, pay attention to the messages passing between the objects.
  • Each object should have a single responsibility. (I’ve seen a downside to this, where you have to chase through a mass of fine-grained objects to find where something is actually done.)
  • Manage dependencies to reduce risk. An object should depend on objects that change less often than it does.
  • Inject dependencies, use Ruby’s duck typing: Send in an object as an argument that responds to the needed message
  • Delay design decisions until you have at least three examples of what a class needs to do. (Two, if pressed.)
  • Good design is TRUE: Transparent, Reasonable, Usable, Exemplary
  • DRY: Don’t Repeat Yourself.
  • Law of Demeter: Don’t chain calls through many objects, since that entails knowing too much about the insides of other objects.
  • Isolate risky bits of code inside a wrapper, so they can be improved easily later.
  • Test an object’s public interface (messages it responds to), and command messages it sends (messages with side effects).
  • Use Ruby Modules to share code and tests.

Highly recommended as a guide for both general design, and how to write maintainable, flexible Ruby code.

The book’s website and Sandi Metz’s website.

Available at Powell’s Books.

Filed Under: nonfiction Tagged With: software

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Primary Sidebar

Recent Books

  • “Orwell’s Roses” by Rebecca Solnit
  • “99 Bottles of OOP” by Sandi Metz, Katrina Owen, and TJ Stankus
  • “Practical Object-Oriented Design in Ruby” by Sandi Metz
  • “What Fresh Hell Is This?” by Heather Corinna
  • “Being In My Body” by Toni Rahman
  • “North to Freedom” by Anne Holm
  • “You Don’t Look Adopted” by Anne Heffron
  • “Witches of Brooklyn: What the Hex?!” by Sophie Escabasse
  • “The Magic Fish” by Trung Le Nguyen
  • “Set Boundaries, Find Peace” by Nedra Glover Tawwab

Tags

activism aging anti-racism bodywork business childhood abuse childrens communication disability domestic violence feminism finance Focusing food fun healing health at any size illustrated lgbt marketing memoir natural world neurodiversity politics psychology relationship science singing software spirituality survival story trauma writing young adult

Categories

Archives

Please note: Amazon and Powell's links are affiliate links. Copyright © 2022 · Genesis Sample on · WordPress