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


in reply to Re^4: Substituting a comma only when it is preceded and followed by a bracket
in thread Substituting a comma only when it is preceded and followed by a bracket

Code written in this way would be instantly apparent to anyone who encountered it,

Aside from the fact that [^)]+   ## all non-close paren chars would mean nothing to anyone who doesn't have at least a passing familiarity with regex notation, writing every regex out this way in production code would be bordering upon the criminal.

I can't think of a single other occupation where apparently sober, experienced exponents suggest that they should do their work such that a beginner can immediately understand everythng they did without expending a little effort.

Take music. When starting to learn to play an instrument, you are likely to be given a score that looks something like this.

But no musician would advocate giving that to professional musicians instead of this.

Do you expect employers to pay for you to spend 10s of minutes of their time formatting and annotating a regex over 20+ lines of their source code, when it took no more than a few seconds to type it -- including the time it took to work out what to type -- on one short line?

When someone is learning and asks for help, I have no problems at all in expending time and effort annotating that line of code -- for them.

But wasting time and effort writing every line of production code as if it might one day need to be understood and modified by my 8 y/o niece, or the guy that came to fill the water cooler -- just in case. I've more respect for the use of my time and my employer's money.


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
  • Comment on Re^5: Substituting a comma only when it is preceded and followed by a bracket
  • Download Code