Wednesday, May 18, 2016

What causes bugs?

I think that developers have a good handle on the idea of bugs in the code, but the thing that I want to focus on is informing other people, who are not developers, how bugs form.   If we can help others to realize how bugs can form we can eliminate the amount of communication that is wasted trying to explain where the bug came from or why it happened all of a sudden. 

We have all had those changes because of business requirements that everyone that isn't a developer blames for creating bugs until the next major change.  What "everyone that isn't a developer" doesn't realize is that there are other variables that play a major factor in the creation of software bugs.  

As technology increasingly gets better, faster, more convenient, etc. the list of things that directly affect your code increases greatly and there is probably a formula for it that follows the Fibonacci sequence or some other fun algorithm like that.

What "everyone" might not know is that an increase in traffic to a site or server can cause things to change on the server, or cause an admin to make changes that will adversely affect your code.  You will not be notified of these changes, whether they be from traffic flow or an admin. In the ideal world, you would know the second a change happens that is going to affect your code,  you can plan for these things and you might even have alerts set up to tell you when traffic increases to your site or application, but if an admin makes a change to a server or a setting on the server, you may never know until something goes wrong with your site or application, and you will be banging your head against the wall trying to figure out why all of a sudden this bug appears out of nowhere.

Another thing that can really throw a monkey wrench into your code is something that was meant to keep bugs away or increase security,  an update.  I am not talking about the ones that "everyone" is thinking of, like the updates that you (or someone in your team/company) have made to another part of the application,  this is what "everyone" immediately thinks broke the application when something isn't working the way it previously did, this is the major update that "everyone" blames bugs on.  I am talking about updates to operating systems, IE, Edge, Cortana, text readers, PDF readers, other browsers, just about anything that needs updating that has to do with some part of your application.

Something else that "everyone" doesn't realize affects your application is the hardware that it is run on, not just your user interface but also the data server, the web server, the application server, the whatever server.  This likely won't cause issues with your application, but it is a possibility that it could cause an issue. Sometimes when we are creating a site and we use certain frameworks, those frameworks rely on a certain hardware structure or a combination of hardware structure and software settings on that piece of hardware, so when the combinations are changed, there is sometimes a chance of it causing a bug in your application.  Let's say that there isn't a lot of memory usage on the server, so someone says hey let's dial back the memory on this server and use it somewhere else (the things you can do with Virtual Machines), now something that doesn't run all the time gets run and you get an out of memory exception, it didn't happen before, why is it happening now?  now you have to do one of two things, rewrite the code to use less memory for this one process, or convince the controlling party that you need X amount of memory on call.

Knowing that bugs happen and how they happen, helps you to prepare for them to happen and how to communicate what happened to who needs to know this bug happened.

So, what causes bugs?