This post originated from an RSS feed registered with Agile Buzz
by Jared Richardson.
Original Post: Ruby is so cool
Feed Title: Jared's Weblog
Feed URL: http://www.jaredrichardson.net/blog/index.rss
Feed Description: Jared's weblog.
The web site was created after the launch of the book "Ship It!" and discusses issues from Continuous Integration to web hosting providers.
I'm going through Dave and David'sRails book and parts of it just amaze me. How much code would it take in your language of choice to do the following:
Pull all the data from a database table
Filter out the data by some value on a single column
Sort the data
Granted, this isn't rocket science. Any beginner programmer should be able to do this. But in the Rails book, it's four lines of code... and it could be one. It's written on four lines to be readable.
This is a routine that returns all the items that can be sold now. Can you read it?
I know, some of the magic is ActiveRecord, the Ruby OR layer... but in my mind I'm running through all the JDBC driver trappings, the selects, the sorting. Maybe if I'd tinkered with Hibernate, I'd know a four line way to do this in Java. Maybe....