Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Debugging

 Debugging

Presentation about debugging for people just learning to program.

sharnik

June 17, 2015
Tweet

More Decks by sharnik

Other Decks in Programming

Transcript

  1. Except the bike is on fire and you're on fire

    and everything is on fire and you're actually in hell.
  2. Fix

  3. Puts debugging class Calculator def add(a, b) puts a puts

    b a + b end end result = Calculator.new.add(2, 3) puts result
  4. strings vs numbers ruby -e "x = 3; puts x"

    # => 3 ruby -e "x = '3'; puts x" # => 3 ruby -e "x = 3; puts x.inspect" # => 3 ruby -e "x = '3'; puts x.inspect" # => "3"
  5. p: shorter puts X.inspect class Calculator def add(a, b) p

    a p b a + b end end result = Calculator.new.add(2, 3) p result
  6. debugger: pry + byebug require 'pry-byebug' class Calculator def add(a,

    b) binding.pry a + b end end Calculator.new.add(2, 3)