Loud Thinking

I'm not lazy at writing neither I'm bad. But I do not have my personal blog! Because I wont be updating it much! Developing a REST API on top of MyOwnDB was our prime decision to make it integrate able to a number of products/services. And that way, we want to be the memory of Web 2.0! We've been working with the REST API for sometime now and it was a leap from a concept to its application to MyOwnDB within the Rails framework. We had to make many interesting design decisions and for that, I explored top ten REST API's available including Twiter, Google, Flicker and many more. I gathered their conventions, practices and the way they're dealing with some of the situations which do occur while you're exposing some functionality as a web service (of course specifically based on REST paradigm). First and foremost decision that we made was: REST API wont be into the core application. It would be an optional plugin. And in order to do that, We had to switch to engines plug-in. Don't know why, but I'm not happy whenever adding an external dependency such as a plugin to the application. So was the case with engines. Today I was browsing the commit history of rails master branch on github while I discovered a commit by DHH himself which indicated that from Rails 2.2, any plugin that contains an app directory would be added to load path. What does this means? Simply now you can place controllers, models and views in a plugin! No engines plugin needed! Not only that, but adding routes from teh engines plugin was not pretty much straight forward and it required few lines of code into your environment.rb and not only that, but your route.rb should be on root of your plugin and it mentions/draws the routes in a little bit different mannor then you'd be doing in your Rails application. But the news is that these days are gone too! Because from Rails 2.2, if a plugin contains a file config/routes.rb, then those routes would be added to the RouteSet because draw method does not clear out all the routes rather its additive in nature now. So in affect, engines plugin would not be needed for MyOwnDB for our REST API plugin to work. There are some other changes which were interesting to know regarding Rails 2.2 specially that your application.rb file is now called application_controller.rb and its a breaking change in that if you're upgrading to Rails 2.2, you'd have to rename your application.rb to application_controller.rb I had a chance to write a small client in Java that reads data from MyOwnDB through our REST API. More on that later! ;-) Best regards, Mohsin Hijazee