- 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
WTF(rist)???
Admin
A real lack of comments in this article.
Admin
I actually appreciate the thorough explanation but maybe I am just weird...
Admin
This is the sort of thing for which comments are for. No amount of naming of methods would capture the information as usefully.
Admin
Comments are more idiotic than the code. // Plz ignore my 2 pages of bullshit
Admin
A few paragraph breaks would have been helpful. Wall-O-Text(tm) is a less than effective way to get ideas across. I've written such comment essays before, and it's a lot more readable when you can skim first lines of paragraphs to get a general idea of what is being discussed.
Admin
Code can never be so clearly written that comments are not, at least, a good idea. Knowing what the programmer did isn't enough. We most often need to know why they did it and what was the objective.
Admin
I'm glad I can leave a comment to this comments.
Admin
Indeed. The code says the how, but only comments can say the why.
Admin
This is the opposite of a WTF. When there is a weird thing in the code, the best possible thing to be next to it is a lengthy discussion of what problem they were trying to solve, what other solutions were considered and discarded, and an explanation of the downsides and gotchas of the solution that was chosen. This person should put this comment on their resume, I would hire them!
Admin
This comment could be more readable, but it packs an excellent analysis of the underlying reason for an apparently senseless code. So kudos++.
TRWTF is the series of bugs that allowed this situation to develop. http://html-agility-pack.net is apparently a transform tools that silently corrupt data. Dear developers of that tool, you just achieved eternal glory.
Admin
Is it just me but isn't the need to mention Frist as first post bloody annoying? Wouldn't this site be improved by basically deleting the Frist entries? Or can those bozos be banned or something? Or at least get a course in either writing correctly, or getting some self-esteem?
Just my two cents.
Admin
I only come here for Frist memes
Admin
And if I'm diving into your code to fix a bug some time in the future, your code tells me what you did.
Your comments should tell me what you meant to do, and ideally why.
Admin
And they say that developers don't like to write documentation!
Admin
Fifftennth!!!
Admin
The provided information is useful (or at least appears to be, so we will go with that)...but I argue that inline comments are NOT the place for any of it. Proper ALM artifacts [Stories, PBIs, Tasks, Bugs, Issues] all linked together is significantly more effective. As a trivial example how many of those points would be known to people who never open that file? [Rhetorical, the answer is ZERO]. But if they items are surfaced on Backlogs, Boards, Dashboards there is at least a chance they will be remediated.
Admin
...until your organization migrates to new ALM software...
Admin
Charles Wood - IT can be a problem if people are not smart. But that describes just about everything in life. I have been dealing with ALM tooling for nearly 20 years [longer if you count the days before the term was coined]. With proper planning and utilization it should never be a real consideration.
Admin
tventifrist!
Admin
Well yes, there is a WTF, but the comments aren't it.
Admin
You're just mad that someone else got there frist.
Admin
in my experience any codebase worth it's salt will outlive many changes of tools, processes, owning companies etc. etc. A comment in the code is much more likely to be found by the person trying to track down a problem than if that was in a document or other external repository somewhere
Admin
Well, commenting that is anything but a WTF. You wouldn't believe that's necessary at all without the background information.
The use of the read/writer lock for that purpose is though, and so is the atomic. Could have been smarter, something like this:
static unsigned int contention = 0; static unsigned int currentVersion = 0; static mutex m; static condition_variable cv;
wrapper (..., unsigned int targtVersion) { lock l(m); cv.wait(l, [&contention, ¤tVersion, targetVersion] () { return currentVersion == targetVersion || contention == 0; }; currentVersion = targetVersion; contention++; l.unlock(); ... // Do work l.lock(); contention; l.unlock(); cv.notify_all(); }
And there you had your nice and simple "multi value lock".
Admin
Or not, because this stupid comment field is guaranteed to screw up any code....
Admin
I heartily agree.
Admin
Ideally, comments should do that. But I've run accross comments like
//Setting filter to .txt openFileDialog1.Filter = "csv files (.csv)|.csv";
And I'm left there wondering if the code is wrong or the comment.
Admin
Stupid me forgot the code-tag. :( That should be 2 lines of code, not only 1.
Admin
Frist posts are brillant.
Admin
In general, I think documenting the need for workaround is a good thing. in this particular case I'm wondering though if working around the problem was the best idea: HtmlAgilityPack is an open source library and it might have taken less effort to fix the bug there than to work around it. It might simply be a case of the parser incorrectly thinking that
Admin
That was supposed to say "<div> is not allowed inside <form>". I blame the lack of a preview option.