A better way to learn refactoring

292 views
250 views

Published on

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

No Downloads
Views
Total views
292
On SlideShare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
4
Comments
0
Likes
3
Embeds 0
No embeds

No notes for slide

A better way to learn refactoring

  1. 1. A Better Way To Learn Refactoring @rafael_sperling
  2. 2. @rafael_sperling
  3. 3. ● Long Method ● Large Class ● Primitive Obsession ● Long Parameter List ● DataClumps ● Switch Statements ● Temporary Field ● Refused Bequest ● ... Bad Code Smell Examples @rafael_sperling
  4. 4. ● Single-Line Statements ● Block Statements ● Methods ● Classes Different Levels of Refactoring @rafael_sperling
  5. 5. ● Extract method for only one responsability ● Eliminate duplication through decomposition ● Allow for decomposition without drawbacks of duplication The Ultimate Goal for Refactoring @rafael_sperling
  6. 6. ● For every number from 0 to 100, ○ If it is divisible by 3, print "Fizz", ○ If it is divisible by 5, print "Buzz", ○ If it is divisible by 3 and 5, print "FizzBuzz" FizzBuzz & The Art of Refactoring @rafael_sperling
  7. 7. @rafael_sperling Eliminate Duplicate Write Lines Calls
  8. 8. @rafael_sperling Eliminate Duplicate Write Lines Calls
  9. 9. @rafael_sperling Extracted isFuzzi and isBuzzi Variables
  10. 10. @rafael_sperling Invert IF Statements
  11. 11. @rafael_sperling Extract Display Actual Number Method
  12. 12. @rafael_sperling Extracted Run Method
  13. 13. @rafael_sperling Moved FizzBuzz Region Into Separate Class
  14. 14. Thanks! rafaelsperling@gmail.com
  15. 15. References https://vimeo.com/43659053 @rafael_sperling

×