5
\$\begingroup\$

I asked this question which someone has flagged as off topic, referencing a question that referred to pseudo code as a reason. My question is in regards to the overall design and not changes to how it is coded.

Is it necessary to provide only fully working code that can be edited and therefore either disallowing design questions or forcing users to ask questions with way too many lines of code, irrelevant to the question?

\$\endgroup\$
  • \$\begingroup\$ There's a false dichotomy in your second paragraph. \$\endgroup\$ – Gareth Rees Jan 31 '14 at 17:43
  • 1
    \$\begingroup\$ Last hour on a Friday, the fingers were faster than the brain. \$\endgroup\$ – Ross Drew Jan 31 '14 at 20:31
10
\$\begingroup\$

This is Code Review, not Design Review. The process works like this:

  • You post some code with the following constraints:

    • You wrote that code yourself
    • It is real-world code. It is not example code, but something you're actually using. This does not exclude code for contrived problems like homework assignments.
    • You want to improve that code, e.g. clearer formatting, best practices, better algorithms.
    • The code works to the best of your knowledge. If it doesn't run, it's off topic (and likely belongs on Stack Overflow).

    Read what's on topic for the full list.

  • Then, other people review that code. You may point out a special area of interest, but anything may be commented on, including

    • best practices including formatting, naming, commenting, …
    • algorithms used
    • designs used
    • better libraries
    • possible bugs

Now with example code, it happens that none of these except the algorithm and the design are relevant to you: You're not interested in improving the code.

There are other sites where such questions are a better fit:

  • Programmers is good for whiteboard-style programming questions, e.g. algorithms, design issues, design patterns, and architecture.
  • Computer Science is good when you have questions about algorithms (in a mathematical setting) or formal methods.
\$\endgroup\$
  • \$\begingroup\$ I doubt that I consider "example code" as off-topic, if it was written by the OP. \$\endgroup\$ – ChrisW Jan 31 '14 at 15:33
  • \$\begingroup\$ @ChrisW I'd say example code can be on-topic or off-topic. If it is "example code" in the sense that it won't compile or will be unusable then I'd say it might be off-topic. That's not really review-able. \$\endgroup\$ – James Khoury Feb 2 '14 at 23:04
5
\$\begingroup\$

Generally, questions about making design choices is a better fit for Programmers.

Your question does not seem to be looking for a Code Review, your question is more to help you make a structural decision. Therefore, I agree with the flag that it should be migrated to programmers.

Please note that I am saying "generally" here, and that this is only an answer relevant for this question. I don't think it is possible to make a "One rule fits all" here, and thereby I cannot answer the second part of your question.

\$\endgroup\$
3
\$\begingroup\$

I thought you provided just enough "code" to enable a reply.

It definitely wasn't "working" code, though, so it was pseudocode at best:

private String generateHTML(Event event)
{ 
    StringBuilder sb = new StringBuilder();

    b.append("<HTML><table>"); <-- WRONG NAME FOR THE VARIABLE

You are allowed to post "code for contrived problems like homework assignments".

So to ensure that your post will be considered on-topic, the best thing to do in a case like this would be to write the smallest piece of working code which demonstrates the problem/question you are asking about.

In your question, it wouldn't take much:

  • Replace the following three comments with a line of code:

    //bunch of properties and accessors
    //properties and accessors
    //append HTML and ExplosionEvent specific data

  • Ensure that the code you post will actually build correctly and contains no bugs.

\$\endgroup\$

You must log in to answer this question.

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