To comment or not to comment

Damn, Chad Myer‘s post about mistakes of comment usage in code made me think !

I tend to agree with him about the fact that your own code should be self explanatory, so that code comment is redundant.
But on the other hand, sometimes a little comment about the flow of the code always tends to help me understand the code itself better.
That aside, my code doesn’t have that much of code comment ( except for the //TODO: lines ) !
So I had to search a bit, but found a good example IMO, to show of the need of code comment… This to answer Chad’s question !

So here it is, what do you think ? Is the comment valid, should it stay in the code ? I think it should ! It still seems very obvious, but I would like to keep it in.


/// The general list has 2 internal lists:
/// * one pointing to the actual objects in the database
/// * one pointing to the actual objects in memory
/// To get the total count we have to take following flow into account
/// * the memory reference can be different from the database reference, so we combine the 2 counts and subtract the objects that are already available in the database list
public int Count
{
int totalCount = 0;

totalCount = ReferenceEquals(this.internalListMemory, null) ? 0 : this.internalListMemory.Count;
totalCount += ReferenceEquals(this.internalListDatabase, null) ? 0 : this.internalListDatabase.listCount;
foreach (DictionaryEntry internalListDataObjectsElement in this.internalListMemory)
{
if (!ReferenceEquals(this.internalListDatabase, null) && this.internalListDatabase.ListFind(internalListDataObjectsElement.Key))
totalCount -= 1;
}

return totalCount;
}

[Update]
Like I stated above, maybe the code comment is a bit to abvious ( so it could be omitted, but I’m in favour to let it in ).
So here maybe another example… but also here a small suggestion, this could maybe be changed to a //TODO: version. Depending on the work flow of programmer and his Task list.


/// There is a bug with the Excel interop for Office XP ! We first need to set the current culture to en-US to get correct date time values
public void StartTimeProcessing()
{
System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.CreateSpecificCulture("en-US");

- Rest of code with use of the interop code
}

Pinball wizard

Boys will be boys… but I’m guessing some girls also like this !!
I’m talking about Pinball machines.

During my high school days, I was hooked and played many games on these machines. One pub where we went to during those days had several machines and they changed often.
But it’s only recently that my fascination got triggered again… a good friend of mine, bought one to put in his living room !!

Man, that is just wicked, not ? If I ever have some spare money, I’ll be able to scratch this from my wish list 🙂

Here my favourite list :

* The Adams Family

Ok this is the holy grail pinball for all pinball players 🙂 ! Played on it during my youth and it just brings general pleasure ! But due to this, it’s not cheap when you want one.

* Twilight Zone

Has this special feature that uses magnets in the play field. So balls just went crazy !! Fun, fun, fun 🙂

* Star Trek: The Next Generation

Well, this machine just got a lot of attention, when it was installed at the pub ! This because it has a nice ball shooting mechanism. It looks like a shuttle craft from the series and with this you could catapult the ball up to a platform across the field !

* Jurassic Park

Main feature I liked, was the stampede trigger ! The machine will give you force feedback and shake all over 🙂

So these 4 are on the list, but I have to be honest… only the last 2 will be an option I guess.
And just out of pure fun, I think that the Jurassic Park pinball will be number one.

Any other players out there ?
What are thou favourites ?

Silence – stil

Even een nederlandstalige post…
Hier wordt ik dus heel stil van, de ouders van het kindje zijn heel goede vrienden van mij !
Ik wil geen oordeel vellen, maar ik had eigenlijk toch iets van uitspraak verwacht in het voordeel van het kind.

Voor verduidelijking de link naar het artikel en de volledige tekst :

http://www.gva.be/Antwerpen/2940/artikel.asp?art={5DE1A4A2-262E-4CE2-9126-D6A3742259C8}

09/11 Onthaalmoeder vrijgesproken voor onopzettelijke slagen baby

De correctionele rechtbank van Antwerpen heeft een onthaalmoeder uit Stabroek vrijdag vrijgesproken voor onopzettelijke slagen aan een zes maanden oude baby.

De vrouw had drie jaar geleden een baby door elkaar geschud, toen die plots niet meer reageerde. Bij het jongetje werden later een schedelfractuur en hersenletsel vastgesteld. Het kind heeft nu een motorische achterstand, maar de rechtbank vond het niet bewezen dat de onthaalmoeder daarvoor verantwoordelijk was.

De ouders van het kleintje kregen op 16 februari 2004 van hun onthaalmoeder te horen dat hun zoontje van zes maanden niet wou slapen en van het minste geluid wakker schrok. Het kind gedroeg zich volgens haar niet normaal.

De moeder bracht haar zoontje naar het Klinaziekenhuis, waar ze haar vertelden dat het jongetje geopereerd moest worden. Hij bleek namelijk vocht op zijn hersenen te hebben. De onthaalmoeder biechtte bij de ouders op dat zij het kind die dag door elkaar had geschud, omdat hij helemaal suf was geworden.

Volgens de ouders was zij verantwoordelijk voor het hersenletsel. Dokters stelden bij de baby het “shaken baby syndroom” vast. Volgens deskundigen kon dat inderdaad ontstaan zijn door met het kind te schudden, maar dat was lang niet zeker. Omdat ook een schedelbreuk van enkele dagen oud werd gevonden, zou het kunnen dat het letsel niet eens veroorzaakt werd door de beklaagde.

De rechtbank stelde dan ook dat er te veel twijfel was en sprak de vrouw vrij. Het openbaar ministerie had een celstraf van zes maanden met uitstel en 500 euro boete gevorderd.

Traditional Kung Fu ( 功夫 )

Most people know I’m following a specific style of Kung Fu ( 功夫 ), called Wing Tsjun ( 詠春 ). But this doesn’t mean I’m not interested in other styles of Kung Fu ( or other martial arts in general ).
I’m always on a look out for new techniques and there is no better way to scout for them then the use of the internet !!

That’s why I’m currently following several martial arts blogs, all of them describe a wide range of different styles and almost each week I encounter something worth noticing ! Very useful indeed…
One of my current favourites is the blog from the Dojo Rat ! He analyzes several arts and tries to point out the good things about them and how to apply this.

Well some few weeks back the Dojo Rat had posted some YouTube clips that got my special attention ! The clips where all about one teacher called Mike Martello, he has a Wing Chun background, but now teaches several styles all more traditional and actually has stopped with Wing Chun. So this actually doesn’t interest me per definition… but these clips on the Dojo Rat just caught my eye, because of the magnificent application of Chin Na ( æ“’æ‹¿ ) techniques.

In our current Wing Tsjun lessons, we do have some Chin Na stuff, but they are all static… what Mike Martello shows in these clips are examples of using it during a real work out and keeping control during drills and flows !! Something I would love to be able to do so too !
So when Dojo Rat posted a new article about Mike telling us that he left USA after a seminar to go back to his teaching center, I was just blow away by the fact that this was actually in Belgium !!! Not to mention it’s in Antwerp, only a drive of 15 to 20 minutes from where I live.

So it’s not a surprise that I got in touch with Mike to be able to get to know his teachings… and last week I’ve been to one of his training sessions. Just let me say one thing; Mike Martello can generate great strength through use of his inner energy, by being totally relaxed !! In other words no brute force at all. Very amazing when you get the chance to feel it !

But words don’t say everything… so here is Mike’s private YouTube account, just check it out : http://www.youtube.com/user/mikemartello

My favourite ( also posted on the Dojo Rat ) here :

Technorati Tags: , , , , ,