It’s an imperfect world.

Sometimes things go wrong, so you need to handle the cases where things don’t go right.

What happens if an API call returns an error? Or doesn’t return at all? What happens if an API returns an unexpected result? Your software needs to handle these cases.

Too many developers just code for the happy path where everything works as expected. It doesn’t occur to them that some of these components that they depend on may fail. They have worked fine for months or even years. Over time, though, components change, dependencies change, libraries change. There are many reasons a failure may occur. When an unexpected failure occurs, the software can’t handle it, leading to system halt, failure, or even data corruption.

Better developers write their code to handle failure more gracefully. Deliver appropriate error messages. Keep the system state intact. Whatever you do, don’t allow the system to fail silently and risk data corruption.

If you plan your system to handle all the kinds of failures it may see, it will be much more resilient.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: