Monday, November 24, 2008

Rama in Kaliyuga

Found this article here, and I found it quite funny. Cut pasting it as-is.

Can you imagine Rama’s men building a bridge to Lanka in modern India? I can see Rama at the local government office asking for a license to build the bridge. “Why do you need to build this bridge?” he is asked. Rama tells them that his wife’s been kidnapped. “File an FIR first at the local police station.”

So Rama lands up at the local police station to file an FIR. “Hmm,” says the inspector in charge. “First I need birth certificate, as proof that you exist. Then marriage certificate. Then ration card. Then pan number. Then chai-paani.”

Rama, with Laxmana’s help, provides the documents and a cup of hot tea. “This is not what I mean by chai-paani,” says the inspector, “but never mind. See, I can’t file your FIR because the kidnapping did not take place in my jurisdiction. You need to file it in the local police station there.”

Elsewhere Hanuman, caught trying to leap over the sea into Lanka, has been detained at customs because his passport is not in order. It’s all a mess.

Wednesday, March 5, 2008

Roop, The Almost Project Manager

College Kids: Hello Sir. We are from XYZ college Sir. We are looking to do some interesting project here Sir. Your manager said that you are the technical one, Sir. So, can you give us a nice project Sir?

Another College Kid: It has to be nice, Sir.

Me: OK. I can do that. Can you give me some idea of what kind of project you're looking to work on?

College Kid: Yes Sir. Our HOD said it should not have database Sir. Give us anything that does not have database Sir.

Me: OK. Actually none of the official projects that are going on, nor the upcoming ones satisfy that requirement of yours. I mean, everything we do is on database only. So, I'll give you a project from a certification exam called SCJD(Sun Certified Java Developer). It's the (second) toughest certification exam for Java technologies. The project's called URLyBird Hotel Manager.

College Kid: Aiyyo.

Me: What happened?

College Kid: The project should not be about any sort of management Sir. Aiyyo. Is there something with networks, encryptions or protocols?

Me: OK, Sure. Let us build an online messenger. We'll build a distributable client application that connects to a socket server. First, we'll do text messaging between clients. If we have time, we'll encrypt conversations using "BlueFish encryption". If we still have time, we'll have voice over IP protocols.

College Kid: That sounds very nice Sir. But messengers are already there no, Sir?

Me: Oh you've got to be kidding me! You want to build something that nobody ever built? For a college project?

College Kid: Oh, OK Sir. We'll get back to you.

Doesn't this remind you of the useful part of college days, project work? I, for one, surely wanted to build something that would change the way the world works, make the earth stop and rotate in the opposite direction. It is nice to have an imagination that's not restricted by the harsh realities of this industry. It's all database and management in here.

Anyway, these college kids seem to have lost their way back home. I'm guessing they got lost and were kidnapped by aliens who say stuff like "We try to make our organization feel like a flat, non-hierarchical one. Even though I'm your boss and I own your soul. So we do not address people as 'Sir' and all. OK?" I don't know what actually happened to them. Why would they not get back to me? It's the aliens, definitely.

Monday, February 18, 2008

Of Progressiveness and Disasters

I'm a big believer in the old saying "Results talk". Results, alone, talk. Which probably makes me a conservative person. The institution of marriage, when looked at from a conservative point of view, paints a pretty bleak picture. Bleak, because among the two choices people have (Love marriage vs arranged marriage), love fails miserably. The exciting stuff always fails.

If you look at countries where the majority of marriages happen between people who're in love a.k.a. "Developed countries", the divorce rate crosses a whopping 50%. More than half of love marriages end in divorce. Some guy in my family who had an "exciting" love marriage, just ended the whole thing. Which is why this topic came up today. On the other hand, if you look at most of the arranged marriages around the world, the couple tend to stick together forever. The right decision, when it comes to marriages, has never been simpler or more painful. It's clear, obvious, "right there". Arranged marriages work. Love marriages have much higher probability of failure. Ouch.

I like to embrace love for what it is, it's the spiritual positive; (fear is the spiritual negative). It isn't just something that you need to get a girlfriend/boyfriend for. It can just be felt and accepted as the ultimate source of energy and passion. Especially if you have no other option! I know that I have none.

"What happened on valentine's day?" Nothing. There's no one,really. There cannot even be anyone. The "perfect girl" for me is something like this:

She's young, about 3-4 years younger than me, very beautiful, from a classy, "high-status" family, belongs to the exact same religion and caste as I, well educated, well read, smart, possibly from the same state (Andhra, is it?), respectful towards her family and ours, orthodox, and jovial.

Of all those specifications, "JOVIAL" is the only thing I got to add; the other specifications are from my parents. That's how bad life is. I did have other things to add but if the list got any bigger, I might be describing a non-existent girl, maybe even an "impossible girl".

So, I've happily outsourced the problem of finding such a girl to the elders. "SHE HAD BETTER BE JOVIAL."

