12
\$\begingroup\$

I notice some users are posting questions where they are immediately posting a long-standing (or just extremely well golfed) solution to the problem.

On StackOverflow posting your own questions has the benefit of showing users solution to problems the poster has (and others may) come across. In this context, where we pose a challenge, I feel it discourages users from posting alternatives and only serves to boost the reputation of the user posting the question.

Should this behaviour be encouraged/allowed?

\$\endgroup\$
1
  • 2
    \$\begingroup\$ Just to clarify, my question regards those who post immediately only. I don't think it is unreasonable for the user to answer their own question after some entries appear or to generate some interest in unanswered questions a day or so later. \$\endgroup\$
    – jtjacques
    Jan 30, 2011 at 18:34

4 Answers 4

15
\$\begingroup\$

I don't particularly have a problem with giving tasks where the poster already has a solution. I have done so myself. However, I agree with others that if you had several days to golf your own solution then you should wait a while before posting it.

At least for me golfing often involves first solving the task, then finding bits and pieces that may be optimized and I then gradually move towards a golfed solution. I had moments where I thought I'd be done and nothing else would be possible anymore and then, all of a sudden, I shave off another 30 characters.

Giving others such a golfed-to-death solution beforehand might discourage them from even trying. Also, since the own solution is often essentially finished it is not really part of the usual competition, where one would notice that another solution is 5 bytes shorter than the own and then see that as motivation to beat it.

In case of my own question above I gave my own solution I prepared months ago only after someone beat it. In case the poster has the shortest solution even after some time has passed, I guess it should be posted, but not immediately after posting the task.

\$\endgroup\$
6
\$\begingroup\$

Personally, I think this should be discouraged.

If the author has a long-standing "solution", they should hold off on posting it for at least a few days, until every has a chance to contribute.

Other Stack Exchange sites are about providing solutions to problems you actual have. But this site is more about challenging users to take part in programming exercises to for entertainment or skill building. If this site is used just rehash and build up a yet ANOTHER collection of coding puzzles found elsewhere, it is going to become very boring very fast.

\$\endgroup\$
1
  • \$\begingroup\$ I'm of mixed feeling about the en-/dis-courage question. But I've given you my vote for the implication of rehashing. 'Tis an important point. \$\endgroup\$ Jan 30, 2011 at 20:45
2
\$\begingroup\$

I think it's acceptable to post a solution, but I don't see why we should encourage users to do so. I prefer a readable reference solution as part of the question as in my Slot Machine Hackers question, but even a golfed solution by the OP could be used as a reference solution to remove ambiguity and resolve arguments over correctness.

If you've worked on your golfed solution for a long time, it might be fair to wait for other answers to start appearing before posting it. If this becomes a problem, we could enforce this by not allowing self-answers until some period of time has passed (e.g. 1 day).

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

Encouraged.

  • It gives other users a target to beat.

  • You could always solve it in another language.

  • You might actually learn something from the solution.

The last reason alone should probably make it worthwile to allow such behaviour.

\$\endgroup\$

You must log in to answer this question.

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