February 24, 2006

For, While Loops & Birthday Wishes

February 23 was an eventful day for one of my close mates. She turned 30 and I "think" she has accepted the fact that she is about to start the third decade of her life.

Another ex-colleague of mine happened to share the same b'day as well. She never revealed her age but she's a SYT and that doesn't matter much. If you're a UAT, then, you've got to hide the fact that you are turning 1 year older. ** hee hee **

NOTE: By the way, SYT = Sweet Young Thing and UAT = Ugly Aunty Thing...

Anyway, this ex-colleague was online and we decided to do our customary geeky thing -- announce her b'day wishes on our chat client's status message. Some were nice, like "Happy Birthday XXXXX!" but some decided to write some archaic program like:

Human object = new Human();
object.happy(..);

I told this friend that his code didn't follow proper Java coding convention and he replied that he was using C#. -_-

Oh well, that got me thinking about putting up some wishes and I went:

for (int i=1; i=10; i++) {
System.out.println("Happy Birthday XXXX!");
}

A lot of people came up to me and said that I should have changed to using a while loop, which loops infinitely. :)

I threw back a challenge to ask them to create an infinite loop using a "for" statement.

One came up with this:


for (; ;) { System.out.println("Happy Birthday XXXX!"); }

Seems valid. Not sure if he had compiled and run it on his system. I threw back another challenge to use a boolean variable as a counter, something with mimics the "while" loop. I came up with:

for (boolean infinite=true; infinite == true; ) {
System.out.println("Happy Birthday XXXX!");
}


I think its valid. :)

The point is, even when writing small pieces of code like this, we should follow the coding conventions properly. Recently, I had to explain some bit of code to someone and we came across something like this:

for (Iterator iter = abc.getSomeList().iterator(); iter.next()) {
SomeObject object = (SomeObject) iter.next();
object.do(someVar);
}


Anyway, to the coder, this seems like OK code but to me, because I like to use coding conventions like "_varName" for local variables and stuff like "doXXX()" as method names, this really irked me a little bit. I think sometimes, its out of habit that we code in a certain manner and when someone tells you that you've got to conform to some standards, I can see why there would be some hostility at first. But once you "sell" the idea of more readable code and easier maintenance, people would get used to it.

I've always felt that one of the tools that a development QA team should have is a code convention verifier/formatter to go through tonnes of code, generate some report to show which pieces of code do not conform to convention. Some would argue that the code convention in use may not be efficient especially when it comes to variable declaration. This is a big issue as in Java, performance gurus always state that we have to be prudent with our object creation/deletion. Some Java developers prefer to use the good old C-style programming that we declare all variables at the top of the file and then, use it in all our methods below these variables declaration. However, others prefer to declare and create the objects as and when they need it so that it lives within a certain scope.

Whatever the preference and how that affects performance, the least the developer should do is follow some naming convention so that code looks more readable. Who knows that a variable called "car" is a local or class variable in the code unless someone traces through the entire file for it?

Oh yes, one final note. I hate it when certain people like to use the "x", "y" and "z" as class variable names. -_-... It doesn't describe what the variable is used for. I don't mind having this in use in for or while loops where I know that the variable's scope is short-lived.

Anyway, best to check out this site for details... ;)

February 21, 2006

Hillarious!!

Ever asked to provide some pearls of wisdom to some fresh graduates, just coming into the "real" world of business (irregardless of industry/training)?

Well, have a read of this, something I read from The Dilbert Blog.

Read the comments as well. Its hillarious!!

February 17, 2006

Reconnecting with Friends...

I just got a call from an old friend whom I've known since secondary school (high school to some of you other folks not from the Commonwealth region.. :-) ) and we chatted up for hours on end. I haven't heard from this friend since a couple of years back.

Anyway, we shared some stuff about what we've been up to and how our other mutual friends have been. From there, we talked about a lot of things about what's life been like back in Aust (where's my mate from) and what certain things are like. Its been a while since we've chatted but we chatted for over 3 hours. LOL!!!

The long and the short of it is that its always fun to reconnect back with a long-lost mate. The truth is, friends are always there and they're never long lost. They're always close at hand, in your heart and it doesn't take much to reconnect with them. So, even if your friend seems to be neglecting you, sometimes, it isn't really entirely their fault. We're a stereo-visioned animal and we tend to lose focus very easily. So, we should probably not b*tch about why friends go apart and how the friendship goes "stale". If you are true friends, the friendship doesn't go away, it probably lies dormant until something brings it to life. And frankly, it doesn't take much for friendships to keep going. :)

February 15, 2006

Gaim and I

Ah... Finally, ITTTSSS ALLLIVVEEE!!!!

** MUAHAHAHHAHAHAHHAA** <--- Evil laugh

** ahem!! ** (Clears throat). Time for a proper blog entry... ^_^

Anyway, it has been a while since I've tried to do a "hack" of something related to some open source software that I wanted to use. And, today is the day that I've finally been able to get that little "hack" to work.

I've been experimenting with loads of chat applications for a long time, mostly on Windows environments and occassionally, I've been asked if there was a *NIX alternative. For a while, we had to hack our way through Yahoo's Messenger client on *NIX to get it to work. A lot of time was spent, installing and uninstalling (removing all traces via our favourite "rm" command) the darn thing.

So, at around the time when I was fooling around with CentOS, I came across Gaim which was installed by default. (Some guy chose the default install option during the installation process and it was there). At first, we thought that this was a chat client which only supported IRC/ICQ and AOL. After a bit of investigation, we found that it supported the popular clients like MSN and Yahoo!

Of course, we found bugs. We hated them bugs. And because of that, we dropped it. Besides, it didn't offer support for Windows at that time. (We weren't sure if Windows like Gaim... :D). Anyway, some of the developers had switched from Windows to Linux and so, were happy to find that Gaim worked well with both MSN and Yahoo servers. They were happy, but did it work on Windows?

Well, lately, I've been checking out stuff like Trillian since I've not used that in a while and of course, came across Gaim as well. And, to my surprise, it did support Windows! I'd figured that it might, because the GUI was running on the GTK+ runtime. I had always liked the GIMP application, which recently had great support for the Windows platform besides the *NIXes, and thought if that application was already portable to Windows, why not Gaim?

To cut a very long story short. Here is the link to setup Gaim on Windows AND USB Thumb drive!! (cool ain't it??!)

Also, a tip to all those who are using a Proxy server for their Internet needs... According to a mate of mine, it seems that by putting in your Proxy information, you can't seem to connect in. I had a lot of problems but have yet to test this tip out.

BIG BIG TIP - PLEASE DO UPGRADE YOUR GTK+ RUNTIME PRIOR TO INSTALLING GAIM!!

February 09, 2006

Another day, another blog

)))))))))))))) Something new and exciting coming this way (((((((((((((

I can't for the life of me, think of what to say.

Anyway, for the moment, I've decided to stop chasing my tail and just sit down to enjoy the evening, while I still can. I just got word that I've a number of items to accomplish by the end of February.

It doesn't help to know that I'll be getting an additional resource but the fact remains that you cannot change one thing - that is, that February consists of 28 days this year. Being a non-leap year, it would be 28.5 days since, its an even number and we're 2 years away from 2008, which is a leap year.

The funny thing is that project management based on the "man-month" typically puts in about 25 days per month. Why not 30? Well, its because of February. If you start your project on February, you don't have 30 days. (** grin **) If you discount weekends, well, you probably have around 20 days.

Anyway, I plan to pick up "The Mythical Man-Month" for my personal reading.

If you can't figure it by now, yes... I'm one of those geeky Software Engineers/Architect. LOL!!!
Related Posts with Thumbnails