I'd said in a previous entry that Microsoft Visual Studio 2005 is my valentine. Maybe people don't get how serious I was: I love it, i trust it, it makes the majority of my "awake time" exciting as hell, nothing in the world can change how I feel about it. Oh wait, Visual Studio 2008 was launched one month back!

--
Swaroop Murthy
http://360.yahoo.com/swaroopmurthy

Friday, February 15, 2008

I am what I am because of who we all are!

Yes. I installed the new revolutionary Linux distribution called "UBUNTU" that's caught everybody's imagination. No. I'm not slowly but steadily turning into an open source geek. It's just that I'm not entirely satisfied with anything these days.

The last time I installed Linux was when I got a dangerous virus in the windows installation, causing all the data to be lost. "Install some Antivirus no, dumbo". Yeah, that's like saying "go to the gym, you'll look better". Things that I somehow never get around to doing. The distribution I installed last time was Fedora. It probably did many things well, but there was that one single power cut that fried the entire file system. The thing couldn't handle one stupid power cut. Being in Bangalore, it's a crucial thing that any system should be able to handle.

Much like being in a support job or a security job, these operating system companies run under extremely high pressure. People never forget the one thing that you did wrong, even if you did a million things right. Even when you did something right, you're simply keeping things the way they're supposed to be, you're not adding any value. If you're in a support job, do what I did: write scripts  to do your job automatically and go to sleep!

Anyway, why did I install Ubuntu today? Don't say it, I'll take the pain myself.  "Dumbo. Big fat dumbo." Ok. This system, my friends said, is far more user friendly than anything else you might have ever seen. Of course, it's not like you can install it and teach mom to use the web cam before going abroad for many years. But it's pretty great. Linux for humans, finally!

I'm thrown a bit off-balance when I write this. I just had the most incredibly exciting day at work, with my valentine. Microsoft Visual Studio 2005! And now I'm back at home, working around with the open source revolution UBUNTU. This thing is bloody fast, lightweight and gorgeous looking. Hopefully, it can maintain its impression for a long long time before it gets dismissed as "another thing that doesn't come from Microsoft".


--
Swaroop Murthy
http://360.yahoo.com/swaroopmurthy

Tuesday, February 5, 2008

IT Slowdown.

As expected, the slowdown in IT has percolated it's way into India. TCS has asked 500 of it's employees to resign. This move is after cutting 1.5% of all the employees salaries. TCS HR head has moved out to Tata Power. He was believed to be the reason behind low attrition rate at TCS till now. IBM too has laid off around 700 employees according to an unofficial report.

Is this the beginning of an end of Indian IT growth story? Have your say.

Friday, January 18, 2008

My job is good too

This blog is our group blog. Sometimes, however, we beg to differ amongst ourselves. This is one of those times. I generally don't, as a rule, attack people for their opinions. At the end of the day, its after all, their opinions and its worth just 2 cents. Some things in the recent blogs here needs to be set straight. Here goes nothing:

I work with the best people in the industry. I wont justify that. I don't need to. I work on one of the most revolutionary products around in the industry in the product's field. Again, I cannot talk about it right now. I will soon though. I work in a team where the product manager is a hard core techie, the author of Frankenstein. The delivery manager and tech lead is the same person who can do both, while delivering stories! The senior developer is one of the best developers and more, thinkers I have had the pleasure to meet. Same goes to the tech lead. 2 remaining developers are senior to me and kick ass in technology - one, geek to the core, other, intellectually so. 2 QA's - both with more experience than others I have ever met, analytical in thinking, kick ass at their work.

Now, that was just for your information. In fact, each and every team in my company are like mine. Why do I even mention all these?

To build a revolutionary product or a company where all the best, not just in technology, in the world want to work is not an easy task. You cannot just attract them with money nor with just technology. However, the main reason I see people staying in my company is because THEY LOVE IT and THEY HATE IT. But isn't it obvious? You have to have both the feelings or else you will be bored. At least, I would be. I hate it because my company is not perfect. It is perfect for me. I wouldn't compromise on that. But it still isn't perfect. I would settle for nothing less from it, because, if not us who else?

There is this story about 2 workers building a wall for a temple. I am sure you remember the story. According to me, its obvious. I am sorry if I sound cocky, but its obvious that you need to understand that you are building the temple. If you are just following rules and doing what you are told, you cannot be the best. But I work with the best. The best can,
1) Build walls
2) Know that they are building a temple and
3) Build the temple finally

I think it is also done in the same order. Everyone who can think for themselves would be able to do (2). That's the part about having a big picture. To be able to do what I do day in and day out, to be able to work on each and every project we work on it is an implicit requirement that you understand the big picture. Nobody tells you what to do. You decide what is to be done. You and everyone else in the team. The thing that motivates everyone at where I work is that single idea of big picture.

