"Everything that irritates us about others can lead us to an understanding of ourselves." - Carl Jung

I spent some of last last week pouring over code in C# trying to get to the bottom of Support issue that I was following up on and I found some examples of irritating code that seems to raise the hairs on the back of my neck ... It should not ... when I think rationally it should not bother me at all, but if code is not immediately readable, if the initial form it takes effects the readability then we all need to get on the same page as it effects someone in the software life cycle.

So here is a simple if statement. that I simply do not like:
if (MyShirt == "Long") MyBoots.Height = MyBoots.Height - 20;

I prefer to see this
if (MyShirt == "Long")
    MyBoots.Height = MyBoots.Height - 20;

or, if I am in a particularly verbose mood then the following is preferred.

if (MyShirt == "Long")
{
    MyBoots.Height = MyBoots.Height - 20;
}

The intention just appears to be clearer, a logical statement followed by decision. Are we that interested in saving white space? I know this is really picky hence the title of the post, and I know what your thinking how can everyone I work with account for my neurosis quirks? Not sure but something has got to give!

My Solution:

All permutations on if, while, do while, for, case select etc should be viewable based on the preference. Much like the CLR it should determine the intent and display it based on your preferences. So the three if statements above would actually be rendered when you open the Visual Studio Project based on preference. There is, actually, no difference between them it just a visual cue of the intent of the developer.

This concept is a little avant-garde, so I will start work on this right away ;)



Comment Section

Comments are closed.