When your program is finished, don’t walk away. Consider redesigning it—as long as a deadline is not looming. Redesigning, not to optimize, but to make working code easier to understand, to debug, to modify, and to integrate with other code is common enough to have a name: refactoring.1 Refactoring is reconsidering both variable and function names, breaking multi-tasking functions into single-task functions, applying stepwise refinement, reconsidering the choice of data structures, considering cohesion versus coupling, and rewriting code to make it clearer and more efficient. ...
12. Refactoring
Get Good Habits for Great Coding: Improving Programming Skills with Examples in Python now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.