Link to home
Create AccountLog in
Avatar of Rohit Bajaj
Rohit BajajFlag for India

asked on

Ways to minimize bugs in java code

I am a java developer
What are the coding practices you use to minimize the number of bugs.
I recently was working on a small project. Time was less due to deadline.
Although i logically coded many things..
And there were several functions to be written.
It was frustrating to check each and every function and test cases were also of many different categories...
So i tested some functions and skipped some. And this had me having a feeling of uncertainity when the time was near for final deployment.
As a coder should i test each and every testcase ? or at least category of testcases ?
or initially strive to make a running code that approaches the final one ?

Some coding practices that i have learn are
1) start writing the code in pseudocode format to ease the process
2) Good naming
3) Defensive coding -- Somehow also making sure they way you are thinking is the way it will turn out.
4) Started testing my code separately in small small blocks

Somethings that delayed my work are small things like -
1) I was getting some error and i figured out it was because i was using java 10. so i switched to java 8. But this happened long back. And i didnt bother to fix it permannetly..and again i got this error because what i did was just doing an export statement.
so ended up again searching for the reason for this error.
2) Any part of code that is less understood or less tested seems to be causing bugs.

Any ideas about good coding practices ways to avoid delay bugs etc...
Avatar of madunix

Link to home
Create an account to see this answer
Signing up is free. No credit card required.
Create Account