Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Infusing Agility
into the Java Legacy
Aman King, Lead Consultant
About Me
thoughtworker, developer,
lead, coach, trainer, oss,
speaker, author, thinker.
java, ruby, javascript, web,
cloud...
www.thoughtworks.com
ambitious missions
need disruptive thinking
JAVA_LEGACY -> { AGILITY }
dictionary.com/browse/agility
Java Legacy
Java Code that is now Legacy Code
Legacy Code
Robert C Martin
Legacy Code
The phrase strikes disgust…
Murky swamp of tangled
undergrowth with leeches beneath
and stinging flies above…
...
vimeo.com/9981123
vimeo.com/9981123
Infusing Agility into Java Legacy
– is it possible?
Infusing Agility into Java Legacy
– is it possible?
Mild Violence
Mild Language
Blood and Gore
Proceed?
Extract Method
Extract Variable
Rename
Team Health Enemy Health
AND WE’RE BACK…
Mission Learnings
Mission Learnings
Not easy.
But improvement is possible.
Mission Learnings
Try one approach.
Doesn’t feel right? Revert, try another
approach.
Mission Learnings
Rely on your weapons and toolkit…
Mission Learnings
Do not forget strategy!
1. Identify change points
2. Find test points
3. Break dependencies
4. Write tes...
But there is more…
Cod e Smells
Des ign
Smells
Arch itectu re
Smells
Dep lo
y-
ment
Smells
• Long methods
• Long class
• Temporal coupling
• Fields as temporary variables
• Out parameters
• Setters
• many more…
Co...
Cod e Smells
Des ign
Smells
• Incorrect responsibility-split across layers
• Confusing or inconsistent module structure
• Missing Dependency Injection...
Incorrect responsibility-split
across layers
Des ign
Smells
Arch itectu re
Smells
Abused Dependency Injection
Des ign
Smells
Arch itectu re
Smells
A B C D
Spring IoC
A B C D
Spring IoC
E
A B C D
Spring IoC
E
A B C D
Spring IoC
E Is E really “cross-cutting” or
is it just too easy to inject?
High
coupling
A B C D
Spring IoC
E Solution?
A B C D
Spring IoC
E
D' E'
• Branching based on release / feature / team
• Dependencies not version controlled
• Database changes not version control...
http://martinfowler.com/bliki/FeatureBranch.html
Scary Merge!
Branching based on
release / feature / team
Arc h itec tu re...
http://martinfowler.com/bliki/FeatureToggle.html
http://paulhammant.com/blog/branch_by_abstraction.html
Arc h itec tu re
Smells
Deployment
Smells
Versioned Change Tracking
“Systems that gradually degrade
are systems that can gradually
improve.”
Cod e Smells
Des ign
Smells
Arch itectu re
Smells...
Infusing Agility into the Java Legacy
Infusing Agility into the Java Legacy
Infusing Agility into the Java Legacy
Infusing Agility into the Java Legacy
Infusing Agility into the Java Legacy
Infusing Agility into the Java Legacy
Infusing Agility into the Java Legacy
Infusing Agility into the Java Legacy
Infusing Agility into the Java Legacy
Infusing Agility into the Java Legacy
Infusing Agility into the Java Legacy
Infusing Agility into the Java Legacy
Infusing Agility into the Java Legacy
Infusing Agility into the Java Legacy
Infusing Agility into the Java Legacy
Infusing Agility into the Java Legacy
Infusing Agility into the Java Legacy
Infusing Agility into the Java Legacy
Infusing Agility into the Java Legacy
Infusing Agility into the Java Legacy
Infusing Agility into the Java Legacy
Infusing Agility into the Java Legacy
Infusing Agility into the Java Legacy
Infusing Agility into the Java Legacy
Infusing Agility into the Java Legacy
Infusing Agility into the Java Legacy
Infusing Agility into the Java Legacy
Infusing Agility into the Java Legacy
Infusing Agility into the Java Legacy
Infusing Agility into the Java Legacy
Infusing Agility into the Java Legacy
Infusing Agility into the Java Legacy
Infusing Agility into the Java Legacy
Infusing Agility into the Java Legacy
Infusing Agility into the Java Legacy
Infusing Agility into the Java Legacy
Infusing Agility into the Java Legacy
Infusing Agility into the Java Legacy
Infusing Agility into the Java Legacy
Infusing Agility into the Java Legacy
Infusing Agility into the Java Legacy
Infusing Agility into the Java Legacy
Infusing Agility into the Java Legacy
Infusing Agility into the Java Legacy
Infusing Agility into the Java Legacy
Infusing Agility into the Java Legacy
Infusing Agility into the Java Legacy
Infusing Agility into the Java Legacy
Infusing Agility into the Java Legacy
Infusing Agility into the Java Legacy
Infusing Agility into the Java Legacy
Infusing Agility into the Java Legacy
Infusing Agility into the Java Legacy
Infusing Agility into the Java Legacy
Infusing Agility into the Java Legacy
Infusing Agility into the Java Legacy
Infusing Agility into the Java Legacy
Infusing Agility into the Java Legacy
Infusing Agility into the Java Legacy
Infusing Agility into the Java Legacy
Infusing Agility into the Java Legacy
Infusing Agility into the Java Legacy
Infusing Agility into the Java Legacy
Infusing Agility into the Java Legacy
Infusing Agility into the Java Legacy
Infusing Agility into the Java Legacy
Infusing Agility into the Java Legacy
Infusing Agility into the Java Legacy
Upcoming SlideShare
Loading in …5
×

