29
\$\begingroup\$

It has happened a few times that I have answered a question where the author is doing things in a round-about and complicated way. I tell author that there is a better way and show them how using a short snippet with the general approach, showing key ideas and solutions. And oftentimes, I leave the rest to the author.

Most of the time, the author appreciates the review, and goes about improving their code merrily. But every now and then there is someone that insists I provide a complete working, tested implementation for them. When this happens I feel as if I'm being used as a free-of-charge contractor. I tell them (albeit in a more polite manner) that:

I'm not your contractor, figure it out.

The question I want to ask is, is it OK to do a review and not give a fully working implementation, i.e. with "some assembly required"? Or can I expect the author to fill in the blanks if I show them the way?

\$\endgroup\$
2
  • 2
    \$\begingroup\$ Related: A Code Review without the code \$\endgroup\$
    – RubberDuck
    Commented Jul 24, 2015 at 1:29
  • \$\begingroup\$ Next time, leave a note at the end saying something like: "<Doing something with the code> is left as an exercise for the O.P.." or similar. I've left it a few times and the O.P. even thanked me! So, yeah, I guess they like it explicit. \$\endgroup\$ Commented Jul 30, 2015 at 19:00

4 Answers 4

34
\$\begingroup\$

It's not just ok to decline, it's definitely ok.

This site is about the fishing rod, not the fish. We're Code Review, not Code Rewrite!

Answers are not even obligated to contain code; reviews that do that on top of reviewing the author's code, do that as a courtesy.

If you're being asked to produce a working and tested solution, just... walk away slowly ;-)

\$\endgroup\$
2
  • 11
    \$\begingroup\$ +1 for We're Code Review, not Code Rewrite! \$\endgroup\$
    – SSC
    Commented Jul 23, 2015 at 17:31
  • 5
    \$\begingroup\$ We're also not paidcodereviews! \$\endgroup\$
    – h.j.k.
    Commented Jul 24, 2015 at 1:30
17
\$\begingroup\$

Is it OK to do a review and not give a fully working implementation, i.e. with "some assembly required"?

Absolutely, see @Mat's answer.

Or can I expect the OP to fill in the blanks if I show them the way?

If you've given constructive comments, then congratulations, you've made a good contribution. If the author doesn't know how to implement your suggestions, they have to research. That's normal, as we're also not teach-you-how-to-code.com

What to do when user insists you spoon feed them?

Although, just as you are in no way obliged to spoon feed, the author is in no way obliged to accept (or even upvote) your possibly brilliant answer. It can also happen that another reviewer swoops in, credits you for your excellent suggestions (hopefully), and provides an example implementation, and snatches that much coveted check mark. It's part of the game.

What I do depends on my mood and on the question. If the problem is interesting enough, or if I just really, really want that check mark NOW, then I might do it. Other times I disengage early and simply ignore the requests for spoon feeding. There's not a whole lot we can do about such requests.

\$\endgroup\$
15
\$\begingroup\$

You definitely do not need to provide a complete, tested solution. I usually provide a minimal example and/or a link to documentation/examples when a user appears to be having trouble understanding a point.

For example, I could say to use the built-in type Foo, with a link to the doc. Or I say to use the Bar algorithm, and the user says "I don't understand how that works". I'll point them to Wiki or another thorough explanation, and possibly provide a minimal example in the answer.

\$\endgroup\$
11
\$\begingroup\$

Your way of telling, is very polite and that's how one should answer, because this is Code Review, not Code Rewrite.

So, you review the code, points out the things that could be improved, and that should work.

Still, if someone is not understanding your point even after you have pointed them in the right direction, you can ask the author which of the questions they managed to answer.

Then, they might see a clearer picture of the problem they have to solve. So, this will give them the vision, and a lesson which they will never forget. At least, this is how I do when I choose to spoon feed, but this is just my humble opinion.

\$\endgroup\$

You must log in to answer this question.

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