Should I Learn Ruby as a First Language?

Hello Group,

I realize this question has been previously asked in different boards,
however, I believe that it is worth asking here owing to the level of
expertise present.

I am a beginner in programming. I have read some fundamental theory
material and mucked around a bit, and now want to move into actually
learning programming and my first language.

Throughout my research into this question, I have seen that the more
credible sources recommend either Python or Ruby, and I am personally
leaning quite heavily toward Ruby, yet I would very much like to read
the thoughts of the group on this question.

Thanking everyone beforehand,

Maurice

Depends what you want to do, and how far you want to go.

For a first language, either Python or Ruby are fine. Python has stricter
syntax, but I suspect Ruby has stricter concepts (of OO, etc). I find Ruby
easier to read, but that's an opinion.

If you want to get a good concept of programming in general, you should learn
(and develop at least some small apps in) a variety of languages -- and a
variety of very different languages.

So, at least one language low-level enough not to do garbage collection (C,
ASM, etc), at least one high-level "scripting" language (Ruby, Python, Perl,
JavaScript), at least one purely functional language (Haskell), and I'll
throw in LISP and either Erlang or Smalltalk.

I'm not sure it matters what order you do this in -- pick whichever has the
best absolute beginner books. I would suggest a tight feedback loop for
learning, though -- look for interactive interpreter shells (Python, IRB),
and avoid compilers (C, C++, Java).

And others will have other lists.

If you don't have that kind of attention span, or if you're looking to learn
what it takes to get stuff done now, that depends very much on what you want
to do. For example, if you're planning to do game development, you're
probably going to have to know C++, and definitely at least C. If you're just
looking to automate some high-level tasks on Unix, learn Bash. And so on.

···

On Wednesday 28 May 2008 07:45:00 MRH wrote:

Throughout my research into this question, I have seen that the more
credible sources recommend either Python or Ruby, and I am personally
leaning quite heavily toward Ruby, yet I would very much like to read
the thoughts of the group on this question.

That is such good advice. Programming and cooking are two areas in which you can both learn and benefit from the result.

///ark

···

On May 28, 2008, at 6:01 AM, Tobias Weber wrote:

But my real advice is to find a problem you really care about, than look
which language has the best library for it, and go with that. You won't
learn anything from example code in books.

MRH wrote:

I am a beginner in programming. I have read some fundamental theory
material and mucked around a bit, and now want to move into actually
learning programming and my first language.

Once upon a time I used to teach C as a first programming language. In
some ways it's good, as it's close to the hardware (bits and bytes,
addresses and pointers etc) but in many other ways this can be a
disadvantage, as you can't see the wood for the trees. However, it
certainly makes you appreciate higher-level languages when you come
across them later on!

Java now seems to be the first language of choice for many universities,
but I would have to disagree with that.

Ruby is much nicer than Java and it will teach you plenty of OO
concepts.

However, there's no such thing as the "best" language, so you should
concentrate on mastering one, then go on to your next.

···

--
Posted via http://www.ruby-forum.com/\.

* MRH, 2008-05-28, 21:45:

I am a beginner in programming. I have read some fundamental theory
material and mucked around a bit, and now want to move into actually
learning programming and my first language.

Which programming language to start with is a question that precisely
has one and only one answer: It depends.

If your primary aim is directly programming hardware it would make
sense to learn C as a first programming language. For other primary
aims Java may be a good choice.

If you are rather a generalist and interested in using a wide range of
programming paradigms and fields of applications Ruby or Python are
good choices.

Consider visiting http://python.about.com/ and http://ruby.about.com/
before deciding which of the two languages to learn. I personally
prefer Ruby for its syntax but other people prefer Python for precisely
the same reason.

Josef 'Jupp' Schugt

···

--
Blog available at http://cip.physik.uni-bonn.de/~jupp/
PGP key with id 6CC6574F available at http://wwwkeys.de.pgp.net/
Jabber - http://www.jabber.org/ - contact information on request

Hi Maurice,

I'm new to this as well. Here's a link to a resource that can maybe
help you find/learn ruby info - (there are a lot of others up there if
you just search) http://www.yoyobrain.com/cardboxes/preview/103

