

Ruby Is The Future - reyu
http://enfranchisedmind.com/blog/posts/ruby-is-the-future/

======
ankhmoop
The author claims that monkey-patching private methods to expose them publicly
is representative of Ruby's beauty, and specifically:

"... later upgrades to the library don’t need to be re-fixed: the one-time
patch will automatically get re-applied by application code automatically!"

Anyone who fails to realize how monkey-patching can and will break both subtly
and catastrophically across library upgrades has no business advising anyone
regarding language choices.

[Edit] I hate April Fool's Day. Depressingly, the author's satire is so subtly
aligned with common arguments as to so thoroughly fool.

~~~
ansin
Just because it's a satire doesn't mean the title in incorrect. I would argue
that Ruby is, in fact, the future for the same reason that Python is the
future.

As for monkey patching, yes, it's ill-advised in general just as global scope
and gotos are ill-advised for similar reasons. However, monkey patching is a
powerful feature if used responsibly as Chad Fowler has noted ("The Virtues of
Monkey Patching"):

[http://chadfowler.com/index.cgi/Computing/Programming/Ruby/T...](http://chadfowler.com/index.cgi/Computing/Programming/Ruby/TheVirtuesOfMonkeyPatching.rdoc,v)

Now admittedly, not every programmer is as competent or responsible as Chad
Fowler or the programming world would be a very different place but the point
is there's a right way and a wrong way to do it.

Werner Schuster's article on InfoQ ("Ruby's Open Classes - Or: How Not To
Patch Like A Monkey") has more good advice on how to do it the right way:

[http://www.infoq.com/articles/ruby-open-classes-
monkeypatchi...](http://www.infoq.com/articles/ruby-open-classes-
monkeypatching)

~~~
ankhmoop
As noted in Werner Schuster's article, many languages (such as C# or Scala) do
support type-safe, non-ambiguous, non-conflicting extension of existing
classes, demonstrating that extension of existing classes can be safely
implemented and does not require the use of dangerous monkey-patching.

~~~
jshen
dealing with the type system in scala can be a pain and is a hit to
productivity in the early stages. The question is if the hit in the early
stages leads to more productivity in the later stages. I'm not convinced that
it does.

I've done a lot of ruby, and I've had monkey patching bite me a few times.
However, fixing the problem was never that hard (two days max) and is clearly
overshadowed by the productivity gained from the power ruby gave my teams.

~~~
ankhmoop
How can one effectively argue against an entirely subjective judgment of
difficulty in terms of dealing with a type system?

Anecdotally, I find that leveraging functional language programming features
coupled with type inference and polymorphism leads to considerable
productivity gains as code correctness can be ensured through judicious use of
types -- without requiring extensive testing or programmer effort -- while
excess verbosity can be eliminated through the use of FP features such as
type-safe anonymous functions, currying, etc.

~~~
ansin
How do you deal with excess verbosity in C#? I know this is a separate
argument from the monkey patching issue but for me the conciseness and
elegance of the Ruby syntax versus C# is the primary reason to choose Ruby.

~~~
SamReidHughes_
Which version of C# are you thinking of?

In C# 3, the verbosity level is much less than in C# 2, where it's slightly
less than C# 1.

I don't see where Ruby syntax is particularly more concise than C# 3's.

Well, let me clarify "particularly". I don't find myself feeling like I'm
suffering under C#'s syntax, relative to Haskell's. It has about the same
amount of syntactic overhead: writing types for method parameters, and when
defining data structures. Occasionally I have to explicitly write a type
parameter to a function.

~~~
ansin
"I don't see where Ruby syntax is particularly more concise than C# 3's."

1.upto(10).each{|x| print x}

I'm curious - how would you print 1 through 10 in C# 3 by comparison?

~~~
erlanger
I still find this clearer:

    
    
      for x in range(1, 10): print x

~~~
lunchbox
I'm nitpicking, but your range should be range(1,11).

~~~
erlanger
Every nit picked is valuable :)

------
neilo
I'm going to dig through HN archives or wait until tomorrow to read any news.

------
plaes
Just two words: "Hopefully not..."

~~~
ansin
Why? Because of monkey patching, syntax, performance, the community or some
other reason such as you prefer Python or have an intuitive, ineffable and
unexpressable disklike of the language or because Matz is from Japan and they
bombed Pearl Harbor?

~~~
nir
I think (and I mostly code Ruby these days) it's not least because of comments
like this.

~~~
ansin
Out of curiosity, what has your experience been like? Do you have any major
gripes with the language or are you still on a Ruby honeymoon?

~~~
nir
I love Ruby. I love that code can be so short and yet easily readable. It
might be slower and perhaps more memory-hungry than other languages, but for
my needs that's usually not an issue.

What I do miss are good, _well documented_ , stable libraries. For example, I
currently process RSS/Atom feeds with FeedTools, whose own creator says he's
tired of maintaining (I totally understand him and am extremely thankful for
the time he put into it). I assume if there were more people coding Ruby,
there would be a better chance someone would step up and take his place. So,
having a community that is more welcoming to newcomers would eventually
benefit us all.

By "open to newcomers" I don't mean that Ruby-celebs should stop posting
snarky comments at each other in their blogs. This is pretty negilible. I mean
stuff like having better documentation, for example, online, free, in
googleable format (rather than screencasts or print books). IMHO PHP3
annotated online docs back in 1999 were significantly more usable than what
Rails has to offer now.

~~~
ansin
"I mean stuff like having better documentation, for example, online, free, in
googleable format"

Do you mean for the core language? Are you not happy with <http://www.ruby-
doc.org/> ?

~~~
jamesbritt
Plus you can do a custom Google search like this:

    
    
          http://ruby-doc.org/q/<your search string>

~~~
ansin
Best thing I learned today. Thanks.

~~~
jamesbritt
My pleasure.

------
petercooper
martoo on the equivalent Reddit post had the best thing to say about this:

 _"There needs to be a special term for an attempt at an April Fool's Day
Joke, which is in all of its points true and then ends up looking like a joke
made by an author at his own expense."_

[http://www.reddit.com/r/ruby/comments/8966h/ruby_is_the_futu...](http://www.reddit.com/r/ruby/comments/8966h/ruby_is_the_future/)

