Reputation:
I found out, while shoulder surfing some other - much more experienced programmers - that they all have different strategies in finding (their) errors in (their) code.
And I don't mean understanding compiler error messages, but understanding the reason why the error message occurs - immediately by following the code-flow and locating a semantical error. That sounds almost too easy.
The problem is: stuff tends to grow huge. I can't follow all my 3000 lines of code and keep everything in mind including auto-generated code for GUIs. Even if I separate pieces, it's still too much to begin again and re-read everything.
I just wonder what the most common practices are to make stuff work :). What do you do if you don't understand why the compiler throws error messages?
Upvotes: 1
Views: 256
Reputation: 56792
Separate your code into small meaningful parts.
The key is the meaningful, you should be able to remember what a part does without reading through its code again.
Upvotes: 0
Reputation:
Compiler errors are not bugs, they are your friends. The moment all programmers dread is when their code compiles and links without errors and they have to actually run the damn thing. That's when the bugs start to appear.
Compiler errors specify the actual line that the error occurs on (plus or minus one, typically). They do this by analysing syntax, they do NOT analyse "code-flow"or semantics. Your task as a programmer is to correct the syntax; the bugs live in the semantics, which can only be investigated when the program has been compiled and is being run.
Upvotes: 3
Reputation: 21950
My best strategy is to have multiple strategies. That said, my best strategies are:
Upvotes: 4
Reputation: 19820
If you don't understand why the compiler is throwing error messages, you'll need to copy the messages into the stackoverflow or Google search boxes. With some notable exceptions, the compiler is our friend...I think...
Upvotes: 0