About two weeks ago I wrote about Kiva, a cool website that allows people to make microloans. Almost one month ago they had started a developer site, including an easy to use API to access the data (loans, borrowers, lenders, etc).

I couldn’t resist the temptation to have a look at the documentation and start thinking about some application to use it. Soon after I started reading I came up with the idea of writing an Opera widget. There were a couple of reasons for that:

  1. I had never written a widget, so it sounded like a good excuse to learn how to write them.
  2. Widgets use Javascript, and that felt like a natural fit (as the API returns JSON).
  3. I didn’t really know that much Javascript (just enough to write a couple of event handlers), and that seemed a good opportunity to start learning the language “properly”.
  4. A widget in http://widgets.opera.com had more possibilities of actually being used than a random pet project of mine lying in some obscure repository of some obscure version control system (well, actually I ended up using Git for it, so it’s not that obscure in some sense; but you get the point).

So I started by learning a bit of Javascript. After asking around, the best thing I found to learn quickly was a very good series of videos by Douglas Crockford hosted in Yahoo! Video.

Then, I had a look at the excellent articles in Dev Opera about creating widgets and started creating one. As I had the idea of creating something that would show loans around the world, I started looking for HTML and Javascript for building maps, and found a very good article in A List Apart about accessible maps. The sad part is, once I understood how everything worked I destroyed the whole accessibility of the solution, but it was for a widget anyway (you have excellent support for CSS and Javascript in Opera, no need to have a fallback to show textual data in a widget) and my code ended up much much simpler and easier to maintain.

Finally, for Git, I had a look at the screencasts hosted in GitCasts. I already new some basic Git things, but I think I started to feel more comfortable with it after watching a couple of those videos. Still, too many references to the obscure objects and SHA names and whatever, but clear enough to understand your way around it.

In short, I have to say that creating the widget was easy enough, and it was lots of fun to write it. I had some frustrations debugging it, but things worked fairly well in general. When I finished it, I uploaded to widgets.opera.com and after a couple of days it was already approved and public for everyone.

So, if you want to give it a shot, just go to my widgets page and download the World Loanmeter! Enjoy it! :-D