22
\$\begingroup\$

This question sparked a thought in me.

To me, the author is not doing this for exercise (not tagged with and no mention of the sort) so I assume it is done for production. I happen to have some experience with LibGDX which the author uses, enough to know that the library can do most of the functionality they have spend time implementing out of the box, rendering their code mostly redundant.

Is it an acceptable review to say (albeit more politely):

Hey, you're doing it wrong! Trash all the code you've written and use the library functions you already have. Look at these classes and here's how you do it...

I posted originally as a comment because I didn't think it was an actual review but then I was requested to post that as an answer so I did (somewhat reluctantly).

\$\endgroup\$
4
  • \$\begingroup\$ The misspelling of "wrong" as "rong" is obviously intentional, but I must admit it just looks wrong to me! Is there a reason for it to be spelled "rong"? \$\endgroup\$
    – rolfl
    Commented Aug 24, 2015 at 12:00
  • \$\begingroup\$ @rolfl I (initially) felt that posting this kind of answer as an review is a bit rude (after all they went through the trouble of writing the code then just telling them to trash it). So the intentional misspelling was an effort in conveying the perceived slight rudeness of this type of answer by means of internet slang. Edit: I might have failed in my objectives though... \$\endgroup\$
    – Emily L.
    Commented Aug 24, 2015 at 12:11
  • \$\begingroup\$ @Quill I'm sorry if you feel that way. It was not my intention (see UD: rong). I was not trying to make the review rude, I was trying to convey my perception that posting such an answer would have been rude. \$\endgroup\$
    – Emily L.
    Commented Aug 24, 2015 at 12:41
  • \$\begingroup\$ Hmm, perhaps you're right. Thank you for taking the time to explain. \$\endgroup\$
    – Quill
    Commented Aug 24, 2015 at 12:43

2 Answers 2

26
\$\begingroup\$

Yes.

If there is an implementation of the functionality already available it is always a good idea to point that out, and suggest how that alternative would be better. Your answer does that, and thus has my upvote now too (nice use of meta-effect).

While it is always best if a developer finds the right tools for the job at coding time, this can often be hard because the experience is not there, or the right search terms are not obvious. Pointing this out in a code review is the "next best thing". The worst thing would be for the code to go through in to production leaving unnecessary code to maintain, and an unwelcome maintenance problem in the long run.

Absolutely - you should point out useful alternatives when they are available.

Additionally, if there are other aspects of their code that could be reviewed it can also be covered, to make a more complete review, but a comprehensive review is never necessary on Code Review - pointing out the most significant issues is often enough - and using the right tools for the job is often the most significant criticism.

\$\endgroup\$
19
\$\begingroup\$

"You're doing it wrong" is kind of the point of having your code reviewed, isn't it? Just be sure to specify what you mean by "it" and "wrong", and it should be OK as an answer. A better answer would also explain how to do it right.

"You're doing it wrong" certainly wouldn't work well as a comment. It's too enigmatic to be helpful. Such a comment would also leave the question in an awkward state: are you suggesting that the author should revise the question with completely revised code?

Another way to look at it: "Rewrote the code to take advantage of library functions" would be a reasonable commit log message, so that advice should belong in an answer.

\$\endgroup\$

You must log in to answer this question.

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