Refactoring

@PaulSWilliamsUK

What is legacy code?

'code without tests'

Reasons to change code

BUT

Edit and pray

Cover and modify

Characterisation Tests

Test what the software ACTUALLY DOES

Legacy code dilemma

Change requires code to be covered by tests, but code needs changing to bring it under test...

Refactoring tools!!

Seams

'a place where you can alter behaviour in your program without editing in that place'

Enabling points

Refactoring methods

Sprout method

Original

1st attempt

Just think of the SRP!

Sprout method

TDD GetUniquePosts()

...

#

/