Talk

Seven habits of highly ineffective software engineers

I have come across many instances of engineers develop these habits over the years without realising the negative effects.

1. Design? What design?

Let me just bang the code out in a few hours, and we shall see what happens. I don’t need a whiteboard. I don’t need a design spec. I can visualise it all in my head. I am a genius.

Effect:

What usually ends up happening is that folks need to continuously rework the code because they missed a major detail somewhere, thus increasing the overall development and test duration.

Solution:

Writing or drawing out a basic design for a fairly large problem and having it vetted by peers goes a long way in ensuring that one spends their coding time effectively.

2. Over optimistic => Over promise => Over deadline

I do not foresee any problems coming my way when I implement the 5 features I plan to work on this month. Nothing comes in my way. I am an optimist.

Effect:

You run into dead ends with a particular feature, and you need to get help from a colleague in a different time zone, resulting in adding X number of hours into the schedule. And then you scramble and roll out crappy code, or simply miss the deadline.

Solution:

Scoping is one of the more harder skills of being a software engineer, so better to be safe than sorry. If you finish what you said you would, then roll out a couple more items. Under-promise and over-deliver!

3. Reinvent the wheel

I am not going to waste my googling to check if someone has already implemented a library. Why waste time when I can write code. Isn’t that what I am paid to do?

Effect:

Spend a few hours writing code, when you could have spent a few minutes using a standard library or a suggestion by someone on stackoverflow.com.

Solution:

If it seems like something that someone might have come across, there must be a way to handle it, without starting from scratch.

4. I don’t need to run tests

I am only changing a few lines of code in ‘my’ class and ‘my’ function. Why would anybody else be affected. The tests will definitely pass. I am a rockstar.

Effect:

Expecting the code to run correctly without running tests is suicidal. Just makes for more work when the breakage is detected and panic sets in a day before the release.

Solution:

Have your tests ready before your code, and run your tests even if you believe your code is not going to break another parts of the system. If all tests were assumed to pass, why have them in the first place?

5. Naming Variables i, ii, iii

I know what the variables denote. I don’t care if its not obvious to others. I am a (wo)man of few words (or letters in this case).

Effect:

People reading your code have no idea what the variables denote thus making it harder to understand it. And if there are no comments, it only makes things worse.

Solution:

Use descriptive variables names as far as possible.

6. Complex is better than simple

I am so good that I will make the code complex. People who read it will not get it, and think highly of me. I am a champion.

Effect:

Sorry, people will be pissed off. Simple is beautiful.

Always code as if the person who ends up maintaining your code will be a violent psychopath who knows where you live.
— Anonymous

Solution:

Make it only as complex as it needs to be. Choose simplicity whenever possible. It just makes everyone’s life easier. And there will be many opportunities to develop a solution for a complex problem.

Programming can be fun, so can cryptography; however they should not be combined.
Kreitzberg and Shneiderman

7. Ctrl-C + Ctrl-V

Let me just copy this code and use it where I want. Who cares about duplication. I am lazy.

Effect:

Duplication. Double updates. Multiple copies of mostly similar looking code adding to the maintenance nightmare.

Solution:

Factor out common parts into a more generic function. Re-factor now rather than later. Run tests to make sure everything still works.

This happens more often than one would like. A little more big-picture thinking on part of developers would help matters. But I strongly believe the following to be true:

One principle problem of educating software engineers is that they will not use a new method until they believe it works and, more importantly, that they will not believe the method will work until they see it for themselves.
–Humphrey, W.S., “The Personal Software Process”

Advertisements

“Randomly” selected at Logan airport

So I was looking forward to traveling to South America, and was flying off to Miami from Logan Airport, Boston to take a connection to Lima, Peru. The excitement began at the security check itself, really. After I cleared security, I was asked by a TSA officer to step aside as there was an additional step of security that day. I wondered why I was the “chosen” one – it was quite obvious since I was the only south-asian guy in the long queue.

First, another TSA guy frisked me. He explained in detail how he was going to perform the check, and I obliged. After the frisk, he ran his gloves through a detector, which seemed odd. Later I would find out that it was an explosives detector. Wow!

Now it was time for the fun part – questioning! The orignal TSA officer had a side-kick who began searching my carry on back-pack, while the main guy starting asking me questions. Some were normal, some weird, and some outright amusing. Here is how the conversation went:

TSA: How did you get to the airport?

