Ruby as First Language

Hi! I’m interested in getting opinions on Ruby as a first language. For
example, how it compares to python/perl/basic/etc as a first language.
My goals are to learn the basics of a language, then delve into network
programming, and then learn how to interact with the operating system
programaticallly. Will Ruby help me achieve this goal? Will Ruby enable
me to transition to other languages (ex., C/Assembly/etc)? Thanks in
advance!

WY

Hi –

On Thu, 23 Feb 2006, woodyee wrote:

Hi! I’m interested in getting opinions on Ruby as a first language. For
example, how it compares to python/perl/basic/etc as a first language.
My goals are to learn the basics of a language, then delve into network
programming, and then learn how to interact with the operating system
programaticallly. Will Ruby help me achieve this goal?

Yes, and then some.

Will Ruby enable me to transition to other languages (ex.,
C/Assembly/etc)? Thanks in advance!

It won’t cause you to know those other languages of course, but it
will enable you to learn them in the sense that it won’t stop you :slight_smile:
And C actually connects up naturally with Ruby, since Ruby is written
in C and you can write C extensions for Ruby.

Have you seen this book?

http://www.pragmaticprogrammer.com/titles/fr_ltp/index.html

David


David A. Black ([email protected])
Ruby Power and Light (http://www.rubypowerandlight.com)

“Ruby for Rails” chapters now available
from Manning Early Access Program! Ruby for Rails

woodyee wrote:

Hi! I’m interested in getting opinions on Ruby as a first language.
For example, how it compares to python/perl/basic/etc as a first
language. My goals are to learn the basics of a language, then delve
into network programming, and then learn how to interact with the
operating system programaticallly. Will Ruby help me achieve this
goal? Will Ruby enable me to transition to other languages (ex.,
C/Assembly/etc)? Thanks in advance!

Ruby vs. Perl: much cleaner syntax and less typing.

Ruby vs. Basic: although there might be Basic dialects around that have
evolved from the ridiculous line number + GOTO I’d rather not consider
it.

Ruby vs. Python: can’t comment on that.

Ruby takes away a lot of the nifty details that you would have to deal
with in C or C++ (memory management etc.) or Perl (how many $'s do I
need
here?). OTOH there is no direct access to system libs (as from C for
example). For that you would have to write a C extension. Still, I
think
to initially learn to develop software Ruby is a pretty good choice.

Kind regards

robert

Robert K. wrote:

OTOH there is no direct access to system libs (as from C for
example). For that you would have to write a C extension. Still, I think
to initially learn to develop software Ruby is a pretty good choice.

Just to knock down your only negative point a little, Robert, there is
DL,
which makes accessing C libraries about equal in pain to doing it in C,
no?

Me, I’m all for learning Ruby as a first language. My first language was
Basic, and I do reckon that it probably doesn’t matter too much what you
pick, but an important factor is being able to actually produce
something
cool/fun/useful as you go. (Games, for instance.) Learning a second
language
will be significantly easier after you’ve learnt one already, almost
regardless of the language.

Ruby’s productive, flexible, and crosses paradigms other languages are
built
around. Perhaps it’s less simple than, say, Java or Basic, but I think
it
more than makes up for it in the
being-able-to-get-something-done-quickly-and-easily department. The
paradigm-crossingness of it may mean it’s easier to pick up a wider
range of
languages after you’ve mastered Ruby; it’s a bit like Lisp, a bit like
Basic, a bit like Java.

Choose Ruby.

Cheers,
Dave

Hi Woodyee, how important is this information according to your
profession?

If you’re doing this for yourself, Ruby will be a great language to
learn and use.

But if you are doing this to revise your position in the job market,
none of the languages you listed will give you much advantage: it’s
Java and/or C# to be obligatory these days in any curriculum.

I am certain that Ruby will grow a lot in the next years and things
will change, but if you have to decide today, and it is for your job,
Ruby is still too weak.

Gianfranco

On Thu, 2006-02-23 at 23:14 +0900, [email protected] wrote:

Have you seen this book?

http://www.pragmaticprogrammer.com/titles/fr_ltp/index.html

I wish I had that book when I first started programming. That book
changed my way of thinking about code more than any other book! Be
warned…If you learn ruby first then you’ll hate the syntax of just
about every other language!

Charlie B.
recentrambles.com

Gene T. wrote:

Perl has gotten a bad rap, well-written perl is pretty easy to follow.
Also perl’s kind of hard to avoid, in certain circles, lots of times i
start somethign by reading CPAN modules, lots of OReilly books have
sample code in perl, etc. so at least being able to read perl code is
helpful

Yes, but this thread is about “first language”. I don’t know how Perl’s
OO has changed since Perl 5 but then it was horrible. Certainly nothing
I’d recommend for learning OO - I’d definitely choose even C++ and of
course Java / C# over Perl for OO.

Kind regards

robert

Robert K. wrote:

woodyee wrote:

Ruby vs. Perl: much cleaner syntax and less typing.

Ruby vs. Python: can’t comment on that.

Perl has gotten a bad rap, well-written perl is pretty easy to follow.
Also perl’s kind of hard to avoid, in certain circles, lots of times i
start somethign by reading CPAN modules, lots of OReilly books have
sample code in perl, etc. so at least being able to read perl code is
helpful

python:
http://mail.python.org/pipermail/python-list/2005-October/305692.html

ruby has a couple really nice IDEs, komodo and Arachno, which make
learning as painless as possible, popping up method names for you to
click on when the IDE can determine what object instance you’re talking
about. (Wing IDE for python is also really nice).

Dave B. wrote:

Robert K. wrote:

OTOH there is no direct access to system libs (as from C for
example). For that you would have to write a C extension. Still, I
think to initially learn to develop software Ruby is a pretty good
choice.

Just to knock down your only negative point a little, Robert, there
is DL, which makes accessing C libraries about equal in pain to doing
it in C, no?

I forgot that. Yeah, with DL it seems reasonably easy. Good point!

Me, I’m all for learning Ruby as a first language. My first language
was Basic, and I do reckon that it probably doesn’t matter too much
what you pick, but an important factor is being able to actually
produce something cool/fun/useful as you go. (Games, for instance.)

I wouldn’t go that far. For example, at the time I was using BASIC
there
were no functions and you had to work with GOSUB and GOTO for
modularization; for me this is a major drawback. I rather recommend to
use PASCAL (no kidding) over ancient BASIC’s. I know current BASIC
dialects are much better - but then again, there are so many of them…

Learning a second language will be significantly easier after you’ve
learnt one already, almost regardless of the language.

I’m not sure; it certainly helps, but I guess the paradigmatic distance
™ of the second language makes a difference. I guess it’s easier to
go
from C++ to SmallTalk (both OO) than from Lisp to BASIC…

Choose Ruby.

Definitively! :slight_smile:

robert

But more importantly, should Ruby be a first language taught, period?
I tend to think no.

C allows you to have a base understanding of all the technical aspects
of programming, like memory management, procedural thought, and the
basics of writing methods. These are generally good skills to have,
and you’ll find that you use them everywhere. C is a lot like latin,
insofar that it’s not changing much, and is used to communicate ideas.
I also think it’s a little more “native” to initial human understanding
about programming. People tend to think of it as a linear, or
semi-cyclical set of instructions. In that regard, I think C is a good
way to enter the scene.

The thought process overhead in object oriented programming is quite
extensive. It takes a long time to really get in the mode. If you
learn somethings about C, and get a basic grasp before moving on to
Ruby, you’ll understand and have a better appreciation for some of the
“magic” going on behind the scenes, as well as opening other avenues
for your programming career. Doubly, it takes a long time to learn how
to think in objects – something I admit, myself, to just be getting
the hang of. When you start reading about design patterns, you realize
the complexity, and beauty that OOP allows you.

If the original poster decides to forgo C for Ruby in the time being, I
hope the poster eventually returns to it, if even just to have a base
understanding of what’s going on beneath the scenes.

On Feb 23, 2006, at 9:28 AM, Robert K. wrote:

Perl’s
OO has changed since Perl 5 but then it was horrible.

I agree.

On the flip side though, I would argue that Perl has better
networking, which the original poster was interested in…

James Edward G. II

Giacecco wrote:

Hi Woodyee, how important is this information according to your
profession?

If you’re doing this for yourself, Ruby will be a great language to
learn and use.

But if you are doing this to revise your position in the job market,
none of the languages you listed will give you much advantage: it’s
Java and/or C# to be obligatory these days in any curriculum.

Your primary goal in learning a language is the most important criteria.

If you are looking first to get insight into programming, go learn
Lisp, or enough Lisp to find your way around.

There are free videos online by Hal Abelson and Gerald Jay Sussman of
their book, Structure and Interpretation of Computer Programs

http://swiss.csail.mit.edu/classes/6.001/abelson-sussman-lectures/

The book is available online for free as well.

Then go learn Ruby.

If you are in need of vocational training, go learn Java.

Then go learn Ruby.

I am certain that Ruby will grow a lot in the next years and things
will change, but if you have to decide today, and it is for your job,
Ruby is still too weak.

Highly subjective observation.


James B.

http://www.ruby-doc.org - Ruby Help & Documentation
Ruby Code & Style - The Journal By & For Rubyists
http://www.rubystuff.com - The Ruby Store for Ruby Stuff
http://refreshingcities.org - Design, technology, usability

On Feb 23, 2006, at 10:13 AM, James H. wrote:

But more importantly, should Ruby be a first language taught,
period?
I tend to think no.

I see this comment a lot and it bugs me, so I’m going to take it out
on you. :wink: (I’m kidding there, really.)

I think it’s important to remember that there are many different
levels of programmer. Some programmers work on operating systems,
bank ATM software, or missile guidance code for a living and we sure
hope they have all the knowledge they can get. That’s not all of
us though!

Many people are coming to Ruby right now through exposure to Rails
for web programming projects. Do they need to know how absolutely
everything works under the hood? Well, it probably depends on the
project, but honestly I don’t think being able to roll their own
binary search off the top of their head is too useful to them.

I work daily with a guy who probably has less language experience
then me, but he sure knows which JavaScript library will help us get
this week’s work done in one day. (He showed me lightbox this
week.) His gift may just be that he follows different news sources
than me, meaning that it isn’t programming knowledge at all. His is
just a different kind of knowledge, but still very useful to both of us.

As another example, my wife works for a food company. She’s always
messing with some data it Excel or Access. One day, I was watching
over her shoulder when she was doing some horribly repetitive changes
to a document.

Soon after that I taught her enough Perl to roll a Unix filter style
input loop, very basic array and hash usage, and a small subset of
regular expression. You learn much more from the first three
chapters of Programming Perl, I assure you. (She has everything I
taught her on a couple of cheat sheets.)

I would not call my wife a programmer and she knows literally nothing
about C, but she does program, and I’m confident that I more than
doubled her productivity for tasks she is often faced with. There’s
nothing wrong with someone getting things done at her skill level.

I’m not arguing that knowing fifteen languages won’t help you as a
programmer. Obviously, experts get to be experts by soaking up all
the knowledge in their field they can get their hands on. What I
think you are forgetting is that we are not all experts. Some of us
aren’t even trying to be, and that’s okay too.

James Edward G. II

C allows you to have a base understanding of all the technical aspects
of programming, like memory management, procedural thought, and the
basics of writing methods.

It won’t teach you anything about methods because there are none in C. :slight_smile:

Ah, yes. I have a bad habit of using procedure and method
interchangably =/

Interesting point about Pascal though, and when I read your words I
find myself nodding my head in agreement that it is definitely more
important to understand the concepts found amongst the majority of
programming languages than the specifics of one (e.g. pointers – one
of the great evils of C).

Okay, how about this: “If you decide to use Ruby as a first language,
it would be wise to learn C later down the road given it’s widespread
usage”. Does that make more sense?

James

James H. wrote:

But more importantly, should Ruby be a first language taught,
period? I tend to think no.

That’s precisely the point where we disagree. :slight_smile:

C allows you to have a base understanding of all the technical aspects
of programming, like memory management, procedural thought, and the
basics of writing methods.

It won’t teach you anything about methods because there are none in C.
:slight_smile:

These are generally good skills to have,
and you’ll find that you use them everywhere. C is a lot like latin,
insofar that it’s not changing much, and is used to communicate ideas.

I use UML to communicate ideas - or Ruby - but certainly not C. I don’t
think it’s suited for this at all. There’s too much overhead.

I also think it’s a little more “native” to initial human
understanding about programming. People tend to think of it as a
linear, or semi-cyclical set of instructions. In that regard, I
think C is a good way to enter the scene.

Even if you want to start with a strictly procedural language I’d
strongly
favour Pascal over C exactly because those detailed technical aspects
are
not present there. Getting memory allocation and pointer handling
right
is difficult for a novice and prevents early successes. IMHO it’s far
more important to grasp abstract concepts that are common to many
programming languages (like abstraction, modularization, data
structures)
than to know how to not shoot yourself in the foot when doing *ptr++.

The thought process overhead in object oriented programming is quite
extensive. It takes a long time to really get in the mode. If you
learn somethings about C, and get a basic grasp before moving on to
Ruby, you’ll understand and have a better appreciation for some of the
“magic” going on behind the scenes, as well as opening other avenues
for your programming career. Doubly, it takes a long time to learn
how to think in objects – something I admit, myself, to just be
getting the hang of. When you start reading about design patterns,
you realize the complexity, and beauty that OOP allows you.

Although I agree with your last paragraph (that OO is more difficult to
grasp than the procedural paradigma) I strongly disagree with what you
state in the first paragraph. If you like to, you can use Ruby
procedurally most of the time.

Kind regards

robert

On Feb 23, 2006, at 8:33 AM, Robert K. wrote:

Even if you want to start with a strictly procedural language I’d
strongly
favour Pascal over C exactly because those detailed technical
aspects are
not present there.

Object and Turbo Pascal took the language nicely into the realm of
OO. It’s still a great way to learn how to program - and even after
all of these years, I still can’t understand why nearly all major
Universities (in the US anyway) have abandoned it completely.

–Steve

James H. wrote:

Interesting point about Pascal though, and when I read your words I
find myself nodding my head in agreement that it is definitely more
important to understand the concepts found amongst the majority of
programming languages than the specifics of one (e.g. pointers – one
of the great evils of C).

:-)))

Okay, how about this: “If you decide to use Ruby as a first language,
it would be wise to learn C later down the road given it’s widespread
usage”. Does that make more sense?

Certainly! C might not be for everyone but if mastered certainly helps
understanding basic issues about how programs, processors and operating
systems interact.

Kind regards

robert

“James H.” [email protected] writes:

it would be wise to learn C later down the road given it’s widespread
usage". Does that make more sense?

Is the “C widespread usage” still true, by the way? I admit it is
still necessary to master C to write extension modules or low level
software, but should this application domain called “widespread” ?

The OS you’re using is likely written in a combination of C and C++ :wink:
There are tonnes of legacy systems written in C too. You can’t forget
those.

That’s such a good point. I’m a self taught programmer and my first
language was perl. Without anyone to point me in the right direction, I
developed some pretty bad habbits. You can still pick up bad habbits
using ruby, but it’s less likely.

charlie bowman
recentrambles.com