I agree code is details and implementation. Someone has to do it. I believe in hats. I will explain the whole theory in some other blog, but for now, just think of each role as a hat. So, I analyze something wearing my "big pictures person" hat and implement it wearing my "developer" hat. Then show case it and sell the idea wearing my "marketing" hat. I am still one person doing different roles. I would rate myself good too. I may not be a great public speaker, but apart from that, I am pretty good at what I do. I know that was naive but was called for.

I think working on dinning tables is one of the best things ever. What you have to understand is you are given freedom. Nobody would eavesdrop on you. Also everyone you ever want to interact with, with respect to a project is around that table. Imagine removing all the cubicles and corner offices in your company and think of the whole of your team made to sit on dinning tables in a manner that makes sense. How many IM/Mails/Phone calls do you think you would save? And how much time? It may seem claustrophobic - completely lacking in privacy. But you cannot judge it unless you follow it. I, for one, have been in both kind of set up and have chosen my favorite. Don't you think you need to do the same before dissing either one of them?

We, in fact, do not care if you produce million dollar contracts, unless it is to our standards. If I were allowed to, I would have talked about our sales process. I am not. So, I wont brag about it.

We have been in the business from 16 years. We are not a publicly held company. I don't think that will ever happen to be honest. I would be very sad if it does and people at work know it and share the same feeling. We are truly employee owned. I am sure you can imagine why this is. We don't give a damn about quarter results. Actually we do. A lot. But I don't think we will ever do things so that our stocks would go up. We are way too egoistic for that. Also, most of us are green capitalists and socialists. I am the former.

I have a job which is currently perfect for me in a company which is truly the best in the overall sense. Hands down. ThoughtWorks is the best.

Friday, January 11, 2008

Of Lengthy Answers And Contracts

Back in those engineering days, we had to write very lengthy answers to score marks. About an entire page for four marks. The people who evaluate these things never actually gave a hoot about what you wrote, but then your answers had to have the following qualities:

1. It has to be of the "right size".

2. It has to be neat.

3. Lines drawn with pencil and scale after each answer, if possible.

4. All the words in the question must be there in the answer. Highlighted in fluorescent green if possible.

A lot of people in class truly understood and played this game well. They would write on and on, pretty much repeating the same points using different words. Even in the few cases where they didn't get the full score, they'd go and fight like so: "Sir, How can you give 3 on 5 for this answer? See this, full page here and the neat diagram half of that page. I deserve 5!" And they'd get it, with due apologies from the lecturer in charge.

Having worked with my company for five quarters, I've come to realize that this is a very useful skill to have, the skill of writing lengthy answers. Each time we put forth an idea to the client with the hope of turning it into a contract, we have to write what is called an approach note. The document template has such sections as "Current process", "Improvements Proposed", "Advantages of implementing the suggested ideas", etc.

