My favourite debugging technique – Code Evaluation

Posted by Gjermund Bjaanes on March 8, 2015

My favourite debugging technique is using code evaluation at break points.

What that means is that I put down a breakpoint somewhere in the code, and when the debugger hits that breakpoint I can pull up a code evaluator to evaluate basically any expression I want.

Using this code evaluator I can then write short code snippets / expressions to debug my code.

I can query different objects and test values and what I can access from that particular point in the code.

Most stuff you can do in code, you can do in code evaluation.

You might have done this manually many times before. Perhaps writing a print statements that tests some variable? Perhaps putting querying lots of services to debug something? Doing that is OK, but it is also extremely slow. In huge systems, it might take quite a long time to build, set up and perform the deployment.

I do not know how to do this in any other IDE than IntelliJ IDEA (however, I am sure it exists for Eclipse, NetBeans, Xcode and most other IDE’s worth their salt).

Screen Shot 2015-03-08 at 17.14.11


Follow me on Twitter: @gjermundbjaanes