Chapter 8. Defensive Programming
If you take care of the small things, the big things take care of themselves.
Defensive programming is a coding style that proactively prevents problems. As a coding practice, defensive programming is an amalgamation of small goals such as writing readable code, proper naming conventions, checking the return value of all functions, and employing design patterns. With defensive programming, it is all about the details. The bottom up approach makes the overall application more robust, correct, and extensible. Candidly, defensive programming consists mostly of common sense practices. For example, look at the following expression:
price=price*1.05;
The previous code statement has a simple problem. It is not ...
Get Solid Code: Optimizing the Software Development Life Cycle 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.