I hope it helps! Let me know what you think about it too.

Best,

Elizabeth

···

On May 28, 7:43 am, MRH <mauricero...@gmail.com> wrote:

Hello Group,

I realize this question has been previously asked in different boards,
however, I believe that it is worth asking here owing to the level of
expertise present.

I am a beginner in programming. I have read some fundamental theory
material and mucked around a bit, and now want to move into actually
learning programming and my first language.

Throughout my research into this question, I have seen that the more
credible sources recommend either Python or Ruby, and I am personally
leaning quite heavily toward Ruby, yet I would very much like to read
the thoughts of the group on this question.

Thanking everyone beforehand,

Maurice

I usually lump beginner programmers into one of two categories, (i) those
who want to become expert programmers for purposes of education,
profession, or hobby, and (ii) those who are interested in learning how to
program sufficiently enough to make work in their primary careers easier,
but don't necessarilly have a specific interest in programming itself.

If you're of the former category, I would say it doesn't really matter what
lanaguage you learn first since you will inevitably learn multiple
languages anyways. Remember that a master programmer is not someone who
expertly understands the minutiae of any single language, but rather is
someone who is proficient in many languages. This is largely due to the
fact that all programming languages seek to achieve that same high-level
goal--enable programmers to use a machine to perform computation--and yet
each language achieves this goal in a different and nuanced way. It's
the understanding of these nuances, and why they exist, that paints the
overall picture.

That said, there are a lot of languages out there that are complicated or
even cumbersome because they attempt to be sufficiently general as to allow
any "style" of programming without enforcing too strict of rules as to what
code should look like. Perhaps the best example of this phenomenon is C++,
and to a lesser extent Perl. I express caution in learning these languages
as first languages, since, as a novice programmer you don't really have an
intuition for what code should look like, and the language doesn't really
help guide you in learning either.

Ruby is guilty of a similar phenomenon which, in this context, goes by the
name of "expressiveness". While Ruby is certainly my favorite language, I
know that part of my appreciation for this expressiveness comes from over a
decade of experience in other languages and being able to place Ruby in
the context of this experience.

In other words, I'm not really sure if Ruby is the best, or even a good
language for beginners because I'm not sure how difficult it is to learn
without the benefit of experience. On the other hand, plenty of people
have learned Ruby as their first language and have gone on to recommend it
to others, so it's certainly possible, and probably not a bad choice
either.

