in reply to Re^2: defining methods on the fly
in thread defining methods on the fly
Yes, it is. "Cool" means the ego of the programmer has somehow gotten involved, emotion has gotten involved, and the programmmer has run off the rails of professionalism.
Good code is not "cool", because ego is not involved. The code is correct, and works. How the programmer *feels* about the code is irrelevant. Good code and good practice stands on it's own merits; "cool", and other subjective, emotional metrics do not.
Flexible is not an antonym of well defined.
"This function is ultimately flexible, just like a Turing machine!!! In fact, it emulates a Turing machine!" Which means, means, by definitiion, that it's impact on the problem to be solved is vaguely defined; absolutely nothing has been specified about the behaviour of how the final result will be generated. Running one turing machine inside another is the ultimate in power, flexiblity... and pointlessness.
Clever is not an antonym of simple.
Clever code requires thought to understand, because it's clever and tricky, and showcases the ego of the programmer. Simple code instead seeks to document the program requires, even as it fulfills them.
idiomatic Perl is simply code that uses the full expressive power of Perl
And using the full expressive power of any language is a mistake. I'm writing this in comprehensible English, not using the full expressive power of the language. If I tried to do so, neither one of us could understand it.
The goal of programming is to write simple, correct, understandable code, not to stroke programmer ego, to be cool, to appeal to mathematical sensibilities, or any of a thousand mental pitfalls that modern programmers fall prey to.
The difference between the judgement of "acceptable cool", and unacceptable cool Perl idioms generally amounts to whatever point the person judging reached before they decided that they had learnt enough Perl.
Ad hominem, and unfair. I refuse to use many of the ugly idioms perl provides, because they grow increasingly complicated to understand, and I know, from experience, that my fellow programmers will fail to understand them even if I myself feel ever-so-clever for using them.
I once wrote a "clever" one-line regexp, as an intellectual diversion. It never went near production. I showed it to my co-workers, wrote the requisite 20 lines of documentation to explain it, then re-wrote it as ten simple lines of obvious code, and put those into production, because that was the obvious thing, so that was the correct thing to write.
That does not mean that you cannot write bad code using cool idioms, but it is equally possible, just as easy, and arguably more prevelent, to write bad code using "simple" Perl.
Anyone can fix simple code, good or bad. You may not agree with what it does, but what it does is obvious. No one can fix bad, clever code without serious effort; it masks both the intent and effect of the code *simultaneously*, whereas simple code is bad at hiding both.
I'm tired of tracing through 3,000 line mazes only to find out that partway through, some idiot quietly re-defined the function I was tracking...
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^4: defining methods on the fly
by eric256 (Parson) on Aug 03, 2006 at 16:09 UTC | |
by Anonymous Monk on Aug 03, 2006 at 22:58 UTC | |
by adrianh (Chancellor) on Aug 04, 2006 at 08:25 UTC | |
by Anonymous Monk on Aug 08, 2006 at 19:30 UTC | |
Re^4: defining methods on the fly
by radiantmatrix (Parson) on Aug 03, 2006 at 17:51 UTC | |
Re^4: defining methods on the fly
by BrowserUk (Patriarch) on Aug 03, 2006 at 16:24 UTC | |
| |
Re^4: defining methods on the fly
by chromatic (Archbishop) on Aug 03, 2006 at 17:58 UTC | |
by Anonymous Monk on Aug 03, 2006 at 20:52 UTC | |
by Anonymous Monk on Aug 03, 2006 at 22:05 UTC | |
| |
by chromatic (Archbishop) on Aug 03, 2006 at 23:09 UTC | |
Re^4: defining methods on the fly
by Anonymous Monk on Aug 03, 2006 at 17:55 UTC | |
by Anonymous Monk on Aug 03, 2006 at 21:00 UTC | |
by Anonymous Monk on Aug 03, 2006 at 21:21 UTC |