|
|
You're welcome!
It's an OO world.
public class Naerling : Lazy<Person>{
public void DoWork(){ throw new NotImplementedException(); }
}
|
|
|
|
|
Write it, send it to code review, get it back and clean it up.
Nihil obstat
|
|
|
|
|
I just gave you a 5 to counter the univoter. There, first time I've said that
Seriously, no mercy in the lounge today, as you can see. Of course, none of us would ever, ever put colorful comments in the code. No, not us. We're professional. laughing at all of us.
All they said is true, work on improving the code rather than colorfully but usefully commenting on it. There IS room for whit though.
Charlie Gilley
<italic>You're going to tell me what I want to know, or I'm going to beat you to death in your own house.
"Where liberty dwells, there is my country." B. Franklin, 1783
“They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
|
|
|
|
|
Thanks; I was kind of surprised at some of the negative comments, personally, but such is life (I'll abstain from using the French version of this saying; considering a strong anti-French leaning of many members, I'll not risk rising their ire again ). What prompted this question was some study as to the profanity count of some MSFT project; I'll have to find it and link to it for context.
|
|
|
|
|
Oh Lord, the running anti-French thing you cannot take too seriously. Wait till the Irish and Brits get going at each other Then comes the anti American tirade, etc, etc.
You are in "The Lounge", so you better man - up ...
Charlie Gilley
<italic>You're going to tell me what I want to know, or I'm going to beat you to death in your own house.
"Where liberty dwells, there is my country." B. Franklin, 1783
“They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
|
|
|
|
|
In some of the more bizarre bit twiddling depths of my code I have comments which just say: WTF???!!!!????
It usually means I have tried to give an explanatory comment but gave up as the code isn't really anything which can be expressed in English
|
|
|
|
|
Example or it isn't true!
I've been able to explain every bithack I ever used, and many that I've never used as well. Sometimes it takes quite a lot of text to explain it in detail, such as in the case of propagating bounds through bitwise AND and OR without a loop (the version with a loop isn't trivial to explain either), but it's still expressible and removing some detail makes it "long but not too long".
|
|
|
|
|
...and if you can't explain it, you don't understand it, and no one can maintain it.
If you get an email telling you that you can catch Swine Flu from tinned pork then just delete it. It's Spam.
|
|
|
|
|
Code comments are just like Lounge comments. People consider themselves funny, witty and to have a sense of humour. This is often a delusion and tends to annoy the hell out of others.
Peter Wasser
Art is making something out of nothing and selling it.
Frank Zappa
|
|
|
|
|
Well played, sir, well played.
|
|
|
|
|
Assuming you are being paid to work for a company, then part of the long-term value in the product/source-code base may well be the extent the code is maintainable, readable, and annotated with appropriate comments that explain unusual methods/solutions/work-arounds, as well as the other functions comments usually perform.
Source-code with inappropriate personal comments might well reduce the chances of a possible future acquisition of the company, as a possibly acquiring company does a "due-diligence" technical review. I have worked at one company which was "consciously designed" from the get-go to become the "apple-of-the-eye" of a certain very large company, to become an inevitable acquisition target for the big company.
And, it was acquired, without ever becoming a "big commercial success" in its own right (to the immen$e benefit of myself, and other holders of the start-up's "fantasy stock").
What if the technical review of the source-code base of the company wishing desperately to be acquired, by the world-class programmers from the acquiring company, had come across a bunch of bizarrely off-topic comments that implied they didn't know why what they were doing, in specific cases, and contained personal ventilation of frustration : ... uhhh ... a deal-breaker ?
At that little start-up (which would certainly have failed within six-months if it had not been acquired), there was a high degree of scrutiny of all source-code by the founder, who was one of those rare geniuses who was both a world=class programmer himself, and an astute business-man able to sell venture capitalists a "field of dreams," all the while deliberately shaping the company to be an irresistible acquisition candidate by one specific very-large well-endowed company.
best, Bill
~
Confused by Windows 8 ? This may help: [ ^] !
|
|
|
|
|
When I was selling my business I went through the code prior to the source code check and changed all the "WTF" comments to nebulous but pertinent sounding ones. My main system uses bitmapped inverted indexes so there is a lot of bit twiddling and in some cases the code can explain what is happening far better than any comment in English - I used the "WTF" comments as place holders for when I did come to sell my business and needed to at least insert some comments in English in those places.
|
|
|
|
|
RugbyLeague wrote: I went through the code prior to the source code check and changed all the "WTF" comments to nebulous
And there is absolutely no possibility that you missed one?
RugbyLeague wrote: I used the "WTF" comments as place holders
Same purpose is served by using a 'TODO'
|
|
|
|
|
I am more keen to check the WTF's than the TODOs - I use TODOs for future enhancements and optimisations
|
|
|
|
|
Thanks for this: a truly well-thought out and explained scenario where there could be unintended consequences. This is exactly what I was looking for.
|
|
|
|
|
I very rarely include expletives in comments, it is rare that I think MY code is that bad. However I will happily call the owner of some particularly bad kludge any number of expletives. It is rather embarrassing when they explain the reason and I can't come up with a better solution
I also make sure I include the URL of any solution I have snaffled off the interweb. This is so I don't have to explain it, the author generally does that in the supporting doco. Added bonus is they get the credit for the solution.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Mycroft Holmes wrote: also make sure I include the URL of any solution I have snaffled off the interweb Indeed. I have a wikipedia link in one spot for an algorithm I used.
Software Zen: delete this;
|
|
|
|
|
I worked for a while at an "international" company based near Munich. We had people from 43 different countries all working in English (more or less). It was very interesting, especially when you read the comments on some code maintained by a multilingual Frenchman, a multilingual German, a multilingual Englishman, a bilingual Italian, a bilingual Pole, a bilingual Spaniard and a poor American who only spoke the US version of English. The comments were (theoretically) in English - although the grammar was all over the place - but the "meaningful" variable and function names, etc. were multi-lingual! You needed the comments to explain the meaningful names!
Yes, I was the Englishman.
- Life in the fast lane is only fun if you live in a country with no speed limits.
- Of all the things I have lost, it is my mind that I miss the most.
- I vaguely remember having a good memory...
|
|
|
|
|
IndifferentDisdain wrote: My thought is that, as the end user of our product never sees the comments, then it's whatever, but some do not agree
The problem of course is that is an assumption.
Some possible serious problems...
As a specific example some customers require as part of sales agreement the ability to inspect source code and even receive a copy of it. So the Acme company gets your code where you have a comment that says "This only exists because the idiots at Acme don't know what they are doing".
A developer from a client company is tasked with helping developing an adaptor in house and in doing so has access to the code base. The developer is John Doe. The comment in the code is "Moron developer at Acme, John something, seems to think that this should return zero instead of null".
The new developer, a woman, starts and takes over maintenance of a project that you are more than happy to hand off. The code is sprinkled with comments like "This code is just as temperamental as a woman on PMS". She complains. And you have a EOC complaint in your record. Even worse she sues and you are called to testify so there is a public record of a EOC complaint initiated by you.
Of course up until the sh*t hits the fan it all seems like just a bit of fun.
|
|
|
|
|
jschell wrote: some customers require as part of sales agreement the ability to inspect source code I've had that happen to me. Twice. By the same sales twit.
In both cases she sold the rights to our source code in a sales contract. In the first case, the customer just needed some documentation that wasn't part of the standard kit. In the second, a few e-mails between the customer and yours truly helped resolve the issue.
This is what happens when you're a software engineer working at a hardware company. The sales twits would never dream of giving away hardware design information like schematics or CAD drawings. Software has no intrinsic value, so just give it away .
Software Zen: delete this;
|
|
|
|
|
Nice; thanks for the warnings. I guess I'd never thought of that possibility, but sure, it could happen.
|
|
|
|
|
The rule is:
If other people are to see or work with your code then keep it proffessional, informative and descreet.
( You don't know their religion, ethics, if they are PC (Politically Correct) or if they are easily offended.)
If you are the only one that manages the code the WTE, do what ever you like.
But then again....
How do you name your variables and your functions? Do you follow the same ethical procedures that you use for comments...?
Catch an exception and .tostring it to a messagebox and have your expletives revealed to all.
Best to write all your code as it was to your Mother or Chris Maunder's Kid sister.
That way you won't elephant up.
Personally though I like a bit of character in comments and in var names, function names, class names, module names and indeed form names.
I do know this though...
Never ever write temporary violent, abuse or expletive stuff in your messagebox or any notification code, because one day you will not delete it or or comment it out, and it will Pop up on a customers machine.
Comments are for other programmers or yourself.
Keep pro or if just for thy then go for it... but always beware...
|
|
|
|
|
To date, I've never used expletives in production code, comments or otherwise (I know my original question intimated that I had, but definitely not). Even if I did, I certainly wouldn't in non-comment code (we're in .NET, so it's all too easy for others to inspect the DLLs, etc.; bad things there). It seems like I remember a case of a large company where the MessageBox scenario you outlined actually happened; I'll have to research to see if I can find it again (some random article I read probably 12 months ago).
|
|
|
|
|