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 4: Pragmatic Paranoia
Key Insight 1 from this chapter

Pragmatic Paranoia and Defensive Programming

Key Insight

Perfect software is an impossible ideal; no one has ever written it, nor is it likely to happen. Accepting this fact is crucial, as chasing perfection wastes time and energy. Instead, Pragmatic Programmers adopt a mindset of 'Pragmatic Paranoia,' akin to defensive driving, acknowledging that code will inevitably interact with imperfect external systems and invalid inputs. This approach involves validating all incoming information, using assertions to detect bad data, and ensuring consistency.

The paranoia extends beyond external systems to one's own code, recognizing that even personal code isn't perfect. This necessitates building in defenses against self-made mistakes. Key defensive measures include Design by Contract, which specifies rights and responsibilities between clients and suppliers, and ensuring Dead Programs Tell No Lies, which advocates for frequent checks and program termination upon error to prevent further damage.

Further techniques for robust software include Assertive Programming, actively verifying assumptions with checks, and How to Balance Resources, ensuring proper management of system resources like memory and files. Additionally, Don't Outrun Your Headlights promotes working in small steps to avoid large, unmanageable risks. These practices collectively ensure safety in a challenging environment of imperfect systems, tight deadlines, and evolving requirements.

📚 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.