Revisiting Refactoring Learning From the Past Improving the Future
What We Will Cover <ul><li>What is a Refactor </li></ul><ul><li>What is a Refuctor </li></ul><ul><li>What are Code Smells ...
Defining Refactoring <ul><li>Code refactoring is the process of changing a computer program's internal structure without m...
A List of Refactors <ul><li>http://www.refactoring.com/catalog/ </li></ul>
Observations About Refactoring <ul><li>Refactoring improves the design of software </li></ul><ul><li>–  without refactorin...
What We Will Cover <ul><li>What is a Refactor </li></ul><ul><li>What is a Refuctor </li></ul><ul><li>What are Code Smells ...
Defining Refuctoring <ul><li>Refuctoring is the process of taking a well-designed piece of code and, through a series of s...
A Sampling of Refuctors <ul><li>Inconsistent Naming Conventions </li></ul><ul><li>Module Gravity Well </li></ul><ul><li>Us...
What We Will Cover <ul><li>What is a Refactor </li></ul><ul><li>What is a Refuctor </li></ul><ul><li>What are Code Smells ...
Defining Code Smells <ul><li>A Code Smell is a hint that something has gone wrong somewhere in your code </li></ul><ul><li...
A List of Code Smells <ul><li>Duplicate Code </li></ul><ul><li>Large Method </li></ul><ul><li>Marge Class </li></ul><ul><l...
Observations About Code Smells <ul><li>Smells are guidelines </li></ul><ul><li>Smells should not be dogmatic </li></ul><ul...
What We Will Cover <ul><li>What is a Refactor </li></ul><ul><li>What is a Refuctor </li></ul><ul><li>What are Code Smells ...
Defining Code Smiles <ul><li>A code &quot;smile&quot; is some aspect of the code that makes other developers smile when th...
A List of Code Smiles <ul><li>Common sense naming conventions </li></ul><ul><li>Cohesive and loosely coupled modules </li>...
Observations About Code Smiles <ul><li>Code smiles do not happen by accident </li></ul><ul><li>Code full of Smiles can det...
What We Will Cover <ul><li>What is a Refactor </li></ul><ul><li>What is a Refuctor </li></ul><ul><li>What are Code Smells ...
Defining Prefactoring <ul><li>Simple steps to take to prevent common problems before they arise </li></ul><ul><li>Conduct ...
Towards a Catalog of Prefactors <ul><li>Identify a recurring issue </li></ul><ul><li>Define a preventative measure  </li><...
Sample Prefactoring <ul><li>Inappropriate Intimacy </li></ul><ul><li>Object model not resembling Business Model </li></ul>...
Where to get More Information <ul><li>http ://www.refactoring.com/catalog/index.html </li></ul><ul><li>http://www.waterfal...
Upcoming SlideShare
Loading in...5
×

Revisiting Refactoring

992

Published on

A tour de force of Refactoring, Refuctoring, Code Smells, and Code Smiles

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

  • Be the first to like this

