- 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
In fact, nop is not its own assembler command (at least not on x86) but just some command that happens to have no real effect and takes only one byte. On x86, it is equivalent to xchg ax,ax (i. e. exchange the values of the AX and AX register):
Admin
The highest price they could have was $999.99, because as the previous developer had told them, the hardware wasn't powerful enough for a thousands digit.
Okay, that line is a keeper. Well, its not the line so much as folks actually believing it when the "developer" said it.
Admin
I don't see how it's possible to know assembler and not know about labels.
Spell checkers have been around for many years now.Admin
When I went to college, they had an analog computer that was programmed by patch cord wiring. When it was programmed, the wiring looked like spaghetti. I wonder if that is the origin of the term 'spaghetti code'. I checked wiki and they didn't reference it.
Admin
Admin
Admin
My greatest "worse than failure" experience to date involved assembly language...
In College I tried to beat the system by taking Assembly Language classes in the Computer Science department and in the Electrical Engineering department at the same time.
Turned out one of the classes was for Intel processors and the other was for Motorola.
Naturally everything would be exactly the opposite for both processor types; To this day I still wake up crying every now and then.
Admin
I think I'd rather be a Nostromo crew member than have Kent's job.
Admin
For something that's an actual requirement there's no excuse. Luckily those are few and far between. Most of them are just happy if you change the button from grey to red. Everyone loves bright candy-colored buttons.
Admin
I think this story is possible. I don't underestimate people's capacity for illogical and unreasonable thinking. I worked for several years as a programming teacher. It's amazing what students come up with. In a simple cash-register program, I've seen students hard code statements like (pseudocode) "if x=$.99 and y=$.01 then total =$1.00" in giant tables. I worked for a computer science professor who used enormous lookup tables to avoid having the computer do simple math because he thought it would be faster. I myself have used large lookup tables in throwaway code because it was faster to implement than figuring out a good algorithm. But I used Excel to generate the tables so it didn't take me more than a few minutes.
Admin
That was the very best WTF in a long time.
Admin
They wrote the ENTIRE billing system in assembly? They hardcoded the prices? I...I don't have words for the level of WTFery I have just witnessed...
Admin
I'm not sure where my shock is greatest:
Admin
Hence its appearance on TDWTF
Admin
yeah, that is just insane. I read that line in the original story and figured he was some highly paid consultant that was making up BS to keep from having to do real work or modifying some clunky, badly thought out DB schema. I never expected it to actually be TRUE given how the code was written, OMGWTF.
This application is going to form at least one interview question I'll ask in the next six months, and likely several nightmares. WHY WOULD ANYONE DO THAT OH MY GOD
Admin
Oh, forgot this also... lookup tables have their place. Like writing a fast converter for doing mu-coded audio decoding/encoding using a pair of tables (one of them 64kb, the other 128kb) and the xlatb (or similar) instruction on embedded hardware where you can control the memory map and arrange the tables to fit cleanly into the L2 or L3 cache can be a good idea. But... the pricing table in an invoicing app? That should have been written in C++ or some higher level language anyways.
Admin
note: I am an idiot and meant 512 bytes, not 128kb, for the 8->16 bit decode table.
Admin
Alternatively, the table might well have been butchered because the programmer was working with vi. I don't know what the repeat limit on using '.' in vi is, but it wouldn't surprise me if it's up there somewhere.
Of course, The Real WTF is that the whole thing was written in PHP.
(Well, no, obviously not. But it's worth trying to drag some of these ninnies in off google so that they get to read an article in assembly language for once. I kept thinking "Did I do something like this?" It's a worrying thought.)
Admin
TRWTF is that people thinks it's so amazing that he "knew assembler" and was able to write a whole billing system in it. It ought to be pretty obvious that he didn't understand assembly language at all. Anybody can fumble through a few tutorials and come up with something that works; it's just a question of how efficiently it works, how reliably it works, and how long it takes to make.
This wasn't some genius that had spent a lifetime doing embedded programming and just decided to do something monumentally boneheaded in spite of his massive intellect. It was a phoney (cargo cultist, whatever) who had no experience and no clue.
Admin
I would agree with you had the language of choice been C#, Java, VB, PHP, etc.
Writing an entire billing application in Assembler is not that trivial and the fact that the program exists shows some sort of intelligence. The way it was done shows the opposite which is why it's crazy to think about (and also activates the headdesk reaction)
Admin
What's the matter of knowing assembler? Anybody can write a whole system in assembler. Remember to write any program you just need few operators. Knowing assembler really mean that you need to know about 150 commands, know how many cycles they take to execute, how many bytes they need, how exactly they will execute etc.
About "Hello world" in assembler: The is no "Hello world" in assembler. If you want to print a string to you screen you need to know what kind of screen do you have? What kind of system do you have. And far more important - what processor do you have
Admin
So the secret to being a hero is to follow in the footsteps of someone who was an utter ignoramus. And this works particularly well when the poor, unfortunate non-programmers have had to deal with the crappy situation for a very long time.
I wonder if any of the people were upset that their bad price list wasn't necessary anymore.
The depths of this wtf still haven't sunk in all the way for me. I mean, short of an infinite loop, which I know this code was capable of, it's actually pretty hard to make a modern computer run slow when using assembly no matter how badly you write the code because it's so dang fast.
With code that bad, INTERCAL might actually have been an improvement. ... On second thought, no it wouldn't.
-- Furry cows moo and decompress.
Admin
Granted it's only psuedocode, but would the app even come up with the correct price?
If you're trying to display $2.05, you're going to increment 205 times. If you assume only one entry is missing between $0.00 and $2.05, won't incrementing 205 times get you to $2.06?
Admin
I think my brain imploded, I am having a hard time understanding this WTF... Is this correct:
He grabs the dollar and "sents" values, say 9, and 99. (Why not just store them as 999?) He does the work to turn this into an integer (and thus has 999)
THEN he adds 1, nine hundred and ninety nine times, to get... 999?
and then, uses a look up table to get 9.99??????
One thing I don't understand, the table had 100,000 entries? (1000x100) How did it fit into 80K bytes? A float is typically 4 bytes, although he could probably have used fixed point and gotten away with 3 bytes. You are still looking at a 300K table.
A lot of WTFs happen because people just don't know and/or they don't have the time to figure it out. But the best WTFs are the ones were people spend way more time and effort than it would have taken to learn something. I mean round about entering $2.03 into the table wouldn't most sane people be thinking "There has to be a better way?"
Admin
That is awesome! :) Thank you for sharing this story.
My Software Engineering program required taking the Computer Engineering department's assembly course (m68k), not the CS department's course. One day's overview of x86 was enough for me. MIPS is nice too (used by the Computer Organization course I was also required to take).
Admin
I suspect this app started life on some ancient plateform running under early VMS/MTS or what not and got ported to modern XT computers sometime in the early 80s by an old mainframe jockey who started life flipping toggle switches and just learned enough 8086 assembly to do a vague one for one translation of the assembly from the source machine.
It then grew the database connection and what not after the fact. Being a cornerstone app and probably a massive investment nobody darned touch it for years... just moved it from machine to machine until you get what you see here.
Admin
I'd say this story is partly made up. What company would accept it after the first test, it wouldn't run well on the first run so you'd run to the guy that made it. And i doubt he'd come up with a good enough excuse for one invoice taking 15 minutes.
Admin
How about setting your own source control, put copy of Subversion tree there, and go by yourself. Fix all that crap. Pretty much ignore the guy. Make him resign.
Admin
IE6 (%&*#@$!) which is what we're stuck with for our intranet was just so much faster displaying a big mess of positioned(!) DIVs than a large TABLE with fixed column widths... :(
Now our department is getting upgraded to IE7 by our IT department as a trial... oh, limitless joy... :/
np: Rhythm & Sound with Rod Of Iron - Lightning Storm (See Mi Yah)
Admin
Oh man... I cracked up reading this one - this is the best WTF in a long time!
(And let me preempt replies by commenting that no matter how good this one actually is, yes, that fact in and of itself IS "TRWTF (tm)" :P )
On the bright side, does that mean that code is getting cleaner? Or is it just that people have become better at obfuscating away any mistakes? ;)
Admin
This was back in the 60's if you must know!
Admin
Of course, this is written in 16-bit assembly, and then will only run under DOS, as a .COM (single-segment) app on the x86 processor. But I still didn't have to know what screen I had! ;)
Admin
These remind me of DooM 3 where the player finds the PDAs of guys that are dead and they are filled with subtle comments of strange things that slowly build up a sense of fear into the player.
Admin
Except from Mel, of course (http://catb.org/jargon/html/story-of-mel.html)
Admin
Would actually be interesting seeing some snippets of the assembly code for that system... seeing the kind of assembly code that some people do for win32 (aka win32asm), a WTF like this doesn't surprise me at all, to be honest.
Admin
Is this going to be the new IT meme ? =)
Admin
The CADET was actually the IBM 1620 (goog or wik it). It handled variable-length decimal numbers using its (loaded from paper tape) addition and multiplication tables (each 10x10 entries). Gluing the results of these tables in an answer was handled by ultra-modern transistor circuitry. It was one of the first non-frighteningly-huge computers (see any New Yorker cartoon before 1995).
As for how to write assembly code:
Assembly code has been useless for mortals for at least 10 years.
Admin
Admin
Exactly.
Admin
And yes, that's even if your compiler supports MMX/SSE intrinsics and you use them, it doesn't take an "expert" assembly programmer to beat the current generation of x86 C/C++ compilers.
Admin
Heck, I still write some embedded assembly from time to time, and it's not really hard if you have some experience...
Admin
Admin
string[10000, 27] comments = {{ a, b, ..., y, z }, { aa, ab, ..., ay, az }, { ba, bb, ..., by, bz }, { ca, cb, ..., cy, cz }, ... { zzza, zzzb, ..., zzzy, zzzz}, ... { yes, but, ..., wtf, why}, ... { ZZZA, ZZZB, ... ZZZY, ZZZZ}};
the hard ware is not powe rful enou gh for word long than four lett ers or comm ents long than twen
Admin
scnr
Admin
That line keeps making me think of a summer job I had in 1997 I keep trying to forget...
To cut a long story short, a massively failed attempt at an online shopping mall featuring high street shops (who thought that would ever work!) was given its final death knell when the Database 'guru' showcased the db structure he'd been working on for the last month. Sadly the specifics escape me (read "scourged from my mind") but the highlight was each shop in the mall being allowed a maximum of 7 products as that was the "limitation of the database".
Admin
Looks like this company had more DOLLARS than SENSE.
Admin
It's a shame you've forgotten the specifics as that would otherwise be great Article material.
Admin
Yeah... Tbh that job was a wtf from start to the protracted finish 8 months later involving letters threatening court action so I could get my last paycheck!
The db layout the guy had produced had iirc 1 table for shops AND products. The field list was something like:
shopname product1name product1price product2name product2price product3name product3price product4name product4price . .
All I remember clearly was a) the look of horror from the techies in the meeting and b) the closing of ranks as his management tried to shift the blame to the spec which had only listed 7 products on the example shop page...
Admin
My theory is that the guy is an Excel wiz - you can get excel to fill down a series of numbers, and then paste that into the code...... no, wait, he missed some numbers out (facepalm).
Admin
LOL - I like that one!!!