I'd strongly disagree with this...
First, let's get the FUD out of the way: Ruby comes with a lot of libraries,
too. What's missing is available on Rubygems, and what's missing from there
is available on Github.
And if there's some Java library you absolutely cannot live without, there's
always JRuby.
Here's the biggest problem I have with Java: Right there, in my first Computer
Science class, was the following chunk of code, a classic "Hello, World":
class Hello {
public static void main(String args) {
System.out.println("Hello, world!")
}
}
And make sure it's in a file called hello.java, or it won't work, with a very
confusing error as to why.
So, to understand this program, you either have to just take it on faith that
you're copying-and-pasting boilerplate code -- which is a REALLY BAD HABIT to
teach a newbie (newbies should have ctrl+c forceably disabled!)
...Or you're learning about classes, methods, method scope, packages, return
values, static/volatile, arguments, arrays, strings, and the compiler, all at
once, all just to understand a "Hello, World".
Now let's try that in Ruby:
puts 'Hello, world!'
Clean and simple. Put the string "Hello, world!" to the screen. Explain what a
string is (a chunk of text), and you're done.
Of course, there's a lot more happening behind the scenes, but you don't have
to know or care until you learn about the more advanced stuff.
Add to that the fact that Ruby ships with irb (an interactive interpreter),
and I would call it the perfect beginner's language. Check out:
http://tryruby.hobix.com/
(I would guess that Firefox is the best bet... There's actually a fully
interactive tutorial in there. Thanks, _why!)
Does Java have anything that compares to the above, as a learning tool?
There's a whole other debate to be had, about Java programming style vs Ruby.
I tend to argue that Java paradigms -- strict typing with Interfaces, lack of
closures, templates, and such -- quite often move beyond simply being
inconvenient, and actually damage your thinking, especially as a first
language.
But then, I have somewhat radical ideas -- I would also argue that threading,
in general, should not be taught before higher-level concepts like Actors
have been mastered. In order to use Actors without having to understand how
threads and locks work, you really need to use Erlang...
···
On Sunday 17 August 2008 01:06:37 Patrick Li wrote:
From my experience, both learning and teaching, Java is a really
suitable beginner language. It's adequately powerful, and extremely
simple, and it comes with enough libraries for you to do a lot of work
in.