Code Refactoring
or
"Why I swear so much"
@BeardedBasco
What it's not
"We're gonna need a whole bunch of refactoring to make this code right..."
WRONG!
Refactoring is not optimization or re-writing
Why Bother?
“ANY FOOL CAN WRITE CODE THAT A COMPUTER CAN UNDERSTAND. GOOD PROGRAMMERS WRITE CODE THAT HUMANS CAN UNDERSTAND.”
Martin Fowler
When?
Refactoring can and should be folded in to how you write and maintain code – a part of the everyday discipline of development, like writing tests and reviewing code. It should be done quietly, continuously and implicitly. It becomes part of the cost of doing work, folded in to estimates and risk assessments. Done properly, it doesn’t need to be explained or justified.
Jim Bird
uncommunicative names
“Good code is its own best documentation. As you’re about to add a comment, ask yourself, ‘How can I improve the code so that this comment isn’t needed?’”
Steve McConnell
“Self documenting code is a myth perpetuated by people who hate to write documentation”
Nicholas Zakas
other types
- Inconsistent naming
- Long parameter list
- Conditional complexity
- Data clumps
- Feature envy
In closing...
“You are not revolutionizing your app; rather you are evolutionizing your app... and evolution is an incremental, slow-paced intelligently-designed process (pun intended).”
Volkan Özçelik
“I’m not a great programmer; I’m just a good programmer with great habits.”
Kent Bock