Me: My friend dropped me here.

TSA: Have you had anything to eat?

Me: Yes, I had lunch a couple of hours ago.

TSA: Can I see your documentation?

Me: Yes (I showed him my passport)

TSA: How long did you take to pack your bags?

Me: A little amused, I said a few days.

TSA: So you have been planning this trip to India for a while now?

Me: Again a little amused about his assumption, I said I was  not traveling to India but Peru.

He and his side-kick exchanged glances, and smiled, and acted as if they had never heard of Peru. To keep it light, I continued to say that I was meeting friends there, and we were planning to go to Brazil too.

He smiled, and seemed convinced, but I could sense he was getting a little desperate.

Next,

TSA: How do you react to caffeine?

Me: (This cracked me up) I hardly drink any coffee, so I don’t know how I react. But I did have a cup of coffee today.

He mumbled something about he can look at the person, and tell whether they had coffee or not.

TSA: How do feel about flying?

Me: (Now a little irritated) If you are asking me if I’m scared of flying, then I’m not!

He laughed, so did his yes-man side-kick.

TSA: How do you feel about airport security?

Me: I’m okay with it, but this is the first time I’ve been asked to step out. Do whatever you need to do.

TSA: Why are you carrying cash in your bag?

Me: I need the money to convert into local currency once I get to Peru and Brazil. Am I allowed to carry it?

TSA: Oh yes, that’s no problem.

By this time the side-kick had finished removing and checking each item in my carry-on with the explosives detector. So it was time for them to say goodbye. They did seem annoyed that they could not find anything. There was no “thank you” or “sorry for the inconvenience”. And they just walked off teling me that I could go ahead.

I wanted to ask for a feedback form to ask the reason why I was picked, and if there were extra steps for security that day then why wasn’t everyone searched the way I was. But I suppose all that would fall on deaf ears anyway. I was not stopped elsewhere on my journey, so that was good. Turns out its a new ‘behavior detection’ initiative by TSA that borders on racial profiling to justify the program according to this article.

And, I now know how SRK felt! 😉

The Spartan Race Experience

English: Starting Line

English: Starting Line (Photo credit: Wikipedia)

I was bored with my gym routine. It had become monotonous, and I wasn’t enjoying it any more. Enter Spartan Race and CrossFit. My colleague told me about the former; he had come across an ad on Youtube, and in a hurried moment of inspiration, had decided to register for it. I loved it when I heard about it, and registered immediately. Think after you act – that’s what I did. So now it was time to get down to business.

I had always passed by a place called Crossfit down the road where I live, but never found what it was. When I did, it was just what I needed to prepare for the race. So I joined the place within a few days. And was it fun or what?! Also a lot of sweat and pain. I was no longer doing the same routines. Each WOD (workout of the day) improved some part of the body. Every warm up before a WOD was taxing in itself. Overall, great fun! I trained for 3 days every week at CrossFit, and did a 4-5 mile run on most Sundays. I could see improvements in my strength, and I was able to run better, which has always been my weak area. Two weeks before the race, however, I sprained my upper arm while doing a snatch. I rested for a few days, but could not resist the urge to get back. And so I did. Bad decision. The pain got worse, so I took several days off right until the day of the race. On race day, it still felt sore, but I knew that adrenalin would get me through it.

Race Day – We arrived at the Amesbury Sports Park at 7 am. Our heat was to begin at 8. It rained! We expected the terrain to be slippery. First we had to run up a hill for about 100 yards.

Then one by one, these were the obstacles we did:

1. Pits of water – About waist height, jump in, climb out. Slippery, muddy.

2. Over-under-through – Climb over a wall, then under a wall, then through a window in a wall. This was there 2-3 times along the course.

3. Herculean Hoist – Rope attached to a cement block, and going through a pulley at the top of a tree. Pull rope from the ground, and hoist the block until it reaches the pulley and bring it down slowly.

4. Balancing act – Thin logs of wood dug in vertically, and placed in a line. Walk from one to the other. I could not. 30 burpees.

5. Rope climb – Jump into a pit of water. Knotted rope going from ground to a bell about 25 ft in the air. Had the most fun doing this, because I had worked on it during CrossFit.

6. Parallel bar traverse – Series of parallel bars about 7 ft high. Monkey jump using your arms from one to the next. I slipped 2 bars before the end! 30 burpees.

