Click here to Skip to main content
15,886,731 members

The Weird and The Wonderful

   

The Weird and The Wonderful forum is a place to post Coding Horrors, Worst Practices, and the occasional flash of brilliance.

We all come across code that simply boggles the mind. Lazy kludges, embarrassing mistakes, horrid workarounds and developers just not quite getting it. And then somedays we come across - or write - the truly sublime.

Post your Best, your worst, and your most interesting. But please - no programming questions . This forum is purely for amusement and discussions on code snippets. All actual programming questions will be removed.

 
GeneralRe: Over-documentation Pin
PIEBALDconsult16-Nov-13 15:15
mvePIEBALDconsult16-Nov-13 15:15 
GeneralRe: Over-documentation Pin
OriginalGriff16-Nov-13 22:20
mveOriginalGriff16-Nov-13 22:20 
GeneralRe: Over-documentation Pin
PIEBALDconsult17-Nov-13 5:26
mvePIEBALDconsult17-Nov-13 5:26 
GeneralRe: Over-documentation Pin
OriginalGriff17-Nov-13 5:42
mveOriginalGriff17-Nov-13 5:42 
GeneralRe: Over-documentation Pin
Max Methot28-Nov-13 5:01
Max Methot28-Nov-13 5:01 
GeneralRe: Over-documentation Pin
PIEBALDconsult28-Nov-13 5:45
mvePIEBALDconsult28-Nov-13 5:45 
GeneralRe: Over-documentation Pin
Sander Rossel17-Nov-13 0:09
professionalSander Rossel17-Nov-13 0:09 
GeneralRe: Over-documentation Pin
Ron Beyer17-Nov-13 5:21
professionalRon Beyer17-Nov-13 5:21 
I would say if the people working on your code can't put the caret in the middle of "string" (or whatever you are using) and hit F1 to read the MSDN documentation, they probably shouldn't be messing around in the code base.

There are a lot of theories about how to document code, and here's mine:

1. Classes, methods, and properties (public especially, but all really), should be documented using the built-in /// method, with at least the summary and parameter explanations, remarks should be added if there is more, and document the exceptions that the method throws. This makes the other developers life easier (in Intellisense and later when you generate API documentation) to understand what a class/method/property is for.

2. Internal documentation (inside methods), generally skip it. There are three (main) reasons why somebody would document inside a function, (a) its complicated or (b) its long. If either of these are the case, it should be refactored. If the purpose of the function is sufficiently documented and the developer is qualified to work on it, the interior doesn't need to be documented. (There are of course rare exceptions, such as documenting bug work-arounds which if the developer didn't have knowledge of the bug, the code wouldn't make sense). The other reason (c) why people put comments in functions is generally white-noise. They are documenting the thought process which is unnecessary. A proper description of the input/output of the function and it being correctly "factored" shouldn't require knowing the developers thought process as they wrote it. When you see that they are probably doing "design by code", or "code-first", I won't get into that...

I used to be in the school of "every line should be documented", but I learned that really the comments where only there for the sake of writing the code, when I was debugging it I never looked at the comments again. It was more of "thinking out loud" than anything. Since adopting my method, I write cleaner, less cluttered code...
GeneralRe: Over-documentation Pin
Sander Rossel17-Nov-13 6:54
professionalSander Rossel17-Nov-13 6:54 
GeneralRe: Over-documentation Pin
ENOTTY18-Nov-13 5:24
ENOTTY18-Nov-13 5:24 
GeneralRe: Over-documentation Pin
Ron Beyer18-Nov-13 5:41
professionalRon Beyer18-Nov-13 5:41 
GeneralRe: Over-documentation Pin
dan!sh 17-Nov-13 6:20
professional dan!sh 17-Nov-13 6:20 
GeneralRe: Over-documentation Pin
Ron Beyer17-Nov-13 6:55
professionalRon Beyer17-Nov-13 6:55 
GeneralRe: Over-documentation Pin
Bernhard Hiller17-Nov-13 23:01
Bernhard Hiller17-Nov-13 23:01 
GeneralRe: Over-documentation Pin
ENOTTY18-Nov-13 5:05
ENOTTY18-Nov-13 5:05 
GeneralRe: Over-documentation Pin
CPallini18-Nov-13 7:39
mveCPallini18-Nov-13 7:39 
GeneralRe: Over-documentation Pin
Marc Clifton19-Nov-13 8:24
mvaMarc Clifton19-Nov-13 8:24 
GeneralRe: Over-documentation Pin
Worried Brown Eyes20-Nov-13 0:49
Worried Brown Eyes20-Nov-13 0:49 
GeneralRe: Over-documentation Pin
Ron Beyer20-Nov-13 3:08
professionalRon Beyer20-Nov-13 3:08 
GeneralRe: Over-documentation Pin
StM0n25-Nov-13 9:56
StM0n25-Nov-13 9:56 
GeneralRe: Over-documentation Pin
Rob Grainger28-Nov-13 22:26
Rob Grainger28-Nov-13 22:26 
GeneralRe: Over-documentation Pin
Vasudevan Deepak Kumar29-Nov-13 1:54
Vasudevan Deepak Kumar29-Nov-13 1:54 
GeneralAbsolutely necessary Pin
imagiro15-Dec-13 23:00
imagiro15-Dec-13 23:00 
GeneralRe: Over-documentation Pin
Lutosław27-Dec-13 1:05
Lutosław27-Dec-13 1:05 
GeneralVS Go BOOM! Pin
Brisingr Aerowing15-Nov-13 12:54
professionalBrisingr Aerowing15-Nov-13 12:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.