Ruby as First Language

James H. wrote:

Doubly, it takes a long time to learn how
to think in objects – something I admit, myself, to just be getting
the hang of.

I think there are two flaws in your argument.

  1. Your experience does not set the standard for everyone else.

  2. I assume you started with a language similar to C (or at least
    procedural), and then learned OO. Because it took you a long time to
    fully grasp OO, you think it is best to start with a procedural
    language. ?? Is there no possibility that it took you longer to grasp
    OO because you started with a procedural language?

I was taught both procedural and OO in college, and did not experience
the difficulties you mention.

Alan Shalloway, one of the authors of “Design Patterns Explained”
argues that avoiding design patterns makes it harder to learn them
object-oriented design. Instead, he introduces his students to
object-oriented design and design patterns and has found the students
learn object-oriented design faster.

Quote from preface in book:
“The design pattern books I had been reading and the design pattern
experts I had been talking to were saying that you really needed to
have a good grounding in object-oriented design before embarking on a
study of design patterns. Nevertheless, I saw, with my own eyes,
students who learned object-oriented design concurrently with design
patterns learned object-oriented design faster than those just studying
object-oriented design. They even seemed to learn design patterns at
almost the same rate as experienced object-oriented practitioners.”

If experience can be used to draw conclusions, I would trust his
experience with a larger test set over yours.

From: “Giacecco” [email protected]

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.

It should be noted that many people here are using ruby for our jobs.

:slight_smile:

It’s true Ruby isn’t suited to every task, but it’s working for a lot
of us.

Regards,

Bill

If you plan on working on the web, you should definitely make sure that
ruby is in your tool belt.

On 2/23/06, woodyee [email protected] 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!

Harvard is teaching Ruby and C in their introduction to CS, and several
other schools are starting to use Ruby. (Take a look at
http://www.oreillynet.com/ruby/blog/2006/02/ruby_at_school.html for
a bit more info – including a URL)

For CS heavy programs it looks like Ruby is a good member of the
first set of languages. For more vocational programs it might be a
good first language. That’s likely an important distinction.

From my perspective (I’m teaching my 11 yo son about programming
with Ruby), Ruby makes sense as a first language because it allows
nearly instant gratification, encourages good habits, and provides a
good bridge to other things.

So it all depends on what you want. Do you want to have knowledge of
processors and memory management by learning C? Or do you want to skip
these low level issues and be able to write practical programs from the
word go?

If you want to be a computer scientist, learn C, plus Smalltalk, Lisp,
Io, etc. If you want to learn to program to code programs, go for Ruby
or Smalltalk.

Ruby - More like other programming languages. Easier to learn if you are
a programmer. Good choice if you want to create webapplications because
of Rails.

Smalltalk - Probably easier to learn for a non-programmer. Good choice
if you want to create webapplication because of Seaside.

James Edward G. II wrote:

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.

Okay, now I have to pull this one out. See if listening to this one
makes your head explode. :slight_smile:

http://www.aoe.vt.edu/~cdhall/Space/AFGUID.wav

Yes, my head exploded the first time I heard it. But if you listen to it
vewwy vewwy cawefuwwy it makes sense.

In a sick, sick sort of way. :slight_smile:

-dave

“James H.” [email protected] writes:

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.

Yes, but you haven’t understood my previous post. I’ve not said that C
isn’t necessary. I’ve only pointed the fact that “widespread use” is
/today/ perhaps a little excessive. I don’t think writing a OS or a
low-level driver is, /today/ a widespread programming job.

On 2006-02-23 13:55:44 -0500, “Glen” [email protected] said:

James H. wrote:

Doubly, it takes a long time to learn how
to think in objects – something I admit, myself, to just be getting
the hang of.

I think there are two flaws in your argument.

  1. Your experience does not set the standard for everyone else.

Of course =)

  1. I assume you started with a language similar to C (or at least
    procedural), and then learned OO. Because it took you a long time to
    fully grasp OO, you think it is best to start with a procedural
    language. ?? Is there no possibility that it took you longer to grasp
    OO because you started with a procedural language?

There’s quite a bit of merit to what you said, and it’s quite possible.
And…

Alan Shalloway, one of the authors of “Design Patterns Explained”
argues that avoiding design patterns makes it harder to learn them
object-oriented design. Instead, he introduces his students to
object-oriented design and design patterns and has found the students
learn object-oriented design faster.

As suggested by this statement, I did find OO easier to grasp and
understand once I started learning design patterns. I suppose I worry
that if someone isn’t taught OO well that they’re just going to end up
like me and program some sort of pseudo-OO crap and just end up
enforcing bad habits.