7. Slippery Wall – Walk along narrow steps attached to a wall. Very slippery. Big toes. Fail. 30 burpees.

8. Fire – Jump over a few pieces of wood on fire. Nothing great, just adds to the drama!

9. Rope ladder – Climb up a rope ladder, and get down on the other side. Shaky.

10. Tire flips – Flip over a tractor tire twice forward, twice back. Takes some doing.

11. Cement block drag – Drag the chain attached to a cement block, around a small field.

12. Sandbag carry – 40 lb bag, on shoulder. Walk up the hill we first climbed, and walk down. Takes a lot out of you.

13. Slanted wall climb – Slippery wall at 45 deg. angle, use rope attached from the top to pull yourself. Then climb down from the other side.

14. Vertical wall climbs – There were several of these. 5 ft was a breeze. 6 ft took some effort. 7 ft one had a small step, so it was not so bad either.

15. Barbed wire crawl – Mud  + Water. 2 feet high barbed wire. Crawl, roll,struggle. Then another one, this time sloping! Fun though 🙂

The terrain was mostly slippery, and muddy, with rocks. Overall it was a great experience. Not as tough as I first thought. CrossFit definitely helped. Time to rest and recover my arm back to normal. Until the next one!

Dr. Saahu on Air India 144

“Haan ji beta..Aapki seat hai.. aao baitth jaao. Myself Dr.Saahu… I was the Chief Medical Officer in Chattisgarh, but I am now retired. My brother is a minister there, and so I am still working at the age of 65. I keep coming to my daughter’s place here in New Jersey every alternate year.”

I was welcome with these words as I sat in an Air India flight back home to Mumbai. I just smiled and looked for another seat, but it wasn’t to be – the flight was full! An aged, bald, unshaven man sat next to me, with his demure wife on the aisle. They had supposedly traveled all around the world, with the man claiming to have been spending all his savings on tours. This got me a little interested, as I thought it was a cool thing to do. But, I wasn’t sure how much more of the constant chatter I could take 🙂 He finally seemed to settle down; by the way in the midst of all this, I didn’t get an opportunity to even introduce my self!
Soon after taking off, sleep found me and I enjoyed a few moments of silence.

Time for some food. The world infamous air hostesses of Air India began serving – food and some cranky expressions. May be they don’t get paid, or its just old age I suppose! Anyway, the food was good, and that’s all that matters on a long flight.

Back to sleep. Oh btw, Dr. Saahu had 3 pegs of whisky, which to my relief put him to deep sleep.
Next wake up call – London. We were supposed to disembark, run through Heathrow and get another round of security check done, and get back into the same plane. What a crappy system, I thought and hurled few abuses in my head. And what a racist country the UK is!!! People were being looked upon as terrorists, with bags being checked once though the scanner and twice manually. A lady was asked to drink some water from her baby’s bottle. Heights of paranoia!! Wonder why AI hasn’t been able to sort this issue.

So, we’re back on the plane after wasting 2 hours. I listen to some music before its time for food again. And Dr. Saahu doesn’t miss the free drinks – 3 pegs more. Well, this time it makes him talk! I get to listen to another round of his life’s achievements and his political contacts and what not. He tells me how great his sons-in-law, and how he advised them regarding their careers. And then finally, he asks me my name!

We reach Mumbai – I’m in a little discomfort as my ears ache(due to the air pressure, and possibly my neighbor!!). We say our good-byes and Dr. Saahu leaves. I get to doing the formalities at the airport, and get out – to get to the domestic airport to Bangalore.

Home sweet home after 18 months, its new year’s eve and I’m going to make the most of it!

One year later

The first thing I felt after landing in the US – sleepy.

My friend and I had a comfortable flight, but still were groggy eyed, and we had to wait for sometime for the seniors to arrive for our “pick-up”. We tried calling them using the public phones at the airport, fumbling with coins, trying to decipher quarters and dimes! It’s been exactly one year since that day, and now we find ourselves planning pick-ups for the Fall entrants this year!

Roles change here, and quickly – The reserved newcomer in August, the settler for the next couple of months, the inquisitive traveler, the laptop-addict (read Youtube in my case), the cricket-player, the laundry-boy(girl), the amateur cook and of course the student, for the rest of the year. Life’s been good, I should say, coming to a new country amongst new people, with not-so-many desis, so to speak. I live in Amherst, a small town in Western Massachusetts and go to Grad school at the University ofMassachusetts here. The early mini-struggle for jobs, choosing courses for the Fall, getting a social security number, a cell-phone, an internet connection and a few more things – take up time, almost one semester, but at the end you feel good about having settled down well!

