Ruby as First Language

J

Jules Jacobs

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

Eric Jacoboni

James H. said:
The OS you're using is likely written in a combination of C and C++ ;)
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.
 
A

Asfand Yar Qazi

woodyee said:
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

I'd just like to add my two pennies - do NOT learn Ruby first. You will be
spoilt, and you will get very disappointed whenever you use any other
language, and yearn for Ruby all the time.

I suggest you start learning x86 assembler first, for the same reason you
would bang your head against a brick wall - it's a wonderful feeling when you
stop.
 
J

John W. Kennedy

Asfand said:
I'd just like to add my two pennies - do NOT learn Ruby first. You will
be spoilt, and you will get very disappointed whenever you use any other
language, and yearn for Ruby all the time.

I suggest you start learning x86 assembler first, for the same reason
you would bang your head against a brick wall - it's a wonderful feeling
when you stop.

x86 assembler is rather a mess.

In one respect, we were lucky in the old days. Both of the 1401
assembler languages were easy -- even the machine language was pretty
straightforward. (It's been nearly 40 years since I last dealt with a
real 1401, and nearly as long since I last dealt with an emulated one,
but I could still write a self-booting program today.) It gave you a
sense of the real machine that's hard to get nowadays.

--
John W. Kennedy
"But now is a new thing which is very old--
that the rich make themselves richer and not poorer,
which is the true Gospel, for the poor's sake."
-- Charles Williams. "Judgement at Chelmsford"
 
D

Dave Cantrell

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

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

-dave
 
J

James Herdman

I think there are two flaws in your argument.

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

Of course =)
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?

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
 
G

Glen

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

Daniel Nugent

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 :D
 
T

tony summerfelt

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

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
 
R

Rob

woodyee said:
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.
 
J

James Edward Gray II

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 Gray II
 
R

Rob

James said:
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 Gray 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.
 
P

Peter Hickman

Rob said:
I found it very difficult to learn because I spent too much
time looking for certain methods in the Ruby book.

This is a big problem for a lot of programmers. We've had Visual Basic
programmers looking for the on error gosub handler because that is
all they know and have become incapable of learning anything new. I've
seen Cobol written in Perl by Cobol programmers who just couldn't learn
anything new. We've had C programmers have fits because they couldn't
use the pre / post
increment / decrement operators that they used in C and -= and += was
too hard to learn.

You get the picture. Take a deep breath and forget you ever knew C then
try again, prior expectations can be a real hindrance when learning
something new.
 
D

Dirk Meijer

------=_Part_3370_5453936.1140803050797
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

2006/2/23 said:
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


besides Ti-BASIC (i'd say that doesn't count), Ruby is my first language,
and i think that's just fine. I had to learn Java at school, and i'm very
annoyed by it's inconvenience and the fact that not everything is an object
(;-)) so i'm happy that i learned Ruby first, because i think i wouldn't
understand the OO-principle this well, if i would have learned Java first..
but that's just my opinion/vision..
Dirk.

------=_Part_3370_5453936.1140803050797--
 
F

Friedrich Dominicus

Robert Klemme said:
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

I don't think the vs stuff is needed. Ruby is a nice language by many
means, and the others are nice also. Of course the programmers here
have decided pro Ruby. Ruby is a good choice if you like OO, but for
that you can use Smalltalk also. Unfortunatly the Self stuff has not
get the attention it deserves, but that's things are.

If you are not used to OO, it is a task to get into it. My experiences
with OO start while learning Eiffel (now around 12 years or so ago). I
was a enthusiastic Eiffel programmer but the whole stuff around a few
actors have taken away all the fun. Now if you are a fan of static
types language which are good for building scyscrapers, you still can
go for Eiffel. But if you learn other approaches like e.g functional
programming (very much advised to learn it whther you use it or not)
you fell way to much tighthen to imperative/object-oriented stuff in
Eiffel.

An eye opener was Haskell, Ocaml, Erlang and last but not least the
Lisp family.

I like Ruby for my scripting purposes, but I write a few liners
of ugly shell code. It's nice that ruby offers quite a lot in regard
to functional programming, also the most software I've seen written in
Ruby uses the imperative / object-oriented programming style.

I found most of the code quite readable and "understandable" the
learning curve is not steep (if you know OO of course)

Regards
Friedrich
 
F

Friedrich Dominicus

Glen said:
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?
This is definitly a problem for "imperative" programmers. Therefor I
would tend to judge C++ quite negativly. You can write C with a C++
compiler but that does not make for "OO" Programming....

Regards
Friedrich
 
T

Timothy Goddard

My order was Quick BASIC, then C++, PHP, then Ruby. I found the
following things:

