Slide 1

Slide 1 text

Harry Potter and The Legacy Code Base Saturday, March 8, 14

Slide 2

Slide 2 text

Harry Potter and The Legacy Code Base Saturday, March 8, 14

Slide 3

Slide 3 text

Saturday, March 8, 14

Slide 4

Slide 4 text

Saturday, March 8, 14

Slide 5

Slide 5 text

Saturday, March 8, 14

Slide 6

Slide 6 text

Saturday, March 8, 14

Slide 7

Slide 7 text

Saturday, March 8, 14

Slide 8

Slide 8 text

MINSWAN Saturday, March 8, 14

Slide 9

Slide 9 text

NIRD.us Saturday, March 8, 14

Slide 10

Slide 10 text

AdaDevelopersAcademy.org Saturday, March 8, 14

Slide 11

Slide 11 text

Saturday, March 8, 14

Slide 12

Slide 12 text

Saturday, March 8, 14

Slide 13

Slide 13 text

WHY YOU’RE HERE • House New Hire -- You’re a new developer joining an established team • House Reorg -- Hogwarts-Online reorg assigned this to you • House Feddup -- You’ve decided you’ve had enough and volunteered Saturday, March 8, 14

Slide 14

Slide 14 text

Saturday, March 8, 14

Slide 15

Slide 15 text

LEGACY CODE ISN’T EVIL, IT’S JUST MISUNDERSTOOD Saturday, March 8, 14

Slide 16

Slide 16 text

IDEAL HABITAT • Software that has been superseded but is difficult to replace because everyone and everything relies on it • Code without tests • Code that you didn’t write • Code written before today Saturday, March 8, 14

Slide 17

Slide 17 text

Saturday, March 8, 14

Slide 18

Slide 18 text

Saturday, March 8, 14

Slide 19

Slide 19 text

CODE ARCHEOLOGY 101 Saturday, March 8, 14

Slide 20

Slide 20 text

Saturday, March 8, 14

Slide 21

Slide 21 text

Saturday, March 8, 14

Slide 22

Slide 22 text

CODE ARCHEOLOGY 101 • Achieve a better understanding of the overall architecture • Discover the root cause of a critical bug • Determine the best way to extend the functionality of a vestigial class • Investigate a previous approach to solving a current problem In this class you will learn how to... Saturday, March 8, 14

Slide 23

Slide 23 text

CODE ARCHEOLOGY 101 •Surveyance •Excavation •Analysis Each House will complete one of three tasks... Saturday, March 8, 14

Slide 24

Slide 24 text

BE BRAVE Saturday, March 8, 14

Slide 25

Slide 25 text

TO FALLEN COMRADES Saturday, March 8, 14

Slide 26

Slide 26 text

Saturday, March 8, 14

Slide 27

Slide 27 text

Saturday, March 8, 14

Slide 28

Slide 28 text

Saturday, March 8, 14

Slide 29

Slide 29 text

SURVEYANCE Saturday, March 8, 14

Slide 30

Slide 30 text

TAKE INVENTORY Saturday, March 8, 14

Slide 31

Slide 31 text

ASK DUMB QUESTIONS Saturday, March 8, 14

Slide 32

Slide 32 text

FLAG MYTHS Saturday, March 8, 14

Slide 33

Slide 33 text

Tricks ↓ Techniques ↓ Process ↓ Methodology ↓ Dogma Saturday, March 8, 14

Slide 34

Slide 34 text

class Basilisk < ActiveRecord::Base def remove_poison update!(poison_quantity: 0) end end Saturday, March 8, 14

Slide 35

Slide 35 text

class PoisonBarrel < ActiveRecord::Base def self.first_free_barrel(liters_needed) free = DEFAULT_CAPACITY - liters_needed PoisonBarrel.where("liters < ?", free) end def self.with_free_space(liters_needed) if self.first_free_barrel(liters_needed) return barrels.first else return PoisonBarrel.create! end end end Saturday, March 8, 14

Slide 36

Slide 36 text

class Basilisk < ActiveRecord::Base def remove_poison barrel = PoisonBarrel. with_free_space(poison_quantity) barrel.liters += poison_quantity barrel.save! update!(poison_quantity: 0) end end Saturday, March 8, 14

Slide 37

Slide 37 text

EXCAVATION Saturday, March 8, 14

Slide 38

Slide 38 text

Saturday, March 8, 14

Slide 39

Slide 39 text

Saturday, March 8, 14

Slide 40

Slide 40 text

"FIRST, DO NO HARM" Saturday, March 8, 14

Slide 41

Slide 41 text

Saturday, March 8, 14

Slide 42

Slide 42 text

class Basilisk < ActiveRecord::Base def remove_poison warn "#remove_poison has been deprecated. “ + “Use #harvest_poison instead." harvest_poison end def harvest_poison store_poison_in(poison_container, poison_quantity) update!(poison_quantity: 0) end private def store_poison_in(container, poison_quantity) container.first_with_free_space(poison_quantity). update!(liters: poison_quantity) end end Saturday, March 8, 14

Slide 43

Slide 43 text

ANALYSIS / DOCUMENTATION Saturday, March 8, 14

Slide 44

Slide 44 text

DOCUMENT EVERYTHING Saturday, March 8, 14

Slide 45

Slide 45 text

MAKE A MAP Saturday, March 8, 14

Slide 46

Slide 46 text

Saturday, March 8, 14

Slide 47

Slide 47 text

FINAL EXAMS Saturday, March 8, 14

Slide 48

Slide 48 text

Saturday, March 8, 14

Slide 49

Slide 49 text

Saturday, March 8, 14

Slide 50

Slide 50 text

★ glass artist ★ Vespa mechanic ★ lighting designer ★ author & teacher ★ player of games ★ software developer @kerrizor KERRI MILLER Saturday, March 8, 14

Slide 51

Slide 51 text

Saturday, March 8, 14