"The more I find out, the less I know."

Tuesday - June 12, 2007 at 09:47 AM in

Ruby on Rails Impressions


I've had some time to dig a little more deeply into Ruby on Rails, and I'm still impressed.
I've been building a pilot logbook application, and in just a few hours of work (maybe 7-8 hours so far, more than half of which was just getting back up to speed on programming and object-oriented techniques) I've built a nearly feature-complete, if basic. I've even had time to add some HTML decoration and formatting, and do a fair bit of user interface refinement.

The coolest thing about Ruby on Rails, though, has been the support for generating "scaffolding," basic interfaces for creating, updating, and deleting database entries. The scaffolding itself consists of only a few lines of auto-generated code (with lots of stuff running invisibly in the framework), but it radically changes the development process.

The magic is that all you need to do is define the stuff you want to store in the database, and from that point forward you have a functional program. It may be crude, it may not provide the features or user interface you want, but it works. That means that as you develop, rather than having to write 80% of the program before you can start actually using (and testing) it, you can start using and testing it almost immediately. Almost the entire focus shifts from working to get basic functionality, to adding features and refining the interface.

That's not just more efficient, it's also a lot more rewarding. There's less of an initial hump to get over before you feel like you've gotten something done.

As an example, take a basic general ledger program. Traditionally, you might start by defining a general ledger database, then write the business logic and create a user interface for entering transactions. There's nothing functional, though, until both the business logic and user interface are significantly complete.

Under Ruby on Rails, you start by defining the fields you want to store in your general ledger (most basically, a general ledger entry will have an account to credit, an account to debit, and a dollar amount). As soon as that's done, you have (for free!) a crudely functional general ledger package. The user interface will suck, and it won't run reports or validate entries, but it will exist and be functional. So then you scratch your chin and say, "I don't like this interface for adding a new ledger entry, I'll replace it with a new one." When that's done, you scratch your chin again and say, "It needs to make sure the credit and debit amounts match," or "I need to be able to generate the balance for any account on any date," and you write that. Eventually you work your way down to details like tracking receivables, calculating depreciation, and so forth, but there's never a point in the process where you don't have working code.

This iterative development cycle is nothing new for those wise in the ways of Agile Development, though I think Ruby on Rails dramatically cuts the time required to get to first base.

Posted at 09:47 AM | Permalink | | |

©
Powered By iBlog, Comments By HaloScan
RSS Feed