Dev Thoughts

Musings from my development journey.


Practical Debugging


Tools to Utilize from the Ruby Standard Library

What kind of problem are you trying to solve?

  • Interface - not understanding the dependent structure of methods or constants (why is this nil?, why don't I have access to a method?, What can this object see and do?)
  • State - when the assumptions you made about the current state of the program are incorrect (How does a value change at a certain point? What has been initialized at this point?) Take advantage of Ruby's quick feedback loops and flexibility. Ability to see into your program's state is critical.
  • Flow - occur when you don't how the Ruby interpreter got to or left a location in code and its associated state. (How did the interpreter get here? Where does the interpreter go from here? When does the instance variable get set?) - Helpful tool: using TracePoint and pass it a block to analyze interpreter data flow. This can help to track when values change.

3rd Party Tools

  • Pry
  • Byebug

Code examples