- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
// TODO: update SUBSTITUTE_CODE
Admin
The real WTF is that SUBSTITUTE is misspelled ;)
Admin
Ok a bad choice declaring a variable that is never used but there are many places in code used in different companies that is marked in different ways for updating, deletion and changing.
If the change is of a minor importance or is scheduled to be made after some other change this isn't the worst way to remember it by.
Admin
// TODO: Mispel SUBSTITUTE
Admin
What if you set compiler options to ignore warnings (at least like that)? So much for the to-do.
Admin
Best lingering comment I ever left behind:
// was drunk...will fix later
Ironically, the code worked, so the code, and comment, remained unchanged.
Admin
The thing is, "//TODO: blah blah blah" will show up in the Visual Studio Task List window. "int SUSBSTITUTE_CODE" and the comments following it will not.
Was code able to fix it?Admin
I think what you were looking for is #warning
Admin
SUBSTITUTE_COMMENT
Admin
int SUSBSTITUTE_CODE; // We NEED to figure out what to do with variables // that are declared but never used.
Admin
Why not, i'm using from time to time:
#warning //TODO: blablabla
this way I can see on every compilation what's todo. Because //TODO is only shown in open document's as far I know.
Admin
TRWTF.
Admin
No, see, that's part of the beauty of it. He INTENTIONALLY misspelled substitute to make it even MORE noticeable.
Admin
If I were the team lead, my response would have been something on the order of, "We tried // TODO:, but that didn't work. I tried this, in the hopes that it would get someone to fix it - but it hasn't worked either. If you can come up with a suggestion that works, I'll recommend to our manager you get a bonus for it - and I'll at least take you and (if you have one) your SO out to dinner." But then, this is one of those things I care about.
Now, that having been said, I've also tried the method of having someone have the primary job of cleaning up old code. (It has thus far failed, because management has never bought into it enough to even give lip service to the idea.)
Admin
TRWTFs:
Admin
So: TODO didn't work, because nobody in the team searches for TODOs.
SUBSTITUTE_CODE didn't work, because whoever is in charge of resolving the overnight build goes MEGO whenever they see it flash past.
Bashing "managers" over the head doesn't work, because ... well, OK, it does. But only because casual brutality can make six months' worth of Hell seem worth it, somehow.
Zero errors, one warning. I'd say this is pretty agile, really. If the OP insists on LOL, may I suggest either Barney or the Tellytubbies?
Admin
You don't really have a clue, do you?
Admin
How does this qualify as a WTF?
I've seen //CHANGEME, //TODO, //REDO, /REVISE/ #UGLY, ;NOGOOD, and probably a few others.
They are mostly intended as "this works but isn't as general as it seems" notes. E.g. when a generic sounding function has a non-generic implimentation, or when some code that looks multi-use is written in such a way that it will only work in specific circumstances.
There is nothing saying that those need to be changed in 1 month or 6... it's a matter of priority. If the code is ugly but works, and something else doesn't work, the proper priorization is to fix what doesn't work before redoing code that does what it needs to do.
Yeah, the method outlined in this story wasn't the best... but it was a hell of a lot better than unmarked potential trouble spots left in the code for people to trip over.
This:
or:
Neither is right. Which is worse?
Admin
Ah, this is C-Hash isn't it?
Isn't there a piece of inappropriate XML that's the correct way of doing this.
Admin
// TODO: IRISH_GIRL
Admin
"How does this qualify as a WTF?"
As people have stated, #warning would have done the same thing without looking completely hackish.
Additionally, //TODO, //HACK, and //UNDONE comments are automatically marked in the task list in Visual Studio to make them a bit less daunting to keep track of.
Admin
No one cares for TODO? Yeah it's not like VS automatically lists those for you in a convenient menu for you for anything.
Admin
Of course, even that isn't going to force anyone to fix the items mentioned, or even read the task list. We have some //TODOs in our code that date from about 2002.
[image]Admin
In Java, isn't TODO a recognised word - certainly in Eclipse it is highlighted like an annotation (perhaps an IDE-specific feature). Does Visual Studio do this for TODO or HACK or similar?
Admin
Admin
Admin
I fail to see how this warning:
[code] E:\ProdSrc\ProductSettingsDALC.cs(82,8): warning CS0168: The variable 'SUSBSTITUTE_CODE' is declared but never used
[code]
Leads to this kind of response:
Submitter must have never worked on a large team project before.
Warning CS0168's proper response should be "oh, someone accidentally left some unused code in again, I'll send a helpful reminder to him to remove it." There's no way CS0168 should elicit "WTF?".
Admin
Nope, it's C-pound.
Admin
The problem is not that he doesn't have a clue, but that he was an ass about it.
Hell, I didn't have a clue or see this as much of a WTF. But now I learned, wooooopie. Time to go to work and deal with real WTFs and with people who realize WTFery is a part of life some times. peace
Admin
I'm reasonably sure that you're aware of this, but I'm not so sure with n00b "Bugzilla and Process will Save the World!" types.
Fact is, they don't.
"TODOs" are old-fashioned "waterfall" (whatever that is) methodology. They kind of depend upon things like (a) the coder reviewing what he/she wrote (b) code review and (c) unit testing.
Very little of this has to do with nasssty, nasssty, GUI interfaces. Or, indeed, enterprisey "bug" reporting systems.
It's at a lower level.
It's worked for about twenty years, and doesn't get in the way of GUIs, Process, or even nastily sliced cheese with out-of-date pickles.
Get used to it. It just works. "TODO" works. Breaking the overnight build with a manufactured warning works.
What doesn't work is a bunch of management morons who leave something like this in the system for six months; but, let's face it -- #warning would't work. //TODO wouldn't work. SUBSTITUTE_CODE wouldn't work.
We're all fucked at this point. As far as I'm concerned, SUBSTITUTE_CODE is perfectly adequate. GO_POSTAL is an equally valid compiler directive, but it tends to have unfortunate consequences in real life.
Admin
Am I a bad coder for thinking that actually makes sense?
Admin
Agreed. As I was reading the article and saw his reaction to the minor compiler warning of "ZOMG WTF!!?!?!?! one one one !!!" I thought it was a little silly. Unused variables are not a WTF. As others have mentioned, they can be used as placeholders for soon-to-be-added code or for any other number of reasons.
Sometimes the brats on this site tend to have knee-jerk reactions just because they want the excitement of having found and pointed out a WTF. rolls eyes
Admin
The way we got our collection of up-to-six-year-old TODOs is, we had developers and contractors who wrote applications, put TODOs in their code, had it tested and published to Production, and then left for other pastures. The code's published; no one's complaining; therefore, no reason mess with it.
Here's an example quoted from one of our applications: "// TODO: (CT) Find out why we display the time only when we can't see any data."
Frankly, no one here cares why we display the time only when we can't see any data. But none of us have felt moved to delete the comment, either. And so it remains, aging gracefully.
Admin
// WTF?
Admin
I think you might be missing the point. Everyone leaves in unused variables or methods from time to time. This guy purposefully added this thing in just so he could get the compiler to remind him to fix it later. It's probably the most original WTF on this site in a long while.
If there is something like this in the code, you can be damn sure that it doesn't compile with exactly 0 errors, 1 warning. There are probably thousands of warnings, in which case something like this would get lost in the crowd.
Admin
Agreed regarding the unused variable... that smacks of someone who learned using tools that didn't support some of the fancier features and hasn't bothered to keep up with the changes. Sort of like some of the "force a divide by zero to cause the program to crash at a certain point and cause a debugger to start because the problem can't be started from the debugger" techniques that used to be commonplace.
However...it really isn't much of a WTF. So they used an obsolete or poor method to do the right thing. Wouldn't it be much more WTFish if they didn't do the right thing at all?
From the comment it looks like the code way deployable but not very flexible... some settings are shared in the wrong way. The product will be better if it is made more generic but so long as nobody does anything fancy in the configuration it's OK. When does it need to be fixed? Perhaps never. It may be that nobody will ever use one of those fancy configurations. In that case it really isn't a TODO, doesn't merit a #warning... so what's the WTF?
Admin
If you are just starting out in programming, you should not do this approach because warnings will not be noticed. It is too easy to ignore TODO: comments, so the best way that I came up with was to insert a divide by zero error. So for example, I would make a variable called intTodo, like this...
Dim intToDo as Integer = 1 / 0
This way you can be sure to get the attention of the developers. The nice thing about this approach is you can use different numbers to refer to lines in a spreadsheet,
Dim intToDo as Integer = 1 / 0 Dim intToDo as Integer = 2 / 0 Dim intToDo as Integer = 3 / 0
for example would refer to lines 1, 2, and 3 in the master work list spreadsheet.
Anyways, I thought I would share my team lead best practices with you in case you are a junior developer and looking for ways to improve your style. I like to use this forum as an opportunity to teach and educate others in the developer community.
Admin
By FAR the best joke post I've seen on this site!
Admin
I really hope you just forgot the <sarcasm> tag.
Admin
I'm not sure if that is an insult or what. But I'm used to being mis-understood, it happens even on my own development team sometimes, especially when we hire a new developer.
Admin
Lol, sorry that was supposed to be posted by TopCod3r ;)
Admin
In general TODOs should be used for things that need to be cleaned up or changed in the future, not as a way to document bugs. A unit test to reproduce the bug is usually the best way to document a bug until it is fixed.
Admin
I didn't think bugs were possible if you used TDD?
Admin
People often accuse me of being sarcastic, but I think it is just a misunderstanding. Probably because I just have some much training in the field that I forget sometimes that other people may not know what I know.
Admin
Not the worlds greatest but I like to comment my code with
'Fix over a beer or 'Reminder, do not create arrays while drunk
On the serious side, I too have also been guilty of trying to point out something I found in code to my senior developers, in hopes of a pat on the back. Sometimes keeping my mouth shut works better, but again I'm a newb at this :\
Admin
So? The point is that nobody looks at those, so they don't get fixed. This was a plan to put the TODO somewhere people would be watching. I doubt people are going to be scrolling up through the build log looking for warnings, though. (Unless they set to treat warnings as errors, but then this wouldn't compile at all)
Admin
Admin
IF I was the team lead, my response would be
"Well, congrats, you passed test #1. You had the initiative and curiosity to both notice and ask about SUBSTITUTE_CODE. Test #2 is to see whether you have the same initiative to step up and do something about it."
Sounds like an opportunity to me!
Admin
#warn FIXME: You really, really need to read this code, it's broken
#ifdef FIX_IT_OR_DIE #error FIXME: I'm not kidding. #endif
Admin
The problem with this method is that using it in this manner instead of a TODO: is like surrounding it with a SEP field. Even the obvious misspelling doesn't help.