“Informative, yet strangely mocking”. That is how compiler errors often appear to be. Sometimes they are straight forward, though often not as much…
Debugging software is an art of its own, without which it could be quite frustrating to explore the field of computer programming. The unchartered areas of computer code often come with ambiguous errors and bugs, and it seems that many students try to stay away from the unknown. There’s this fear of being told, by a computer, that you are wrong — though that may stem from the general tendency of schools to suppress creativity.
And that’s a closed loop — fear of errors discourage trying new things; isolation from errors limits experience of understanding bugs; limited experience spawns fear of dealing with errors. It’s a tough loop to break out of, especially if the educational system re-enforces the idea of not making mistakes. Though mistakes are there to learn from, and we must break out of this loop. Otherwise we give up creativity. We give up ability to deal with errors. We give up the sense of exploration and ability to understand and push a system to its limits. This is too much to pass up on.
There are many way of dealing with bugs and errors, and most come down to just one thing, understand exactly what you are doing. This is where the Computer Science part kicks in — set up an experiment that isolates the faulty code. This is kind of like deleting faulty code, but in reverse. Figure out what part of the code causes a problem. Figure out the problem. Really figure out the problem. It’s a learning process, and over time it’s easy to get a feel for what causes cryptic error messages, without the need to jump through the hoops to find that code. Though it takes practice.
I am not suggesting to break your own code on purpose (that’s just not the same), but don’t be afraid to have your code broken. It’s best to get in this habit early, as programming comes with a lot of errorous code: accidental mistakes and typos, having to deal with someone else’s code, or simply pesky University exam questions.