Re: I wish to learn Ruby ,can anyone teach me???



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.

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...

.



Relevant Pages

  • Re: Ruby Online
    ... For dynamic sites, you could write the program in just about any language, though some are not very practical. ... Some libraries are more extensive than others. ... Rails is a web development framework written in Ruby. ... Plone and Django o are Python frameworks. ...
    (comp.lang.ruby)
  • Re: Ruby vs Java vs c++
    ... data modeling--including graphics and data handling via database queries, ... Then they use an OO language for their high-level command-and-control ... That's because Java was invented to take market share from C++, ... Ruby, by contrast, is the ultimate in programmer-friendliness. ...
    (comp.lang.ruby)
  • Re: Ruby vs Java vs c++
    ... data modeling--including graphics and data handling via database queries, ... Then they use an OO language for their high-level command-and-control ... That's because Java was invented to take market share from C++, ... Ruby, by contrast, is the ultimate in programmer-friendliness. ...
    (comp.lang.ruby)
  • Re: Java equivalent of C++ Spirit or Boost Graph Library ?
    ... Chris warns me about the difficulty of learning Java. ... The posters are generally far more familiar with the language, and more accomplished in their fields. ... management techniques in C versus using a standard garbage collector. ... regular-expression libraries or scanners (such as ...
    (comp.lang.java.programmer)
  • Re: Reddit Guys on the Pros and Cons of Lisp
    ... >> I never have to do that with Java. ... > language features, etc. ... They either have the feature or they don't. ... > libraries doing almost the same - for those languages. ...
    (comp.lang.lisp)