- 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
Isn't this sort of thing classed as job security? I've made myself very unpopular over the years automating and removing such "features".
Never so keen on sticking around to the end of time in any role, less so if it's a daily/monthly/annual drudge of updating pointlessly hardcoded shite.
Oh, and;
Admin
right_now_comment = 2; // TODO: look up if months are zero based or one based
Admin
A good thing it wasn't the right_now_day or right_now_hour or they'd have many more PRs to review.
Admin
That's sick, sick, sick. Couldn't they at least set up a database table and query it. Most companies do this, for example, for Fiscal Calendars. Of course the Accounting department must remember to set up the approaching year, or all hell breaks loose in January. The same goes for Working-Holiday Calendars. My outfit uses both. Are there any companies left in this modern world that DON'T use both? Finally, even if it's some oddball Calendar, they could still create a tblRightNowMonth and have someone update it when appropriate.
Admin
This... This is so... No, words fail me.
Congrats, never before have I seen a single "representative line" be a WTF of such epic proportions.
Admin
How about rejecting the PR? Shows the pointlessness of reviewing PRs if crap like this keeps being merged.
Admin
How can that code possibly be meaningful? By the time it's deployed . . . ungh the pain.
Admin
At least he actually updated it monthly; I've been inflicted with this sort of stuff that was allowed to get out of date, and then the users were told not to rely on the displayed date, and to manually change it
Admin
It's people like this who will be first up against the wall when the revolution comes....
Admin
Let's add some bureaucracy on top - what if the change management process was slow that month and the deployment was delayed to the next month....
Admin
What if some accolyte of the BOFH sneaks thru a PR to set the month to 13?
Admin
Should rename that "variable" something like compile_time_month...
Admin
Don't they call this a periodic function in math? No? I'll show myself out...
Admin
That code is clever: If this remains unchanged, it will be correct for many years from now!
((However only during certain periods of a year. ))
Who is able to say this on own code?
Admin
You have no idea. I do code review on slop like this and it never matters.
The real WTF here is that they probably have a code review committee that insisted on underscores in the variable name and a single space before and after the // but wouldn't allow a constant definition or runtime lookup because that would be "too hard."
Admin
I worked on a project once where all window sizes were hardcoded and not resizable. Every time the Indian updated the global styles such that a child window somewhere had to scroll (weekly, at least), every link to that window had to have the size parameters updated. This was necessary because the Indian had deliberately hidden the scrollbars because they were "too confusing." Just another WTF on a Mickey Mouse project that was several months late for "unknown" reasons.
So one day, I spent like an hour figuring out how to automatically size these child pages based on content (clamped to a percentage of the screen). It only took that long because the Indian had broken HTML in the master page that perpetually lengthened the height by 25 or so pixels on every reload that I had to compensate for. Figuring I'd saved a great deal of wasted time in the future, what with the Indian's love of fiddling with global styles for no reason instead of working on the numerous bugs in its "framework," I checked it in and took a break (I was never assigned more than about an hour's worth of work in any given week - another WTF).
The next day, I got a "talking to" from the Indian's pet about how we "didn't have time" to do something like that because it was "too hard" (nevermind that it was already done). Yet, as strapped for time as we supposedly were, I was to remove the code and put hardcoded sizes back into to every caller. After I did that, the Indian's pet complained that she couldn't see some fields at the bottom of the page. It seems the Indian had, without warning, changed the margins for every control from 20px to 60px. So I got to go through the checkin-checkout dance on 50 pages yet again.
I think I spent five months on the same handful of pages because of stuff like this. And people wonder why software just stagnates at barely usable levels...
Admin
I submitted a good WTF article ages ago, but flavorless crud like this continues to get posted. Sigh.
Admin
At least our system only has that pain every DST change. Once a week for a whole month as different countries go onto (or come off) DST. It's not like there's any way of finding out from Unix ...
Admin
This is C code. Horrible C code, but still. There's no reason to assume it talks to a database at all. Not everything is DB-driven, you know...
Admin
Then put it in a configuration file, as a command line parameters, as an input control on a screen... Anything that doesn't require deploying a new binary.
Admin
Then put it in a configuration file, as a command line parameters, as an input control on a screen... Anything that doesn't require deploying a new binary.
Addendum 2017-08-29 05:28: CAPTCHA: clicking the submit button twice accidentally also submits twice. #WontFix #WorksAsDesigned
Admin
To be fair to the Veteran Team-Member, it did take five minutes to look up how to do this in the glibc documentation. Ain't nobody got time for that! (TM)
Mmm. Glorious C and it's pass-by-ref-but-not-really-because-I-only-understand-pointers interfaces.
Admin
Had a stand-up argument with one of my team members once, back in the days of FORTRAN.
He had designed a tool which read a list of records from a simple text file, the last line of which was the count of the number of lines.
"Can't you automate that bit?" was my question.
"Surely it's not beyond the wit of the developer building the file to count the lines himself and just add the number at the bottom," was his reply.
Admin
I've seen that. It is not an uncommon pattern in FORTRAN used both as a signal that the end of a completed file was reached as well as a parity check that no rows were skipped or double processed.
Admin
I doubt that any of this is true beyond "someone hard coded something that they shouldn't have". I get that there's a desire to obfuscate the origin but when 90% of the stories are admitted to be made up I don't understand why people keep reading this site.
Admin
If it was done as a parity check, I assume he counted the lines, compared with the check, and handled the situation that they disagreed? I don't think so.
Admin
"It is not an uncommon pattern in FORTRAN used both as a signal that the end of a completed file was reached as well as a parity check that no rows were skipped or double processed." Not just with FORTRAN, but with any "file" that was read from a deck of punch cards in any language. You needed a check that cards hadn't been lost out of the middle, slipped in, or if the order mattered, that the deck wasn't scrambled. Of course, there was no error handling for a wrong count - it took hours to compile the program without adding frills and whistles to it, so the software would announce that it had found an error* and abort, leaving it to the user to correct the problem and start over.
*That is, it might tell the user that there was an error before aborting. It would print the relevant details of the error (on dead trees, in all caps, few punctuation marks, and at least 140 columns wide) only if the programmer was unusually adept at communicating with humans, for a programmer.
Admin
And how would the program know where the error was to report details? About all that it would know was that more records were processed than should have been or too few records were processed.
Admin
"the Indian"?
I suspect you have bigger problems....