I remember seeing a question which caused me to ask myself: "Why even bother writing all that code if XYZ would reliably solve that problem in a few lines?"

Would it be a relevant answer if I proposed the XYZ-based approach?

In my mind, the answer to this question depends on many things:

  • If the question is a puzzle/contest problem/programming exercise, it is okay to provide an alternative within the context of that problem becase that's the whole point of the question. Say, commenting on a better way to select a pivot in quicksort question is fine. Proposing to use a mergesort in the same question is probably not a good idea.
  • If the question is in the realms of real project/production code AND the assessment criteria are NOT provided, proposing an alternative seems to be a nice things to do because this may lead to quality/cost effects that affect end-users in real life.

Am I thinking in the right direction?

  • 1
    \$\begingroup\$ Alternative solutions can make fine answers. You just have to justify why. \$\endgroup\$ – 200_success Oct 21 '17 at 18:27
  • \$\begingroup\$ @200_success Oh boy, I did search for the duplicates and missed that one already exists! \$\endgroup\$ – Igor Soloydenko Oct 21 '17 at 18:29

Browse other questions tagged .