- 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
c o d e r s
a r e
p a i d
b y
t h e
l i n e .
Admin
Admin
Hey! Your mom didn't have any problems monitoring my 3 inches with her scroll bar.
Admin
The customer is always right. Not everyone is a customer, that's all :)
Admin
Admin
Admin
Admin
Oh, fun. I've also dealt with people who think that it's only a defect if it makes the product violate specs. Anything else is an enhancement. Apparently "functioning" isn't considered an implicit design spec....
That said, if this doesn't violate a spec, then the specs aren't as extensive as they're claiming, since this function will not work as advertised. Or working correctly is considered an optional extra.
Admin
This is the second person to claim this. First off, its nonsense. The problem will happen much sooner, as they are using int (31 bits), and not unsigned int (32 bits).
Secondly, there is only a year 2038 problem if you are using int as your time type. All real OS have time_t type, which is/will be at least 64bit by 2038, if it isn't already.
Finally, there is not enough context for determining whether this is a WTF or not. If the only goal of the code is to say how many days ago a request was opened, and requests are never opened longer than a year, then this may be 'good enough'.
You might want to consider why some developers are doing 2nd line support and maintenance, and why some are designing and specifying the project.
TRWTF would be a junior developer seeing something minor and jumping all over it like a pre-teen on Bieber, and then bitching on the internet when his wailing is deemed irrelevant.
Admin
78 characters or less, bitch.
TBH, this isn't really even formatting. This is just what you get when you set up vim right, and just type C style code.
Admin
Welcome to teh interwebs!
Admin
This is because most people have a fundamental inability to evaluate software quality. So they assume "wow if they put that much work into making it look so good, it must be good."
Admin
I honestly think that the "If it ain't broke, don't fix it" quote is absolutely right.
But it should be followed by Seth Godin's quote: "If you think it's broken, then it's broken".
Admin
FTFY
Admin
"If it ain't broke, fix it until it is."
Admin
A bicycle repair shop when I was kid had a sign that read:
"If we can't fix it we'll fix it so nobody can!"
Admin
Admin
Unfortunately in the real world there are things like "deadlines" which have to be met. Every developer should keep in mind that, when looking at another's code, they will always find things that look ugly to them, that they would do another way.
Admin
Of course, there's no actual need for there to be a problem at all, provided the size of time_t itself is expanded (1970 AD+2**63 seconds is a very long time off indeed). The real issue is going to be migrating all the existing data, notably including filesystems and archives of various kinds. The lifespan of builds of programs is much shorter than that of data.
Admin
Admin
Wait, have Microsoft and "looks pretty" ever really gone together?
Admin
TRWTF is expecting outsourced code to work correctly in the first place. Face it, you are working with a bunch of Indian code monkeys who are 'coding to the spec', and who will freely mash whatever unholy code style and practice they are familiar with into your shiny new project, because that is what they know.
At my company, we are still maintaining an outsourced program I like to refer to as the 'Indian abomination'. After we got the final code drop, it took me another 9 months to get it into working shape, and we still find hidden gems that make us go 'huh?' every once in a while.
Admin
Admin
Everyone ignore this guy... low level troll here.
Admin
A good point...except they actually did it the long-winded way instead of using the built-in functionality.
Admin
TRWTF is that Jeff took ten minutes figuring this code out. It's obviously trying to calculate time since Unix epoch... it's also immediately obvious that it's buggy because the line (which is nicely separated out from the rest of the calculation for clarity) for handling leap years is based off a year that's not divisible by four (in addition to the lack of support for 2100).
Admin
Admin
Actually, there is plenty of context to determine it is a WTF.
First of all, there are built-in functions that do this right.
Second, the request doesn't have to be open for over a year for the bug to show up. Try February 28, 2012 to March 1, 2012.
Admin
Admin
OK, I will.
convertDate diff: 1 TimeSpan diff: 2
Oh, it's off by a day. Go figure.
The worst part is that you know that this is just the tip of the iceberg. They've probably written dozens of other buggy, poorly-documented date-handling routines for validation, converting from strings, or determining the day of the week.
Admin
"ain't" is a contraction of "am not" and "have not" -- see http://en.wikipedia.org/wiki/Ain't
People use "ain't" also as a contraction of "is not" and "are not" "It ain't going to work" == "It is not going to work" "If it ain't broke, don't fix it" == "If the object or system operates satisfactorily, do not attempt to improve it in some irrelevant manner that may make things worse."
In most of the United States, "ain't" is considered incorrect, and its use marks the speaker as being ignorant or uneducated. In some areas and within some groups, it is an acceptable usage, especially when speaking informally (say "ain't" to your friends, but not to the judge at your trial.)
In "if it ain't broke, don't fix it" the speaker is using "ain't" and "broke" ("broken" is the standard usage) to suggest the point of view of a person who may not be highly educated, but has practical knowledge and wisdom that are more valuable than formal education, especially formal education without real-world experience. The speaker may be advising you to look for a higher-priority project to work on. Or, he may judge that the object or system that "ain't broke" is actually more complex than you can manage, and doesn't want to you to break it even more while trying to fix it.
Of course, you still have to decide for yourself whether the person is actually saying something wise, or is just repeating an old saying. (The wikipedia article gives more info on "if it ain't broke, don't fix it.")
Admin
WhoTF is sbs talking to?
Admin
Thank you kindly! I ain't will be forgeting this explaination!
Admin
Does anyone know if this guy is for real or a troll? He posts things like this on nearly every post thread.
Admin
Nagesh is the generic "Indian" coder made up by a bunch of white people and faked by various other users to amplify negative stereotypes about indian programmers. So no, he is not for real, and there is a minimum of 2^64 "nagesh" posts per wtf thread on this site. You get used to it and sometimes laugh, but never ever reply to it (directly).
Admin
DONT!
ACCUSE!!
ME!!!
OF!!!!
BEING!!!!!
!!!!! STRESSED !!!!!
Admin
Don't know man. You seem to be the one who doesn't know an obvious joke when he sees it. Maybe you're the one who's stressed?
Admin
Jeff must be kinda slow. You can guess this from the previous line
So it's substracting two "converted" dates, and dividing by a constant DAY to get days. Conclusion: convertDate converts to some absolute time format. This is probably the best approach if you have to write your own time-handling library, and it makes sense to reuse Unix time as a standard(instead of, say, half-minutes since 2002).
Of course it's still very bad coding: never write your own time functions (or input sanitizing functions, or XML parser, or GUI toolkit, or...). You won't get them right. Spend five minutes checking if your language has them instead.
90% of the WTF code in this site is noobs not knowing that the language has functions for that. Maybe C has made people too used to writing boring parts again and again.
Admin
Exactly. If it was just reinventing the wheel, it would raise the issue of either the programmers being unaware of the builtin functions in C# (or even how to find them on the fly) or them overcharging the company.
But on top of that it is inaccurate.
What about pre-1970 dates? Pre-1852 (Gregorian Reform)?
Admin
Admin
have fun with your libraries, you five-figure salaried peons, we'll be out building a new world
Admin
Admin
WONTFIX
Admin
How long do you think it would have taken you to write the program from scratch and get it into working shape?
Admin
We're not mind readers either. But you know what we do? We ask.
Admin
If it's not broken you can't fix it. You could make it prettier. Or you could make it faster. Or you could make it easier to maintain. But you couldn't fix it.
Admin
Admin
Maybe I'll go and [censored for drug references] and that will solve my stress problems ^_i^
Admin
Help! Help! I've fallen through a wormhole and ended up in 1996!
Admin
Good luck collecting on your 1851 invoice when you send it out. This is for a billing system after all.