1. Don't learn any of the BASIC family. My knowledge of this was a
severe impediment to learning C++ a few years later. It teaches you
really bad habits.

2. C++ is extremely useful to know. It provides a very good launching
point for understanding OO design while at the same time providing an
understanding of low level details of how it all works under the hood.
The easy Ruby-C(++) integration also makes this useful for speeding up
the slower parts of your Ruby code later.

3. Ruby is truly incredible in its simplicity and ease of expressing
quite complex concepts. I started using this about 3 months ago, just
before beginning my first job designing a web application. I used the
Rails platform (built on Ruby) and would choose it over PHP for web
applications any day.

After using Ruby you will feel handicapped writing in any other
language. For this reason, I would thoroughly suggest learning at least
the basics of C or C++ in parallel with Ruby. Learning two languages at
once is not nearly as daunting as it sounds as the basic concepts
translate nicely between them. After building up a basic knowledge of
each of them, you will have a nice base to launch off into the
specifics.

Please note that I am completely self taught in programming and have
never taken any formal education in any language. My experience may not
be typical.

My personal choice for application development would be Ruby, using C++
extensions for the heavy lifting. I believe it is essential to
understand both a compiled and high-level language, preferably that
integrate easily with each other, as this will let you effectively
partition tasks based on speed requirements while retaining the clean
overall logic of the higher language. For this, I believe Ruby and
C(++) are an ideal pair.

My advice to you is to get an introductory book on C++ and a book on
Ruby (the Pragmatic Programmers' guide is excellent). As you work
through the books, try to write the equivalents of the C++ examples and
the Ruby examples in the opposite language. This will rapidly teach you
both the upsides and the downsides of each language.
 
D

Dave Cantrell

Rob said:
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.

Perfectly said.

Wittgenstein's Ladder. http://c2.com/cgi/wiki?WittgensteinsLadder

Training wheels, training wheels, training wheels.

Everybody needs 'em when starting out in a new area. I need 'em. Big
time. Especially as I start watching the SiCP LISP videos. And I have
some past experience hacking around with Python. Though with my
background it looked more like object-oriented VBScript.

God help me.

Just my $.02.

-dave
 
G

Gregory Seidman

On Sat, Feb 25, 2006 at 08:13:34AM +0900, Timothy Goddard wrote:
} My order was Quick BASIC, then C++, PHP, then Ruby. I found the
} following things:
}
} 1. Don't learn any of the BASIC family. My knowledge of this was a
} severe impediment to learning C++ a few years later. It teaches you
} really bad habits.

I mostly agree with this, but I will both expand and contract that
category. Most forms of Basic are, indeed, impediments to learning to
program well. This specifically includes all Visual Basic forms through VB6
and VBScript. It does not, however, include VB.NET. VB.NET is pretty much a
dialect of C#, rather than the horror that is VB6. I include Perl in this
category, however. I will name this category "Languages that play fast and
loose with syntax, types, and APIs without any coherent underlying sense."
It is because of this lack of basis that it impedes learning other
languages.

I learned AppleSoft BASIC as my first language. Thankfully, I bridged the
gap between this category of bad languages with Logo, Pascal, many years,
and puberty. I consider Logo an excellent first language, and not just for
moving the turtle around to make pretty pictures.

} 2. C++ is extremely useful to know. It provides a very good launching
} point for understanding OO design while at the same time providing an
} understanding of low level details of how it all works under the hood.
} The easy Ruby-C(++) integration also makes this useful for speeding up
} the slower parts of your Ruby code later.

C should be learned before C++. Everything useful and powerful about C++
(other than employability) is brought into sharp relief by contrasting it
with C. I don't think it is a good language for learning OOP, however. C++
is slightly better at providing OO features than straight C (yes, I'm
serious), but its real power lies in its libraries and its facilities for
generic programming (i.e. templates).

} 3. Ruby is truly incredible in its simplicity and ease of expressing
} quite complex concepts. I started using this about 3 months ago, just
} before beginning my first job designing a web application. I used the
} Rails platform (built on Ruby) and would choose it over PHP for web
} applications any day.

Ruby is great. Rah rah rah. I mean, it's true, but you aren't going to get
much dissent about it on this list.

} After using Ruby you will feel handicapped writing in any other
} language. For this reason, I would thoroughly suggest learning at least
} the basics of C or C++ in parallel with Ruby. Learning two languages at
} once is not nearly as daunting as it sounds as the basic concepts
} translate nicely between them. After building up a basic knowledge of
} each of them, you will have a nice base to launch off into the
} specifics.