No Downloads
Views
Total Views
992
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
17
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Revisiting Refactoring

  1. 1. Revisiting Refactoring Learning From the Past Improving the Future
  2. 2. What We Will Cover <ul><li>What is a Refactor </li></ul><ul><li>What is a Refuctor </li></ul><ul><li>What are Code Smells </li></ul><ul><li>What are Code Smiles </li></ul><ul><li>How does this change what we do </li></ul>
  3. 3. Defining Refactoring <ul><li>Code refactoring is the process of changing a computer program's internal structure without modifying its external functional behavior or existing functionality </li></ul><ul><li>improve internal non-functional properties of the software </li></ul><ul><li>improve code readability </li></ul><ul><li>to simplify code </li></ul>
  4. 4. A List of Refactors <ul><li>http://www.refactoring.com/catalog/ </li></ul>
  5. 5. Observations About Refactoring <ul><li>Refactoring improves the design of software </li></ul><ul><li>– without refactoring, a design will “decay” as people make changes to a software system </li></ul><ul><li>• Refactoring makes software easier to understand </li></ul><ul><li>– because structure is improved, duplicated code is eliminated, etc. </li></ul><ul><li>• Refactoring promotes a deep understanding of the code at hand by tearing it apart and putting it back together again </li></ul>
  6. 6. What We Will Cover <ul><li>What is a Refactor </li></ul><ul><li>What is a Refuctor </li></ul><ul><li>What are Code Smells </li></ul><ul><li>What are Code Smiles </li></ul><ul><li>How does this change what we do </li></ul>
  7. 7. Defining Refuctoring <ul><li>Refuctoring is the process of taking a well-designed piece of code and, through a series of small, reversible changes, making it completely unmaintainable by anybody except yourself. </li></ul><ul><li>Often occurs when refactoring is not disciplined </li></ul><ul><li>Occurs when changes are made at the last minute </li></ul>
  8. 8. A Sampling of Refuctors <ul><li>Inconsistent Naming Conventions </li></ul><ul><li>Module Gravity Well </li></ul><ul><li>Useless prefixes / suffixes “Pig Latin” </li></ul><ul><li>Reusing names </li></ul><ul><li>Often introduced accidentally in a rush </li></ul>
  9. 9. What We Will Cover <ul><li>What is a Refactor </li></ul><ul><li>What is a Refuctor </li></ul><ul><li>What are Code Smells </li></ul><ul><li>What are Code Smiles </li></ul><ul><li>How does this change what we do </li></ul>
  10. 10. Defining Code Smells <ul><li>A Code Smell is a hint that something has gone wrong somewhere in your code </li></ul><ul><li>A Code Smell is a hint that something might be wrong, not a certainty. </li></ul><ul><li>Calling something a CodeSmell is not an attack; it's simply a sign that a closer look is warranted. </li></ul>
  11. 11. A List of Code Smells <ul><li>Duplicate Code </li></ul><ul><li>Large Method </li></ul><ul><li>Marge Class </li></ul><ul><li>Inappropriate Intimacy </li></ul><ul><li>Feature Envy </li></ul><ul><li>Switch Statements </li></ul><ul><li>Comments </li></ul>
  12. 12. Observations About Code Smells <ul><li>Smells are guidelines </li></ul><ul><li>Smells should not be dogmatic </li></ul><ul><li>Smells should introduce a sense of humor to code reviews </li></ul><ul><li>Code smells have associated Refactors to address specific smells </li></ul>
  13. 13. What We Will Cover <ul><li>What is a Refactor </li></ul><ul><li>What is a Refuctor </li></ul><ul><li>What are Code Smells </li></ul><ul><li>What are Code Smiles </li></ul><ul><li>How does this change what we do </li></ul>
  14. 14. Defining Code Smiles <ul><li>A code &quot;smile&quot; is some aspect of the code that makes other developers smile when they have to maintain it. </li></ul><ul><li>Code Smiles add up to code that is easily maintained </li></ul>
  15. 15. A List of Code Smiles <ul><li>Common sense naming conventions </li></ul><ul><li>Cohesive and loosely coupled modules </li></ul><ul><li>Elegant abstractions </li></ul><ul><li>Lack of duplication </li></ul><ul><li>A close resemblance to the application domain </li></ul>
  16. 16. Observations About Code Smiles <ul><li>Code smiles do not happen by accident </li></ul><ul><li>Code full of Smiles can deteriorate without careful attention </li></ul><ul><li>Code smiles may also require supporting documentation or one on one training </li></ul>
  17. 17. What We Will Cover <ul><li>What is a Refactor </li></ul><ul><li>What is a Refuctor </li></ul><ul><li>What are Code Smells </li></ul><ul><li>What are Code Smiles </li></ul><ul><li>How does this change what we do </li></ul>
  18. 18. Defining Prefactoring <ul><li>Simple steps to take to prevent common problems before they arise </li></ul><ul><li>Conduct “Lessons Learned” meetings from previous projects </li></ul><ul><li>Identify common problems </li></ul><ul><li>Take steps at every stage to avoid issues known to cause problems in the past </li></ul>
  19. 19. Towards a Catalog of Prefactors <ul><li>Identify a recurring issue </li></ul><ul><li>Define a preventative measure </li></ul><ul><li>Verify that the prevention is being followed </li></ul><ul><li>Verify that the recurring issue is reduced </li></ul><ul><li>Refine the preventative measure </li></ul>
  20. 20. Sample Prefactoring <ul><li>Inappropriate Intimacy </li></ul><ul><li>Object model not resembling Business Model </li></ul><ul><li>Separation By Interfaces </li></ul><ul><li>Read code aloud to customers </li></ul>
  21. 21. Where to get More Information <ul><li>http ://www.refactoring.com/catalog/index.html </li></ul><ul><li>http://www.waterfall2006.com/gorman.html </li></ul><ul><li>http://www.simple-talk.com/dotnet/.net-framework/code-deodorants-for-code-smells/ </li></ul><ul><li>http://www.simple-talk.com/author/nick-harrison/ </li></ul>
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×