We continue to use and reuse code that is no longer maintainable because it still works in some way and we are afraid to modify it. When we remove redundancy, eliminate unused functionality, and rejuvenate obsolete designs it means we are refactoring. Refactoring throughout the entire project life cycle saves time and increases quality. Refactor allows you to keep your code clean and concise so it is easier to understand, modify, and extend. Make sure everything is expressed once and only once.
Why Refactoring?
Refactoring allows a rapid development process and simple code structure while maintaining clean, scalable, and modular code.
1. The meaning of the code should be obvious to anyone reading it. Comments can be added as well for providing additional explanation to the code, but one should try to make the code itself clear enough to understand.
2.Eliminate redundant code: Refactoring is the time to recognize patterns and factor them out of your code. Similar and redundant classes and code blocks should be combined, and unnecessary functions and variables eliminated.
3. Modularity and Scalability: Code should be easy to extend or modify, and be able to scale without adding complexity
Implementation issues
Refactoring means having to go back over one's own code. Especially when deadlines loom, working code is often assumed to be good-enough code. Refactoring can become another post-process like internal documentation that everyone recommends but that few programmers actually have the time to perform. As Cooper puts it in Extreme Programmming vs. Interaction Design, "There's enormous cost in writing code, but the real cost in writing code is that code never dies. If you can think this stuff through before you start pouring the concrete of code, you get significantly better results."
This can be addressed through several means. If code is kept simple, then going back over and having to understand everything again is significantly easier and the programmer is more likely to do it.
References:
http://www.exciton.cs.rice.edu/comp410/XP/refactoring.html
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment