Anonymous Monk posts a question, such as:
"How do I empty out a hash?"
Then the answers roll in. There are subtile differences, and some of the answers are entirely valid approaches depending on how the context of the question is intrepreted. Others are rubbish. Please remember, I didn't invent these, I just dug them up with the Perlmonks search engine:
Newbie asks: How do I find the index of the last element of an array?
That last example doesn't even do what the question asked, but rather yields the last element, not the index of the last element.
These are very simple examples. They are, however real examples found within real nodes here in the monastery. I chose simple one-liner type examples only to illustrate the point concisely. But I am sure that most of us can think of times when a very simple question, asked in a simple and reasonably well-defined way, resulted in many, many solutions being proposed. Thought provoking answers are good. But most of us can also think of times when many of the proposed solutions ventured down that road of each one wackier and farther from "the Perl way" than its predecessor.
I am all for the diversity of technique that Perl provides the opportunity to explore. But sometimes I find myself wondering, was this response posted because it's a good way to do something, or because the poster found a hot thread and wanted a shot at a few more experience points?
My favorite example of common sense prevailing is the one of merlyn pulling back in the reins when the simple question was asked, "How do I concatenate two strings?". Several answers came in: join "", @strings;, and $string = "this" . "that";, and even $string = "$first$second"; Then along comes a class act with the best answer of all: " ."
Friday golf, obfus, and abused regexp engines can be fun mindbenders. However, it seems like many of the zanier solutions to a simple problem are proposed in what seems to be all seriousness, and it's those sorts of posts that lead me to wonder if this is an XP chase or just plain bad style.
I'm curious what others feel regarding this issue. I'm not looking for "a solution". It's not even a situation in need of a solution. In fact it's not even a situation. It just seems to be human nature to try to one-up the last guy, and often that leads down a chaotic road.
Many will assert that all these examples of many ways to do the same thing are good for the thought process. I don't disagree. But it strikes me as an interesting thing to mull over.
What is the point to this post? My objective is simply to express a meditation. ;)
Dave
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |