Error messages

My course load is the same as it usually is every spring:

  • Intermediate programming (CSCI 13)
  • Discrete structures for CS (CSCI 26)
  • System programming in C (CSCI 46)
  • Introduction to SQL (CSCI 52)

In my students I see the usual patterns emerging: some students pay zero attention to compiler error messages. They do notice the existence of the message, but don’t actually read it. Rather, they just go back to the source code and stare at it, trying to figure out where the error could be. If I happen to be looking over their shoulders when the message pops up, I read it to them, point out the line number, and then show how the message correlates to their code. But, alas, for some students it doesn’t appear to sink in.

This phenomenon only happens with the traditional programming languages: Java, C, and the like. It does not happen in my SQL class. There, the students without fail diligently read the error message and make corrections to their code.

Why is this?

It’s the interactive nature of the SQL user interface. Type in a query, press Enter, and the computer compiles and executes it right on the spot. If there is an error, the message appears right below the input and, often, there is an arrow pointing at the exact character where the compiler noticed the error.

db=> select name, balance from account were balance < 200;
ERROR:  syntax error at or near "balance"
LINE 1: select name, balance from account were balance < 200;
                                               ^

See the arrow pointing at “balance?”

Contrast this with a traditional compiler, whose error messages appear detached from the actual source code, and frequently in abundance. It’s not only overwhelming to the beginning student, it’s very difficult to connect the error message with the location in the code.

IDEs and text editors could certainly help out. How about graphical “speech balloons” pointing at the troublesome code?

Advertisements

One thought on “Error messages

  1. Some very good points made. As to SQL students being different, I think they start out with a different perspective as to what they are trying to learn. In regular languages they are fixated on the syntax and less on the overall picture of what’s going on. They are not trying to understand but to follow the recipe. After all, isn’t education just about memorizing factoids?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s