11. Refactoring
● “…is a disciplined technique for
restructuring an existing body of code,
altering its internal structure without
changing its external behavior.”
- refactoring.com
12. Refactoring
● “…is a disciplined technique for
restructuring an existing body of code,
altering its internal structure without
changing its external behavior.”
- refactoring.com
13. Refactoring
● “…is a disciplined technique for
restructuring an existing body of code,
altering its internal structure without
changing its external behavior.”
- refactoring.com
14. Refactoring
● “…is a disciplined technique for
restructuring an existing body of code,
altering its internal structure without
changing its external behavior.”
- refactoring.com
● “Tests are implied.” - Katrina Owen
15. Refactoring
● “…is a disciplined technique for
restructuring an existing body of code,
altering its internal structure without
changing its external behavior.”
- refactoring.com
19. Long Methods
● “a method, function, or procedure that has
grown too large”
20. Long Methods
● “a method, function, or procedure that has
grown too large”
21. Long Methods
● “a method, function, or procedure that has
grown too large”
● IMO: a method with a flog score of > 20
22. Flog
● ruby gem for analyzing code pain
● “Flog reports the most tortured code in an
easy to read pain report.”
● “The higher the score, the more pain the
code is in.”
23. Flog Scores
●
●
●
●
●
●
●
0-10 Awesome
11-20 Good enough
21-40 Might need refactoring
41-60 Possible to justify
61-100 Danger
100-200 Whoop, whoop, whoop
200 + Someone please think of the children
24. Long Methods
● If a method is long, it’s likely that it does too
many things.
● “Methods, like classes, should have single
responsibility.” - Sandi Metz
● SRP - every class should have a single
responsibility, and that responsibility
should be entirely encapsulated by the class