Sunday 12 October 2014

BUGS BUGS BUGS!



What is it
When you think of bugs, usually people think of the small annoying animals which annoy or disgust them. This is similar to coding bugs, as these are small things which annoy programmers.
Coding bugs are technically mistakes, which could range from unintended behavior of the program to the program crashing during a specific case. Mild bugs may be comedic such as causing AI to malfunction or deformed objects, but not crash the program. Serve bugs can cause a section of a game to be unplayable, or some functions could be cut out.

What types of bugs are there ?
Arithmetic bugs
When the user does a mathematically impossible argument. This could range from Division by zero, to arithmetic overflow or underflow. There could also be loss of arithmetic precision due to rounding or unstable algorithm.
Logic bugs
Logical bugs deal with loops and incorrectly using them. This could be from infinite loops/recursion, to using one too few loops which will access uninitialized data. 

Syntax bugs
Syntax bugs occur when using the wrong operator, usually a result of being new to programming or switching to a different language.  The good news is that in some cases the complier will give a warning about these bugs, even making it an error at times.
Resource bugs
Resource bugs occur when you are improperly using your resources, from pointers, to buffers, to variables. Pointers can give an issue when they are null, or used after its memory is free. Variables have issues when the wrong data type is being packed into it, or there is an uninitialized variable.  Finally buffers can have issues with overflow, or resource leaks may occur.
Interfacing bugs
                Interface bugs deals with incorrect usage of the external tools, and hardware. This could be software based with incorrect api/library usage and/or implementation. This could also come from hardware related issues, such as incorrect hardware assumptions, resulting in incorrect handling of the hardware.
Performance bugs
Finally performance bugs are issues which could range from minor hiccup to major malfunction. A minor case could a be a random hiccup when a piece of code is used, there will be a performance hit for a few seconds. A major performance bug will be when the game continuously suffers low frame rate due an “unoptimized code”. With this code optimization is something done near the end of game development cycles, so performance bugs may not be solved till then.
Debugging  
                Debugging is process of solving these bugs split into 2 parts, find and solve. First we have to find out what specific area or line of code that is causing this problem, which can be a tedious process if our complier doesn’t tell us what the line causing the issue is. If we find the line causing the issue we now have to identify what specific issue it is, and now attempt to solve it. With knowledge on the bug, the solution can range from changing the line, to modifying another piece of code which could be affection the line, or changing the whole section due to incorrect coding.
I will be spending the rest of the semester learning how to find and solve these bugs