You’re right, his experience is much more extensive than mine and I’d
trust it more. Just sharing my $0.02 though =)

Kindly,

James

I think they should teach kids Lisp/Scheme, C, the Lambda Calculus,
and computer organization at the exact same time.

Then they’ll grasp the differences between the theoretical computer
science, practical computer engineering, and the balance between the
two faced when programming.

A second course would then use Ruby or Smalltalk along with design
patterns as an introduction to Object Oriented programming/design and
being able to communicate about programs (that is, talk to other human
beings).

Then, I dunno, teach them declarational programming using SQL and
Prolog, explaining the relational theory and logic programming.

The ones that come out of it alive will be Masters of the Universe.

I did find OO easier to grasp and understand once
I started learning design patterns.

Sorry, I did not notice that in your first post.

I suppose I worry that if someone isn’t taught OO well
that they’re just going to end up like me and program
some sort of pseudo-OO crap and just end up enforcing
bad habits.

I agree with you on this. In fact, my worry goes further. I
worry about college grads only learning the technical aspects
to programming and not learning to solve problems. This is by
far one of the largest problem I have encountered with peers.
Other problems being, an unwillingness to learn. But that is
another soapbox. :wink:

You’re right, his experience is much more extensive than
mine and I’d trust it more. Just sharing my $0.02 though =)

Oops. I didn’t mean to come across as rude. Your experience is
certainly valuable. And when combined with Alan Shalloway’s
experiences I think we can agree that it takes a good teacher
and that we might need to rethink how we teach programming.

On 2/24/06, Daniel N. [email protected] wrote:

I think they should teach kids Lisp/Scheme, C, the Lambda Calculus,
and computer organization at the exact same time.

“They”?? Have you ever tried to teach kids programming?

I humbly suggest starting with Ruby.

The ones that come out of it alive will be Masters of the Universe.

The ones that come out of it alive would have been Masters of the
Universe, anyway.

:slight_smile:

Chris

I agree, I was just being flippant (mostly).

I do sort of wish that when I was just starting someone had told me
straight up the sort of things I mentioned right there. Understanding
the differences between functional, procedural, declarational, and
object oriented programming models has been haphazzard(at best) in my
education.

I just think that it’s possible to really get at the core of what
“Computer Science” really is without arduously teasing the nuances of
it out over the course of years.

Heck, what do I know. Maybe we should just have kids read all the
back archives of Lambda the Ultimate :smiley:

On 2/24/06, Daniel N. [email protected] wrote:

I just think that it’s possible to really get at the core of what
“Computer Science” really is without arduously teasing the nuances of
it out over the course of years.

Hmm… iteresting. (I was just talking about teaching kids to
program, not getting at the core of what CS really is.)

Perhaps the analogy to draw upon would me that programming (as I meant
it: getting the computer to do things for you) is like arithmetic and
maybe simple algebra: it’s how you get things done, and if you don’t
have a good handle on these basics, it will be hard to move beyond it.

In this analogy, I guess that makes CS kind of like Math: deep,
subtle, hard to get at the core of it.

But (sticking with the math side of the analogy, since that’s where my
education is), I think it would be a mistake to begin by teaching
people the field axioms (that is, expecting them to use them in proofs
and such), or arithmetic base n (for n other than 10), or about
groups. In some sense, these are more general or fundamental or
simple… but they’re not, not really. :slight_smile:

Without a background of the basics, it’s hard to understand the
significance of more general or fundamental or simple solutions. If
I don’t know how to concatenate strings or show those strings on the
screen, what do I care if this way is the procedural way to do it, and
that way is the object-oriented way to do it?

So many things are common to (nearly) all languages. Variables.
Functions/methods/procedures. Using numbers to do things other than
solving math problems. These are so basic that we don’t even think
about them anymore, but they are not obvious to new programmers.

So, getting back to the original question: Is Ruby a good language
for getting a handle on those basics of programming?

Absolutely. (And much better than C for this.)

After Ruby, C is a reasonable choice as a next langauge. As is Lisp.
(Depends on where you want to go with your programming.) But it sure
is nice that you can stick with Ruby for most tasks.

(As an aside, I’m always skeptical of people who say you should learn
language X first, when that’s not the language they prefer to use
themselves. Usually, they have over-thought the problem.)

Chris

On Thu, 23 Feb 2006 23:18:33 +0900, you wrote:

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

ruby has the cleaner syntax, but i don’t think it has less typing you
mean at the keyboard :slight_smile:

i find the typing to be about even.

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.

