Tuesday, November 28, 2006

Using m_ prefix

Cross posted from http://blogs.msdn.com/abhinaba/archive/2006/11/28/m.aspx

We all know that Hungarian notation is bad. That has been debated a thousand times and closed upon. It has been proven that having type information as the variable name can lead to trouble. Some nice examples are here and here.

However, though most developers agree with the issues with type information in the variable name, there is some lack of clarity on the other aspects of variable naming. Like the m_ prefix. Many developers believe that it's ok to use m_ for non-public variables, especially because it can be easy to get confused between local and instance variables. Some even prefer just an underscore prefix.

The .NET Fx guidelines and MS internal coding guidelines clearly calls out against it and so does tools like FxCop and StyleCop. The reason is simple; it looks ugly and has other repercussions. For example if one uses m_ for instance variables, then he might want to call out static variables with s_ and global variables (yea C# is exempt) with g_. So one falls into the same trap while changing a static to an instance variable or vice-versa.

Moreover, these prefixes are simply not needed. The guidelines suggested way of using a this. prefix works much better, as you clearly use the this pointer indicating that the reference is to an instance variable. Topics like these turn into religious war during code-reviews or reviews of team wide coding guidelines. I personally believe that things like prefixes has no place in todays world of coding…

Tuesday, November 21, 2006

Actually that should be one of the first zunes in India, but hey what the ....

Our dear AmitChat the resident gadget maniac got himself a Zune (nah, not the Brown one). This is sure to be one of the first Zune's to come into India. He got it from Redmond and costed about $260.

That's me holding it with its smaller bro in the other hand ;). As they say bigger the better (I'm referring to the screen size :)



Sunday, November 19, 2006

Is it for him or her??

I accompanied one of my friend to the Central mall in Hyderabad. He wanted to buy a present for his fiancee. I was acting as the experienced consultant :)

We approached the watch salesman and my friend told him "I'm looking for a present for my would be" the salesman asks him back "is it for a him or her". We were stunned. This is India, I thought we don't talk in these lines :)

Friday, November 17, 2006

Program performed illegal operation. Let's call the police

Cross posted from http://blogs.msdn.com/abhinaba/archive/2006/11/17/program-performed-illegal-operation-let-s-call-the-police.aspx

One of our Colleague's young kids were working on a computer when it popped up a message "Program has performed illegal operation and will be shut down". He got a urgent call from his 9 year old daughter "Dad, does this mean that the police will come?".

So next time you ignore a UX guideline think thrice.

And yes this is a true story and I didn't cook it up.
IE 7 menu bar

Cross posted from http://blogs.msdn.com/abhinaba/archive/2006/11/17/ie-7-menu-bar.aspx

I'm using IE 7 for some time and lovin it.

I had believed that IE has done away with the menu. Whatever functionality I needed were available through the Tools and Page split buttons in the toolbar and I always printed using Ctrl+P so I never felt the need of the Menu. However, I just found out some time back from Amit that when you hit the alt button the menu magically appears and then magically disappears!!!

I have no idea what made the IE team come up with such a weird non-discoverable feature! Its so non-standard design. I understand the need of minimal UI and that WinForm enumerates the Alt key as System.Windows.Form.Keys.Menu but would've never figured out the association :)

Thursday, November 16, 2006

Scheme of things

Programming in Static OO languages for a long time numbs the brain. These languages are designed to be simple and efficient. These criteria not necessary create beautiful languages. In the world of C++, C# our imagination get severely restricted.

Take for example the expression x + y. In scheme you can code this as

(define (addAbs x y)
((if (> y 0) + -) x y))

(addAbs 4 -5)

The if expression is very interesting. It actually compares y with 0 and returns a operator (+ or -). Its simply beautiful :)

Tuesday, November 14, 2006

Black day for Indian SW industry and NCR

Today we got the shocking news of the kidnap of Adobe India head's son. Being a father I can imagine the trauma the family is going through. Its a disgrace for NCR (National Capital Region). It's high time police acted up and brought these element under control.

I pray for early recovery of Naresh's child...

I had worked in Adobe India and had known Naresh personally. I had also met Naresh's baby, then only about a year old. Naresh is one of the most amazing people I have ever met in my life. He used to know each and everyone working in Adobe and what they worked on. In a party he actually asked my wife how she's finding NOIDA and whether she plans to start teaching again. We were amazed how he remebered that she used to be a teacher back in Bangalore.

Monday, November 13, 2006

Tea-Shots

When I visited USA for the first time I was surprised by the size of the servings. Specially the sizes of drinks (Starbucks starting from Tall :) ). I remember asking for a large Coke in a Panda Express outlet and was handed over a bucket of coke. In contrast here in India you get miniature size drinks, like the one I'm holding. It's a cup (??) of Chai

Get Indian Rope Trick

Cross posted from my MSDN Blog

Even though Wikipedia expresses doubts over the validity of the great Indian rope trick I saw a variant of it in MS India. I call it the great indian ladder trick.