When I'd joined the support team (very long back), I had the idea of "Let's stop staring at production logs, we'll build something that will notify us of exceptions through email." The only real advantage of this idea was: I don't have to work. (2. I can do more useful things in life, like sitting in the canteen watching the AMEX vs Phoenix cricket matches. 3. Go to gym, which will lead to good physical growth. Hah! I'm good, too.) But, thanks to being educated engineers, we were able to fill up the "advantages of implementation" part of the document gloriously:

1. Increased stability of the systems.

2. Decreased response time for system issues leading to increased stability.

3. Decreased effort required for monitoring leading to decreased response time leading to increased stability.

4. Hey, these are live production systems. You want stability or not?

5. Increased profits due to increased reliability from the increased stability.

6. Increased business capabilities resulting from the increased profits mentioned in point 5.

And so on! OK, it wasn't exactly like that, anybody's blog has a little embellishment. But it was very much like that, the approach note we sent. My managers have given me extensive training on how to convince clients. "Assume that they (clients) don't know anything, not even the word 'Java'. All the understand is business, dollars, profits and costs. Say everything in these terms." So the contract got through and I had interesting development work even in the support team.

From these experiences, I have come to the conclusion that education wasn't a total, 100% carnal waste of time. It's just 99.999999999999999999999% now.

Monday, January 7, 2008

Trip To Ooty

January 5, 6: On this, the very first weekend of 2008, Abhi, Sudhi, Ketan and I went on a trip to Ooty, which is a hill station somewhere north of the Pacific Ocean. (Don’t listen to me; I have as much direction sense as a stuffed tiger.) Speaking of directions, our first destination was Mysore, the famous city west of Bangalore, given that you take a left turn at that point before Mysore road where people can turn left or right.

MYSORE:
This city is kind of like Bangalore, (it belongs to the same state) but has maintained its ethnicity very well as its infrastructure developed. In other words, “we saw no babes”. We went past the famous Mysore palace very quickly, deciding to get back to it later and went ahead to a great little hotel called Mylari, somewhere northwards, I remember the left turn. This is one of those tiny little places that makes the greatest-ever dosas, much like Bangalore’s Vidyarthi Bhavan, Janata hotel and Domino’s. After the awesome breakfast of butter dosas we went back to that big green circle and continued west, towards:

GUDLUR:
It’s not much of a town; its raison-de-erte is to simply connect Mysore to Ooty. It does have a few shops, where we grabbed some chocolates and banana chips and continued east or something. In a couple of hours, noon, we reached:

DECISION POINT:
There was a good road and a bad road both leading to Ooty. The bad one had great sceneries while the good road would get you to the destination fast. This is when we remembered the instructions that were passed on from our wise forefathers “ALWAYS PICK THE BAD ROAD”. This took us west, till we reached that beautiful place:

THE SMALL HILL WHOSE NAME PAVAN WILL KNOW:
This spot is very beautiful and scenic. I suppose one famous scene of a Kannada movie, “Mungaru Male” was shot here. According to Abhi, so was Ananth Nag. Yeah, we’re still talking about the movie. And then that Kannada hero sang in Sonu Nigam’s voice, Kunal Ganjawala’s voice AND Udit Narayan’s voice till the heroine (who held her own with Shreya Goshal’s voice), shot him on the forehead. It all happened in the backdrop of THIS hill, which we will repeat because it’s true, is very very beautiful. After spending two hours here, we went forth till we hit:

A VERY LARGE TREE:
Not really.

FROG HILL:
A series of hairpin bends and blind curves amidst the beautiful, natural background led us to a high viewpoint on top of a hill, where finally, there were babes. The view was beautiful, and Ketan had the time of his life shooting photos with that new camera of his. We’re talking about nature now, not the babes. After a while of making “king of the world” noises from the viewpoint, we headed further up and reached the actual destination:

OOTY:
It’s called so because “Udhagamandalam” is quite a mouthful. It’s a very low temperature town in Tamilnadu, which is famous for tea (OOH, tea!), home made chocolates and carrots. We ate lunch at a restaurant there and went to the Ooty lake. It’s a nice little lake that offers boating (the pedal boats are incredibly painful) and a mini train. What the hell, if we’re going to go to a hill station in the middle of winter, we might as well climb onto a kids’ train. After some miscellaneous sauntering and dinner, we ended up in:

GARDEN VIEW HOTEL:
Some room somewhere on some floor has a view of some garden. It was a decent hotel room with good service, albeit overpriced. After a good night’s sleep, we left and headed right towards:

DODDABETTA:
That’s a big mountain, which offers great views and charges hefty parking fees. It even offers a telescope around which so many tourists gather and fight that nobody gets to look through it. Along the way up, or the way down, you can visit:

THE TEA FACTORY:
That’s the name of a factory. Yup, “We went to a tea factory called the tea factory”. As the name suggests, it’s a very small factory that’s also a museum, a place where you can take kids for a field trip. They offer you a great cup of tea at the end, very good taste. Having enjoyed the tea and bought some packets, we headed south to:

THE OOTY BOTANICAL GARDEN:
A totally “DUH!” kind of garden that has a lot of grass and some occasional “DUH!” flowers here and there. And then we went to a place that DOES NOT HAVE BLACK ROSES:

THE ROSE GARDEN:
DUH! Red and Orange roses. Flabbergasted, we went:

BACK HOME:
On the way back, we encountered some wild elephants, tame elephants, wild boars, black-and-white-monkeys AND stuffed tigers across the Bandipur forest area. Free. Didn’t even have to pay for a safari! Then we came across Gudlur again (stopped for lunch), Maddur (vadas for dinner), Mysore palace again till we got to R.V. College, the place where we all studied. Driving past it at 90 kmph gives me an inexplicable sense of pleasure. Education is over for good, for the rest of my life.

We were finally at Ketan’s place, we parted after going “WHOA!” at the amounts we’d each spent for this trip. But it was totally worth it.

Friday, January 4, 2008

Happy Birthday, Whoever

If it’s your birthday today, I hereby wish you many happy returns of the day!

It’s quite amazing, how some people can perfectly remember everyone’s birthday without using any reminder service, or gadget, or even noting them down. They just care a lot about other people, even more than they do about themselves, and belong to an ayurvedic constitution called “Kapha”. Which brings us to today’s topic of discussion: Ayurvedic Doshas.

In the ancient Indian system of medicine, called Ayurveda (ayus is life and veda is science), the entire universe is made up of five elements: Earth, Water, Wind, Fire and Void. (I didn’t forget the fifth element, if that’s what you’re wondering. It’s really called void.) The understanding of people (psychology) would be based on Doshas, or constitutions, each of which is made up of some combination of these five elements. In the system, there are three main Doshas and all human beings have all these doshas in their own unique combinations. Let’s explore these doshas in an attempt to understand ourselves slightly better.

Vaata: This dosha is made up of earth and wind. If you have dry skin (earth), a naturally slim build (the statistically general case) and are very restless by nature (wind), you have a lot of vaata in you. People belonging to vaata are generally very creative and simulating conversationalists. They’re totally spontaneous, a lot of fun to be around. One week they’ll be talking about this great new project they just started “You know what, I’m going to write G.R.E and study engineering abroad!”, and the next week they’ll be talking about another new project they just started “You know what, I’m going to go write CAT and study management!” “What happened to G.R.E??” “That was a totally stupid idea.” And the same thing’s going to happen next week. Making plans and sticking with them is totally against their windy, volatile nature. Too much vaata leads to restlessness and lack of sleep. These people do great work in creative fields.

Pitha: This dosha is made up of wind and fire. Pitha people generally have a medium build, neat and tidy hair, and a general heat about them, the kind of heat that comes from being extremely ambitious (fire). These people, by nature, have high digestive power in all aspects of life, starting of course, with the rate at which they metabolize food and the speed at which they can learn. They are very goal oriented and seem to turn every little thing into a competition. They’re highly organized and disciplined, and probably have immaculately maintained rooms and cubicles. Their ability to stick with plans and decisions make them fantastic leaders. In any project, the Vaatas are good starters and the pithas are good finishers. Most of the great leaders today, be it in business or politics, belong mainly to this constitution. Too much of pitha can lead to health problems related to (of course) digestion.

Kaapha: This dosha is made up of earth and water. These people are generally overweight and have moist, glowing skin and hair. They’ve a lot of glow in their nature that comes, of course, from water. These people have high emotional quotient and make friends easily. They’ll remember your birthday perfectly, they’ll want to wish you at 12 A.M, and they’ll easily forgive you for not remembering their birthdays. So much genuine love and selflessness, the only thing they expect from you (probably) is to spend time with them. In corporate world, you’ll find them sticking with a company for many years even if they don’t like the work, just because they love the people there. Almost all moms are Kaapha personalities.

Someone might have made up that whole thing just to say “I’m very sorry, girlfriend. But it’s not my fault that I don’t remember your birthday. It’s nature’s problem, I’m simply a victim.” But seriously, there’s nothing to believe in here, it’s simply an old system for understanding people.

Remember, everyone has all three doshas in their nature, but in different proportions. These proportions can change by age, upbringing and a whole lot of other variables. For example, most kids are vaatas, most middle aged people are pithas, most old people are kaaphas.

Think about what makes you you, in terms of these constitutions. Then think about goals and ambitions (if any) and what kind of a person you’d need to be to have them; it’s very simple to make the necessary changes and bring balance. As an example, if you have trouble sticking to a plan (vaata imbalance), the solution is as simple as making tiny little plans, fulfilling them and working your way up to bigger plans. Simply act against your nature till it becomes habit.

Perfectly balanced constitutions do not convert you into a certain stereotype, rather they enable you to be the best you can be, to let your uniqueness shine through in your work and your life.

Thursday, November 29, 2007

Frankenstein - Swing Testing Tool

I am a committer on the open source project Frankenstein. Its a swing testing tool. You can go through this presentation by Vivek Prahalad. You can also watch this talk at GTAC to see more about the tool.

The tool came into existence as a necessity on one of the projects at ThoughtWorks. Vivek had done the crux of getting the tool ready. Some cool features:

1) Testing mutli-threaded Swing App without a need for explicit waits due to threading.
2) Identifying all basic components present in AWT, both for playback and recording.,
3) Ability to record and playback both in Ruby as well as Java.
4) Ability to test applets.
5) A fall back naming strategy to identify controls which aren't named appropriately.
6) Assertion API in the driver interface for Thread Safe assertions.

