My sister and I have been working on a family software project for a while now. In this context, we employ a tool developed by one of our clients at LOGIC, while also actively contributing to it. As my sister attempted to use it last Friday, suddenly a not so helpful error occurred.
I started looking into the error reporting tool, trying to understand what might be going on. As it turned out, this was a multifaceted issue caused by a recent update that we rolled out. On one side, there was a business logic issue, where the software behind the product reached a state that in principle did not make sense. On the other side, this situation was poorly handled by the rest of the software we built. This is what I would like to talk about here.
Our code handled the situation poorly, because it made too many assumptions. We assumed that a particular SQL query would always return results, while It doesn’t. And because of this assumption, our code crashed, when the application received empty results from the database. Although we could have shaped our query differently so as not to receive an empty result at that point, it was more important to make our code more resilient by making less assumptions, because we might as well be wrong and we were wrong at that time.
What we did eventually was to both tweak our query, so that it would return correct results, but also stop assuming it will always return results. Now, if for any reason it returns empty result in the future, we handle it gracefully and we return an error that gives a possible way out to the user.
Of course we cannot guard software against any possibility and there is no point in assuming that everything can break. Such a stance would be cynical, mundane and make our work joyless.
There is always a sweet spot though, where with less assumptions we get more resilient software. That’s what we are after.
If you are looking to build a rock solid application, we would love to talk with you. You can reach out via email at [email protected] or book a free 30-minute meeting directly to discuss in real time.