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 2: Principles in Refactoring
Key Insight 5 from this chapter

Refactoring's Impact on Software Architecture and Performance

Key Insight

Refactoring has fundamentally shifted architectural thinking from upfront, fixed designs to an evolutionary approach. Instead of trying to predict all future requirements and build extensive flexibility mechanisms prematurely, developers can now build software that only addresses current needs but is excellently designed for those. As needs evolve, refactoring is used to adapt the architecture, avoiding the complexity and potential misdirection of speculative flexibility. This strategy aligns with 'Yagni' (You Aren't Going to Need It), advocating for simple design and deferring architectural decisions until they are clearly needed and understood, a credible approach only made possible by refactoring.

Refactoring, while potentially slowing software in the short term by prioritizing clarity, is instrumental in achieving fast software in the long run. It enables a strategic approach to performance optimization, where software is first built in a well-factored, tunable manner. Performance tuning is then a separate, deliberate exercise guided by profiling tools that identify 'hot spots'β€”small fractions of code consuming most time. This allows developers to focus optimization efforts precisely where they will have the greatest impact, avoiding wasted work on the 90 percent of code that is not run much.

A well-factored program offers two key advantages for performance tuning: it provides more time for optimization due to faster functionality additions, and it offers finer granularity for analysis. Clearer, modular code allows profilers to pinpoint smaller, more manageable sections, making it easier to understand options and apply effective tuning. An example from the Chrysler Comprehensive Compensation project illustrated this: initial speculation on performance issues was wrong, but profiling revealed a specific 'date creation' hot spot. Refactoring that specific part, by introducing a constant empty date range, doubled system speed in five minutes, demonstrating that clear, refactored code is more easily diagnosable and optimizable.

πŸ“š 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.