http://www.perlmonks.org?node_id=1011354


in reply to Syntax explanation required

And I would cordially augment Anathasius’s excellent response by making two observations:

  1. There’s More Than One Way To Do/Say It (TMTOWTDI™) ... and ...
  2. “At the end of the day,” the hands-down winner is:   the one that is the most clear, to the greatest number of human beings who will actually encounter it, either now or in the distant future.

When you are writing source code, it frankly does not matter whether what you have written is “efficient,” much less “clever.”   (And in making that comment, I consciously and respectfully intend to steer the middle-ground against acknowledged valid ... [BrowserUK] ... edge-case exceptions ...)   What (typically) matters is that what you’ve written is drop-dead obvious ... and maintainable.   (You are not at the computational bleeding-edge and never will be.)   Even if the piece of source-code that you encountered works perfectly as-writ (as I presume it does), it triggered a show-stopper question from you that was sufficient to prompt a humble-petition to The Monks.   For that reason alone, it should be judged Insufficient.   It should, at the very least, be prefaced by a comment.

Yeah, there is a “hard dollars” motivation for doing that.   The mere fact that it triggered a public comment titled “Syntax explanation required” classifies it as “very $$costly$$.”   Most of the time, there are many equally-valid ways to express your intentions to the digital computer, and so what really matters is how clear it is to your colleagues.

Replies are listed 'Best First'.
Re^2: Syntax explanation required
by Anonymous Monk on Jan 02, 2013 at 21:44 UTC
    What?