The most important among these which makes tests from being flaky is the implicit waits. One needs to follow a naming convention, which can be obtained from the doc, when naming their Worker Threads which carry out some operation in the background and Frankenstein monitors these threads and waits till they are done. This means there is no need for explicitly adding sleeps in your Swing test code which otherwise makes test very flaky.

One thing to keep in mind is that Frankenstein uses AWT Robot. So, one has to keep the application in focus for the components to be identified.

Currently, I am working on the ability to remotely drive Frankenstein through Java. Frankenstein takes care of bootstrapping your Swing application which means both the testing tool and the application under test will be in the same process. Sometimes, for various reasons you may want the test itself to run in a different process. This is how the Ruby Driver works by default.

If you are interested to know more about this, leave a comment here. Do visit the OpenQA forum. Vivek or I will indeed answer any queries you may have.

Tuesday, September 25, 2007

Random Newbie Stuff

This post is strictly for people who have just entered into the software profession. I have jotted down some random things that I have faced myself or seen other people do wrong here. The solutions may seem to be pure common sense or banal, but I take that risk of being obvious because I know a lot of people who lack common-sense.

When I was coding in Fortran and C just to get something working, first days as a programmer, I never bothered about anything. I just wanted to get something done, by hook or by crook. Then, after joining a formal course on Computers, I had this notion of a good programmer being someone who spews out code which works on the first go. No errors, compiler or otherwise. Just works. Now, when I recollect what I used to think in those days, I almost feel its so lame that I shouldn't admit to it. But then, you learn soon after shooting yourself in the foot enough number of times that its just not worth it. You have to start coding and face the problems as they come. What I have found out over the years is that it is not only insane to try to write error-free code without actually coding, but also totally unproductive! I agree that human brain is a marvelous thing, but why waste it on stuff which a computer is kick-ass in doing. Don't sweat a lot about syntax and stuff. You anyway have Google, if nothing else. I suggest you, of course, learn the syntax and stuff, but there is no need to memorize it, like a lot of people I know try to do. You will remember stuff if they are important enough. Others, you can always look them up.