Infusing Agility into the Java Legacy

1,117 views

Published on

Talk that introduces useful techniques to bring agility into a legacy codebase. Covers code smells, design smells, architectural smells, and deployment smells. Examples are representative of typical Java legacy projects. Includes refactoring screencasts.

Presented at GIDS.Java 2015 in Bangalore, India.

Published in: Technology
  • Be the first to like this

Infusing Agility into the Java Legacy

  1. 1. Infusing Agility into the Java Legacy Aman King, Lead Consultant
  2. 2. About Me thoughtworker, developer, lead, coach, trainer, oss, speaker, author, thinker. java, ruby, javascript, web, cloud. agile, xp, scrum, cd. www.amanking.com
  3. 3. www.thoughtworks.com ambitious missions need disruptive thinking
  4. 4. JAVA_LEGACY -> { AGILITY }
  5. 5. dictionary.com/browse/agility
  6. 6. Java Legacy Java Code that is now Legacy Code
  7. 7. Legacy Code Robert C Martin
  8. 8. Legacy Code The phrase strikes disgust… Murky swamp of tangled undergrowth with leeches beneath and stinging flies above… Not enough to try to prevent the rot – you have to be able to reverse it. Robert C Martin
  9. 9. vimeo.com/9981123
  10. 10. vimeo.com/9981123
  11. 11. Infusing Agility into Java Legacy – is it possible?
  12. 12. Infusing Agility into Java Legacy – is it possible?
  13. 13. Mild Violence Mild Language Blood and Gore Proceed?
  14. 14. Extract Method Extract Variable Rename
  15. 15. Team Health Enemy Health
  16. 16. AND WE’RE BACK…
  17. 17. Mission Learnings
  18. 18. Mission Learnings Not easy. But improvement is possible.
  19. 19. Mission Learnings Try one approach. Doesn’t feel right? Revert, try another approach.
  20. 20. Mission Learnings Rely on your weapons and toolkit…
  21. 21. Mission Learnings Do not forget strategy! 1. Identify change points 2. Find test points 3. Break dependencies 4. Write tests 5. Make changes and refactor
  22. 22. But there is more… Cod e Smells Des ign Smells Arch itectu re Smells Dep lo y- ment Smells
  23. 23. • Long methods • Long class • Temporal coupling • Fields as temporary variables • Out parameters • Setters • many more… Cod e Smells Des ign Smells
  24. 24. Cod e Smells Des ign Smells
  25. 25. • Incorrect responsibility-split across layers • Confusing or inconsistent module structure • Missing Dependency Injection • Abused Dependency Injection • No componentization • Over-componentization • Big-bang rewrites: long-lived either-or • Mixed tech stack Des ign Smells Arch itectu re Smells
  26. 26. Incorrect responsibility-split across layers Des ign Smells Arch itectu re Smells
  27. 27. Abused Dependency Injection Des ign Smells Arch itectu re Smells
  28. 28. A B C D Spring IoC
  29. 29. A B C D Spring IoC E
  30. 30. A B C D Spring IoC E
  31. 31. A B C D Spring IoC E Is E really “cross-cutting” or is it just too easy to inject? High coupling
  32. 32. A B C D Spring IoC E Solution?
  33. 33. A B C D Spring IoC E D' E'
  34. 34. • Branching based on release / feature / team • Dependencies not version controlled • Database changes not version controlled • Deployment scripts not version controlled • Shared non-isolated environments • Infrastructure access highly restricted Arc h itec tu re Smells Deployment Smells
  35. 35. http://martinfowler.com/bliki/FeatureBranch.html Scary Merge! Branching based on release / feature / team Arc h itec tu re Smells Deployment Smells
  36. 36. http://martinfowler.com/bliki/FeatureToggle.html http://paulhammant.com/blog/branch_by_abstraction.html
  37. 37. Arc h itec tu re Smells Deployment Smells Versioned Change Tracking
  38. 38. “Systems that gradually degrade are systems that can gradually improve.” Cod e Smells Des ign Smells Arch itectu re Smells Dep lo y- ment Smells Robert C Martin

×