I've said it before and I'll say it again. Learning your first language is
*hard* because you are also learning concepts of programming. Learning your
second language is somewhat difficult because you will spend most of your
time thinking in your first language and trying to translate that to the
second, and often getting hung up on syntax. Learning your second paradigm
is *hard* because you must make your brain think in a way that it hasn't
before. Learning your third, fourth, or fifth languages is a bit of a
challenge. Learning your tenth language is a weekend of geekiness. Learning
your twentieth language is a day of playing around.

I think the ideal progression of learning languages would be:

1) Logo as a preteen, or AWK and/or Bourne shell scripting at any age
2) C (second procedural language)
3) Ruby, Python, Java, or C# (first OOP language)
4) C++ (kitchen sink language)
5) Scheme, Haskell, or ML (not OCAML) (first functional language)
6) SQL (first declarative language)
7,8,9) Whichever of Ruby, Python, Java, and C# has been missed previously
10+) Anything at all

} Please note that I am completely self taught in programming and have
} never taken any formal education in any language. My experience may not
} be typical.

I learned BASIC, Logo, and Pascal on my own. I took a high school CS course
which used Pascal, so what I learned was good programming. I learned C,
C++, Bourne shell scripting, and AWK before entering college.

In college, as part of a CS major, I learned (in no particular order) Lisp,
ML, SQL, Java, make (fantastic declarative language, BTW), and lexx/yacc.
Outside of coursework, I also learned JavaScript, a bit of AppleScript,
VRML (both 1.0 and 2.0, but 2.0 was sort of a dataflow language), and just
enough Perl to modify other people's scripts while hating it.

In grad school I taught C++, both as a TA for the software engineering
class and in a week-long minicourse; this meant that I had to learn it
deeply, and I learned to appreciate its subtlety, power, and specific
safety nets. (I could go into the relative advantages and disadvantages of
C++ for pages. I will spare you all.)

} My personal choice for application development would be Ruby, using C++
} extensions for the heavy lifting. I believe it is essential to
} understand both a compiled and high-level language, preferably that
} integrate easily with each other, as this will let you effectively
} partition tasks based on speed requirements while retaining the clean
} overall logic of the higher language. For this, I believe Ruby and
} C(++) are an ideal pair.

The right tool for the right job. Ruby is nearly the same size and shape
tool as Perl and Python. It is good for many of the same things. In
addition, Rails makes Ruby ideal for standalone, database-backed web apps.
For a GUI app, however, I would choose C++ and Qt/KDE or C#. For a major
enterprise app (e.g. the mission-critical, proprietary, special-purpose,
in-house application with which a company performs its work, such as the
retirement management software I am working on now for an actuarial firm) I
would choose C#. For a numerically intensive application, particularly one
that is paralellizable, I would use C. For simple scripts I continue to use
Bourne shell and/or AWK.

The really valuable thing about knowing lots of languages is that you can
think flexibly and work efficiently. Granted, I haven't found a use for a
functional language for ages, but I've certainly use functional idioms that
would not have occurred to me if I hadn't learned a couple of functional
languages. My dayjob involves programming VB.NET, but you better believe I
use a variety of other languages (particularly SQL, AWK, and Bourne shell
scripting) to aid me in my work. Furthermore, I take great joy in playing
with Ruby (and Rails in particular) and JavaScript on the side.

} My advice to you is to get an introductory book on C++ and a book on
} Ruby (the Pragmatic Programmers' guide is excellent). As you work
} through the books, try to write the equivalents of the C++ examples and
} the Ruby examples in the opposite language. This will rapidly teach you
} both the upsides and the downsides of each language.

Gah! I could not disagree more. Learning more than one language at a time
is a recipe for confusion. My advice is to choose a simple toy task that
you will attempt to implement in each language you learn. For many years I
used an abacus (which I implemented in Java 1.0, Java 1.1, VRML 1.0 w/ CGI,
VRML 2.0, C++, and JavaScript/DHTML). For BASIC, Pascal, and C I used a
simple bubblesort. For Ruby (and Rails) I used a Firefox "live bookmark"
generator <http://www.anthropohedron.net/bookmarkfeeds/>.

Start with shell scripting and awk. There are excellent books on it out
there, the technology isn't changing, and you can keep pretty much the
entire language in your head. Failing that, there are good man pages. If
you are on Windows, get Cygwin. If you want to jump straight into Ruby from
there, well, that's almost as good as the progression of languages I listed
above.

For someone who is starting out with no programming experience, I consider
Why's Poignant Guide to be the best introductory Ruby text out there. Yes,
really. It introduces concepts gently and humorously.

--Greg
 
C

Chris

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

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

I apologize for noise but I have to say thanks for that link. My
girlfiend ask me what goes on in my brain while I am reading/writing
code - I played that for her and I am positive she will not try to learn
how to code. Another soul saved...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,756
Messages
2,569,540
Members
45,025
Latest member
KetoRushACVFitness

Latest Threads

Top