I made some time to sit down and play with Rails this evening, and thought I'd work on a simple Bookmark Manager (ala del.icio.us) - a piece of software that I am sorta familiar with, since I use del.icio.us a fair bit, and have some ideas that I think would improve the service. So, I'll try mocking them up in Rails to give me something to chew on while I learn...

So, about half an hour into it, and I have a barebones app that lets me add new bookmarks (complete with title, description, rating, date added, url, etc...), and list existing bookmarks.

Next, to try to work in the concept of Users, and tie bookmarks to specific users. Then, to try to do something interesting with the connections that can happen when multiple users bookmark the same resource, or similar resources, or tag them differently, or give them different ratings, etc...

I'm really liking the concept of Scaffolding in Rails. It feels very similar to starting a WebObjects application via DirectToWeb, and slowly overriding the default functionality as you need to. I also really like the strong MVC separation. Controller files (.rb - analogous to the WebObjects .java files) contain the business logic, while View files (.rhtml - analogous to the WebObjects .html and .wod files merged?) contain HTML with bindings to the methods and variables in the controller.

Almost forgot - I only "wrote" about 3 lines of code. Still, there were several files automagically generated by Rails, and a couple of the .rhtml files with html and bindings, but still - very little actual code to write/manage.

I think I'm really going to like Ruby, as well. It's easily readable without being annoyingly verbose. It's nicely object oriented, without being too abstract. It's interpreted, so it's easy to see code "live" as you tweak it.

I'll play with this app over the next few days/weeks to see what I can come up with. If it gets stable enough, I might deploy it on my desktop box back in the office...

Here's the basic database schema I'm working toward. I still have to think out the bookmark --> tag relationship. I want Tags to be primitive "nouns" - not belonging to any user, and being linked to from Bookmarks through a join table. Adding tags is just a matter of ensure the "noun" exists, and creating (or removing) a join to it.

Rails Bookmark Manager Schema

Update: Thanks to a tip from Hunter, I checked out the acts_as_taggable plugin/extension/whatever for Rails (description here). Basically, you just drop this bad boy into place, and declare in your controller that the class acts_as_taggable - then, the plugin takes care of managing a many-to-many relationship between that class and the tags.

Sample code from the description page for acts_as_taggable:

class Photo < ActiveRecord::Base

elephant = Photo.find(4437)
elephant.tag 'zoo animals nature'

elephant.tagged_with?('urban') # => false
elephant.tags.size # => 3
elephant.tag_names # => [ 'zoo', 'animals', 'nature' ]

Can it get any easier than that? It's doing exactly what I was describing as wanting, but For Free. Sweet.

Update 2: Yes, it can get easier. And more powerful. The developer of acts_as_taggable reworked the mixin/plugin after some thought, and came up with something even cooler (documentation here).

In poking around some of the Rails sites, I keep thinking that although it's still a bit immature (it just hit 1.0 a month ago), it "feels" like WebObjects, but based on Open Source from soup to nuts, and with an apparently vibrant and cool developer community. WebObjects is waaaaay more mature, but isn't Open Source (hence the licensing fiasco this summer), and it feels like the developer community may be atrophying a bit (although I could be wrong on that - I hope I am).

Update 3: About an hour into noodling with the acts_as_taggable mixin, and I have a fully folksonomic bookmark manager. I've got a simple form that lets me add bookmarks, complete with a freeform text field for entering tags, which get bursted into individual Tag rows with the appropriate join table invisibly managed.

I've got some more work to do to clean it up, and then I want to add in the concept of users - which apparently is absolutely trivial in Rails. Then, add in some OPML and RSS exports, and support for bookmarklets, and perhaps implementing part of the del.icio.us API on the back end to allow other things to talk to it, and I've got a decent bookmark manager, with only a handful of code written. Sweet.