[prog] Ruby again ...

jennyw jennyw at dangerousideas.com
Mon Jan 24 21:26:40 EST 2005


I remember that there was some interest in Ruby earlier -- there was 
even talk of creating a course or study group on courses, although it 
looks like that didn't happen (unless it happened off-list?).

I've always been kind of interested in Ruby, but hadn't had a real
reason to use it until now.  I was doing Web searches about XML and
Ptyhon (pretty soon I'm going to need to process a bunch of XML), and I
happened to come across an entry on Martin Fowler's Web log about how
nice it is to work with XML in Ruby. Someone wrote a comment that said
that Ruby's XML parser was nicer to use than the multitude of Python
parsers, which got me thinking that before I embark on my project, I
should take a closer look at Ruby first.

I started reading "Programming Ruby" (the 1st ed. is online at
ruby-doc.org), and I found there's a lot to like about the language. 
It's pure OO, which appeals to me, and has a lot in common with
Smalltalk (which means that it's easier to read than C-like languages,
at least to me).  It also can do Perl-like things. For example, the only
thing I reguarly use Perl for these days is in-place edits from the
commmand-line (which I can't do with Python):

find . |grep -i "\.txt$" | xargs perl -p -i -e "s/find/replace/gi"

Here's the same thing with Ruby:

find . |grep -i "\.txt$" | xargs ruby -p -i -e 'sub(/find/, "replace")'

Nifty! Of course, I'm more interested in more complex programming
projects, but it's nice to know that I don't need to use Perl for that
simple task.

Anyway, my inspiration for writing this message has little to do with
the original reason I was looking into Ruby (XML).  It's because in the
course of reading, I came across Rails, and I thought that it might be
interesting to anyone here who wants to learn more about Ruby and/or has
an interest in developing Web apps. Here's a recent article on OnLAMP
that walks through the creation of a Web database application using
Rails:

http://www.onlamp.com/pub/a/onlamp/2005/01/20/rails.html

It's a very simplistic example, but it shows some of the innovative
features of Rails that allow for very rapid development of Web apps (it
only takes a few minutes to go through the article).  Note: the author
used Windows screenshots, but it's easy enough to follow along.

I've read some people compare Rails to Zope, but these comments never 
seem to come from anyone who's used both Rails and Zope. As far as I can 
tell, they're very different beasts.

Jen



More information about the Programming mailing list