somewhere around ‘87 they had fully evolved to the point of no line
numbers or gotos. something like libertybasic is great for
beginners… although it’ s not object oriented.

http://home.cogeco.ca/~tsummerfelt1
telnet://ventedspleen.dyndns.org

On Fri, 24 Feb 2006 00:28:32 +0900, you wrote:

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.

it still feels “tacked on”. i think python’s does also…

[incr tcl] has oo similar to C, but i’m not sure i’d recommend that as
a first language…

lua is great as a first language. oo, very clean syntax, cross
platform and small.

it also makes a great embedded language.

http://home.cogeco.ca/~tsummerfelt1
telnet://ventedspleen.dyndns.org

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!

WY

Personally, I think it is a horrible first language. Let me preface
this by saying I’m a hardware guy that uses programming as needed, so
I’m not a real programmer.

Here is the problem. With C or even C++ I can learn a few basic
conditional statements, variable declarations, etc. and I can write just
about any program. Sure, it will be long and inefficient, but at least
I can write it without knowing any more about the language. In Ruby,
you can’t do that. The key to learning Ruby is learning the numerous
methods that come with each class.

When I first started playing with Ruby, I thought I would do a typical
programming exercise and write several sort functions in Ruby (bubble,
selection, quicksort, etc.). I couldn’t figure out how to do it because
all I needed was Array.sort! It is tough to find documentation on
things like for loops in Ruby, and blocks can be confusing.

I think Ruby is best for people that already have some programming
experience.

James G. wrote:

On Feb 24, 2006, at 7:56 AM, Rob wrote:

Here is the problem. With C or even C++ I can learn a few basic
conditional statements, variable declarations, etc. and I can write
just
about any program. Sure, it will be long and inefficient, but at
least
I can write it without knowing any more about the language. In Ruby,
you can’t do that. The key to learning Ruby is learning the numerous
methods that come with each class.

I’m not seeing that. Ruby supports pretty much the same constructs
and even index access to Arrays. Iterators are a lot sexier, but if
you want to walk everything by index knock yourself out. If you
don’t know the helper methods, you can always roll your own code.

That doesn’t make sense to me.

James Edward G. II

Sure, you can do that stuff, but most of the existing documentation
focuses on the sexy aspects of Ruby. I don’t think it means much to a
novice programmer to write some ultra-powerful statement consisting of
one or two lines of code. It’s easier to follow something that is three
times as long and more verbose.

Don’t get me wrong. I love Ruby. It’s just that as a mediocre
programmer, I found it very difficult to learn because I spent too much
time looking for certain methods in the Ruby book. Sometimes it is
easier for beginners to move forward when they don’t have 10 different
options for how to do something.

On Feb 24, 2006, at 7:56 AM, Rob wrote:

Here is the problem. With C or even C++ I can learn a few basic
conditional statements, variable declarations, etc. and I can write
just
about any program. Sure, it will be long and inefficient, but at
least
I can write it without knowing any more about the language. In Ruby,
you can’t do that. The key to learning Ruby is learning the numerous
methods that come with each class.

I’m not seeing that. Ruby supports pretty much the same constructs
and even index access to Arrays. Iterators are a lot sexier, but if
you want to walk everything by index knock yourself out. If you
don’t know the helper methods, you can always roll your own code.

That doesn’t make sense to me.

James Edward G. II

Dave C. [email protected] writes:

http://www.aoe.vt.edu/~cdhall/Space/AFGUID.wav

Plain lovely.

On 2/24/06, Rob [email protected] wrote:

Sometimes it is
easier for beginners to move forward when they don’t have 10 different
options for how to do something.

While I disagree with most of what you have written (respectfully,
though :), I think you hit the nail on the head here. Most of the
time when we are showing Ruby, we are showing off Ruby. How can we
not!

But, for a sufficiently beginner audience, it’s not the most helpful
way to go about things. (This was one of the things I really tried to
address in my book.)

Having said that, I seriously doubt that looking up “how to
concatenate strings” in Ruby is much harder than in C, and ‘+’ is
easier to remember than ‘strcat’, don’t you think? So you’re less
likely to have to look it up. And which is easier to use?? What,
exactly, does strcat return? What if the strings overlap? Plus, once
you use strcat, you have the potential gotcha of having changed one of
your strings. And, of course, you have to make sure you have enough
space in your destination string… well, not in the “string”, but in
the space declared…

How can you possibly think these are equally easy?? You have to know
more to get things done in C than in Ruby, not the other way around.

(Have you tried teaching people to program using C? And Ruby? If you
have, and in your experience C is not vastly more difficult for your
students, I’d love to hear about it. :slight_smile:

Chris