[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Should I Learn Ruby as a First Language?

MRH

5/28/2008 12:43:00 PM

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
62 Answers

Tobias Weber

5/28/2008 12:59:00 PM

0

In article
<ab0a1bc3-b23c-48b3-a721-2413e4140d33@j22g2000hsf.googlegroups.com>,
MRH <mauriceroman@gmail.com> wrote:

> however, I believe that it is worth asking here owing to the level of
> expertise present.

That is one way to avoid being sent to Google ;)

> learning programming and my first language.

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

> credible sources recommend either Python or Ruby, and I am personally
> leaning quite heavily toward Ruby, yet I would very much like to read

You'll have to learn more than one language anyway, so why not just
start with one and try the other in 2 weeks time? They're not that hard.

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

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.

(I learned/wrestled PHP just to use an ID3 tag library. A while ago I
ported all my code to ruby and use pipes to communicate with a very
small PHP script wrapping getID3)

--
Tobias Weber

David Masover

5/28/2008 1:04:00 PM

0

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.

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.

Mark Wilden

5/28/2008 1:26:00 PM

0

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.

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

///ark

Dave Bass

5/28/2008 1:39:00 PM

0

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

Elizabeth Barnwell

5/28/2008 3:36:00 PM

0

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

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

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

Best,

Elizabeth

forgottenwizard

5/28/2008 4:33:00 PM

0

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

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.


Mike Kasick

5/28/2008 5:47:00 PM

0

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.

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.

Kyle Schmitt

5/28/2008 6:37:00 PM

0

Since nobody's posted it...
http://xkc...

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 :)

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

Rodrigo Bermejo

5/28/2008 6:55:00 PM

0

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

Mark Wilden

5/28/2008 7:55:00 PM

0

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

> Learn C first.

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

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