Slide 1

Slide 1 text

Legacy Code Sleman, April 1st, 2016

Slide 2

Slide 2 text

What is legacy code? Code we’ve gotten from somewhere else Demoralising code (big ball of mud) Code without unit tests

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

Characteristics Poor Architectures Without tests Poor written documentation Oral documentation IT’S WORKING!!!

Slide 5

Slide 5 text

IF IT’S WORKING, THEN WHY CHANGE IT ???

Slide 6

Slide 6 text

Reasons to change Legacy Code Kill some BUGS! Add new FEATURES Do some OPTIMISATIONS Add new automations things ( tests, scaling, etc)

Slide 7

Slide 7 text

No content

Slide 8

Slide 8 text

Reasons not to change Legacy Code It looks ugly I would like to see nicer code I want to use new shiny tools ….

Slide 9

Slide 9 text

What do we do? REWRITE?

Slide 10

Slide 10 text

BOOOOMMMM!!!

Slide 11

Slide 11 text

STOP!! DON’T REWRITE It takes time Need business analysis Features will keep coming Breeding new bugs

Slide 12

Slide 12 text

Working Code is OK

Slide 13

Slide 13 text

What do we do? You can rewrite but you cannot rewrite all Fight temptations to refactor a lot of codes DO IT SLOWLY AND CALMLY!!

Slide 14

Slide 14 text

2 Kinds of Refactoring Edit and Pray Cover and Modify

Slide 15

Slide 15 text

Edit and Pray Steps Find boundaries Discover the codes Refactor / Rewrite Run it and do smoke tests Pray that everything is okay

Slide 16

Slide 16 text

Cover and Modify Steps Find boundaries Discover the code Start write tests around the to-be- refactored code Do refactor / rewrite Tests and ensure its working

Slide 17

Slide 17 text

Find Boundaries Act at one part of code at a time Domains FTW

Slide 18

Slide 18 text

Discover the Code Read documentations Interview previous developers Read the codes Try the codes

Slide 19

Slide 19 text

Prepare and Write Tests Surround it with tests ( integration, GUI, unit tests, exploratory tests ) Testing is an investment

Slide 20

Slide 20 text

Write Code to make it Pass! SELF EXPLANATORY! ^_^

Slide 21

Slide 21 text

THANKS!!