refactoring out of the mess
TRANSCRIPT
Refactoring your way out of the mess
@WolframKriesing, uxebu - JavaScript company
Improve structure all the timewas not possible with this tower, of course
A bit of history
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
http://martinfowler.com/books/refactoring.html
base
controlled technique
code
improving design
applying
series small
tranformations too small to be worth doing
tranformationscumulative significant
error
small steps
reduce risk
avoid
system
broken
carrying out
restructuring
allows
gradually refactor
system
extended period of time
Reasons to refactor(refactoring workflows)
http://martinfowler.com/articles/workflowsOfRefactoring/
# 1
#2 - Litter-Pickup
#3 co
mpr
ehen
sion
refa
ctor
ing
prepare
#4
#5
#6 Long-Term Refactoring
• Design • Gradually get to a new design • Little jumps • Parallel refactoring
„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
1 TDD Refactoring 2 Litter-Pickup Refactoring
3 Comprehension Refactoring 4 Preparatory Refactoring
5 Planned Refactoring 6 Long-Term Refactoring
–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?
Write Code
Read Code
Easier to understand?
- less to read! - expressive
The Power Of (Long) Names
Let’s use our time more efficiently!
How?How?
„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
broken?requires tests
–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
stay green
reflected in tests
Tests?
LEGACY
Tests?
http://www.merriam-webster.com/dictionary/observable
observable
behavior
implementation detail
test this
DONT test this
implementation detail
test right!OR disable refactoring
Tests?
„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
baby stepping on green
baby stepsstay green
have the right testsdon’t test
implementation detail
Why refactor?
think in economics not in code ethics
http://martinfowler.com/bliki/DesignStaminaHypothesis.html
What to refactor
https://github.com/ emilybache/
Tennis-Refactoring-Kata
thx
@WolframKriesing, uxebu - JavaScript company