Cover of The Pragmatic Programmer by Andrew Hunt, David Thomas - Business and Economics Book

From "The Pragmatic Programmer"

Author: Andrew Hunt, David Thomas
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: A Pragmatic Approach
Key Insight 3 from this chapter

Orthogonality

Key Insight

Orthogonality, a concept from geometry referring to independent axes, signifies a vital principle in computing: independence or decoupling between components. Two or more elements are orthogonal if alterations in one do not impact any of the others. In a well-designed system, this implies, for example, that database code can be modified without affecting the user interface, and vice versa. Nonorthogonal systems, exemplified by the complex interdependencies of helicopter controls where every input has cascading secondary effects, are inherently more challenging to modify, control, and maintain due to the absence of localized fixes.

Designing orthogonal systems provides two primary benefits: increased productivity and reduced risk. Productivity gains arise from localized changes, which decrease development and testing time, and the ease of creating small, self-contained, cohesive components that can be designed, coded, and tested independently. This approach also encourages reuse, as components with specific responsibilities can be combined in novel ways, and loosely coupled systems are easier to reconfigure. Furthermore, combining orthogonal components provides more functionality per unit effort by avoiding overlap. Risk reduction occurs because problematic code sections are isolated, preventing issues from spreading, making the system less fragile, easier to test (especially at the module level), and less dependent on specific vendors or platforms due to isolated interfaces.

Orthogonality is applied in design through modular, component-based, and layered architectures, where each module or layer delivers independent functionality and abstractions. A key test for orthogonal design is that a dramatic change in requirements for a specific function should only impact one module; for instance, relocating a GUI button should not alter the database schema. When integrating third-party toolkits, ensure they do not impose nonorthogonal changes on your code, keeping such details isolated. In coding, maintaining orthogonality involves writing 'shy code' that does not expose unnecessary details or rely on other modules' implementations, often achieved through the Law of Demeter. Avoiding global data minimizes component linkage, and critically examining similar functions can lead to refactoring opportunities using patterns like Strategy. This continuous monitoring and refactoring enhance system structure and orthogonality.

📚 Continue Your Learning Journey — No Payment Required

Access the complete The Pragmatic Programmer summary with audio narration, key takeaways, and actionable insights from Andrew Hunt, David Thomas.