Rewriting Code for Better Understanding (Coding Horror)
- What I cannot create, I do not understand. [Richard Feynman]
- "What I do not create, I do not understand."[Chris]
- "It's easier to understand 600 tables than 100,000 lines of code." [PaulC on comp.databases.theory/2005]
- Create a new project with blocks of code copied from old code. Refactor to reduce "old code smell"
- Start refactoring by adding small tests to better understand code and act as regression tests.
- Just scan through huge amounts of code till it starts making sense - "understand by constant exposure".
- Create a text file to capture your understanding - briefly describe how the component works, realtions to other components, what it persists, its states, and source browsing/debugging tips you found useful.
- Manually reformat a copy of the code - white space, and indented as per your personal style.
- Working Effectively with Legacy Code
- Object Oriented Reengineering Patterns
- Refactoring: Improving the Design of Existing Code