6

I found this answer for drawing a sphere in OpenSceneGraph.

It has some errors and the OP clearly stated that

the code is just not usable

So, I tried the code and fixed the issues it had and was able to see a nice sphere.

My question is:

  • Should I post a new answer, crediting the original author, with the fixed code?

  • Or should I directly edit the original code and fix it?

EDIT :

The OP accepted the answer in question, yet the code still contains errors. Since it was accepted, I'm leaning towards the editing options. Any thoughts?

1
  • If I were to post an answer it would be the same as from the linked duplicate. Go ahead and edit the code as long as you only make changes that reflect the author's intent.
    – Veedrac
    Commented Oct 31, 2014 at 14:35

2 Answers 2

3

If the edits are more than the answer author can figure out, they are a significant contribution and you do deserve credit for them.

Leave your own answer, including fixed code and explanation of the fixes, mentioning that you used the other answer as a starting point. You can also explain what the other answer already did well, or just instruct viewers to read the other answer.

In an ideal situation, your answer would then receive the green checkmark, for being the most complete, and viewers would vote for both yours and the answer you based yours on, because both are helpful in getting to the solution.

1
  • The original answer is great, but the code won't compile as-is. My fix would only make the code correct.
    – Adri C.S.
    Commented Oct 31, 2014 at 14:02
2

Don't edit the accepted answer to modify the code!

What you could do, if you think that taking the credit for a correction of the code would be "wrong", is to make it a community wiki.

Or you comment the answer, stating that the OP can take your code instead/additionally of/to his.

3
  • Thanks for your answer. But why not edit the answer if it's wrong? And by wrong I mean it won't compile.
    – Adri C.S.
    Commented Oct 31, 2014 at 13:47
  • You said that you used his answer and built upon, so it can't be so wrong...
    – Theolodis
    Commented Oct 31, 2014 at 14:04
  • I explained bad myself. The answer is excellent, but the code won't compile.
    – Adri C.S.
    Commented Oct 31, 2014 at 14:15

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