+2

Better debugging experience

saso petrovic 7 years ago updated by Ahmad Bawaneh 7 years ago 2

Will the debugging experience ever get any better? Can it get any better? 

I'm talking about "guessing" variable names, evaluating expressions, ...


+1

We are working on an aspect of this right now - it appears the sourcemap spec supports parameters and local variable renaming (though I'm less sure about field renaming) so that the debugger can correctly get the JS value that corresponds to the java name you are highlighting. One possible problem will be scoping - in JS, this.name and name are different, and I'm not sure how the browser debugger will know the difference, but at least it might work better in your console? worth looking into more.


Expressions on the other hand are not as simple, at least not in GWT2 - the entire expression must be compiled into JS, and the process that does this must already know how all of the other java was renamed. I don't think this is something sdm can presently do, and I'm also not sure that the browser debugger or the sourcemap spec knows how to pass that back and forth correctly... All worth exploring though.

a good practice is to keep the need for debugging in the browser to the minimum, you will still need to debug in the browser from time to time, i still do that, but following a good MVP pattern you can isolate most of your code into classes that can run and debug from a simple junit test case -not even a GWTTestCase- or a main method directly in the IDE, i do this all time and it is pretty useful, but you should know that this approach needs a good structure of code that allows you to stub the parts that you are not interested in debugging.