- 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
That's just like my tri-level house that has four levels with the basement.
Admin
A good TS_INTRADAY to you, sir!
Admin
TS_WTF_IS_AN_INTRADAY?
Admin
Why, it's TS_NO - 1.
Admin
So how many choices are there for a 5-state?
Admin
FileNotFound, I guess?
Admin
It used to be true tri-state until the Senior Software Consultant changed the original code(see below).
Admin
NOBODY CARES
...like a bear
Admin
Perhaps it goes up by primes? A five state enum would have seven options, and a seven state enum (say, days of the week) would have a full eleven options to work with.
Admin
So a 2-state has 3 states, and a 3-state has 5. I suppose the real question here is whether the true number of states in an n-state grows linearly or exponentially.
Because if it's exponential, I pity anyone who encounters a 9-state object.
Admin
Okay, now it makes sense. They have an engineering overdesign factor of 50%:
statesImplemented(statesSpecified) = ceil(statesSpecified * 1.5) statesImplemented(2) = ceil(2 * 1.5) = ceil(3) = 3 statesImplemented(3) = ceil(3 * 1.5) = ceil(4.5) = 5
Admin
Yeah, that's a concern. It's hard to tell with only two data points. However, I think that it's more likely to be linear than exponential since people prefer O(N) algorithms over O(exp(N)).
Admin
2 -> 3 3 -> 5
It's Fibonacci.
Admin
people may like linear algorithms, but on this site they're more likely implemented in an exponential manner.
Admin
... mostly harmless
Admin
This code only works within the tri-state area.
Admin
Where's TS_IDSPISPOPD?
Admin
Ok, now it makes sense, I always wondered how movies like Friday The 13th that were originally a trilogy have ended up with more than three!
Admin
I think this is all about payments/transactions, therefore the name intraday.
It could be possible that TRI_STATE is an enumerator for "TRansaction Identification(type)", or something else with an I. Making this a nonsense WTF...
Admin
}; indeed
Admin
I think the formula is double it and subtract 1.
2 -> 4 -> 3 3 -> 6 -> 5 5 -> 10 -> 9
Admin
♫ Every TS_MORNING, every TS_EVENING, ain't we got fun? ♫
Admin
That's the enum holding all the state names of the USA.
Admin
Obviously the code writer was a fan of Hitch-hikers Guide to the Galaxy, the 5 book trilogy.
Admin
Meme status in 3...2...1...
Admin
Six books. See above.
Admin
FTFY
Admin
Admin
There's a sixth one - kind of. I just read ISBN-10 1401323588. It wasn't too bad.
Admin
haha... someone named a variable to represent 3 items and then added some more without changing the variable.. cool story bro.
What next, someone putting a spelling mistake in a comment?
Admin
it was good, a descent book by a descent author, but didn't quite fit the Trilogy in my mind
Admin
this is just like the five book trilogy - Hitch Hikers Guide to the galaxy
Admin
2 -> 3; 3 -> 5. With no doubt possible, it's Fibonacci. So a 5-state (or penta-state) would have 13 states. Also, the US has 32951280099 states.
Admin
Admin
Nope, wrong. It's the n'th prime number. 1 -> 2 2 -> 3 3 -> 5 4 -> 7 5 -> 11 etc.
Admin
I don't believe the kind of people to have a 5 state Trinary enumeration are the kinds who would prefer less of anything. I'm pretty sure they would like exponential algorithms.
Admin
This one almost makes sense. Almost.
TS_UNKNOWN could be a variation on a stock first item in every enum for handling errors and other exceptional cases. As the first item, it should have the value of 0. That conveniently makes it the only false enum value giving rise to constructs like:
And if we assume that the "NO" in TS_NO is actually an abbreviation of "number" rather than the English negative, then it makes a bit more sense. Similar to *_UNKNOWN being a stock first item in each enum, *_NO could be a stock last item so that its value can be used to automatically calculate the number of values in the enum. It does have some disadvantages (TS_UNKNOWN is included in the count and TS_NO creates an invalid state that the enums shouldn't be set to), but it does theoretically serve a useful purpose. Of course in an ideal world, the programming language would provide a mechanism for figuring out how many values are in an enum and TS_NO would be unnecessary.
Once we've excluded what appear to be stock enum values (possibly mandated by the coding style in use), what's left does properly fit the tristate label. So it's a little ugly, but there's a potentially reasonable explanation for everything.
Of course calling it a tristate is still a WTF since the enum values imply it's a lot more specific than just involving 3 states.
Admin
Theres also the boolean mysql enum, if you create one that can be ('true','false') you'll find it is actually: ('true','false',NULL) even if you set the default to be 'false'...
NULL == FILENOTFOUND?
Admin
For those of us old enough to remember, and before the widespread advent of computers, noon was 12 m. and midnight was 12 p.m. There was no 12 a.m. But computers are binary/two-state. So now noon is 12 p.m. and midnight is 12 a.m. Arrgh!
This change also ignores the question of how can there be an a.m. and a p.m. without an m. to give them meaning? For you young whippersnappers who don't get this, tempus fugit.
And in days of yore, printed schedules for buses and trains, by convention, printed a.m. times in light face and p.m. times in bold face. Again, binary/two state. And also why there were so many arrivals at 11:59 (light face) and so many departures at 12:01 (bold face).
Admin
Admin
Yup, and calling it "vestigial."
Admin
TS_MORNING = Submitted after midnight, but before business hours TS_EVENING = Submitted after business hours, but before midnight TS_INTRADAY = Submitted during business hours TS_NO = Not submitted at all (possibly an internal note? TS_UNKNOWN = Unsure of the submission time
The use would be in a ticket tracking system, to differentiate the number of tickets that come in by the time (so you can charge differently for each "time period")...
Now, as far as the name "TRI_STATE", I can think of 2 possibilities. Either TRI == three, and TS_NO and TS_UNKNOWN were added post-deployment as it was found they were needed. The other possibility is that TRI == 'Transaction Scheduling Information' or something like that...
Some documentation would be nice (since it's not obvious what it's talking about), but other than that, it CAN be justified (obviously without seeing how its used, it's hard to see if it's a real WTF)...
Admin
I think what you mean to say is that the sixth book is "almost, but not quite, entirely unlike" the Hitchhiker's Trilogy
Admin
Admin
Admin
Admin
Admin
Admin
Admin
9'. It looks like 9, but it hails from an alternate dimension in which 3 was never born. Also, it has a goatee and is evil.