Monday, 17 November 2008

Did you stitch any code today?

If I ask you - "Did you stitch any code today?" - will you be surprised?

You probably will be, but that's what we do everyday - if we write code for long enough we would have accumulated tried and tested methods which we use again and again in new programs that we write. We call it - "Reuse".

I call it stitching code - bits and pieces of used code strung together to make a bigger program.

There is no good reason for calling it so, it just came to me and my friends while discussing reuse one day.

With reuse, the problem is not only with identifying reusable bits of code, the problem is also that you want to store them somewhere, somewhere you can easily look at them and then put them together. It will be best if this "somewhere" was not tied to a single computer or an office LAN.

Everyone has their own means of managing their reusable bits of code. I used e-mail as a effective strategy - until I got to the current project where I had more than a hundred such pieces. I had close to 200 mails in my Gmail account and each time having to search them ( even using Google search) is not funny.

So what do I do??

Here is what I did. I built an application using Google App Engine. It authenticates you with your Google account, and lets you upload bits of code - any language. You can upload 100 such bits.
Obviously you name each snippet and attach a description. Because its on the Internet, you can use it just about anywhere you can access your email.

So if you are sitting in a cafe sipping coffee and using your net book to browse the Internet and your boss or friend calls you to ask for some code - or you just feel like doing something - you log in to this application, specify the names of all the bits that you want to stitch together and press a button!

You will see a program appear in front of your eyes using magic bits that you created not so long ago! And depending on where you are you can either execute it or just copy into a text file for running later.

This app is called "Stitch the code" and can be accessed at
http://stitchthecode.appspot.com

Do feel free to let me know what you think about it at anarahari@gmail.com !