refactoring out of the mess

64
Refactoring your way out of the mess @WolframKriesing, uxebu - JavaScript company

Upload: wolframkriesing

Post on 17-Jul-2015

235 views

Category:

Technology


5 download

TRANSCRIPT

Page 1: Refactoring out of the mess

Refactoring your way out of the mess

@WolframKriesing, uxebu - JavaScript company

Page 2: Refactoring out of the mess

Improve structure all the timewas not possible with this tower, of course

Page 3: Refactoring out of the mess
Page 4: Refactoring out of the mess
Page 5: Refactoring out of the mess
Page 6: Refactoring out of the mess

A bit of history

Page 7: Refactoring out of the mess
Page 8: Refactoring out of the mess

Design is hard.The design of

reusable software is especially hard.

Reusable software usually is the result of many design iterations.

William F. Opdyke, 1992

it’s

all a

bout

des

ign

Page 9: Refactoring out of the mess
Page 10: Refactoring out of the mess
Page 11: Refactoring out of the mess

http://martinfowler.com/books/refactoring.html

Page 12: Refactoring out of the mess

base

controlled technique

code

improving design

Page 13: Refactoring out of the mess

applying

series small

tranformations too small to be worth doing

Page 14: Refactoring out of the mess

tranformationscumulative significant

Page 15: Refactoring out of the mess

error

small steps

reduce risk

Page 16: Refactoring out of the mess

avoid

system

broken

carrying out

restructuring

Page 17: Refactoring out of the mess

allows

gradually refactor

system

extended period of time

Page 18: Refactoring out of the mess
Page 19: Refactoring out of the mess

Reasons to refactor(refactoring workflows)

Page 20: Refactoring out of the mess

http://martinfowler.com/articles/workflowsOfRefactoring/

Page 21: Refactoring out of the mess
Page 22: Refactoring out of the mess

# 1

Page 23: Refactoring out of the mess
Page 24: Refactoring out of the mess

#2 - Litter-Pickup

Page 25: Refactoring out of the mess

#3 co

mpr

ehen

sion

refa

ctor

ing

Page 26: Refactoring out of the mess

prepare

#4

Page 27: Refactoring out of the mess

#5

Page 28: Refactoring out of the mess
Page 29: Refactoring out of the mess

#6 Long-Term Refactoring

• Design • Gradually get to a new design • Little jumps • Parallel refactoring

Page 30: Refactoring out of the mess

„If somebody talks about a system being broken for a couple of days while they are refactoring, you can be pretty sure

they are not refactoring.“

http://martinfowler.com/bliki/RefactoringMalapropism.html

Page 31: Refactoring out of the mess

1 TDD Refactoring 2 Litter-Pickup Refactoring

3 Comprehension Refactoring 4 Preparatory Refactoring

5 Planned Refactoring 6 Long-Term Refactoring

Page 32: Refactoring out of the mess

–Martin Fowler

„Refactoring (noun):

a change made to the internal structure of

software to make it easier to understand and cheaper to

modify without changing its observable behavior.“

Why?

How?

What?

Page 33: Refactoring out of the mess

Write Code

Read Code

Page 34: Refactoring out of the mess

Easier to understand?

- less to read! - expressive

Page 35: Refactoring out of the mess

The Power Of (Long) Names

Page 36: Refactoring out of the mess

Let’s use our time more efficiently!

Page 37: Refactoring out of the mess

How?How?

Page 38: Refactoring out of the mess

„If you are doing refactoring your system should

not be broken for more than a few minutes at a time“

http://martinfowler.com/bliki/RefactoringMalapropism.html

Page 39: Refactoring out of the mess

broken?requires tests

Page 40: Refactoring out of the mess

–Martin Fowler

„Refactoring (noun):

a change made to the internal structure of

software to make it easier to understand and cheaper to

modify without changing its observable behavior.“

stay green

Page 41: Refactoring out of the mess
Page 42: Refactoring out of the mess
Page 43: Refactoring out of the mess

stay green

reflected in tests

Page 44: Refactoring out of the mess

Tests?

LEGACY

Page 45: Refactoring out of the mess

Tests?

Page 46: Refactoring out of the mess
Page 47: Refactoring out of the mess

http://www.merriam-webster.com/dictionary/observable

observable

behavior

implementation detail

test this

DONT test this

Page 48: Refactoring out of the mess

implementation detail

Page 49: Refactoring out of the mess

test right!OR disable refactoring

Page 50: Refactoring out of the mess

Tests?

Page 51: Refactoring out of the mess

„If you are doing refactoring your system should

not be broken for more than a few minutes at a time“

http://martinfowler.com/bliki/RefactoringMalapropism.html

Page 52: Refactoring out of the mess
Page 53: Refactoring out of the mess

baby stepping on green

Page 54: Refactoring out of the mess

baby stepsstay green

have the right testsdon’t test

implementation detail

Page 55: Refactoring out of the mess

Why refactor?

Page 56: Refactoring out of the mess

think in economics not in code ethics

Page 57: Refactoring out of the mess

http://martinfowler.com/bliki/DesignStaminaHypothesis.html

Page 58: Refactoring out of the mess

What to refactor

Page 59: Refactoring out of the mess

https://github.com/ emilybache/

Tennis-Refactoring-Kata

Page 60: Refactoring out of the mess
Page 61: Refactoring out of the mess
Page 62: Refactoring out of the mess
Page 63: Refactoring out of the mess
Page 64: Refactoring out of the mess

thx

@WolframKriesing, uxebu - JavaScript company