A lot of people like to talk about high level, abstract, potential "solution" to a lot of problems. They think and analyze for a long time and fear getting their hands wet. I know I used to do it and I know people who still do. All I can say is that its sheer "balls". You cannot just talk about problems. You have to get down to code at sometime and actually solve them.

Something I have found out is people don't learn the right things at the right time. If you are learning Java, there are reasons why you should, I would suggest you start from the command line and go through the Java classpath hell before you start doing stuff in an IDE like Eclipse or IntelliJ. You need to know how things work under the covers, irrespective of what it is that you are learning.

Something that boggles people down is the size of a code base, either when they join a project middle way or when they have to understand how something works. One thing you need to understand is that it is written in a language, I assume, that you understand. Just think of it as a novel or a text book that you need to read. The chances are you cant digest everything that is there in a day or even in a week. Just like reading a book, you need to start from the beginning, logical i.e., and then move deep into the code base. You will surely finish it, sooner or later! Just like a book, some code appeals to you and some don't. Its up to to you if you really want to work with some code or not. You can always do this. Or bail out.

A few things that I can think of which are done blatantly wrong and which can be fixed easily, with some mental effort.

Tuesday, September 18, 2007

Redesign the World

As a professional programmer, one of the things I constantly crib about is the fact that NOTHING fits my current requirements. No single tool, no open source library, no neat application, no nothing. I just get frustrated. Something that I want is automation. I don't want to be bothered with repeating something more than twice. I get all pissed because I have to do it. If its repetitive a computer got to do it. Why in the hell would I want to waste my time and effort??

Sometime back we were using Antlr as a Parser on our project. Given the simplicity of our grammar, we thought Antlr would be a perfect fit. But turns out, it was not! It was so painful that we replaced it with a hand written parser in about a day. With complete test coverage.

Given this attitude of "Redesign the one tends to redo a whole lot of things. The most important thing to keep in mind when you want to replace something that already exists and is very irritating is that it solves the problem. Doesn't matter if its not done well, if its slow etc etc. Because the chances are, by the time you reach where that tool/library is, you would have inadvertently ended up making some compromises or hacks every now and then yourself. Unless of course, there is a very strong reason such as the project productivity/velocity is getting screwed etc. to replace the tool.

What's more important is to be wary of what I call the "Quick-Win" syndrome. When you want to replace, lets say, Cruise Control or Selenium RC, its easy to get carried away thinking, "Its just a freaking while loop" and start off. The chances are you will get the basics quiet right, in fact may be better. But there are so many corner cases and issues that something like CC takes care of which were shielded from you that you just wont be able to "hack it" away to glory in a weekend. You will get a quick win in the sense that it works perfectly well in the happy path and feels Oh-so-close-now to the solution that you wont be prepared to give up until the contrived corner cases start biting you. But its just normal that you think its just one of those things or lets just hack this one away quickly which ends up in something "enterprise" like Selenium RC.

All I am saying is, when you want to replace something once and for all, don't think of it as a weekend hackday thing. Especially if its something big. So, take your time and make some wise decisions before starting off.

Friday, August 3, 2007

Mundane Problems

I have an IOC container with some beans which are listeners. I have a POJO which is in itself a listener to some events. I want to notify my beans when the POJO gets notified of some event. But, because of some intricacies in how my container works into which I won't go, I have to get the list of all beans only at the time when my POJO gets notified. Kapeesh?

Well now the problem is I can hack my way out of this by passing an instance of the IOC container to my listener which will then get a list of all the listener beans in it and notify it away to glory. But then, my POJO now needs to know about an IOC! Damn. So, I won't want to do this. This is how we solved it:

We created an interface which provides the listener beans to anyone who wants to notify them. Then injected this interface to the POJO. This is how it looked:


public interface BeanListenerProvider {

List getBeanListeners();

}

public class POJO implements SomeListener {

public POJO(BeanListenerProvider listenerProvider) {
this.listenerProvider = listenerProvider;
}

public void getNotified(SomeEvent event) {
//Do Anything...
foreach (BeanListener listener : listenerProvider.getBeanListeners()) {
listener.notify(new AnotherEvent());
}
}
//Whatever follows...
}


