in reply to Re^5: next unless condition
in thread next unless condition
With Perl, I'd say just write the most understandable and maintainable code you can.
It may surprise some here that I wholeheartedly agree with this statement.
The problem comes with defining the target audience, and what they will find understandable.
I personally find $DEBUG or ...; eminently readable; ditto ... unless <cond>; and ... until <cond>; where the condition is more accurately or clearly expressed in the negative.
But there are whole chunks of the IT community who have never used Perl -- and seemingly a large part of Perl community -- for whom these constructs are somehow 'difficult to read'.
Many seem to think that if not ...; is somehow *always* more natural or clearer than ...unless...; which I find bewildering. Contrast:
"I'm here while not September and not the money runs out."
"Don't go in if not you're invited."
"Don't cross the road while not you've checked both ways and the road is not clear."
And then there are those that suggest that I should not write for me (or those with my level of Perl); but rather for those new to Perl, or perhaps those for whom English is not their first language, or those who are complete newbies to the world of programming.
To which my response is: if we all write all of our code as if the target audience are newbies; then they will never grow as programmers, because they are never stretched to learn new stuff; and we will never grow as programmers because we are ham-strung into targeting the least common denominator; and programming languages will never grow because no one is allowed to utilise their full feature set.
To me: dumbing-down our code, because someone, somewhere may not understand it -- or is too lazy to update their skills in order to understand it -- is the stupidest idea to plague the IT business (in a field full of stupid ideas), in the last 30 years. It is the equivalent of doctors resisting antibiotics in favour of leeches.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^7: next unless condition
by RonW (Parson) on Apr 04, 2016 at 23:45 UTC |