Cover of Refactoring by Martin Fowler, Kent Beck - Business and Economics Book

From "Refactoring"

Author: Martin Fowler, Kent Beck
Publisher: Addison-Wesley Professional
Year: 1999
Category: Computers

🎧 Free Preview Complete

You've listened to your free 10-minute preview.
Sign up free to continue listening to the full summary.

🎧 Listen to Summary

Free 10-min Preview
0:00
Speed:
10:00 free remaining
Chapter 3: Bad Smells in Code
Key Insight 1 from this chapter

Foundational Concepts of Code Smells and Refactoring

Key Insight

The ability to identify 'when' to refactor is as critical as understanding 'how' to perform the mechanical steps. This strategic decision-making involves recognizing 'code smells,' a metaphor developed to describe structures within code that suggest a need for improvement. These 'smells' offer a more concrete basis for refactoring decisions compared to vague notions of programming aesthetics, having been identified through extensive analysis of diverse software projects, from highly successful to nearly dead.

Effective refactoring relies primarily on informed human intuition, rather than rigid sets of metrics. While precise criteria for refactoring are not provided, the text offers indications of potential trouble spots that can be resolved through refactoring. Developers are encouraged to cultivate their own judgment regarding excessive elements, such as the number of instance variables or lines of code within a method, as this discernment is deemed superior to automated measures.

This chapter, alongside a companion table, functions as a practical source of inspiration when the specific refactoring needed is unclear. The recommended process is to first identify the detected 'smell' within the code, then consult the suggested refactorings to assess their potential helpfulness. Even if an exact match for the observed 'smell' isn't explicitly listed, the provided guidance is designed to direct the developer towards an appropriate and beneficial refactoring direction.

📚 Continue Your Learning Journey — No Payment Required

Access the complete Refactoring summary with audio narration, key takeaways, and actionable insights from Martin Fowler, Kent Beck.