Sunday, 8 March 2009

An Ode to OpenSource

-Akshay Ranganath

Last week, in our office, we were working on building an application that needed some graphs and charting capability. Lots of options came up, from Flash, to Silverlight, CSS, AJAX and so on. However, when the timelines got clearer, we had to look for something that was fast and already doing most of the work..

The way we went about deciding on the solution and building a small prototype was a reveleation on how entrenched open source has become – and how we have started to take it for granted. Here's the story..

Graphing

The primary requirement was generating graphs. We had options like JfreeChart, CSS based charts, some RUI components like Flash and Silverlight.

Java based tools were too heavy for us. We wanted something to plugin with Apache web server. We did not need another app server – even though they may be free. This effectively rendered most options out – and we did not have time to explore option of changing technology from LAMP stack to Java/J2EE based stack.

Enter Google Charts – Its a free HTTP API. You just send data to be charted in a pre-defined format and the Google server returns you a nice graph as a PNG image. Just embed it and behold – your site has ability to draw charts! No excel, no complicated libraries. What's more – you canconfigure many things:

  1. type of graph – bar, pie, line
  2. colors for graph
  3. scales – especially for line charts to appear nice
  4. title for graph, legends and so on
and all for free. Development time for graphs – reduced to 0!

UI
Next question was how to provide a rich UI for generating these graphs. There were lots of answers like writing our own XhttpRequest to using Yahoo UI, Jquery and so on.

Finally, we settled on Jquery. It is simple, easy and very light. Compared to Yahoo UI's MNs of size, this entire library is just one file and provides ability for:
  1. DOM manipulation
  2. AJAX calls
  3. Simple effects like hide, display, etc.
Again – cost is zero and development is 0!

Environment
Next was the question of environment. Server we'd already decided was Apache. So again, cost is zero.. (Well, I was getting good at suggestion these zero cost solutions :-)

IDE
Next came the decision of what to use as IDE. Although we could have done a bit of R&D on this, we simply chose Eclipse since the installers were already available.

Test Environment
Since we were learning Jquery and testing it, we wanted a brower that could point out any Javascript errors and in an easy to debug manner. We also wanted to do a multi browser test – just to ensure that it worked correctly. So, we got hold of Firefox and Google Chrome. Both have a very helpful JS debugger (Firebug in Firefox is every developer's dream come true!) Safari too is free so we just got hold of that too..

So finally..
The result of all these solutions was that we managed to get a small protoype taking user input, sending data to Google, getting the chart and displaying it. This entire application took just about 4 hours of development time – most of which was spent in installation of software! It was amazing that so much could be accomplished with just a plug and start model. We did not have to invest time or money in getting any of the actual functionality to work – we just focused on the business problem of getting the right data for graphing. Everything else was just open sourced!

I was amazed at how we could achieve this all – and never give it a thought. So, I just wanted to say a big “Thank you” to all the people who took pains in developing such helpful software and publish it out so that the entire world could use it for their needs.

OSS rocks!

PS: We tested our application on Ubuntu and this blog was written on OpenOffice – something I totally forgot while writing the blog.. amazing isn't it how you get used to the OS being non-Windows and OpenOffice just makes you feel so much at for MS Office users (at least for most part!)

No comments: