in reply to sort +*, @array
“Brevity” is not necessarily a virtue. The comment above, “what does this piece of code actually do...?” is actually very telling, IMHO.
#define SOAPBOX
Sure, “clever” is entertaining, as “golf” is entertaining, but I frankly hate to see code that does things such as stringing-together map and grep calls. Congratulating themselves for “cleverly” do what a nearly-equally short but easily maintainable and clear “conventional” (how boring ...) subroutine could have done just as well. I hate these things when, and because, I have to change them for some reason. Then ... well ... have you ever taken apart a Rubik’s Cube?
(To clarify the engineering reason for my beef here ...) A source-code change that is made to a “compact, elegant, clever” piece of source-code, is of necessity a highly pervasive one, affecting much more than “the minimum change necessary to implement this particular feature or to correct this particular problem.” Because the whole thing is a Gordian Knot, the change forces itself not only upon the particular issue being addressed, but also every-other piece of logic that runs through this area ... because, likely as not (knot?), the whole thing must be torn-apart and rewritten. From an engineering point-of-view, this is a serious loss of maintainability – and for no good reason. Hence, a thing to be avoided, whenever possible, even at the cost of a few microseconds, because human time is really what costs money ... and, business risk. Please give me code that “obviously” does what it’s supposed to (or that equally “obviously” doesn’t). And, give me code that I can very easily and “obviously” change, even after its author is long gone, using one very small, very targeted suture. Don’t oblige me to rig up a heart-lung machine.
Give me clear, every time. Nothing else. If it “runs too slow,” I’ll spend $10,000 USD on a mother-of-god CPU to run it with, and it will cost me much less money to do that, than it would to tear-apart and build-up-again “clever” source code written by some long-gone someone who is nowhere to be found (or dead). Please design your code, not for the “efficiencies” of the moment, but for maintainability aimed squarely at the many decades to come.
#undef SOAPBOX
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: sort +*, @array
by raiph (Deacon) on Dec 10, 2013 at 23:03 UTC | |
by hdb (Monsignor) on Dec 11, 2013 at 07:11 UTC | |
by BrowserUk (Patriarch) on Dec 11, 2013 at 08:09 UTC | |
by raiph (Deacon) on Dec 11, 2013 at 19:57 UTC | |
by BrowserUk (Patriarch) on Dec 11, 2013 at 20:34 UTC | |
| |
|