Effective Strategies for Dealing with Bugs in Code

We use the squash, splat and crush analogy from insects when talking about bugs. This is with good reason: Thomas Edison wrote about bugs during his hardware engineering travails and this means the term is probably here to stay.

Get used to it, or bug off!

Approaches to dealing with bugs

Clean your area

One way to make your code bug-free is to avoid writing them in the first place!

  • Testing
  • Modularity
  • Simplicity and clarity

By testing (perhaps using TDD or unit testing) your code is much less likely be to bugged as it is tested before ever getting close to production. The works hand-in-hand with modularity and making sure that your code is written in separate, testable chunks.

The third pillar of of well-written non-bugged code is simple clear code. This minimal code should be created with the eventual reader in mind (that is, another programmer should be able to pick up your code and understand it).

Writing a //TODO is fine for missing functionality, but code that is incomplete should not be checked in.

Don’t ignore warnings

Warnings are there for a reason. Using a linter helps to point out your errors before they grow and become real problems that can stop a release or mean that you’ll be working late into Friday night.

Click Here

Tags: Bugs Code Dealing