5
\$\begingroup\$

These questions involve the practice of commenting on another user's answers to suggest a shortening of the code.

Which of these are polite? Which are best practices?

  • Commenting on an answer to indicate that a shorter solution in the same language has been posted (for example, this Perl 5 answer to FizzBuzz has more votes than this one despite being longer)
  • Giving credit to a user who suggests an optimization (e.g. in my answer here):

Pyth, 21 20 bytes

-1 byte by Dennis

c/J-*3.d3C\ᙹ4T+33J
  • Upvoting an answer because one suggests an optimization for it, to 'cancel out criticism'
\$\endgroup\$

2 Answers 2

6
\$\begingroup\$

It's nice to include an edit in the post, referencing the user

Since comments tend to get removed by the user (or by a moderator) after they've been addressed, it is good practice to include a reference to the user for their suggested improvement(s).

  • Thanks to [user] for golf help!
  • -x bytes by [user]
  • etc...

Upvotes are optional, of course, but giving credit may make the user more inclined to give you one.

Don't comment on an answer pointing to another answer that's shorter unless it really matters (like if there can only be one answer per language.) It seems rude.

\$\endgroup\$
1
4
\$\begingroup\$

I'm not sure to understand point 1.

If I find a way (or many ways) to shorten an existing answer, I'll put that in a comment. When (and if) my suggestion is accepted, I will probably upvote the answer just for the pleasure of vote for myself.

But if I find a different way, I'll post an answer

\$\endgroup\$
2
  • \$\begingroup\$ I was referring to pointing out someone else's shorter answer. \$\endgroup\$
    – lirtosiast
    Sep 27, 2015 at 14:43
  • 7
    \$\begingroup\$ @ThomasKwa clearer now. I'd say no if the other anser is mine - blatant self-promotion \$\endgroup\$
    – edc65
    Sep 27, 2015 at 15:02

You must log in to answer this question.

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