Showing posts with label C#. Show all posts
Showing posts with label C#. Show all posts

Saturday, February 27, 2010

Meaningful code comments...

Nothing frustrates me more than looking at someone else's code and searching for that elusive bug that killed part of the application.

The code I looked at yesterday is  undocumented and did not use any of the standard naming conventions for C# which makes it doubly hard! Well, to be truthful there was some comments here and there but the way the comments were written is what ticks me off. Here's a sample:

// If index @ 0 not equal to mLinks count
if (ckbSkip.Checked
   && mLinks.SelectedItems[0].Index != mLinks.Items.Count - 1)
{
  mLinks.Items[mLinks.SelectedItems[0].Index + 1].Selected = true;
  mLinks.SelectedItems[0].Selected = false;
}

Did you see what I meant?

The comment alone wasn't very helpful, at all!

It could have been written in this manner:

//if user wants to skip to next mfg
//and we are not at end of list, go ahead
if (ckbSkip.Checked
   && mLinks.SelectedItems[0].Index != mLinks.Items.Count - 1)
{
  mLinks.Items[mLinks.SelectedItems[0].Index + 1].Selected = true;
  mLinks.SelectedItems[0].Selected = false;
}

Code comments should say 'why' it is written that way and the code itself shows 'how' it's done.

Sunday, August 27, 2006

New job!

I'm learning a lot of cool stuff in my new job as Software Engineer. I get to use my experience on computer programming using Visual Basic in a more concrete way. On top of that, I'm into C#, web-services and Delphi.

C# is quite new to me. I remember very well the days that I spent trying to figure out how the language works. It took some time, a lot of head-scratching and lots and lots of Googling. But it's paying off and everything is falling in its place.

Also, I get to delve deeper into SQL Server. I thought I already know a lot of about SQL coding but, believe me, it's very, very different in the real world. More googling!

In a few days, I'll be starting on a new language; one that I have never programmed with. I'm pretty sure that I will like this language too. It's Java. I know, it's been around and it's very popular but hey, it's a Microsoft world out there and previously I just didn't have the time to go learn another language.

This time it's going to be different. I'm off to school (my place of work is paying for it) and it's one of the courses that I need to take. I would have preferred C# but they don't have that so. I'm not disappointed. In fact, I'm glad that I get to learn Java finally.

And, oh before I leave, I just want to let the whole world know about my new website. It's http://www.plumjava.com Currently, there's not much in there. That, I hope would change in a few days. Did I mention that I'm also learning stylesheets? Oh, yes. Definitely.

It's going to be hell juggling my schedules from hereon. School, work, home. Hopefully, I'll make it to the next posting!