Slide 1

Slide 1 text

1 Bugs What are they good for?

Slide 2

Slide 2 text

No content

Slide 3

Slide 3 text

What is a bug?

Slide 4

Slide 4 text

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

Slide 5

Slide 5 text

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

Slide 6

Slide 6 text

The Crash <> Request Scale Crash Change Request ⚠

Slide 7

Slide 7 text

Let’s ship some products

Slide 8

Slide 8 text

Numbers only?

Slide 9

Slide 9 text

Nope

Slide 10

Slide 10 text

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

Slide 11

Slide 11 text

“Well you should know how addresses work”

Slide 12

Slide 12 text

The Crash <> Request Scale Crash Change Request ⚠

Slide 13

Slide 13 text

Record Investigate Fix

Slide 14

Slide 14 text

No content

Slide 15

Slide 15 text

Reproduce It Fix It Ship It

Slide 16

Slide 16 text

Find a reproducible scenario

Slide 17

Slide 17 text

Speeds up fixing process

Slide 18

Slide 18 text

accepted Closed Won

Slide 19

Slide 19 text

paid Closed Lost

Slide 20

Slide 20 text

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

Slide 21

Slide 21 text

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

Slide 22

Slide 22 text

Lets you try out different solutions

Slide 23

Slide 23 text

Makes it clear what to fix

Slide 24

Slide 24 text

NoMethodError: undefined method `date’ for nil:NilClass

Slide 25

Slide 25 text

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

Slide 26

Slide 26 text

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

Slide 27

Slide 27 text

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

Slide 28

Slide 28 text

Confidence that bug has been fixed

Slide 29

Slide 29 text

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

Slide 30

Slide 30 text

But what about actually fixing the bugs?

Slide 31

Slide 31 text

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

Slide 32

Slide 32 text

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

Slide 33

Slide 33 text

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

Slide 34

Slide 34 text

Push Continuous Integration Deploy Revert Continuous Integration

Slide 35

Slide 35 text

Record Investigate Fix Now Depends on Urgency/Impact

Slide 36

Slide 36 text

My Latest Bug

Slide 37

Slide 37 text

No content

Slide 38

Slide 38 text

No content

Slide 39

Slide 39 text

No content

Slide 40

Slide 40 text

No content

Slide 41

Slide 41 text

Reproduce It Don’t jump to conclusions