How not to miss small issues while coding?

twitter logo github logo ・1 min read

We all have faced it. Bugs are a part of the software development lifecycle. However, we sometimes miss some small things. For example: adding that null check where required or repopulating that cache after clearing it.

TDD is an answer but I feel that it does not always help.
Your views?

twitter logo DISCUSS (2)
markdown guide
 

Over time, you will learn which bugs you tend to introduce most often and will be able to catch those types of bugs while you are coding. That takes years of experience, but in your example, once you've been burned by a few missed null checks you'll learn to guard against nulls as you code.

TDD will eliminate a specific category of bugs caused by the output of a specific scenario not matching the expected result. However, this class of bug is just one of many, and depending on your type of application you're writing TDD might not give you the most value. When it's all said and done, a bug can have many root causes, and not having test-driven a unit of code is only one such cause.

Most often I find that bugs are introduced primarily due to:

  • A lack of knowledge
  • A lack of experience
  • A lack of interest
  • A lack of attention to detail
  • A lack of time

If you lack knowledge, experience, interest, attention to detail, or time; no methodology or tool is going to eliminate bugs.

The reason the industry fixates on automated testing (in all of its various forms) as much as it does, is that the degree of automated tests can be measured and tracked over time. Anything that can't be measured is ignored as not being a source of bugs. As long as the prevailing software development management philosophy is grounded in the industrial era, this thinking will persist, and the more common and impactful root causes will continue to be ignored.

 
Classic DEV Post from May 10

Discuss: GitHub Special Event

GitHub is holding a "GitHub Special Event" today. Let's discuss what we're thinking leading up to it + while it's happening <3

Shreyash profile image