Am I the only one who noticed that each of the two comments by dbenavidess110 are all one sentence apiece, but without a period (or even a semicolon) at the end? Is there a competition for a one-line (one-sentence) comment?
@yog-sothoth "Now if you teach them how NOT to do things, but how to do them better and more cleanly, then I am 100% in agreement."
That's exactly what we are doing with the code from the contest - using it to teach engineers how NOT to do it. But based on this dicussion here, it sounds like rather than having people do obfuscated code intentionally we have more than enough real-world examples out there to share. The challenge is, of course, finding out how it works and how to fix it.
@BrainiacVI: After I was halfway through my rant I figured that was the case, but continued anyway in case I was mistaken.
It's hard to stop when you are full of righteous indignation and you are in the middle of a good rant ... and then you realize that maybe the other person didn't mean what you thought he/she had meant...
@BrainiacVI I got my satisfaction a year later when one of them had to modify a program he had written and I had to contain my laughter as his expressions cycled between quizzical, astonished, confused, and dumbfounded.
There's that classic old comment: "When I wrote this, only God and myself knew what it did and how it worked... now God only knows!"
BrainiacVI, I was being sarcastic about self documenting code. It was always a joke with my co-workers. Your story makes it clear that documentation is always needed and can save even the author a lot of time and heart ache.
daleetse: Well my code doesn't need them because it is self documenting...
I worked at one place where the "older and wiser" heads told me there was no need to document the code, the instructions told you what it is doing.
I just smiled and keep documenting my code. I had learned my lesson years earlier when I had to throw out about 6 boxes of cards with programs I had written without comments and couldn't figure out what they did.
I got my satisfaction a year later when one of them had to modify a program he had written and I had to contain my laughter as his expressions cycled between quizzical, astonished, confused, and dumbfounded.
Instructions tell the computer what to do, comments tell you why.
Although I must admit I had once written a program in FORTH where I extended the compiler (FORTH lets you do stuff like that) and there was a block that looked like documentation of the OPTO I/O panels but in fact the compiler read it to generate the port addresses and bits within the port I/O byte.
The company I wrote it for brought in FORTH, Inc. to look over the code. FORTH, Inc. told me the majority of the code was vanilla, which I intended it to be, but then they flipped to the I/O declarations and said, "But this was pretty neat."
I think there are a lot of examples of malicious code out there too be counted, but don't quote on that ;), in safe system languages you can tell by module which program behaves well or can behaves bad, honestly saying we write good code anyone can do but in unsafe system languages nobody can proof as unintended acceleration case proves, is a shame we failed to understand that, too bad, people are getting hurt or killed, a shame
I have seen a lot of bad code in my career, but most don't do it out of malice. There may be a few that think it is job security, but they are no longer in the industry... Of course, my code is perfectly readable and maintainable... It's just like writting, why use a big word when a small one will do. And comments? Well my code doesn't need them because it is self documenting...
Replay available now: A handful of emerging network technologies are competing to be the preferred wide-area connection for the Internet of Things. All claim lower costs and power use than cellular but none have wide deployment yet. Listen in as proponents of leading contenders make their case to be the metro or national IoT network of the future. Rick Merritt, EE Times Silicon Valley Bureau Chief, moderators this discussion. Join in and ask his guests questions.