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.
A Better Way To Learn Refactoring
@rafael_sperling
@rafael_sperling
● Long Method
● Large Class
● Primitive Obsession
● Long Parameter List
● DataClumps
● Switch Statements
● Temporary Field...
● Single-Line Statements
● Block Statements
● Methods
● Classes
Different Levels of Refactoring
@rafael_sperling
● Extract method for only one responsability
● Eliminate duplication through
decomposition
● Allow for decomposition witho...
● For every number from 0 to 100,
○ If it is divisible by 3, print "Fizz",
○ If it is divisible by 5, print "Buzz",
○ If i...
@rafael_sperling
Eliminate
Duplicate Write
Lines Calls
@rafael_sperling
Eliminate Duplicate Write Lines Calls
@rafael_sperling
Extracted isFuzzi and isBuzzi Variables
@rafael_sperling
Invert IF Statements
@rafael_sperling
Extract Display Actual Number Method
@rafael_sperling
Extracted Run Method
@rafael_sperling
Moved FizzBuzz Region Into Separate Class
Thanks!
rafaelsperling@gmail.com
References
https://vimeo.com/43659053
@rafael_sperling
Upcoming SlideShare
Loading in …5
×

A better way to learn refactoring

418 views

Published on

Published in: Technology, Business
  • Be the first to comment

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

×