In the next few months at Amherst, I found several things amusing – people run a lot, on the roads with a music player and a beverage; most of them help you find your way if you are lost, and very politely; some of them will make a mockery of your name (most make one of mine!), the police cars, ambulances and LOUD fire engines try to scare you off, bus drivers wave at each other, cars stop for you if you are a pedestrian crossing the road(though, this almost never happens in the cities here!), students skate-board their way onto campus (sometimes right into class!), every food item has lettuce, tomato and cheese in it, and most importantly one will not find a single public toilet in case of an emergency!

What you might possibly find is, few Indian students trying too hard to make an impression – most commonly this means trying the accent but making it very obvious, criticizing India (this gets them a bashing, of course), trying to roller skate (but without practice, we know what can happen), changing voice mail messages on their phone every week with an accent that gets heavier with time! You will definitely find a couple of such specimen, but my friends and I just have a good laugh at their expense.

The biggest change one feels is that you have to do all your work yourself – Shopping for groceries, converting pounds to kilos and gallons to liters, long queues, dividing the shopping list amongst your roomies and finishing up quickly to get the bus back home on time(get a car!); washing utensils; cleaning your room, and the kitchen (the frequency varies drastically from house to house); ironing your clothes; cooking by guess-work(for the newbies, turns out alright, don’t worry) and other chores.

Seriously speaking, you just have to make sure you are doing things right, like paper work at the University administration offices, your taxes and legal stuff, and of course not getting on the wrong side of the law. Look for a house online before you arrive so that you don’t spend a lot of time here and staying at other places for too long. I would also suggest that newcomers share apartments with themselves, as it just helps each other to get along better. Just an opinion.

All in all, I would just say – the key is to find like-minded people to stay and interact with, go out and explore new places, talk to people and just be yourself.

You’re all set! (I bet you’ll hear this phrase time and again).

Welcome to USA!

Hello Mr. Hedge!
One of the many strange things that happened to me upon coming to the USA – my last name being pronounced Hedge. Isn’t is easy to say – ‘heh-gh-dey’. I was taken aback, almost laughing at the other person, thinking “Is it really that hard ?? !!”. How does one manage to interchange the ‘g’ and the ‘d’ when it is’nt written that way? Nevertheless, they’re nice enough to say ‘Oh ! Its two syllables!! I’m sorry !”, when I correct them. But my friends enjoy this the most 🙂

Helping pick up truck
Like most new students here, we set out hunting for stuff to furnish our apartment – mattresses, couch, closets, lamps etc. After a few days of collecting bits and pieces, we hit a jackpot. A really nice study table with several shelves – was an amazing find, a bit too heavy though. Not a big deal for four guys we thought, but 10 steps and we were spent 😛
We caught our breath, and were about to start over when this pick up truck with a couple in it offered to give us a ride. We were amazed – helping strangers was not something city-bred people are used to, for obvious reasons. But I guess its something really nice that small towns like Amherst have’nt lost yet. So we loaded the treasure on the truck, and jogged along till the apartment. Said our goodbyes and thank yous to the gentleman. The next hurdle was to get it into the apartment, and we somehow managed to hurl it in without damage 🙂
Nice feeling at the end of the day!

Friendly directions
Recently, we were looking for a new apartment close to Amherst Center. We found a nice one on Craig’s list and decided to have a look. We took Route 30, and got down at the Main Street bus stop (the one near Amherst groceries), and started walking further hunting for Spaulding Street. After a long walk and not finding it, we took a turn into a road hoping it would be the right one. But we didn’t find number 40 on it. Right there, on our left, there stood an old man with a long beard mending the plants in his house. I went in and hesitantly asked, hoping he wouldn’t get annoyed, “Can you please tell me where Spaulding St is ?”. He came towards me with the spade, and I moved back a bit. Then, slowly he said, “This one is Gray, next is High, then comes North Whitney, and then you have Spaulding. So it’s a little further way!”. I was surprised – it was the most polite reply I’ve got :). Amherst has some really nice and affectionate people. They’ll go out of their way to help you. And about the house, it turned out to be nice, so we’ll think about it !