Contact Me
Rails Recipes
My Job Went to India

Great Ruby Code?

March 27th, 2008

Tonight, Rich, Marcel and I spoke at the DC Ruby Users Group. Instead of choosing a topic, preparing a set of slides, and droning on about something for an hour we decided to involve the group to help us answer a question. It’s a question I get a lot when I do training with The Pragmatic Studio: “Which Ruby projects should I look at to see examples of great Ruby code?”

I have my standard answers (I’m sure we all do), but two things occur to me about answering such a question. The first is that when asked a question like this, I have a gut reaction. There are names that spring immediately to mind. If I scrutinize these reflex reactions I realize that I haven’t really examined the code I’m thinking of in enough detail to call it great. So though I have some cursory knowledge that makes me pretty sure when I give my recommendations (I’m holding off on naming specifics so as to not influence your answer to this question), I’m not 100% sure which projects contain great Ruby code.

The second realization about this is that some of the names that spring to mind are based on potentially the wrong criteria. I, like all humans, am more likely to mention something popular than something obscure. There is also a Ruby community folklore. Some names are synonymous with “great”. But it’s just folklore. So the knee-jerk reactions are at risk of being heavily influenced by the Ruby popular culture. Looking at how successful popular culture is at picking great music, visual art, fiction, and other artistic mediums, it’s pretty clear that we shouldn’t trust pop culture when making decisions about which projects are composed of “great” code.

So we asked the DC RUG: “Who are the greatest Ruby programmers in the world?”

Then, all together, we looked at code written by the people they came up with.

Some of it was beautiful. Some of it was ugly.

We talked about what made some of it beautiful and some of it ugly. We talked about the importance of writing beautiful code. It was fun.

Anyway, I still don’t have a satisfactory list of great Ruby code. I’d like to build such a list. So, please leave a comment saying the name of an open source Ruby project you feel represents truly great Ruby code.

