|
I mean, the programmer leaving this line in code:
}
I suppose lightning up a dull Monday?
|
|
|
|
|
Given the way some people use braces it may have been necessary.
|
|
|
|
|
Our apprentices code like that. I get ones like this checked in regularly:
var dateTime = DateTime.Parse(txtDate.Text);
I used to comment most lines many years ago, before I became familiar with what I was doing. Then I realised it's a lot quicker and a lot less effort to simply read your code.
|
|
|
|
|
jim lahey wrote: read your code
Just keep in mind you're not the only one that has to read your code... I comment blocks of code (versus lines) but still commenting helps even me out when I revisit the code later.
|
|
|
|
|
While I personally too prefer to read code, rather than comments (especially since the compiler checks my code but not my comments), I don't mind the occasional meaningful comment (although I am eager to delete comments when I spot them, provided the code they explain is self-describing). But stuff like the // parses the date in the post above, or } // code block ends here are IMO just a sign of sloppiness and lack of understanding of what comments are really for.
|
|
|
|
|
Yeah but that's an extreme case.... the other side of that is someone who assumes that all their code is readable and interpretable by other people. An engineer that I'm working with now is really bothered by the fact that someone used "fs" to stand for file something or another (can't remember exactly) but to those of us in telecommunications, that's usually used for sampling frequency.
In another words, your self-commenting code might not mean the same thing to someone else, so just be mindful of that.
|
|
|
|
|
This is the end / Beautiful friend / This is the end / My only friend, the end ... of the code block.
Maybe you encountered Captain Obvious...
(yes|no|maybe)*
|
|
|
|
|
The Doors?, I believe that I have used the same quote in the past, survived a code review as it funny & relavent.
|
|
|
|
|
I don't know. There are some times where this would be extremely helpful. Usually about 4:50 PM on a Friday.
|
|
|
|
|
That was my first thought. Though not the 4:50 bit, guessing the same time like that would be weird, but Friday Afternoon would have been my call.
|
|
|
|
|
I didn't mean 4:50 exactly...but they always call with the tough urgent fixes when you have ten to twenty minutes left until the weekend and your brain is swiss cheese from the long busy week.
|
|
|
|
|
Yes, the comment is quite bad... He should have also commented the four spaces preceding the closing bracket, what a slacker!
Wout
|
|
|
|
|
But, but, it took him an hour to find the missing close bracket. Might as well comment it!
|
|
|
|
|
The best thing about this particular example is that it doesn't even tell you which code block it is closing!
|
|
|
|
|
yep... noticed that too... I use that for #ifdef conditionals since they're not indented... but even I have enough sense to say which one I closed
|
|
|
|
|
I comment the end of my code blocks. Sometimes they get nested. When you have two using statements, an if statement, a try catch, finally, and a while loop all mixed together it gets helpful.
|
|
|
|
|
He was probably raging at the elephanting sunshine who wrote the >1000 line method with broken indenting; and the coding policies that forbid making anything beyond the minimum possible change to fix a bug/implement a feature (meaning whitespace fix, or breaking into 20 smaller logical functions).
Did you ever see history portrayed as an old man with a wise brow and pulseless heart, waging all things in the balance of reason?
Is not rather the genius of history like an eternal, imploring maiden, full of fire, with a burning heart and flaming soul, humanly warm and humanly beautiful?
--Zachris Topelius
Training a telescope on one’s own belly button will only reveal lint. You like that? You go right on staring at it. I prefer looking at galaxies.
-- Sarah Hoyt
|
|
|
|
|
C'mon, the method was only 300+ lines longs ... and he wrote it himself.
|
|
|
|