crazy debugging idea
Oct. 17th, 2006 03:17 amWhen debugging, we sometimes observe information being transformed on the GUI, and we want to know *WHO* is doing that processing. Say, you want to find out who is sorting the string "d-f-a" into "a-d-f".
If you don't know the source that well (which is always the case in large enough projects), this can be very time-consuming.
My solution:
Write a script to modify ALL methods in your source that take strings. The script will add to the beginning of these methods the following code:
for each method
*Even* if you forget to back-up your code, the prints are very easy to remove, since they all have string "//CRAZY-DEBUGGER" in them.
But this is only a hack towards my general goal: transparency between code and interface. Mapping visual properties (i.e. the user's concepts) into variables (i.e. the programmer's concepts) should be automatic.
Am I the only one with this dream?
If you don't know the source that well (which is always the case in large enough projects), this can be very time-consuming.
My solution:
Write a script to modify ALL methods in your source that take strings. The script will add to the beginning of these methods the following code:
if (s.equals("d-f-a")){ //CRAZY-DEBUGGER
System.out.println("foo: s = " + s); //CRAZY-DEBUGGER
} //CRAZY-DEBUGGERfor each method
foo and string s in the list of arguments. For methods taking two strings, the scripts adds the above code twice.*Even* if you forget to back-up your code, the prints are very easy to remove, since they all have string "//CRAZY-DEBUGGER" in them.
But this is only a hack towards my general goal: transparency between code and interface. Mapping visual properties (i.e. the user's concepts) into variables (i.e. the programmer's concepts) should be automatic.
Am I the only one with this dream?