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

Bugs - What are they good for

Bugs - What are they good for

Leif Gensert

December 05, 2019
Tweet

More Decks by Leif Gensert

Other Decks in Technology

Transcript

  1. 1
    Bugs
    What are they good for?

    View full-size slide

  2. What is a bug?

    View full-size slide

  3. “First actual
    case of bug
    being found”
    Grace Hopper - 1947

    View full-size slide

  4. “I did find a bug
    in my apparatus”
    Thomas Edison - 1878

    View full-size slide

  5. The Crash <> Request Scale
    Crash Change Request

    View full-size slide

  6. Let’s ship some products

    View full-size slide

  7. Numbers only?

    View full-size slide

  8. “You didn’t say you wanted
    to ship stuff to the Queen”

    View full-size slide

  9. “Well you should know
    how addresses work”

    View full-size slide

  10. The Crash <> Request Scale
    Crash Change Request

    View full-size slide

  11. Record Investigate Fix

    View full-size slide

  12. Reproduce It
    Fix It
    Ship It

    View full-size slide

  13. Find a reproducible scenario

    View full-size slide

  14. Speeds up fixing process

    View full-size slide

  15. accepted
    Closed Won

    View full-size slide

  16. paid
    Closed Lost

    View full-size slide

  17. context 'accepted order' do
    let(:order) { build(:order, status: 'accepted') }
    it 'returns "closed won"' do
    expect(deal_stage(order)).to eq('closed won')
    end
    end
    context 'paid order' do
    let(:order) { build(:order, status: 'paid') }
    it 'returns "closed won"' do
    expect(deal_stage(order)).to eq('closed won')
    end
    end

    View full-size slide

  18. def deal_stage(order)
    return 'enquired' if order.nil?
    return 'quoted' if order.open?
    return 'closed won' if order.accepted?
    'closed lost'
    end

    View full-size slide

  19. Lets you try out different solutions

    View full-size slide

  20. Makes it clear what to fix

    View full-size slide

  21. NoMethodError: undefined
    method `date’ for nil:NilClass

    View full-size slide

  22. def render(order)
    {
    id: order.id,
    delivery_date: order.delivery.date
    }
    end

    View full-size slide

  23. def render(order)
    {
    id: order.id,
    delivery_date: order.delivery&.date
    }
    end

    View full-size slide

  24. GET /api/v1/orders?status=delivered
    • Order 01
    • Order 02
    • Order 03

    View full-size slide

  25. Confidence that bug
    has been fixed

    View full-size slide

  26. Continuous Integration
    Heroku Review Apps
    Create App
    Precompile Assets
    Create/Migrate Database
    Launch App
    Code

    View full-size slide

  27. But what about actually fixing the bugs?

    View full-size slide

  28. def deal_stage(order)
    puts "What's happening?: #{order.inspect}"
    return 'enquired' if order.nil?
    puts "What's happening?: #{order.inspect}"
    return 'quoted' if order.open?
    puts "What's happening?: #{order.inspect}"
    return 'closed won' if order.accepted?
    puts "What's happening?: #{order.inspect}"
    'closed lost'
    end
    Puts Debugging

    View full-size slide

  29. github.com/pry/pry
    def deal_stage(order)
    binding.pry
    return 'enquired' if order.nil?
    return 'quoted' if order.open?
    return 'closed won' if order.accepted?
    'closed lost'
    end

    View full-size slide

  30. Is it really the culprit?
    Caching
    Third Party Libraries
    Recent Changes
    User

    View full-size slide

  31. Push
    Continuous Integration
    Deploy
    Revert
    Continuous Integration



    View full-size slide

  32. Record Investigate Fix
    Now
    Depends on
    Urgency/Impact

    View full-size slide

  33. My Latest Bug

    View full-size slide

  34. Reproduce It
    Don’t jump to conclusions

    View full-size slide