Art of Debugging the Code : The Tribune India

Join Whatsapp Channel

Are you computer savvy?

Art of Debugging the Code

Art of Debugging the Code

Picture for representational purpose only.



What is debugging?

Debugging the code means to find an issue in the programme/code that you have written to solve a specific problem and repair it. It is one of the important steps to consider if you want to be a good coder. Software developers estimate spending up to 50 per cent of their time debugging the code.

How to debug your programmes?

There are few best practices that you can follow to find and correct errors in your programmes:

1. Try to catch common mistakes: One of the potential mistakes is to just start using the variable without declaring it. Example: to make use of variable 'a', its important to declare int a.

2. Dry run the programme: Dry run is a process of a programmer manually working through their code using a pen and paper to trace the values of variables. Code by hand, walk through your functions and other modules to identify the bugs.

3. Break and Repair: Try to walk through the code, module by module. Make a small change and try a fix, then repeat with another change. It is always easier to catch bugs in a smaller piece of code.

4. Go line by line: Focus on each line of code carefully and use print statements at various checkpoints to catch the line from where the code is working incorrectly.

5. Never get discouraged: Always remember that getting run time errors, compilation errors or even fatal errors is totally normal for a programmer. One should always consider error and debugging as an opportunity to be a better coder.

6. Take a break: When debugging, it is common to fall into the pit for hours and there is no guarantee that you would be able to fix the bug. To avoid such situations, it is advisable that you move yourself away from screens for few hours. It helps you to gain a fresh perspective to solve the problem and improves the productivity.

Debugging is a cyclic process. Keep calm and fix the bugs.

Time to test your Debugging Skills!

Designed by Dr Jyotika Pruthi, Assistant Professor, The NorthCap University, Gurugram


Top News

‘Congress mantra is loot in life, loot after life’: PM Modi on Sam Pitroda’s inheritance tax remarks

‘Congress mantra is loot in life, loot after life’: PM Modi on Sam Pitroda’s 'inheritance tax' remarks

Grand Old Party accuses BJP of distorting Pitroda’s remarks ...

Congress suspends Punjab’s Phillaur MLA Vikramjit Chaudhary over statements against ex-CM Charanjit Channi

Congress suspends Punjab’s Phillaur MLA Vikramjit Chaudhary over statements against ex-CM Charanjit Channi

The suspension letter has been issued by Congress’s Punjab a...

Supreme Court seeks clarification from EC on functioning of EVMs, summons senior poll panel official

VVPAT: ‘We can’t control elections’, Supreme Court tells petitioners

The Bench, which has already reserved its verdict, told the ...


Cities

View All