Jamis said:
Now, I don't do Ruby for a living. But I *do* write Java code, and we
use many different open source libraries. I *do* have *some* say in what
libraries we use, but I do *not* have absolute say.
There are some libraries we are using which were mandated upon us. My
life would be a lot less stressful right now if I could choose an
alternative, but that's not the case, unfortunately.
I, too, have been earning a living using Java. It's not so much
stressful as boring. I, too, am expected to be conversant with far too
many tedious frameworks and APIs and XML formats and vendor
implementation quirks. But I guess that's why they call it work.
There are numerous reasons why such-and-such a tool, app, lib, or
whatever might be mandated. The typical case is management
misunderstanding of the difference between technical value and corporate
hype. Sometimes it's more like betamax vs VHS; something just
happens to gain traction, and the network effect kicks in. Worse is
better, or worse is worse but too damn bad, or something like that.
But you still have to wonder why mouse poop sandwiches are so common,
and it may be that a given language does not readily lend itself to a
clear expression of subtle ideas, so garish hacks are needed.
People generally make a good-faith effort to solve a problem in a clean
way, but the nature of B&D languages is such that anything out of the
ordinary is considered irresponsible, and so should be hard to do.
It will also motivate others to write a replacement. And if that never
happens, it may be because the language makes it hard to do it; the pain
of using the bad features of given lib or tool is still less than the
pain of trying to devise a better alternative.
Unfortunately, that's a rather naive view of things (and I don't mean
that to say that YOU are naive, only that you have apparently never been
in a situation where you've been forced to "eat someone else's
sandwich"). Many times, especially in our own pet projects, we have
ultimate say over what we use and don't use. There are also times,
however, when we do not have that freedom.
All in all, Ruby gives one plenty of opportunity to write painful code.
This is probably true of any reasonably complete programming language.
Ken Arnold has recently written an article (well, an
op-ed piece), "Style is Substance" [0] wherein he argues that languages
should be so restrictive that code formatting anomalies should be treated
as compiler errors. Really. In his world, writing if(foo) instead of
if (foo) would cause a program to fail. Illegal syntax. (I'm not sure
if he would allow if ( foo ), though.)
I find that intriguing but psychotic. It is double-plus ungood. I
guess I'm one of those who prefer not emulate a machine, one who tends
to think of code as being more like music or painting than an endless
sequence of text existing only to please the compiler gods. But maybe
it's just a personal quirk.
I spent a bit of time trying to create a good but short example of truly
wack Ruby code. Given that you can override core classes and methods,
it is fairly easy to create code that bears only a superficial
resemblance to Ruby, requiring the user to think instead in a new,
Bizarro world mini-language. It requires nothing that doesn't already
exist in Ruby. Yet one does not often see this sort of code in the wild.
Truth is, the cat's out of the bag, the genie is out of the bottle, and
the poop is out of the mouse. As new changes to the mallardability of
Ruby are suggested, the question is not whether we want people to be
able to do odd, weird, convoluted things; they already can. The
question is will the changes enable or encourage odd, weird, convoluted
things that are indeed appropriate for a given task.
A while ago I decided I wanted to be able to code in a message-oriented
style, where one would specify a message, and dispatch it to any and all
objects, at once, without know the specific receivers.
Instead of receiver.message( args ...) it would be
message(args ...)->/some dynamic criteria for target receivers/
So I could, for example, send the 'close' message to all open File
objects, without having to know where they were or what they were called.
I had a hard time scheming up nice syntax for this, and I suspect the
ability to define free-form operators would have been quite handy.
I find that the arguments for allowing such things are more persuasive
than those calling for a more restrictive or conservative approach. I
tend to believe that misuse will simply be lost to the ages because Ruby
makes it easier to just re-write bad code; if any one devises a
super-useful lib that just happens to have an MPS (mouse poop sandwich)
implementation, it will simply get fixed faster then it would in, say
Java or Perl.
"Ruby: MPS-free for over 10 years!"
James
[0]
http://www.artima.com/weblogs/viewpost.jsp?thread=74230