Why should I learn ruby?

I have wondered whether I should learn ruby or python hence they are
both pretty common languages and both look pretty much alike except for
some differences like blocks and how the structure of ruby is.

So what arguments are there for learning ruby? :slight_smile:

Thanks

Hi,

I was faced with the same decision a few years ago. The reason I chose
Ruby over Python was that I found it just a bit more mature and elegant.
For example, object orientation in Ruby is very consistent and clear:
Every value is an object, almost everything is done using methods. In
Python, it seems rather bolted on (no implicit “self”, heavy use of
global functions). I also don’t like the concept of significant
whitespace at all, since it makes the syntax rather “fragile” in my
opinion. I do appreciate well formatted code, but I don’t want to
struggle with spaces and tabs just because the interpreter forces me to.

On Tue, Jun 12, 2012 at 02:17:49AM +0900, Kasper S. wrote:

I have wondered whether I should learn ruby or python hence they are
both pretty common languages and both look pretty much alike except for
some differences like blocks and how the structure of ruby is.

So what arguments are there for learning ruby? :slight_smile:

It’s largely a matter of taste, though I know some Pythonistas who would
disagree and start saying bad things about Ruby. This leads to the
first
of a few matters of taste that apply in my case:

  1. I like the Ruby community more.

  2. I find that Python is unnecessarily confining in terms of what it
    allows the programmer to do. I feel like Ruby sets me free to achieve
    what I want, the way I want to achieve it.

  3. As of version 1.9.3, I like Ruby’s license terms more (dual-licensed
    under the Ruby License and a BSD License, the latter of which is quite a
    nice little license).

  4. The books on the market for Ruby are, in my opinion, generally more
    enjoyable and useful for advancing my skills as a Rubyist.

  5. Python’s syntax kinda annoys the crap out of me, but maybe that’s
    just
    me. One case in particular is the way Python defaults to a style that
    leaves blocks of code looking unfinished to me, in large part because
    multi-expression or multi-statement blocks have no ending delimiter.

Your mileage may vary.

Thanks everyone :slight_smile:

I began learning ruby a week ago and I seem to enjoy it and I want to
continue using ruby and not python :slight_smile:

On 06/11/2012 10:47 PM, Kasper S. wrote:

I have wondered whether I should learn ruby or python hence they are
both pretty common languages and both look pretty much alike except for
some differences like blocks and how the structure of ruby is.

So what arguments are there for learning ruby? :slight_smile:

Thanks

checkout the link. i hope it helps :slight_smile: .

http://myloveruby.herokuapp.com/

Chad P. wrote in post #1064088:

  1. The books on the market for Ruby are, in my opinion, generally more
    enjoyable and useful for advancing my skills as a Rubyist.

Although on the flip side, Python’s official web documentation is 100
times better than Ruby’s. All the semantics are documented, every single
change to the language is documented.

My other pet peeve with ruby is the ludicrous way that Strings are
handled in 1.9. Python 3’s approach is clear, precisely defined, and
symmetrical.

  1. Python’s syntax kinda annoys the crap out of me, but maybe that’s
    just
    me. One case in particular is the way Python defaults to a style that
    leaves blocks of code looking unfinished to me, in large part because
    multi-expression or multi-statement blocks have no ending delimiter.

I can live with that, especially after having used HAML.

What I find annoying about Python is that methods are function values,
and you have to remember to use () to call them. But this means you have
to know whether an attribute is a direct value, or is an accessor method
which returns the value you want.

e.g. is it str.len or str.len() ?

Answer: neither, it’s len(str). But that’s actually a shortcut for
str.len()

That would be simple enough, except that some objects can have
‘properties’ which you access as if they were values, but are actually
calling methods under the surface:

import random

class Foo(object):
def __random(self):
return random.random()
x = property(__random)

a = Foo()
print a.x
print a.x

So there’s no consistency. With Ruby everything on an object is a
method, and it’s called automatically whether you use () or not.
Instance variables are hidden.

Kasper S. wrote in post #1064079:

I have wondered whether I should learn ruby or python hence they are
both pretty common languages and both look pretty much alike except for
some differences like blocks and how the structure of ruby is.

So what arguments are there for learning ruby? :slight_smile:

Thanks

Hi,

I think if you just want to learn a scripting language, Ruby is nice.
However, if you are more toward “scientific computing”, I think Python
has better libraries. Also, if you are more toward web, I think you
should also consider JavaScript.

Regards,

Bill

On Mon, Jun 11, 2012 at 12:17 PM, Kasper S.
[email protected]wrote:

For someone with no programming experience, I would recommend learning
JavaScript. It doesn’t have much to offer, except it is ubiquitous and
will
allow you to quickly start playing with things that you can see tangible
results. For Ruby or Python, it will take quite a bit longer before you
have anything beyond mind castles.

Of course, if you’re satisfied with mind castles, then I’d choose Ruby.
Mostly because I can’t think of anything that Python has to offer except
simplicity for beginners. But Ruby is so much more expressive and
powerful
because of its syntax and support for many different paradigms, each
with
their own strengths(disclaimer: my python experience is quite limited).
Python might make a better language for a total beginner, though,
because
it is considerably simpler than Ruby since it tries to have only one
obviously correct way to solve a problem, whereas Ruby gives you lots of
tools to choose the best solution for the problem.

