Wanted: A nice clean ruby app to disect

C

Curt Hibbs

We've started a new Ruby Users Group in Saint Louis, Missouri (US). We had our first get together last night over dinner (many thanks to Dave Thomas who also came since he was in town). About 90% of our members are new to Ruby, and we decided that a good way to get started would be to dissect the code of a Ruby app to learn Ruby and its idioms first-hand from *real* code.

There's *lots* of Ruby open source projects and lots of code available for study. But we have to pick something. I'm looking for some Ruby code that is not too complex, but also not trivially simple. Something that is fairly clean and makes good use of Ruby idioms. And, preferable, something that makes good use of unit tests.

What would you recommend?

Curt

PS
I'll thank you in advance for your suggestions as I'll be offline today at a computer conference.
 
J

James Edward Gray II

We've started a new Ruby Users Group in Saint Louis, Missouri (US). We
had our first get together last night over dinner (many thanks to Dave
Thomas who also came since he was in town). About 90% of our members
are new to Ruby, and we decided that a good way to get started would
be to dissect the code of a Ruby app to learn Ruby and its idioms
first-hand from *real* code.

There's *lots* of Ruby open source projects and lots of code available
for study. But we have to pick something. I'm looking for some Ruby
code that is not too complex, but also not trivially simple. Something
that is fairly clean and makes good use of Ruby idioms. And,
preferable, something that makes good use of unit tests.

What would you recommend?

I sure learn a lot reading the Ruby Quiz submissions every week.

Are they too complex, too simple, clean? Do they have unit tests and
make use of Ruby idioms? Sometimes. In my opinion, that's what makes
them such a valuable tool. You see so many different styles and you
can decide what works and what doesn't. I've adopted some
habits/tricks in my own code that I've seen in solutions.

Are the submissions perfect? No way, but I consider that another
feature. Sometimes I spend a lot of time playing with a certain
solution to figure out how it works. It's a rewarding search that
teaches me a lot. I'll give an example, just because it's fresh in my
mind:

http://www.ruby-talk.org/cgi-bin/scat.rb/ruby/ruby-talk/122593

Take a look at that submission from the Crosswords quiz. Glance down
at the "main" code in:

if $0 == __FILE__
# ...
end

See if you can find the subtle "bug" in that code. It works, but not
the way the author intended. (Sadly, I found that one after I wrote
that summary.)

Don't stop there. The rest of that solution is quite interesting. I
had to insert a few print statements to fully understand it, when I
went over it. Even better, there's a handful of other great solutions
for that round. Compare and contrast. That way you get to see
everyone's take on just how to use Ruby to accomplish the same task.

Enough of the commercial. I'm clearly biased. I just get a lot out of
the quizzes and hope everyone else finds them to be a valuable resource
as well.

James Edward Gray II
 
S

Sascha Ebach

Curt said:
We've started a new Ruby Users Group in Saint Louis, Missouri (US).
We had our first get together last night over dinner (many thanks to
Dave Thomas who also came since he was in town). About 90% of our
members are new to Ruby, and we decided that a good way to get
started would be to dissect the code of a Ruby app to learn Ruby and
its idioms first-hand from *real* code.

There's *lots* of Ruby open source projects and lots of code
available for study. But we have to pick something. I'm looking for
some Ruby code that is not too complex, but also not trivially
simple. Something that is fairly clean and makes good use of Ruby
idioms. And, preferable, something that makes good use of unit tests.


What would you recommend?

Rails?

It has everything you asked for. So now you are going to ask what to
pick from Rails? ;)

Sascha
 
C

Curt Hibbs

Thanks, I'll take a look.
I sure learn a lot reading the Ruby Quiz submissions every week.

Are they too complex, too simple, clean? Do they have unit tests and
make use of Ruby idioms? Sometimes. In my opinion, that's what makes
them such a valuable tool. You see so many different styles and you
can decide what works and what doesn't. I've adopted some
habits/tricks in my own code that I've seen in solutions.

Are the submissions perfect? No way, but I consider that another
feature. Sometimes I spend a lot of time playing with a certain
solution to figure out how it works. It's a rewarding search that
teaches me a lot. I'll give an example, just because it's fresh in my
mind:

http://www.ruby-talk.org/cgi-bin/scat.rb/ruby/ruby-talk/122593

Take a look at that submission from the Crosswords quiz. Glance down
at the "main" code in:

if $0 == __FILE__
# ...
end

See if you can find the subtle "bug" in that code. It works, but not
the way the author intended. (Sadly, I found that one after I wrote
that summary.)

Don't stop there. The rest of that solution is quite interesting. I
had to insert a few print statements to fully understand it, when I
went over it. Even better, there's a handful of other great solutions
for that round. Compare and contrast. That way you get to see
everyone's take on just how to use Ruby to accomplish the same task.

Enough of the commercial. I'm clearly biased. I just get a lot out of
the quizzes and hope everyone else finds them to be a valuable resource
as well.

James Edward Gray II
 
C

Curt Hibbs

Sascha said:

Surely you don't mean Rails, itself. That would be way too complex.
It has everything you asked for. So now you are going to ask what to
pick from Rails? ;)

Its a possibility, but I was thinking something more along the lines of a
console app. That way we'd be going through mostly pure ruby code without
having to drag in understanding of a larger framework.

Curt
 
M

Mike Clark

We've started a new Ruby Users Group in Saint Louis, Missouri (US). We
had our first get together last night over dinner (many thanks to Dave
Thomas who also came since he was in town). About 90% of our members
are new to Ruby, and we decided that a good way to get started would
be to dissect the code of a Ruby app to learn Ruby and its idioms
first-hand from *real* code.

There's *lots* of Ruby open source projects and lots of code available
for study. But we have to pick something. I'm looking for some Ruby
code that is not too complex, but also not trivially simple. Something
that is fairly clean and makes good use of Ruby idioms. And,
preferable, something that makes good use of unit tests.

What would you recommend?

Have you looked at RubLog (http://rubyforge.org/projects/rublog)?

Mike
 

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,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top