Your Code is CollapsingHow Refactoring Can Save YourThursday, 1 March, 12
DISCLAIMER Refactoring can generate endless  discussions. What we will sharetoday are original thoughts on the topic, in o...
Lack of RefactoringThursday, 1 March, 12
GrandPerspectiveThursday, 1 March, 12
DbVisualizerThursday, 1 March, 12
StatSVNDevelopers modify code much more often than they write new codeThursday, 1 March, 12
Our brain’s processing power is    extremely overratedThursday, 1 March, 12
Thursday, 1 March, 12
Thursday, 1 March, 12
Lack of Refactoring causes:                          Slower Delivery                           More Defects               ...
“If it ain’t broke, don’t fix it”Thursday, 1 March, 12
When reusing the source code  ends up costing more than     starting from scratchThursday, 1 March, 12
You say: “technical debt”                         I ask: “credit history?”Thursday, 1 March, 12
Solution           The solution involves change management           techniques. It requires education, awareness,        ...
Solution                        1. NEW CODE BASE: continuous                        refactoring (and automated tests).    ...
Raising AwarenessThursday, 1 March, 12
Explain refactoring to                        non-programmers with                           writing recipesThursday, 1 Ma...
Thursday, 1 March, 12
Thursday, 1 March, 12
How much time does it                        take to spot the error?Thursday, 1 March, 12
1/2 cup all          Preheat oven to 425F and place rack in center.  purpose flour  1/4 teaspoon          Wash the cherries...
SolutionThursday, 1 March, 12
1/2 cup all          Preheat oven to 425F and place rack in center.  purpose flour  1/4 teaspoon          Wash the cherries...
Let’s RefactorThursday, 1 March, 12
1 lb fresh cherries     Preheat oven to 425F and place rack in center.                        Wash the cherries, remove st...
And now?Thursday, 1 March, 12
1 lb fresh cherries     Preheat oven to 425F and place rack in center.                        Wash the cherries, remove st...
Source code is invisible                              (by default)                          Problems with source          ...
Junior developers don’t see                  the point. Senior developers                      don’t care.. Project       ...
MAKE IT VISIBLE!                          Even Better:                        MAKE IT STINK!Thursday, 1 March, 12
Code Smells                        http://www.codinghorror.com/blog/2006/05/code-smells.htmlThursday, 1 March, 12
Ideas                  1. Sonar (SonarSource.org) can display,                  for each build: code coverage, complexity ...
SonarThursday, 1 March, 12
Ideas               5. Provide realistic estimates which include               time to refactor (include in your definition...
Books       • Refactoring by Martin Fowler (1999)       • Refactoring to Patterns by Joshua Kerievsky (2004)       • Code ...
@ogourment                        refactor@smarterportal.comThursday, 1 March, 12
Upcoming SlideShare
Loading in …5
×

Your Code is Collapsing- How Refactoring Can Save Your Ass 2012 03-01 - confoo

2,135 views

Published on

One of the most overlooked Agile techniques may also be the most useful one.

In the context of software product development, Refactoring (improving the design of existing code) is absolutely mandatory to continuously deliver quality code in reasonable timeframes.

Teams that do not practice continuous refactoring see their quality and
velocity go down with time.

Developers should understand from this presentation:
- How to explain the topic to managers?
- How to make sure refactoring is done, and regularly?

Managers should take away from this session:
- What is refactoring?
- What to do to maintain a good velocity as products are being built?

Published in: Technology, Business
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
2,135
On SlideShare
0
From Embeds
0
Number of Embeds
28
Actions
Shares
0
Downloads
26
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Your Code is Collapsing- How Refactoring Can Save Your Ass 2012 03-01 - confoo

  1. 1. Your Code is CollapsingHow Refactoring Can Save YourThursday, 1 March, 12
  2. 2. DISCLAIMER Refactoring can generate endless discussions. What we will sharetoday are original thoughts on the topic, in order to provide ideas to address your own situation (every situation is different)Thursday, 1 March, 12
  3. 3. Lack of RefactoringThursday, 1 March, 12
  4. 4. GrandPerspectiveThursday, 1 March, 12
  5. 5. DbVisualizerThursday, 1 March, 12
  6. 6. StatSVNDevelopers modify code much more often than they write new codeThursday, 1 March, 12
  7. 7. Our brain’s processing power is extremely overratedThursday, 1 March, 12
  8. 8. Thursday, 1 March, 12
  9. 9. Thursday, 1 March, 12
  10. 10. Lack of Refactoring causes: Slower Delivery More Defects Lower Morale It’s a vicious circle!Thursday, 1 March, 12
  11. 11. “If it ain’t broke, don’t fix it”Thursday, 1 March, 12
  12. 12. When reusing the source code ends up costing more than starting from scratchThursday, 1 March, 12
  13. 13. You say: “technical debt” I ask: “credit history?”Thursday, 1 March, 12
  14. 14. Solution The solution involves change management techniques. It requires education, awareness, incentives, making metrics visible, reports and alerts automatically generated (CI). Different levels of awareness will cause frustrations. You will often need external help (coaching.).Thursday, 1 March, 12
  15. 15. Solution 1. NEW CODE BASE: continuous refactoring (and automated tests). Ideally, TDD (Red, Green, Refactor) 2. EXISTING CODE BASE: cost- benefit analysis (how long is the product to be supported?)Thursday, 1 March, 12
  16. 16. Raising AwarenessThursday, 1 March, 12
  17. 17. Explain refactoring to non-programmers with writing recipesThursday, 1 March, 12
  18. 18. Thursday, 1 March, 12
  19. 19. Thursday, 1 March, 12
  20. 20. How much time does it take to spot the error?Thursday, 1 March, 12
  21. 21. 1/2 cup all Preheat oven to 425F and place rack in center. purpose flour 1/4 teaspoon Wash the cherries, remove stems and pits. salt In blender, process flour, salt, eggs, sugar, 2 large eggs 2 tbsp sugar and vanilla extract until completely smooth. 3/4 cup milk Let batter rest. 1/2 teaspoon vanilla In large 9-inch nonstick skillet melt butter over extract medium heat. 1 lb fresh cherries Add cherries, and cook for 3 minutes. Add the 1 tbsp butter remaining sugar and cook for 2 more minutes. 2 tbsp sugar Pour the batter over the cherries and bake for about 20 minutes or until the clafoutis is puffed, set, and golden brown around the edges.Thursday, 1 March, 12
  22. 22. SolutionThursday, 1 March, 12
  23. 23. 1/2 cup all Preheat oven to 425F and place rack in center. purpose flour 1/4 teaspoon Wash the cherries, remove stems and pits. salt In blender, process flour, salt, eggs, sugar, milk, 2 large eggs 2 tbsp sugar and vanilla extract until completely smooth. 3/4 cup milk Let batter rest. 1/2 teaspoon vanilla In large 9-inch nonstick skillet melt butter over extract medium heat. 1 lb fresh cherries Add cherries, and cook for 3 minutes. Add the 1 tbsp butter remaining sugar and cook for 2 more minutes. 2 tbsp sugar Pour the batter over the cherries and bake for about 20 minutes or until the clafoutis is puffed, set, and golden brown around the edges.Thursday, 1 March, 12
  24. 24. Let’s RefactorThursday, 1 March, 12
  25. 25. 1 lb fresh cherries Preheat oven to 425F and place rack in center. Wash the cherries, remove stems and pits. 1/2 cup flour In blender, process flour, salt, eggs, sugar, milk,1/4 teaspoon salt 2 large eggs and vanilla extract until completely smooth. 2 tbsp sugar 3/4 cup milk Let batter rest. 1/2 teaspoon vanilla extract 1 tbsp butter In large 9-inch nonstick skillet melt butter over medium heat. 2 tbsp sugar Add cherries, and cook for 3 minutes. Add the remaining sugar and cook for 2 more minutes. Pour the batter over the cherries and bake for about 20 minutes or until the clafoutis is puffed, set, and golden brown around the edges.Thursday, 1 March, 12
  26. 26. And now?Thursday, 1 March, 12
  27. 27. 1 lb fresh cherries Preheat oven to 425F and place rack in center. Wash the cherries, remove stems and pits. 1/2 cup flour In blender, process flour, salt, eggs, sugar,1/4 teaspoon salt 2 large eggs and vanilla extract until completely smooth. 2 tbsp sugar 3/4 cup milk Let batter rest. 1/2 teaspoon vanilla extract 1 tbsp butter In large 9-inch nonstick skillet melt butter over medium heat. 2 tbsp sugar Add cherries, and cook for 3 minutes. Add the remaining sugar and cook for 2 more minutes. Pour the batter over the cherries and bake for about 20 minutes or until the clafoutis is puffed, set, and golden brown around the edges.Thursday, 1 March, 12
  28. 28. Source code is invisible (by default) Problems with source code are even less visibleThursday, 1 March, 12
  29. 29. Junior developers don’t see the point. Senior developers don’t care.. Project Managers, well...Thursday, 1 March, 12
  30. 30. MAKE IT VISIBLE! Even Better: MAKE IT STINK!Thursday, 1 March, 12
  31. 31. Code Smells http://www.codinghorror.com/blog/2006/05/code-smells.htmlThursday, 1 March, 12
  32. 32. Ideas 1. Sonar (SonarSource.org) can display, for each build: code coverage, complexity metrics, rules compliance... 2. Use in conjunction with Continuous Integration (Jenkins). Configure to alert when non compliant 3. Name Code Quality Managers 4. Regular Retrospectives to discuss rulesThursday, 1 March, 12
  33. 33. SonarThursday, 1 March, 12
  34. 34. Ideas 5. Provide realistic estimates which include time to refactor (include in your definition of DONE) 6. Multiple little refactorings are better than large ones 7. Rule of thumb: dedicate 10% of your time to refactor (before each commit) 8. Metrics: watch TRENDs, NOT absolute numbersThursday, 1 March, 12
  35. 35. Books • Refactoring by Martin Fowler (1999) • Refactoring to Patterns by Joshua Kerievsky (2004) • Code Complete 2 by Steve McConnell (2004) • Clean Code by Robert C. Martin (2008)Thursday, 1 March, 12
  36. 36. @ogourment refactor@smarterportal.comThursday, 1 March, 12

×