Skip to main content

Posts

Showing posts from September, 2013

5 things to do when you cannot trace a bug

Programming today, is more about fixing existing code than writing new. In most of the cases, bugs are easy to trace, especially when you are using a modern IDEs like Eclipse or Visual Studio. However, it is very likely that you get trapped in situations like a specific button not doing anything, application crashing randomly,  or a record not updating for a specific ID. Here are some tips you may find lifesavers if you get jammed too often when debugging your code: Catching random errors Remember, there are no random errors unless you are calling a random function. The code is always consistent, if a function calculates compound interest of an amount over a certain period of time -- within an allowed range -- correctly, it will never do it wrong as long as the parameter values are in range. So, the code is consistent. Data, however, may not be. Here is an example: public boolean saveRecordInDB (int id, String name, float height, float weight) { // Do something } Test: save