2 ms·
Small things that I noticed hurt debugability a lot: a.getB().getC().getD().e() - NullPointerException can have 4 causes B b = a.getB(); C c = b.g
by ajuc 12y ago
Small things that I noticed hurt debugability a lot:
a.getB().getC().getD().e() - NullPointerException can have 4 causes
B b = a.getB();
C c = b.getC();
D d = c.getD();
d.e(); // NPE can have only 1 reason, you can inspect b,c,d at debug time without stepping inside
Another thing that hurts debugability are non-reversible transformations in code. If sth is non-reversible it means 1 effect can have many possible causes, so when debugging you need to consider many possibilities why we are here. When there are many non-reversible steps you get exponential increase of possibile causes.
The most common things that cause this in code are defaults - when you have defaults and need to debug you need to consider many possible reasons the end effect is what it is.
It's not a big deal, but it makes debuging one step harder (instead of "I know why we get there, let's go deeper" it's "We get there either because of X or Y, let's debug to decide, or go both ways").