Writing Empathetic Code

Writing Empathetic Code

We mostly focus on technology choices as engineers, but so much about programming is actually about human factors. Let's explore some of those factors and spend way too much time revising one method.

This talk should help us talk about some factors that make our code easy (dare I say enjoyable?) to work with, and infectious in its style.


Joseph Mastey

January 22, 2015


  1. Writing Empathetic Code - Ruby, Postel’s Law, and a Little

    Philosophy Joe Mastey
  2. What is Empathetic Code, and Why Should We Write it?

  3. Code is empathetic if we can confidently and comfortably manipulate

    it. Most code is not empathetic. This sucks.
  4. Readability > (Some) Performance

  5. So How Do We Write It?

  6. – Jon Postel “Be conservative in what you send, be

    liberal in what you accept.”
  7. None
  8. None
  9. Coincidence?

  10. – Lao Tsu, The Tao Te Ching “The highest virtue

    is to act without a sense of self The highest kindness is to give without a condition The highest justice is to see without a preference”
  11. An Example

  12. {{ ORIGINAL CODE }}

  13. “Be conservative in what you send”

  14. None
  15. None
  16. Return Types Inputs Output Philosopher, Thought Thought Philosopher, [Thought, …]

    [Thought, …] Pleb, anything nil
  17. None
  18. None
  19. “Be liberal in what you accept”

  20. None

  22. WTF is Kernel#Array()

  23. Kernel#Array() Input Output array unmodified object that implements :to_ary object.to_a

    nil [ ] object [ object ]
  24. Other Conversion Functions Complex() Float() Hash() Integer() Rational() String()

  25. None
  26. None

  28. So What Do I Win?

  29. – Pete Hodgson, “Rails as a SOA Client” “This is

    the way you evolve (SOA) systems over time without having to redeploy your entire enterprise at once.”
  30. More Things to Think About Our tests are also docs,

    how do we optimize for that? Should we do UX for software libraries? How can we make code that acts as a good role model to the next developer? Good code should reduce the need for documentation (because nobody writes good docs anyway)
  31. More Resources Confident Ruby (eBook) - Avdi Grimm Practical Object

    Oriented Design in Ruby - Sandi Metz Thanks.