Avatar of Rohit Bajaj
Rohit Bajaj
Flag 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 undefined
Last Comment

8/22/2022 - Mon

View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.