17
\$\begingroup\$

This is in regards to Solving the Lazy Hobo Riddle.

Is it acceptable to have answers that have code written in a different language than the OP's? The OP has since accepted an answer, but others are posting their own in Java and Haskell. Some answers are mostly just code, but others offer explanation.

When an answer has been accepted, can this be overlooked or do we flag them as being not an answer?

\$\endgroup\$
1
  • 5
    \$\begingroup\$ No. One of the posted answers isn't even a code review. \$\endgroup\$
    – SDOG
    Commented Oct 11, 2014 at 17:35

2 Answers 2

15
\$\begingroup\$

Maybe it would have a chance at working if the code shared similar syntax (such as Java), but Haskell certainly doesn't count here. Now, if the answerer was simply trying to demonstrate an algorithm, then it would be better off as pseudocode, which is okay as an answer as long as it relates to the original code.

As for that specific answer at least, it was also about showing off another piece of code, with no regards to the original code whatsoever. When you see an answer like this, and it's in the same language, then you can ask the answerer to explain how it relates to the original code. In the meantime, or just after a while, you can flag it as NAA, as we do not consider such answers valid code reviews. If it gets fixed while the flag is still active, the mod reviewing it will still dismiss it as helpful. It will not count against you.

\$\endgroup\$
10
\$\begingroup\$

On the whole, I'd have to say: No. This site is supposed to be about reviewing the code, posting a working version of the code in another language doesn't always help the OP. If you are suggesting an alternative algorithm, or you want to illustrate a point, using a language you are more comfortable with is fine, but answering a review request by posting the same program, written in another language just doesn't sit well with me.

Just allowing different language answers would, perhaps, put us at risk of becoming a half-arsed codegolfing site (which already exists). It'd also devoid what little meaning the tag-score has. Someone with a bronze, or silver badge in C should have proven he knows his way around C. If we were to allow answering in other languages, he might've answered everything in Java, and know very little about actual C, and memory management and all of the low-level stuff.

So in resuming: On the whole, an answer can contain snippets in an array of languages, provided the answer itself reviews the code the OP written. The remarks and suggestions must bare relevance to the OP's language of choice.
Demonstrating concepts/algorithms can be done in most any language, but I do think it's quite obvious that you can't truly review C code using Scheme. The languages are just too far apart.

When in doubt: post pseudo code

cf comments below: I'm not familiar with C#, but the syntax makes it (up to a point) acceptable to post Java and or C++ based answers. But if you're not sure how something is expressed in C#, if it can be expressed at all, just write pseudo code, not VB, Haskell or Lisp.

\$\endgroup\$
2
  • \$\begingroup\$ I don't know C, C++ or Java, but I do know most of the Syntax in them to get me a little bit of a tag score in each... \$\endgroup\$
    – Malachi
    Commented Oct 20, 2014 at 14:18
  • 2
    \$\begingroup\$ @Malachi: That's absolutely fine. Like I said: tag scores don't really tell the store, they are indicators at best. But someone who continuously answers C/C++ questions using Java code might rack up a significant tag score answering beginner questions. That, to me, is not entirely fair. I'm not familiar with C#, but if I can help using what I know of C/C++ or Java, I should be able to do so. But, as I said, my answer should be relevant. Snippets in C++/Java are acceptable, but Lisp or Scheme isn't. When in doubt: post pseudo-code \$\endgroup\$ Commented Oct 20, 2014 at 14:31

You must log in to answer this question.

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