The good thing about this is that I now have the POJO decoupled from my container. This may be a rookie thing to do but it is easily lost when you are working on a Friday afternoon after working a lot with Eclipse code base. This led to an interesting conversation with Hakan, my teammate, about being a pragmatic coder as against being an idealist coder.

A lot of problems are mundane. Its only what you do to solve them in a clean way is going to make your work interesting. A clean code indeed gives one a kind of satisfaction which nothing can beat. OK, may be sex, but that's about it.

Friday, July 27, 2007

Weekly Review - "Next"

I am late by a year. Sorry about that. Apparently, I was wrong when I said this. "Next", the recent Michael Crichton's book, was a complete waste of my time. For one thing, I just dint get what was Crichton's point. OK, so, the chimp talks. OK, so, the parrot talks. OK, so, something weird has happened to some turtles. OK, so, ah, wait a minute. What? Are you just repeating stuff or, ah, FUCK IT. It was really not worth reading it. I hope Micheal Crichton starts writing in his usual self, or else it will be about time I stopped reading his new books.

Current Work Pattern

Finally! I got the much longed for time when one can ramble on the net for random people to see. I mean you people. So, lets get on with it.

These days I have been working a lot. By that I don't mean I am working like Abhi, where you just work for the heck of it and are always bitching about it. I am enjoying a lot at work these days. I reach by about 10.30 in the morning. Break for lunch for about 25 minutes. Then work till 7. Play Unreal Tournament till 8. Then leave and come back by 9. For me, those are long hours.

Thing is, I am amidst some really kick ass people with loads of experience and exposure. My team has only 5 people, 3 other developers and a QA. All with at least 6 years experience. I am working with him, him and him, all developers. Some of the more geeky-cool people at work and incidentally in my project. Especially, Hakan is one funny person and is a very and I mean very pragmatic person. I just love all the discussions, technical or otherwise I have with these people. All the vehement talking in TGIF is not to be forgotten. Good for me.

On an other note, one of the things I was thinking about lately was, "Is technology a means to an end or is it an end in itself?" A very philosophical question indeed. And I am sure a lot of people at my work have a ready answer, An end in itself. But some of the more introspective ones may say, "Hmmm, depends." That is exactly the answer I get from a lot of people. They just don't want to commit to a side. Only a few people know why they shouldn't be taking a side. This is indeed something that can potentially lead to a long discussion. Can't wait.

Discussions till now: Why should Earth be Flat, Why Shouldn't Earth be flat(Discussed after about 45 minutes of rigorous drawings of flat earth on our story wall!), Is it sensible to have a fear of Aliens, Education vs. Creativity, Intelligence - Fucked if I know what it meant, Genomes and People are stupid.

Monday, June 4, 2007

Code Poetry

When you listen to good music, anything that you perceive is soothing or whatever qualifies music as good to you, you will feel a sense of satisfaction. Even though the music itself is not yours, you can always enjoy it. Ever read a piece of article which is crisp, to the point and yet drives the point in such an affirmative way that you are just happy that there are people who write without bull-shitting? Then there are the sculptures, the paintings and a whole lot of other arts which require an artist to create them but even more, people who appreciate the art itself. I am going to write about a form of art which is lost among a lot of people. The art of writing code, the cosmetics of it rather. Some of the key things to keep in mind if you want to write code that appears like poetry:

* One thing I think is the key to art is that there should be nothing redundant in the your work. It kills the genius behind the art itself. In the same way, there is no place for something which has no purpose in your code. Get rid of those variables and fields which you have because you think they may be useful in the future. Get rid of private/helper methods which are not used anymore. They are like random noise in a symphony.

* Claustrophobia is not something that only humans suffer from. You can't expect to write "The Prey" by Michael Crichton in 3 pages and expect people to read the whole thing. At the same time, I won't read a 10,000 page version of "The Prey" either. I enjoyed reading the 400-odd paged version thoroughly. The content mattered only after the spacing was properly. So, keep in mind to leave spaces as required by the conventions of the language that you are using. Like a space after an "if" and before the start of the parenthesis of the condition in Java, etc. When you write code, don't be prodigal in leaving white spaces and empty lines. They don't add value. They are a distraction. More often than not, people wonder as to why there is a new line and if they missed some logical separation marked by the demarcation. Follow the conventions all the time and be bold only when the situation calls for "dire" measures, and even that only when it comes to leaving a new line.

* Don't initialize local variables on one line and use it in the next line alone and nowhere else. You don't need such variables. For example:

int length = someList.size();
doSomething(length);

Here, there is no need for you to use 'length'. In fact, I would argue that the intent is much clearer when you write something like:

doSomething(someList.size());

Here you know, without an extra level on indirection that you are "doing something" with the size of the list. Traditionally, having a lot of variables was advised because function calls were very costly. But there is such an advancement in processors and compilers that there is virtually no difference between using a variable and a getter method of the variable. Given this, I would write something like this:

foreach(String name : getNames()) {
//whatever
}

