victor chircu - silviu eigel - clean legacy code - codecamp 10 may 2014
DESCRIPTION
Victor Chircu - Silviu Eigel - Clean Legacy Code - CodeCamp 10 may 2014TRANSCRIPT
Clean Legacy CodeVictor Chircu @YonderSilviu Eigel @Ness
10th of May 2014
Legacy Code
“Source code inherited from someone else and source code inherited from an older version of the software”
Wikipedia
Legacy Code
“Code without tests” Michael Feathers
So What?
Refactoring
“A controlled technique for improving the design of an existing code base, without changing external behavior”
Martin Fowler
Refactoring
Refactoring requires unit testsEspecially refactoring legacy code
Daily Standup
Yesterday I’ve…Today I’ll fix a bug inside BookOverview page
Nothing is blocking me
What Is BookOverview Page
Demo
Cleaning Legacy Code
Cleaning Legacy Code Algorithm
1. Identify change points.2. Find test points.3. Break dependencies.4. Write tests.5. Make changes and refactor.
Dependency Breaking Techniques
Extract method under testParameterize methodBreak encapsulationExtract and override callSubclass and override method
Refactorings
Extract Method, Inline Method, Inline Temp, Move Method, Extract Class, Self Encapsulate Field, Consolidate Duplicate Conditional Fragments, Replace Nested Conditional With Guard Clauses, Invert Conditional, Replace If With Switch, Rename Method, Change Signature, Add Parameter, Remove Parameter, Separate Query From Modifier, Pull Up Field, Pull Up Method, Extract Interface, Replace Constructor With Factory Method
Our Legacy
Github Repo: http://tinyurl.com/CleanLegacyCode
Stay tuned: iasidevelopers.net
Q&A
Clean Legacy Code
Victor Chircu @YonderSilviu Eigel @Ness
10th of May 2014
Please fill in your evaluation form