Is it on-topic (or acceptable practice) here to post code written in one language, and ported code in another for review ? I am learning scala and in doing so I am translating some code I wrote (in C++, Python or R) in an imperative style, to scala, written in a functional style. Would it be better simply posting the scala code and not mentioning that it is a translation, and simply describe what I am trying to do ?


1 Answer 1


I think this mostly depends on what you want to accomplish:

  • Reimplement the whole exact feature set of the original as exactly as possible (so a "pure" translation).

    In this case, we'd need to see the original code in order to make sure nothing has been missed, overlooked or mistranslated if you want the best coverage possible in the reviews as it's part of the specification.

    If possible, try to visually distiguish between the translated code and the original one, e.g. by posting the original code in a blockquote.

  • Implement another solution to the same problem in a new language, maybe with inspiration from the original.

    Here, posting the original is completely optional, especially if you can simply describe what the solution is intended to do. A link or other reference to the original might be nice, but wouldn't be required for a full review.

  • 4
    \$\begingroup\$ I would add that if you do post the original code, it should be in a code block that is inside a blockquote, to make it more apparent that that code is not intended to be reviewed. \$\endgroup\$ Aug 14, 2018 at 5:27
  • 2
    \$\begingroup\$ "In this case, we'd need to see the original code in order" Yes, the original code will be part of the specification. Code Review questions with a good specification usually get better answers than questions were the reviewer is left guessing, to the point the question would be borderline off-topic if the original code wasn't included. \$\endgroup\$
    – Mast Mod
    Aug 14, 2018 at 5:45

You must log in to answer this question.

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