That said, keep in mind that Ruby is a bit unique compared to other popular
languages. For example, the idiom of using internal iterators and blocks
as looping constructions (e.g., Enumerable#each) is unlike the usual
approach of using a for loop and/or external iterator as you would use in
C, C++, Java, or Python. While I think Ruby's approach is better, it is
not the norm in other languages. Another example is Ruby's idiom of
automatic allocation and deallocation of resources by passing them to code
blocks (e.g., File#open). In other languages, one typically has to
explicitly deallocate the resource (close the file) and the code for
writing this safely is not intuitive.

This brings up another advantage/disadvantage of learning Ruby first: code
safetyness. One example of this is the resource allocation/deallocation
idiom I mentioned above that ensures that resources are always properly
cleaned up when the program is finished with their use. Another is that
most methods raise an exception upon encountering an error, forcing a
program to abort is an unexpected error happens.

Exceptions are good, and they're prominent in other languages (Java and
Python) and behave, more or less in the same way. Unfortunately some
popular languages implement exceptions (C++ and Perl) but don't use them
universally in library functions, and other languages (C) don't implement
them at all. In these languages, you must (or at least should) check
return values of any function you call to make sure that the desired action
performed successfully. Often times people forget to do this, and the
result is code that continues on ignoring error conditions, usually blowing
up somewhere else where it's difficult to debug.

So, while I regard these features as advantages of Ruby, they are, in some
sense a disadvantage when you attempt to learn a different language that
doesn't take care of these issues for you, as you must be diligent in
taking care of them yourself and it's not something you're used to.

Anyways, the crux of my advice is this: Any language that you're
enthralled by, and can't get enough of, is a good (first) language to
learn. On the other hand, any language that you find bewildering,
confusing, or just plain unfun to learn is probably not a good first
language candidate. If you find youself becoming disinterested after
spending a week or two learning whatever language you choose, skip it and
move on to something else. It may take a while to find the language that
fits, but trial and error is better than giving up on programming
entirely--especially when the language that clicks with you is right around
the corner.

Briefly getting back to the other category of beginner programmers, those
that are not particularly interested in programming itself but recognize
that some proficiency is beneficial for getting their work done--if you're
only going to learn one language and you're not sure which, both Python and
Ruby are reasonable choices. The argument is that since you're only going
to learn one language, you might as well learn one that's useful enough to
enable you to accomplish a wide variety of tasks, and one that's popular
enough that there are many libraries, tutorials, and resources available
for helping you get the job done. Python might be a bit superior with
regard to popularity, at least in the English speaking community. At one
time Perl was much more so, but I wouldn't consider any beneift in greater
popularity of Perl to be worth the pain of having to deal with it's
obtuseness.

···

On Wed, May 28, 2008 at 09:45:00PM +0900, MRH wrote:

Throughout my research into this question, I have seen that the more
credible sources recommend either Python or Ruby, and I am personally
leaning quite heavily toward Ruby, yet I would very much like to read the
thoughts of the group on this question.

Tobias:

Thank you for your reply.

I learned by doing, in perl, and think it worked well

I agree, and plan on using that approach.

You'll have to learn more than one language anyway

Quite true, and I plan on a few . . . I am just debating which one to
try first . . .

Educationally Python might make more sense since it has less syntax (no
blocks)

I will keep that in mind.

But my real advice is to find a problem you really care about, than look
which language has the best library for it, and go with that. You won't
learn anything from example code in books.

Had also planned on this.

Cheers,

Maurice

That type of thing pops up pretty often on this group.

In engineering, you _need_ to know the fundamentals. With Ruby, it is
somewhat of a gray area. With Rails, you risk giving something to
somebody that is powerful with the side effect of gun-in-baby's-hands
syndrome.

Many questions float to this list about Rails where it becomes really
clear to rubyists that the person has no idea about how to use the
underlying language. This is probably common with other DSL's as well.
And the C guys probably say the same thing about rubyists.

So, where do you start? I'd say skim through the K&R C book,
read/scan through a couple of design oriented books, and then tackle
Ruby/Python/Perl/whatever with an open mind (meaning, awareness of
different programming paradigms -- hanging out in the book store is
not only pragmatic, but also allows you to ogle your
competition/pretty girls or guys/whatever :slight_smile:

Programming is not entirely Knuth anymore. Although, you could learn
a lot from the guy. On a similar note, a person should avoid trying
to turn Ruby into C or Python like 7stud and some others like to.

Todd

···

On Wed, May 28, 2008 at 7:45 AM, MRH <mauriceroman@gmail.com> wrote:

Hello Group,

I realize this question has been previously asked in different boards,
however, I believe that it is worth asking here owing to the level of
expertise present.

Hello everyone,

Very well, this discussion has played out so to speak, thus I have
decided to submit this last post, so as to thank everyone who
participated - I appreciate it quite a bit, and find the generous and
helpful attitude of every single poster to be very encouraging as it
bodes well for future interaction with Rubyists.

I also want to let everyone know that I have decided to become
acquainted with some of the lower level fundamentals first, not
necessarily learn Assembler and/or C, but work my way through the
concepts . . . I have picked up a copy of Programming From The Ground
Up . . . after that, I will - indeed - teach myself the Ruby
Programming Language as a first language!

Regards and Happy Hacking to All,

Maurice

Actually, TinyCC has a C interpreter that you can use to test code, so
there isn't much need to compile when you are using it.

I believe there is a Windows and a *nix version, so there shouldn't be a
problem with platforms.

···

On 22:04 Wed 28 May , David Masover wrote:

I'm not sure it matters what order you do this in -- pick whichever has the
best absolute beginner books. I would suggest a tight feedback loop for
learning, though -- look for interactive interpreter shells (Python, IRB),
and avoid compilers (C, C++, Java).

Since nobody's posted it...

Ruby is an awesome language, highly abstracted from the hardware,
incredibly flexible and fluid, and probably not a good first language
just for those reasons alone.

Learn C first.

To really get programming, to understand what's going on, you need to
go deep. All the way down to C (though some say assembler).

C is the lingua franca of computers. It doesn't make things easy for
you, it doesn't make things pretty, or necessarily intuitive, but it
does bring you right down to the metal in the end.

It isn't flexible, when you have to tell it to do something, you have
to tell it exactly what to do, And C will do it, even if it's not a
good idea, even if it crashes.
You grab your own memory, and are responsible for putting it back.
You make and move pointers to access the memory: if you point to the
wrong place, you'll get the wrong data, corrupt your own program, and
probably crash it.
You've got to link your own binaries, and link them to the right libraries.

And doing all that makes you a better programmer, makes you understand
what really is going on behind the scenes. Not to mention makes you
appreciate languages like ruby, perl, python and java so much more
when you get to them :slight_smile:

I don't think you necessarily should program your first projects in C,
but you should learn C as a first language, even if you don't use it
for your first projects. Even if you never use it outside of studying
it.

--Kyle

Mike Kasick wrote:

···

On Wed, May 28, 2008 at 09:45:00PM +0900, MRH wrote:

I usually lump beginner programmers into one of two categories, (i)
those
who want to become expert programmers for purposes of education,
profession, or hobby, and (ii) those who are interested in learning how
to
program sufficiently enough to make work in their primary careers
easier,
but don't necessarilly have a specific interest in programming itself.

If you're of the former category, I would say it doesn't really matter
what
lanaguage you learn first since you will inevitably learn multiple
languages anyways. Remember that a master programmer is not someone who
expertly understands the minutiae of any single language, but rather is
someone who is proficient in many languages. This is largely due to the
fact that all programming languages seek to achieve that same high-level
goal--enable programmers to use a machine to perform computation--and
yet
time Perl was much more so, but I wouldn't consider any beneift in
greater
popularity of Perl to be worth the pain of having to deal with it's
obtuseness.

Excellent answer !
Aplausos !!
--
Posted via http://www.ruby-forum.com/\.

Hi David,

Thank you for your post.

Depends what you want to do, and how far you want to go.

I want to program for myself, for clients, and contribute to FOSS
projects, and take it all as far as I can.

For a first language, either Python or Ruby are fine. Python has stricter
syntax, but I suspect Ruby has stricter concepts (of OO, etc). I find Ruby
easier to read, but that's an opinion.

Will keep this in mind.

If you want to get a good concept of programming in general, you should learn
(and develop at least some small apps in) a variety of languages -- and a
variety of very different languages.

I agree . . . part of my research into the fundamentals has led me to
decide to, as part of stage 2 - if you will - work my way through the
(and I hope I don't sound like online bookstore spam with this)
"Concepts, Techniques, and Models of Computer Programming" book . . .

So, at least one language low-level enough not to do garbage collection (C,
ASM, etc), at least one high-level "scripting" language (Ruby, Python, Perl,
JavaScript), at least one purely functional language (Haskell), and I'll
throw in LISP and either Erlang or Smalltalk.

Ah, this resonates with some of my preliminary conclusions . . .

I'm not sure it matters what order you do this in -- pick whichever has the
best absolute beginner books.

I think that for me personally, the best approach is to go from higher
level to lower level, and yes, one of the reasons I have been torn
between Python and Ruby was that Python has (from what I have read)
great beginner books, yet Ruby does as well . . .

I would suggest a tight feedback loop for
learning, though -- look for interactive interpreter shells (Python, IRB),
and avoid compilers (C, C++, Java).

Will do.

If you don't have that kind of attention span, or if you're looking to learn
what it takes to get stuff done now, that depends very much on what you want
to do. For example, if you're planning to do game development, you're
probably going to have to know C++, and definitely at least C. If you're just
looking to automate some high-level tasks on Unix, learn Bash. And so on.

I hear you, I am mostly interested in web applications, yet also want
to explore desktop applications for Mac OS X . . . and the more I read
about Lisp, the more interesting it becomes . . .

Cheers,

Maurice

That is such good advice. Programming and cooking are two areas in
which you can both learn and benefit from the result.

I actually cook a bit :slight_smile:

Dave,

Thank you for your post.

Once upon a time I used to teach C as a first programming language. In
some ways it's good, as it's close to the hardware (bits and bytes,
addresses and pointers etc) but in many other ways this can be a
disadvantage, as you can't see the wood for the trees. However, it
certainly makes you appreciate higher-level languages when you come
across them later on!

I see.

Java now seems to be the first language of choice for many universities,
but I would have to disagree with that.

Me too, that is a conclusion I reached after reading the internal SUN
memos that talked about the problems in Java/JVM . . .

Ruby is much nicer than Java and it will teach you plenty of OO
concepts.

Great to know this. I just recently learned that all languages do not
handle OOP the same way. I find it interesting that Ruby, according to
what I have read, features the possibility of using several paradigms
in addition to OO.

However, there's no such thing as the "best" language, so you should
concentrate on mastering one, then go on to your next.

I will keep that in mind.

Best,

Maurice

I'm new to this as well. Here's a link to a resource that can maybe
help you find/learn ruby info - (there are a lot of others up there if
you just search)http://www.yoyobrain.com/cardboxes/preview/103

I hope it helps! Let me know what you think about it too.

Best,

Elizabeth

Hi Elizabeth,

Thank you for the link! That is pretty interesting, and I believe it
will be very useful.

Regards,

Maurice

Hi Mike,

Thank you for this post.

I usually lump beginner programmers into one of two categories, (i) those
who want to become expert programmers for purposes of education,
profession, or hobby, and (ii) those who are interested in learning how to
program sufficiently enough to make work in their primary careers easier,
but don't necessarilly have a specific interest in programming itself.

I am a category (i) :wink:

If you're of the former category, I would say it doesn't really matter what
lanaguage you learn first since you will inevitably learn multiple
languages anyways.

Yes, please see prior post. :slight_smile:

Remember that a master programmer is not someone who
expertly understands the minutiae of any single language, but rather is
someone who is proficient in many languages.

A-ha! I had assumed the contrary - this is great to know, and it makes
sense.

That said, there are a lot of languages out there that are complicated or
even cumbersome because they attempt to be sufficiently general as to allow
any "style" of programming without enforcing too strict of rules as to what
code should look like. Perhaps the best example of this phenomenon is C++,
and to a lesser extent Perl. I express caution in learning these languages
as first languages, since, as a novice programmer you don't really have an
intuition for what code should look like, and the language doesn't really
help guide you in learning either.

I see

Ruby is guilty of a similar phenomenon which, in this context, goes by the
name of "expressiveness". While Ruby is certainly my favorite language, I
know that part of my appreciation for this expressiveness comes from over a
decade of experience in other languages and being able to place Ruby in
the context of this experience.

In other words, I'm not really sure if Ruby is the best, or even a good
language for beginners because I'm not sure how difficult it is to learn
without the benefit of experience. On the other hand, plenty of people
have learned Ruby as their first language and have gone on to recommend it
to others, so it's certainly possible, and probably not a bad choice
either.

I will consider this.

That said, keep in mind that Ruby is a bit unique compared to other popular
languages. For example, the idiom of using internal iterators and blocks
as looping constructions (e.g., Enumerable#each) is unlike the usual
approach of using a for loop and/or external iterator as you would use in
C, C++, Java, or Python. While I think Ruby's approach is better, it is
not the norm in other languages. Another example is Ruby's idiom of
automatic allocation and deallocation of resources by passing them to code
blocks (e.g., File#open). In other languages, one typically has to
explicitly deallocate the resource (close the file) and the code for
writing this safely is not intuitive.

I get the gist of what you are saying. Will remember.

This brings up another advantage/disadvantage of learning Ruby first: code
safetyness. One example of this is the resource allocation/deallocation
idiom I mentioned above that ensures that resources are always properly
cleaned up when the program is finished with their use. Another is that
most methods raise an exception upon encountering an error, forcing a
program to abort is an unexpected error happens.

Exceptions are good, and they're prominent in other languages (Java and
Python) and behave, more or less in the same way. Unfortunately some
popular languages implement exceptions (C++ and Perl) but don't use them
universally in library functions, and other languages (C) don't implement
them at all. In these languages, you must (or at least should) check
return values of any function you call to make sure that the desired action
performed successfully. Often times people forget to do this, and the
result is code that continues on ignoring error conditions, usually blowing
up somewhere else where it's difficult to debug.

So, while I regard these features as advantages of Ruby, they are, in some
sense a disadvantage when you attempt to learn a different language that
doesn't take care of these issues for you, as you must be diligent in
taking care of them yourself and it's not something you're used to.

This resonates with my earlier research as well. Will also remember
this.

Anyways, the crux of my advice is this: Any language that you're
enthralled by, and can't get enough of, is a good (first) language to
learn. On the other hand, any language that you find bewildering,
confusing, or just plain unfun to learn is probably not a good first
language candidate. If you find youself becoming disinterested after
spending a week or two learning whatever language you choose, skip it and
move on to something else. It may take a while to find the language that
fits, but trial and error is better than giving up on programming
entirely--especially when the language that clicks with you is right around
the corner.

Will do.

Regards,

Maurice

Todd,

Thank you for your reply.

That type of thing pops up pretty often on this group.

In engineering, you _need_ to know the fundamentals. With Ruby, it is
somewhat of a gray area. With Rails, you risk giving something to
somebody that is powerful with the side effect of gun-in-baby's-hands
syndrome.

I know what you mean (and what others mean who have voiced analogous
conclusions) I used to translate legal documents professionally, and
was often horrified by translations created using translation software
by people who - even though they were bilingual - had no knowledge of
the underlying principles and subject. It is one of the reasons I left
that market: since those folks would do it for peanuts, companies
began to send me that stuff expecting me to "just clean it up" for 1/3
the going rate since "well, it is more than halfway done" (when in
actuality it takes 200% more work to clean up a mess than to start
from scratch and do it right the first time) . . .

So, where do you start? I'd say skim through the K&R C book,
read/scan through a couple of design oriented books, and then tackle
Ruby/Python/Perl/whatever with an open mind (meaning, awareness of
different programming paradigms -- hanging out in the book store is
not only pragmatic, but also allows you to ogle your
competition/pretty girls or guys/whatever :slight_smile:

I will keep this approach in mind, it strikes me as very pragmatic and
balanced, I had considered something similar but figured I was wrong
by not knowing enough to reach an accurate conclusion in the first
place. Oh, and btw, it's girls I ogle :wink:

Programming is not entirely Knuth anymore. Although, you could learn
a lot from the guy. On a similar note, a person should avoid trying
to turn Ruby into C or Python like 7stud and some others like to.

Will keep in mind . . .

Cheers,

Maurice

As someone who learned UCSD Pascal first, and then went on to assembler, then C, I disagree. :slight_smile:

You don't have to be able to overhaul an engine to ride on a train. You should always take the easiest way that fulfills your goals.

I was a Classical Studies major at university. People would always say, "Oh, I wish I'd learned Latin!" Idiots. :slight_smile: Yeah, learning Latin will help you learn French, etc. But if you want to learn French, you should just learn French.

We only have a limited amount of time in our lives. Any time spent learning a bad language like C is time we can't spent learning something else - like how to write maintainable, well-tested code.

Taken to its logical extreme, you should really know how to design digital circuits before you jump into C. Would it make you a better Ruby programmer? Absolutely! What would make you an even better Ruby programmer, however, is learning Smalltalk or Scheme or TDD or Rails. Limited time means you can't learn everything. Make sure what you learn is actually useful.

Learning C means not learning something else.

///ark

···

On May 28, 2008, at 11:36 AM, Kyle Schmitt wrote:

Learn C first.