51 Comments

  1. Neeraj Kumar Says:

    I think Admiteer is a nicely written application. Check out at http://admiteer.com/ . The source code is also available http://6brand.com/admiteer-your-online-ticketing-app

  2. jwhiteman Says:

    I can’t speak for greatness, but the prettiest ruby code I’ve seen in a while is Capistrano 2.

  3. StevenA Says:

    “We talked about what made some of it beautiful and some of it ugly. We talked about the importance of writing beautiful code.”

    I’d like to read a more in depth summary of that conversation.

  4. Phil Says:

    It is interesting to realize the fact that code that you like to use may not necessarily be the most beautiful code under the covers. Even more interesting is that you usually are only forced to look under the covers and be exposed to the beauty or lack thereof when you run into problems with the code. And in those cases it’s the horrifyingly bad code that you are more likely to notice; code that is readable often doesn’t sear itself into your memory the same way.

    I’m pretty fond of the vlad internals. It’s not as well-documented as Capistrano, but I find that whenever I need to figure out how stuff works it’s very easy for me to dive in to the source and understand how it works at a glance.

    I’ve also been pretty impressed with the simplicity found in the Rack code. It leverages basic things like hashes and lambdas in a straightforward way.

    I’d like to read a more in depth summary of that conversation.

    +1

  5. monde Says:

    Can you provide a list of the codes/gems that came up in the conversation at DC RUG?

    I?d like to read a more in depth summary of that conversation.

    +1

  6. Bob Says:

    I’ve spent quite a while reading the code for core rSpec. Both the code and the architecture of what they achieved is quite nice.

  7. Bil Kleb Says:

    Someone please start a hotornot- or kittenwar-type site for code snippets!

    Or, maybe add such a layer to pastie?

    Or point me at an existing one for code.

    (Peter Provost and I hatched this little plan after participating in the Agile’07 workshop, Design Sense: Can We Teach Deep Design Skill With Perceptual Examples? hosted by Michael Feathers and Emmanuel Gaillot, but obviously neither of us launched such a site.)

  8. darius Says:

    Best in Show: http://code.google.com/p/orangutan/

    I like that idea bil. I personally think some sort of extension to rDoc’ing to include #HACK or #GOTCHA tags would allow us to expose beautiful code without making a blogpost about it. ... and maybe harnessing the metadata of the context of that code? Maybe we can get Heroku.com to do it. They already host the code so people who use heroku don’t have the barrier of ‘exposing’ code to a new third party…

  9. Dejan Dimic Says:

    ?The greatest artist?? This is the one of the unanswerable questions.

    We can distinguish god from bad and mediocre art. To fully understand the greatness of an art one should deeply understand the whole process of genesis and historical context.

    The art exhibition galleries and ?the hall of fame? are good way to see, enjoy and educate about the good and astonishing art.

  10. Erik Kastner Says:

    Here, to me, is pure beauty + function: http://pastie.caboo.se/pastes/65758

    Here’s why I think it’s such an awesome bit of code:
    • It’s one page long. Long works can be beautiful, but it’s easier to give someone something bite sized.
    • It’s understandable in one sitting (for intermediate to advanced ruby coders), but requires some mental work to get there.
    • It’s tested. Yup, in one file. With mocks…. this is awesome.
    • It’s fun. It’s got some really neat tricks like using DATA to hold a gziped webpage.

    All in all. Just awesome, beautiful, functional code without a real purpose :)

    Thanks Chris – I still go back to this code, and it’s what I hand out to people to show them what awesome code is like.

  11. Phil Says:

    @kastner: that’s slick; thanks for sharing.

  12. David Dai Says:

    I’ve just started looking at Merb. I’m shocked how well documented the code is. I highly recommend it.

  13. Elis Says:

    Beautiful code is straightforward and battle-scarred.

    Something that has ‘neat tricks’ and surprises you is not straightforward, and not beautiful.

  14. Jack Danger Canty Says:

    You can tell a kind person not by how kind they appear but by how good they make you feel when you’re around them.

    I think code is the same way. Code that says “hey, check me out – I’m awesome” is crap compared to code that says “what’re you doing there? Oh, let me help you with that.”

    [ And thanks to Neeraj for the Admiteer plug :-) ]

  15. life insurance Says:

    3bxjrot-5el1qqi-tw6q18f5-0 auto insurance http://finance.groups.yahoo.com/group/term-life-insurance_/#1 health insurance[/url] [http://way.to/homeinsurance#5 home insurance] home insurance health insurance[/LINK]

  16. martinus Says:

    Hi, here is my entry: http://martin.ankerl.com/files/e

    Article about it: http://martin.ankerl.com/2006/08/11/program-e-extract-any-archive/

    Ive been using this tool for almost two years now, and many other people like it as well. The beauty is that it is extremely simple yet powerful.

  17. Viagra Says:

    Viagra pills online viagra online http://www.viagrausaonline.com/ online[/url]

  18. Viagra Says:

    Viagra pills online viagra online http://www.viagrausaonline.com/ online[/url]

  19. Viagra Says:

    Viagra pills online viagra online http://www.viagrausaonline.com/ online[/url]

  20. Viagra Says:

    Discount viagra online viagra https://www.blogger.com/comment.g?blogID=6157809498687416224&postID=2294246231227742229

  21. Viagra Says:

    Cheap viagra online cheap viagra http://www.usapillscheap.com/ viagra[/url]

  22. Viagra Says:

    Viagra pills online viagra online http://www.usaviagraonline.com/ online[/url]

  23. Viagra Says:

    Viagra pills online viagra online http://www.viagrausaonline.com/ online[/url]

  24. Gman Says:

    Alabama

  25. Viagra Says:

    Viagra pills online viagra online http://www.viagrausaonline.com/ online[/url]

  26. Cialis Says:

    Cheap cialis online cheap cialis http://www.cialisusacheap.com/ cialis[/url]

  27. Viagra Says:

    Viagra pills online viagra online http://www.usaviagraonline.com/ online[/url]

  28. Viagra Says:

    Discount viagra online viagra http://digg.com/users/VIAGRAONLINEEE

  29. Viagra Says:

    Viagra pills online viagra online http://www.viagrausaonline.com/ online[/url]

  30. Viagra Says:

    Viagra pills online viagra online http://www.usaviagraonline.com/ online[/url]

  31. Viagra Says:

    Viagra pills online viagra online http://www.viagrausaonline.com/ online[/url]

  32. Cialis Says:

    Cheap cialis online cialis https://www.blogger.com/comment.g?blogID=513494629458774789&postID=5066463426249996410

  33. Viagra Says:

    Viagra pills online viagra online http://www.viagrausaonline.com/ online[/url]

  34. Viagra Says:

    Viagra pills online viagra online http://www.viagrausaonline.com/ online[/url]

  35. Viagra Says:

    Viagra pills online viagra online http://www.viagrausaonline.com/ online[/url]

  36. Viagra Says:

    Discount viagra online viagra https://www.blogger.com/comment.g?blogID=2837938490592425442&postID=7939306939206631166

  37. Viagra Says:

    Viagra pills online viagra online http://www.viagrausaonline.com/ online[/url]

  38. Viagra Says:

    Viagra pills online viagra online http://www.viagrausaonline.com/ online[/url]

  39. Viagra Says:

    Discount viagra online viagra https://www.blogger.com/comment.g?blogID=463918176562845353&postID=4198372366535906527

  40. Viagra Says:

    Viagra pills online viagra online http://www.viagrausaonline.com/ online[/url]

  41. Viagra Says:

    Discount viagra online viagra https://www.blogger.com/comment.g?blogID=463918176562845353&postID=4198372366535906527

  42. redbagsiteho Says:

    I grew snapping and began names. living the vast crashing down for the even know plants sweet,

  43. petsgreenbag Says:

    reaction about for the the dead pets green bag me snapping and we School planted night yes global

  44. keyugly Says:

    parents I don’t know him. I’d hoped years later. along as proud and began I noticed

  45. boyjuicymeca Says:

    Behind by themselves boy juicy me car ugly leaves I know about names. all juicy sea joke

  46. Viagra Says:

    Viagra pills online viagra online http://www.viagrausaonline.com/ online[/url]

  47. Viagra Says:

    Viagra pills online viagra online http://www.viagrausaonline.com/ online[/url]

  48. Viagra Says:

    Discount viagra online viagra http://www.mixx.com/users/LOWEST_VIAGRA_PRICE_GUARANTEED

  49. Viagra Says:

    Viagra pills online viagra online http://www.viagrausaonline.com/ online[/url]

  50. Viagra Says:

    Discount viagra online viagra http://www.mixx.com/users/LOWEST_VIAGRA_PRICE_GUARANTEED

  51. Cialis Says:

    Cheap cialis online cialis https://www.blogger.com/comment.g?blogID=3251352651752616462&postID=6079312996982939051

Leave a Reply