Also, don’t neglect that there are many viable languages to choose from,
depending on your criteria. And, of course, you’re asking this on a Ruby
forum, so obviously these answers will have a certain bias that you
should
consider mitigating by querying enthusiasts of alternative languages.

-Josh

On Wed, Jun 13, 2012 at 12:18:32PM +0900, Josh C. wrote:

For someone with no programming experience, I would recommend learning
JavaScript. It doesn’t have much to offer, except it is ubiquitous and will
allow you to quickly start playing with things that you can see tangible
results. For Ruby or Python, it will take quite a bit longer before you
have anything beyond mind castles.

I disagree. The languages I have had the best luck picking up quickly
were those that were best suited to creating command line utilities that
automate common tasks. With some basic understanding of array handling,
regular expressions, command line argument parsing, and file reading and
writing, whole worlds of such automation possibilities open up.

Admin T. wrote in post #1064432:

Isn’t that array handling, regular expressions, command line argument
parsing, and file reading and writing also covered in JavaScript and in
scripting languages in general?

Well, standard JavaScript only runs in the browser and doesn’t have
access to the file system or the command line. You’d have to use
something like Node.js (server side JavaScript).

This is also the reason why I don’t find JavaScript a good choice for
learning: It doesn’t run on its own, it’s limited to editing HTML, and
it requires some previous knowledge.

Chad P. wrote in post #1064324:

I disagree. The languages I have had the best luck picking up quickly
were those that were best suited to creating command line utilities that
automate common tasks. With some basic understanding of array handling,
regular expressions, command line argument parsing, and file reading and
writing, whole worlds of such automation possibilities open up.

Hi,

Isn’t that array handling, regular expressions, command line argument
parsing, and file reading and writing also covered in JavaScript and in
scripting languages in general?

Regards,

Bill

Paul Sutton wrote in post #1064451:

On Thu, 2012-06-14 at 00:38 +0900, Jan E. wrote:

learning: It doesn’t run on its own, it’s limited to editing HTML, and
it requires some previous knowledge.

I agree. JavaScript is not a great learning language because the runtime
enviroment (i.e. the browser, usually) makes error handling, debugging
and experimentation difficult. When you are starting you are going to
make a bunch of errors in the code and syntax, and will want to play
with how things work. In the browser you don’t see errors (normally),
and it is painful to do things like inspect what is happening (alert
boxes everywhere?).

Hi,

With Ruby, you have to install it in the system. With JavaScript, it is
available automatically on most browsers. If you need access to the
file system or the command line, you can install JSDB (or Node.js as has
been pointed out), but it is the same effort as installing Ruby, isn’t
it?

Regarding the runtime environment, have you tried Google Apps Scripts?
It is server-side JavaScript and it has some (maybe not the greatest)
debugger. At least one great thing about it is you can run it anywhere
where there is an Internet connection and a (appropriate) browser; no
installation is needed.

Regards,

Bill

On Thu, 2012-06-14 at 00:38 +0900, Jan E. wrote:

learning: It doesn’t run on its own, it’s limited to editing HTML, and
it requires some previous knowledge.

I agree. JavaScript is not a great learning language because the runtime
enviroment (i.e. the browser, usually) makes error handling, debugging
and experimentation difficult. When you are starting you are going to
make a bunch of errors in the code and syntax, and will want to play
with how things work. In the browser you don’t see errors (normally),
and it is painful to do things like inspect what is happening (alert
boxes everywhere?).

With Ruby (and other command-line languages) you’ll get meaningful
errors, you can debug and single step your code easily, you can throw in
some pp or puts statements as needed, and you get the super-useful irb
to be able to play with statements and inspect the state of the
environment.

If you do learn using JavaScript, get a good browser debugger such as
Firebug.

-Paul

So what arguments are there for learning ruby? :slight_smile:

matz.

On Sat, 16 Jun 2012, Marc H. wrote:

So what arguments are there for learning ruby? :slight_smile:

matz.

Yeah, but he does all his programming in C…

– Matt
It’s not what I know that counts.
It’s what I can remember in time to use.

On Mon, Jun 11, 2012 at 1:17 PM, Kasper S. [email protected]
wrote:

I taught myself the basics with Ruby before I started college. For me
one of the best things about Ruby is the way in which concepts that
might be considered more advanced in other languages are run of the
mill in Ruby. More specifically Ruby’s collection handling mechanisms
and the way that blocks work make the concepts very easy to grasp.
Ruby makes working with collections in a non-imperative fashion very
easy without having to go into some Lisp dialect which while
fascinating is very weird, especially when coming from most other C
derivative languages. I have been very pleased with “Programming Ruby”
the explanations are generally very clear and easy to understand even
if you are just starting out programming.

I’ve also found that the concepts presented right up front in Ruby
have applications with languages like C# as C# takes on more and more
functionality that Ruby has already built in to it.