2
\$\begingroup\$

This question already has an answer here:

Let's say I have a question roughly of the form:

I am trying to implement some not uncommon thing, X. I have done it in three different ways:

  • Full, working, concrete example implementation A.
  • Full, working, concrete example implementation B.
  • Full, working, concrete example implementation C.

What is the best choice of A, B, C, as far as flexibility, scalability, and maintenance goes? How is X typically implemented?

Key points: I'm able to provide fully functional code for the different options (I saw Are questions on design only requiring minimal code off topic?). Also, the topic is implementation of a very specific feature, rather than a broader overall software design issue.

My questions are:

  • Is this type of question on topic?

  • If not, can it be made to be on topic by one of the following:

    • Rewording "what is the best choice" to present it in a way that does not seem "opinion-based" (I am unfamiliar with CR's policies, I have a strong anti-opinion-based bias from SO).
    • Reframing the question to present only, say, A, then asking for a review and how it can be improved, hoping that the best option comes out of that review.
    • Something else.

For the particular question I have in mind, it's a behavior (regarding deserialization of objects) that I have implemented very often, but have never been able to come up with a satisfactory implementation pattern that I can stick to.

\$\endgroup\$

marked as duplicate by 200_success Mar 29 '15 at 16:39

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

2
\$\begingroup\$

Yes, No, and Maybe ....

Yes

Comparative reviews are on topic, and there is a tag for them too: .

No

The part about "How is X typically implemented?" is generally off topic on Code Review (and anywhere on Stack Exchange). It is too opinion based.

Maybe

There has been some recent debate that only one of the options can be your 'real code', and the other options must be 'hypothetical'. This debate is still ongoing, and is not resolved, so, for your purposes, the questions are on-topic, but that may change.

Conclusion

Yes, ask your question.

Note, the debate is also called the A vs. B debate.

Should comparisons of code snippets be closed as "not seeking a code review"?

\$\endgroup\$
1
\$\begingroup\$

I am fully with rolfl and the points he's making. I'd still want to add something for consideration:

Full, working, concrete example implementation ...

This is the part where I see the largest threat for your question:

As you probably already know, example code is off-topic on codereview. On the other hand, sometimes there's restrictions and circumstances that forbid posting the actual code to be reviewed verbatim.

Additionally there's questions asking for a review of a design. These are (to my knowledge) off topic. Further reading.

The point is: There is a line somewhere between Design Review and Code Review. Where exactly that line is, nobody knows. But if your question is on the "wrong" side of the line, it will probably get closed as off-topic ;)

\$\endgroup\$
  • \$\begingroup\$ Thanks, this is a good tip. Would it possibly be more acceptable to, say, isolate an implementation from an actual project (when the rest of the project is irrelevant and adds noise), rather than coming up with a contrived example? In that case, though, comparison implementations would still have to be "examples" in order to make them parallel to the project code for comparison, since pulling three different implementation types from three different projects clouds the comparison (or does it?) \$\endgroup\$ – Jason C Mar 29 '15 at 16:54
  • 1
    \$\begingroup\$ Currently it's impossible for me to judge that... You'll have to try I think. \$\endgroup\$ – Vogel612 Mar 29 '15 at 17:00

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