DEV Community

Debugging philosophy; goals of testing; & mistakes junior devs make

Arpit Mohan on October 11, 2019

TL;DR versions of articles I read today on software engineering. Sign up for my newsletter to receive these in your inbox every weekday. ...
Collapse
 
tuwang profile image
TuWang

Fix the cause of this anomaly, not the symptoms.

That's such a critical mindset to have! I have seen junior engineers super relying on the debugger such that they can fix the data somehow, but they pay less attention to the fundamental causes:

  • perhaps the entire workflow is wrong
  • maybe the function should be refactored
  • or the unit test points out an actual bug!
Collapse
 
mohanarpit profile image
Arpit Mohan

I completely agree! A lot of times, I've seen developers fix a NullPointerException by adding a null check before the function invocation. But the variable should never have been null in that location!

Longer term fixes such as investigating the workflow, figuring out data issues go a long way in building a robust system instead of immediate symptomatic fixes.