Recently, somebody was given a homework assignment with an exercise specification that left much to desire. Yet, they've tried to make the best out of it and managed to write some code that seems to do something related to the specification; even though it is not clear how this code would be useful. They then posted their code together with the specification for review by the community.

The question received two answers so far; one of which I posted myself. The other answer looks more like a code review, although significant parts of it are basically a rant about the poor specification. My own answer is very high-level and barely mentions the code in the question at all and instead clarifies some terminology and recommends further reading on superior algorithms.

To my surprise, the question itself as well as both answers were well received by the community. My own answer currently even scores significantly above the mean score for my answers. I'm positive that both answers were useful for the OP, yet I'm wondering whether we want these posts on this site. Are they generally useful and within the scope of this site?

Should I refrain from answering such questions in the future?

If we don't want these questions, how should they be dealt with? I don't see a close reason that immediately seems appropriate. (I don't actually have VTC privileges on this site.)

  • \$\begingroup\$ It's possible the question needs a "reinventing-the-wheel" tag in situations like this. \$\endgroup\$ Apr 18, 2016 at 17:46

3 Answers 3


Should I refrain from answering such questions in the future?

You should refrain from answering off-topic questions. This was not an off-topic question.

All on-topic questions should be answered. The quality of the answer could depend on the quality of the question, but not necessarily. Note that the author of the question appears to have done his best in phrasing the question, which is admirable. If there's no better spec, there is no better spec. No point in beating on something that isn't going to improve.

Pointing out the spec is sloppy could be a constructive part of a review, especially if it teaches something valuable about the underlying facets of the problem. In this case I think it does. Reviews are allowed to be harsh, to each his own how he wants to teach.

  • 3
    \$\begingroup\$ I too admire the OP for their pace with this assignment. They really made the best out of it. \$\endgroup\$
    – 5gon12eder
    Apr 15, 2016 at 18:05
  • 1
    \$\begingroup\$ I see large consensus among all three answers so far and it is hard to decide which one to accept. I'll pick yours because you were the first to answer and your answer has accumulated the highest number of votes so far. Thanks to all who have spent their time participating in this discussion. \$\endgroup\$
    – 5gon12eder
    Apr 18, 2016 at 19:13

The mission of Code Review is to help programmers become better programmers. An important part of being a good programmer is figuring out how to

  • interpret ambiguous specifications, and seek clarification where necessary
  • identify requirements that are unreasonable or unsafe
  • make counterproposals for better interfaces

If the poster thinks that he or she has solved the task,1 but we find that the premise of the task is fundamentally flawed, it is absolutely our responsibility to point that out as part of a code review.

1 The question is on-topic, because the solution "works", to the best of the poster's knowledge.


I answered a question with similarly "weird specs" recently: Determining which vehicle Rob wants to buy

The OP had to implement some logic using nested ifs. The specs also implicitly dictated the use of Hungarian Notation for identifiers.

These questions are perfectly on-topic if OP got their code to work as intended and isn't asking our community to fix a problem or explain what's going on.

The specs can be deconstructed just as well as the code/implementation itself; I think Eric's answer did that (albeit a bit harshly), and I have no problem with it - I did that in my own answer for choosing Rob's truck.

IMO the two middle paragraphs in the body of your answer directly relate to OP's code.

If your function should compute such a cryptographic hash, I recommend that you look into one of the existing cryptographic hash function even though I doubt that you're supposed to implement one of these. [...]

Since I see the word “hash table” in your code, I suspect that instead of a cryptographic hash function, they wanted to see a “simple” hash function [...]

I think you did wonderfully; you posted an answer that's useful both for the OP and for whoever is reading. Not very different from posting an answer that suggests a completely different approach to the OP's problem, while still relating it and being relevant to the OP's code.

Keep 'em coming!

  • \$\begingroup\$ Thank you, I'll take with me that criticizing specs is also within the scope of this site. This makes sense but I wasn't sure about it. Just giving the community a little more time until I'll accept an answer. \$\endgroup\$
    – 5gon12eder
    Apr 15, 2016 at 18:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .