What are your strategies for using refactoring?
How should I start when I face a Big Mess?
What are the generic emergencies for refactoring and why should be considered?
What are the worst case scenarios related to technical debt refactoring and what skills could help?
How refactoring could help eliminate waste (~Lean Development). Clean code, refactoring and technical debt management could address some significant sources of waste as defects, waiting and overproduction. Ward Cunningham's original concept of technical debt refactoring could be used to achieve an adaptive and lean design (that's more than "emergent").
Avoid and manage the technical debt using Disciplined Agile strategies during the end-to-end development life-cycle.
3. Definition (Martin Fowler)
“Refactoring is a disciplined
technique for restructuring an existing
body of code, altering its internal
structure without changing its
external behavior. “
“…a series of small behavior
preserving transformations. Each
transformation (called a "refactoring")
does little, but a sequence of these
transformations can produce a
significant restructuring. Since each
refactoring is small, it's less likely to
go wrong.“
5. Alternatives
Redesign
When we cannot change in small steps
Higher risks
Rewrite
More expensive (usually)
With clear requirements and a much simpler
solution, could be an option
6. Tactical refactoring
Refactoring
Refactoring - Improving the Design
of Existing Code by Martin Fowler
(with Kent Beck), 2 editions
Clean Code
RobertC. Martin books
Implementation patterns
Kent Beck book
7. Big Mess – external signs
Symptoms of Rotting Design
(Robert C. Martin )
Rigidity – difficult to change
Fragility – breaks in many places for any change
Immobility – cannot be reused
Viscosity – easier to do the wrong things (hacks)
Waste examples
Time to change, time to fix
Time to read & understand
Time to find features
Many defects
8. Big Mess – internally
Big size: components,
classes, functions
Big numbers: functions
and data members per
class
“Duplications” ~
Multiplications
Reverse of each
refactoring/clean code
pattern
9. Big Mess & Tactics
Hundreds of problems,
hundreds of tactics
Context matter
Some problems could have a bigger priority
• Important business-related rules are multiplicated
• Some modules are more important than others
• Some problems generate a bigger fragility
16. first make it easy
See : https://www.facebook.com/notes/kent-beck/mastering-programming/1184427814923414/
After refactoring
• Change/Test/Debug/Refactor are easier
• Each functional flow has its own data transformation flow
• If …these flows are not sharing an unnecessary global context
19. See similar discussions on tests : http://xunitpatterns.com/Erratic%20Test.html
See - The Clean CodeTalks - "Global State and Singletons" , by Misko Hevery
21. What we duplicate
Technical mechanisms
More then “car newer engine vs. old engine”
Could be accepted if offer the same functionality
Increase complexity on change & maintenance
Business/Functionality
A threat to business integrity
IncreasedComplexity & Fragility
36. Refactoring & Avoiding Waste
Lean Software development
Inspired from
Toyota Production System
Reference:
Lean Software Development:
An AgileToolkit - Mary and
Tom Poppendieck
Solutions: XP-like practices,
refactoring included