This is a nice way to write "for each" statements without using local variables for the lists/arrays and you will appreciate it once you start using it.

* If you are programming, say in Java, make sure you choose an order in which you want to import stuff, so that it is consistent over the whole of your project. This keeps things neatly. For example, I would have all the bundled java classes be imported first. Then other stuff which are, say, javax stuff. Then I would import stuff which are from my project. This way when I, say, create a patch between my older version of a file and a newer version, I can be sure that if there is a change in the import, its because of a change in the code that affected it and not the order in which stuff are imported. In fact, I think this is a really important code cosmetic if you are using code versioning.

* Try avoiding the use of comments for private methods and variables and instead use a name which suggests what it does. The use of a good name is something that is emphasized the most by almost everyone but is something which is either not leveraged or abused beyond any use. Don't keep a constraint on how long the name should be. At the same time avoid using articles like 'a' and 'the' and try making the method sound like a sentence when it is read with the argument that is sent to it.

Most of the stuff here are in fact built into IDEs for the language you use. The options to do these may be obscure or obvious, based on the quality of the IDE itself. Its important to use them to write clean code.

These are some of the things that I think which makes a code appear clean and pure, like an art. I have seen some seasoned OO programmers who use these rules and many others and just to see them spew the code out is like watching someone paint. And the code itself reads like poetry.

Friday, June 1, 2007

Hacking

I know the media has hyped up the word "Hack" and "Hacker" so much and so bad that the true meaning of the words are lost among the masses. But what really ticks me off is that even a lot of people in the industry think I "broke" into a website or some network where I am not supposed to go and got my work done when I say, "I hacked my way around this stubborn problem". Illegally. Yeah, right, if I were a "Black Hat" I wouldn't dare write stuff with my identity so blatantly given away!

So, here's what Hacking means - HACK
And here's what Hacker means - HACKER
And the actual word which stands for "hacking" as people conceive is - CRACKER

I hope this makes a difference. Thank You.

Tuesday, May 29, 2007

On the Lot!

This new reality show on Star World, is just amazing. It has everything that a movie buff would want to watch. This show is about selecting the best director for the $1 million contract with DreamWorks. It somewhat resembles The Apprentice but it's nothing like it.

The show started off its first episode with 50 wannabe directors selected of the 12000 lot. These are selected from all over the world, not just US. They were asked to pitch a story based on the logline given to them. Some pitches were so good that the audience actually lived through them. Each episode tests for the directing skills in different areas like comedy, horror etc.

Steven Speilberg and Mark Brunett (Survivor, The Apprentice) have produced it. Distinguished directors Brett Ratner (X-Men), Carie Fisher (Star Wars) and Garry Marshall (Pretty Woman) are the judges. They give brilliant reviews unlike The Apprentice trio who just focus on blasting and searching a scape goat. Moreover, you don't have to see the contestants fighting with each other selling a Donald Duck sticker'd water bottle. There are no made up fights or fake emotions either. I mean, on Apprentice, a guy irritates his team mates by sleeping all the time, while on a particular task and don't get eliminated. In the next episode, he is an amazing leader and the previous manager will be acting dumb and eventually does a lousy job. Finally, one of these would end up being the winner and the judge in the next season.

None of those crap are there on this show. You can watch it at 10pm Tuesday on Star World in India.

Thursday, May 24, 2007

Me and ThoughtWorks.

Yesterday, I had been to ThoughtWorks (You might want to click on this link! I don't think that it's their official website.) That place was just incredible. It was a fusion of say, a design firm and a lot of geeks workin in a software company. Right from ambience to crowd, everything was good. They have everything in their pantry that my current office lacks. Literally everything! The lunch out there wasn't all that great but then again, at least they have free food, unlike some places, where you have no food at all!

So, why did I go there? I had an interview. As I said, I loved everything about that place but my interview. It was disastrous. I stammered, fumbled and was not confident while answering, I went blank, like the whole time. All in all, I blew it.

Initially, they started asking questions about the concepts that I had used in my final year project. Later on, as the interview progressed, they tested my knowledge in basic Computer Science concepts. In the end, they probably would have asked me about my hobbies etc etc, but I dint make it to the end. It was one of the best interview's that I have attended. The fatal mistake I did was that I lead the interview exactly towards the concepts I barely knew.

In the end, HR spoke to me well, helping me figure out what went wrong. I had this sentence going on, in my mind, which a classmate of mine had said seriously in college. "Given the opportunity, time and resources, I'll prove myself!".

I was overwhelmed with my yesterday's experience. If you care about your code, you should try it too. Btw Abhishek and Chethan have got calls from ThoughtWorks. Hope they get through and give us DIFFERENT treats :)

"I learnt something yesterday!" (Like kayle from Southpark) You should always pick your company based on work and not pay. (Yea Yea! I know that you already know it). Anyways, so I decided not to apply for any other company but (thoughtworks and few more!)