Common StackOverflow errors

I answer lots of beginner questions on StackOverflow. The same issues come up over and over again so I thought I would post articles about the commonly seen ones.

There are several ‘meta’ issues; questions that are not answerable, lack data, etc. I thought I would start with some of those. These are mainly FYI but I want to get them out of the way.

Meta #1 — posting an assignment.

This is surprisingly common. A new user simply pastes the homework assignment. You will see a question like this

You are required to write a program that prompts the user to enter a list of integers. The list is terminated by entering 0. Sort that list in ascending order and print it out. Then calculate the average and print that too. You may not use the standard library functions for sorting (qsort for example)

My assumption is that in many CS classes either:

  • The teacher says that if you get stuck you can try StackOverflow
  • There are students who pass this knowledge along

But obviously making zero effort is a bad idea. Its not going to advance your CS knowledge. These questions get closed fast but I usually comment on them like this.

SO is not a code writing service. Please try something, if you get stuck post the code you have so far and say what issue you are seeing

There is ‘official’ homework policy on SO that discourages people from actually writing the assignment program for the questioner.

Open letter to students with homework problems — Software Engineering Meta Stack Exchange

How do I ask and answer homework questions? — Meta Stack Overflow

and others.

My view is that if you make an effort and get stuck its OK to ask for help on SO. Some view this as cheating since they did not answer the question unaided, but in real life students help each other out all the time. Also learning to ask others for technical help (describing a problem clearly and concisely) and interpreting the results is a valuable skill.

I do not like it when somebody else does actually provide a complete working answer to the ‘no effort’ question. That is usually done by a relative novice and will get a lot of negative feedback (downvotes, comments pointing to the SO policies etc.)

Meta #2 — Not asking a question.

Another very common sight is code posted with some text describing what is does, but with no question. These will get comments saying:

do you have a question?

does it work, if not what goes wrong?

If the question is not amended, then it will be quickly closed. Sometimes reading the code you can see errors and guess what the issue is. I will occasionally post a comment stating my guess.

Meta #3 — Not saying what goes wrong

This is closely related to the previous issue but in this case the questioner will say:

I get an error

It doesnt work

It throws something

Without actually including the actual error.

If the program fails to run at all then we need to what error messages the questioner is getting

If the program runs but gives incorrect results then we need the input, the expected output and the actual output.

Again, these will get closed fairly quickly unless the questioner responds to comments that will say something like:

Please paste the exact error message into the question

Meta #4 — posting images of code.

Sometimes people post screen shots of code rather than pasting the code into the question. This is very frustrating because

  • sometimes its hard to read
  • you cannot copy the code into your own dev environment
  • often only some of the code is shown

Again, these get closed fast.

Next

I will start on actual common technical issues. I think experienced developers will find it interesting to see the commonly recurring errors. Newer programmers may find it helpful to make sure they done make the same mistakes.


Comments

Leave a comment