12.3. Importance of a Policy

As an architect or team leader, it is vitally important that you establish an error-handling policy, and make it clear to every member of your team or organization. Proper error handling only helps to reduce total cost of ownership for your customers if it is done consistently and with a clear vision of how it helps support both developers and eventual end users. Without a solid policy and a consistent implementation, even the most well-executed error handling only increases support costs.

When writing such a policy, it is important to keep the goal in mind: reducing cost. If other developers are calling your code, you must reduce the cost to them in terms of debugging time. Remember that adding additional error-handling code (even if it costs processor cycles at runtime) is cheaper than having developers debug problems with less-than-complete error information. If end users are running your code, you must reduce the cost to them in terms of technical support, installation, and configuration. Any problems with your application should be easy for your customer to diagnose, understand, and resolve. By coming up with a consistent error-handling strategy that reports any errors to the customer in a way that is accessible to them (see Chapter 11, "Tracing"), you will reduce the amount of time it takes your customers to diagnose and resolve problems. If you can achieve that goal, your customers will save money, and in turn they will give more of their money ...

Get Code Leader: Using People, Tools, and Processes to Build Successful Software 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.