- 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
Exactly ... this is more or less the right solution if only certain sequences of mods are permitted.
Admin
WTF FTW indeed!
Admin
Even more than 2^45, because there are different ways of entering the same combination. The reasoning above only considers cases where all the steps are entered separately, but if for instance we had:
1,2,3,4,5,6
then the same combination could be entered as:
1-2,3,4,5,6 1-3,4,5,6 1-4,5,6 1-5,6 1-2,3-4,5,6 1-2,3-4,5-6 1-2,3,4,5-6
etc, etc...
And each of these needs its own row in the table. The total number would be quite a lot more than 2^45.
Admin
Only if the table also included the name, employee ID, and date of approval. If this is in fact a system to prevent unapproved mods then you need to be able to audit it. My money's on the WTF.
Admin
Admin
Admin
(1) FAA regs. There may be a good reason why these apply to "multimedia" components, but I'm not convinced. Could well be pointless red tape. (2) Lots of ripping "warranty invalidated" panels off. Given the general ambience of the story, I'd bet that the owner of the warranty isn't the repair service company. (3) Oracle 11i. Well, we'll get to that. (4) 'The field accepted "shorthand" input.' So presumably 'the doohickey' in charge of 'the field' can perform simple validation and normalisation. It's not like turning "1-6" into "1,2,3,4,5,6" is an especially burdensome task. (5) Why is any of this at all being done in the database?
Really, I swear, the sort of morons who buy Oracle 11i for applications like this make junior PHP hobbyists look like Gurus. If there really are dependencies between the steps, or even the ordering of the steps, then this is a perfectly sensible use of a database (only minus the actual logic). Exactly what benefit is derived from a "one validation fits all" massive denormalisation into a single table with a single column of machine-unfriendly -- and user-unfriendly; what happens if I prefer "1-4,5-6"? -- gibberish is ... aak, the bats! they're swooping again!
Of course, as usual, half the important details have been elided for clarity, but I'm at a loss to see how any of this makes sense.
And the real WTF, the true WTF, the absolutely goddamn inevitable WTF with a system like this, is
. Well, yes, I imagine you would.In which case you have three choices:
(1) Rewrite the goddamn application so that it makes sense. Heck, you've got Oracle 11i. Use (shudder) Java, if you feel you have the need. (2) Keep with the current system. At least it requires manual intervention from one of three people who are liable to be sued when things go wrong. (3) Auto-add each new mod.
W-T \wH\w \w+CK?
Once you've got down to 0-normal form, I didn't think it was possible to go lower.
I was sadly misinformed. By the way, is that an African plane falling burning from the sky, or the European kind?
Admin
Actually this sort of thing could be a feature. Instead for writing boring '1-4,7' thingies in the edit box you could write 'waffles' and then get your buddy in IT to add the line in the table so 'waffles' turns into '1,2,3,4,7' and 'rabbit' becomes '1,2,3' heck Tom over there can get 'jupiter XY' to be '1,2,3,4,7' too just to add more excitement to the system.
Admin
This place is so flippin' mod biased...there's never any mention of rockers! I'm gonna go ride my scooter off the Cliffs of Dover now...
Admin
If so, I want the link on YouTube. Hell, my mother wants the link, and she's been dead for three years.
We're not much a Cliff Richard family, us.
BTW Rocker+1 that comment, my man.
Admin
My co-workers gave me a weird look when I just said "Noooooo" in sad disbelief.
Admin
A quick scan of the comments suggests to me that the solution is not as big a WTF as it first seems.
There may very well be selected combinations of mods that cannot be performed during the same service call. In this case, you would need to build a table of "if I am doing this and this and this then I cannot do that or that or ..." Well, you get the idea.
This kind of knowledge is specialized and, in a small shop, that kind of knowledge might be known by only, say, 3 specialists. The effort to develop a rule-based algorithm might very well be non-trivial given the universe of possible combinations.
So, instead of building in all the logic to handle which mods can/cannot be combined, you build in logic (a simple table lookup) that accepts only previously approved combinations. All other sequences need validation and confirmation by the SMEs.
Admin
Brilliant case of job security
Admin
Hot.
Admin
(I was wrong, btw:) The database table holds two columns: one contains "shortcuts" and the other "expansions." Now, I've actually written this in Perl once, and it's not as easy as it sounds ... if you want to get it right. I mean, it's about two hundred lines of Perl.
Or two fucking stupid columns. Plus about a quarter inch for any other columns with really narrow column names.
Look. It's simple. Only one column is necessary, no matter how brain-dead this application may be. Can you guess which column that might be?
So you go with the simple solution: a list of ordinals. Jeez, even Access can manage this (single-threaded). But, let's consider your proposition first.
Let's assume the model is "disassemble ... spray miracle unglue ... remove chip ... replace with new chip ... spray miracle reglue ... reassemble."
That would be about it. I don't see any PhD Electrical Engineering stuff going on here. You've got preconditions, you've got actions, you've got postconditions. You also have dependencies on other components/procedures, which ought to be trivial to model for something that sits in a recess in the back of the seat in front, for God's sake.
I see this as a decision tree about yay deep by hoo wide, where (yay < limit) and (hoo < limit) and (limit ~ 10). Basically, a sparse matrix with a built-in state-machine. Not too difficult to implement for the average Pooh Bear in 1970. Possibly too difficult for the idiots we have using things like Oracle 11i these days.
Oh, and if it is too difficult? Why would you rely on Los Tres Supremos to get it right manually on a bad hair day?
Or maybe that's why they don't answer their emails any more ...
Admin
Damn! "Add a row to a database table" looks better and better all of the time...
Admin
TRWTF is why you all are debating the best way to code a solution when it's obvious:
"the field accepted "shorthand" input to represent a range of numbers"
... change the field to diable "shorthand" input. A few extra keystrokes won't kill them and compared to everyone stopping what they're doing every time someone comes up with a new permutation it would probably save time in aggregate.
Admin
I assume you have some sort of psychological problem with state tables and decision trees. You can leave me with the Perl and 1970s horror.
Yes, perhaps now is a good day to die.
Addendum (2009-04-23 18:03): PS, it's a "state machine," not a "state table," you cretin. I took your word for it, because your Quotez Skillz are sadly deficient and I didn't want to draw attention to the fact in case your sophomore year supervisor was checking in.
There is a fairly important difference.
Admin
Wait, I can fix it!
It was too confusing before, I couldn't follow the logic.
Admin
I'll say. This is more of a baby WTF that grew over time.
At the start it was probably the easiest solution, especially since the guy programming it probably gave up on the always illogical business logic that the supervisors use.
pink fairy wants to spend a few months analyzing the requirements, while the original dude spent all of a day from bright idea to code complete.
You've also got to think about how other systems consume data. Perhaps some braindead report writer thing can't actually extract 1-3,5 to be 1,2,3,5 so the table of possible combinations also has to store it.
I only bring these up because most of the time the wtf's in your system are a result of illogical business logic, and other enterprisey apps. At least we can be certain they'll never develop the world domination robots.
Admin
Admin
$user_input
SELECT sequence FROM lookup_table WHERE shorthand = '$user_input' AND status = 'live'
if(num_results < 1){
// generate user alert here // Something along the lines of: // 'Please contact a service engineer to add your job request'
//Charge 3 hours' work
INSERT INTO lookup_table (shorthand , sequence , status) VALUES ($user_input , $parsed_result , 'pending') } else { // Continue program logic here. }
.. Sounds like a great gig to me.
Admin
There are 45 factorial permutations of just listing numbers 1 to 45. That doesn't even count the ranges, like "2-3".
Also, 45! is definitely much greater that 2**45 power, since each term in the product, except one & two, are greater than two. There are 45 terms in both products.
Computers do math. so, programmers should know math. That's a common WTF.
Admin
C'mon, one of the nice things about having a computer is it can do the math for me! All that math they made me learn to get my degree... never used a bit of it in over 25 years of software and database development.
Admin
It seems to me that if the whole parse-a-comma-delimited-list-of-numbers-and-numeric-ranges alternative solution is itself a WTF.
Even if there is some kind of restriction on the valid combinations, why wouldn't you just design the front-end so you could click on the mods you wanted in the set? You could use a checked list box or a Left-list/Add/Remove/Right-list style form. This way you could allow the user to see the actual mod names and not have to mess around with the numbers.
I can't think of any time that I've seen a comma-delimited list stored in a database where there hasn't been a much better solution.
Admin
I know! They could write a routine that automatically goes through each possible permutation to pre-load the table!
Err.. waitasec...
Admin
Well, one the plus side, he's got a few thousand unit tests already written for his new function.
Admin
And he'll probably find a few errors in those tests...
Admin
Admin
Well ... all that would be relevant if all 45 steps were to be performed on all mods, and the only difference between them was in the order in which they were to be performed. I leave it as an exercise for you to determine how many of them would have "Close field-serviceable covers" immediately followed by "Open field-serviceable covers".
What's going on here is that there are 45 different tasks that may or may not need to be performed for any given mod, and only a very limited amount of leeway in the order in which those tasks could be performed (exactly how many possible permutations there are for each mod - how many topological sorts are admitted by the dependency graph - is of course something that would come from the realms of business logic).
Admin
I wonder how many entries are already in the table. And how many of them contain errors. I'd bet that somewhere in there, there's something like "1-9" maps to "1,2,3,4,5,6,7,9". And then somebody gets the wrong list of steps, and no one can figure out why.
Note to those saying this may actually be a good design if the requirement is to limit the set of legal combinations: The story started off with the requirement that new combinations be "auto-added". So the whole point is that there is NOT a requirement to limit the combinations.
Admin
On my present job, I recently commented that I was impressed how the original authors of a certain software package we are using managed to get such a complex product to work through sheer persistence and hard work, despite their total lack of skill and talent.
I'd say the same thing applies here. Can't get a 20-line function to work? No problem. Just hand-type a few thousands rows into a database. I guess it's better than giving up in despair.
Admin
What a great idea! Just have a list of common comments that users can select from. Think how much time it would save.
First!
The real WTF is using VB.
Irish Girl!
Wooden table!
This story is obviously fake because no rational human being would do any such thing.
If we make a few additional assumptions what the programmer did here is completely valid.
... and maybe a dozen or so more.
Admin
Going by the examples, it appears that the numbers must always occur in order, that is, 1,2,3,4,5 is valid but 2,4,3,1,5 is not.
Given that, the correct total count is 2^45. Each of the forty-five numbers may or may not appear, but the order is fixed.
45! would be the correct total if all 45 always appeared, but they could come in any order and the order is relevant. That is, there are then 45 choices for the first number, 44 remaining choices for the second, etc.
Admin
As has been stated already, these are not just random numbers, they represent real steps in a process which must be followed.
Presumably there are many dependencies between the different steps thus:
a) limiting the number of permutations b) requiring some form of validation
Having a pre-populated list like this could make sense, particularly if there is code which maps particular sequences to something more meaningful. e.g. rather than showing 1-5,7,12-14,18 on the front end, maybe this sequence could be mapped to "Standard Engine Repair/Service" or whatever, which again could benefit from a table to validate against (but would presumably have a name column here).
Having said this, it is a pretty poor solution and suggest that either the designer had an IQ of 5, or the requirements initially only involved 3 possible steps and the designer hadn't accounted for growth.
Admin
Admin
Admin
Ah, yes, the kind of solution that makes you want to cause physical violence to it's creator, simply because justice requires that somebody that incompetent also be in pain.
Admin
Admin
I don't consider this a WTF. There is probably only a very small number of sequences valid (in the sense of "You are still allowed to fly the A/C afterwards"). And the rules to determine the valid sequences are probably somewhat complicated. Thus a field validation would be a disatrous big piece of code with rules, exceptions, exceptions of the exceptions, ... So it's perfectly reasonable to outsource the real field validation to the most effective device to do this (the human brain of somebody understanding the A/C maintenance process) and to cache the results of this validation in a list.
Admin
Ok, but then why doesn't it just expand the shorthand and check to see whether the final expansion is in the table?
Admin
Admin
Admin
Admin
Admin
There is one other reason why this might have been done, that I don't think anyone has mentioned yet...
You see, the user interface there looks a lot like Oracle Applications, rather than just the Oracle Database. If that's the case, then the original "Developer" probably was just a techie who performed the initial install and configuration of the application.
The standard features of Oracle Apps lets you specify a lookup table for a field, but it doesn't let you specify a custom PL/SQL function. This means the original techie had two choices:
Of course, the correct solution (without modifying the Oracle Applications code) is to add an "On UPDATE" trigger for the field with the expansion function - but that still probably sounded too much like "customise 3rd party app" to a manager somewhere!
Admin
Admin
I don't see the problem, it's only 35,184,372,088,832 rows. I'm sure there's no better way to do this.
Admin
To those people who are suggesting that the design is intended to restrict the options to valid combinations, I think you missed something in the first sentence of the post. The guy was hired to implement an way to "automatically add mods". If the business process was that some person reviewed the new combination to make sure it was valid, they wouldn't be adding a feature to automatically add any new user-entered combination to the look-up table.
Admin
Combinations aren't the same as permutations. That's a common WTF, and programmers should know math. 2^45 is correct for the number of combinations of 45 items.