• (cs)

    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):

    C:\>debug
    -a100
    1592:0100 xchg ax,ax
    1592:0101 nop
    1592:0102
    -u100 101
    1592:0100 90            NOP
    1592:0101 90            NOP
    -q
    
  • jmt (unregistered)

    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.

  • (cs)

    I don't see how it's possible to know assembler and not know about labels.

    Jake Vinson:
    exagerration
    Spell checkers have been around for many years now.
  • Dirk Diggler (unregistered) in reply to VacuumHead

    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.

  • (cs) in reply to VacuumHead
    VacuumHead:
    You young guys/gals don’t know how easy you have it.
    G'day, Top Cod3r
  • Dirk Diggler (unregistered) in reply to jmt
    jmt:
    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.

    The way he programmed it, he was probably accurate.

  • Beat by the system (unregistered)

    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.

  • Andrés (unregistered)

    I think I'd rather be a Nostromo crew member than have Kent's job.

  • (cs) in reply to jmt
    jmt:
    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.

    C'mon. We've all done it. When there's something we're asked to do and we know it will require a significant recode we just say it can't be done. And most of the time they believe us.

    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.

  • Cudgel (unregistered) in reply to daqq

    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.

  • Mark V Shaney (unregistered)

    That was the very best WTF in a long time.

  • (cs)

    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...

  • (cs)

    I'm not sure where my shock is greatest:

    1. An invoice application in assembler, or
    2. The application made it into production in the first place.
  • Dan (unregistered) in reply to daqq
    daqq:
    Sorry, but I simply don't believe this one. 1. There's just NO WAY someone would accept such a system if they got it. 2. There's no way a combination of a person that can code a billing system in assembly and a person that will use the mentioned aproach can be the same person. 3. Even if the system actually was created, and accepted, and bizzare as told, it would still be impossible to know the story, as the person who would look through the code would go insane, die of laughter or be met with some other gruesome fate

    Hence its appearance on TDWTF

  • Ken (unregistered) in reply to dpm
    dpm:
    the hardware wasn't powerful enough for a thousands digit.
    That's almost true. Think about how much room the table would require --- one hundred times over, remember --- if it was ten times bigger to accomodate prices up to $9,999.99. The original programmer was actually being honest, from his point of view.

    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

  • Ken (unregistered) in reply to Ken

    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.

  • Ken (unregistered) in reply to Ken

    note: I am an idiot and meant 512 bytes, not 128kb, for the 8->16 bit decode table.

  • (cs) in reply to Covarr
    Covarr:
    I'm surprised the original programmer had the patience to input nearly 10,000 numbers by hand. I'm doubly surprised that it didn't occur to him, while doing it, that at the very least he could write another program to input the numbers for him; it would still be a crap program, but it would have been a lot faster to write and wouldn't have been missing any numbers in the middle.
    Emacs, baby, emacs. It's the ideal way to create tables like this. A little bit of elisp goes a long way ... although there was clearly some sort of elliptical failure between 699.95 and 699.99. I'd expect that would have been fixed as of Emacs 21.4.

    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.)

  • (cs)

    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.

  • SomeCoder (unregistered) in reply to Aaron
    Aaron:
    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.

    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)

  • Will (unregistered)

    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

  • Wyrd (unregistered)

    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.

  • Bizerk (unregistered)

    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?

  • (cs)

    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?"

  • dsh (unregistered) in reply to Beat by the system
    Beat by the system:
    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.

    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).

  • Just Another WTF (unregistered) in reply to chrismcb

    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.

  • Zydeco (unregistered)

    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.

  • (cs) in reply to nixar
    nixar:
    I'm reading this post, and I'm thinking, "wow, that's outrageous, nobody would ever program something that bad, he's making sh!t up." And then I pause, and I remember the steaming piece of syphillytic donkey dung I have to deal with. And I weep.

    Bonus: I have to deal with the actual lead programmer. He's a nutjob. 3 fresh hires have resigned within a month since this summer.

    He keeps exclusive access to the subversion repository. That's right. He doesn't let the other 5 programmers commit. 'cause, you know, they could DELETE STUFF by mistake. I asked him about branches; he panicked briefly and then started mumbling a quick excuse.

    He doesn't know about 'void *'.

    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.

  • (cs) in reply to K
    K:
    When you have tables of tabular data don't try to reinvent the table display, but use actual tables... That's why they call it semantic HTML.
    I hate to say it, but I actually did that a few months ago with an internal app.

    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)

  • (cs)

    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? ;)

  • Herby (unregistered) in reply to scruffy
    scruffy:
    This reminds me of an ancient machine known as the CADET, which earned the backronym "Can't Add, Doesn't Even Try".

    That machine did actually use tables for addition! It sounds like the original developer here got hung up on that kind of thinking.

    Nice to see a WTF end with the WTF being fixed!

    On the Model 1 of said machine, the add table was only 100 digits. The assembler ALWAYS created the loader for the add table, so it was ALWAYS assumed to be there. Luckly on the Model 2 of said machine, it DID learn how to add, and could do so about 3 times faster. One also notes that the later machine also knew that multiplying by zero involved no processing and skipped a few steps.

    This was back in the 60's if you must know!

  • (cs) in reply to Will
    Will:
    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

    -a100
    0CFF:0100 MOV AH,09
    0CFF:0102 MOV DX,109
    0CFF:0105 INT 21
    0CFF:0107 INT 20
    0CFF:0109 DB "Hello World!$"
    

    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! ;)

  • (cs)
    His search led him to some scary code comments. "Some prices are wrong, I don't know why," "Fix this" and "OH GOD WHAT HAVE I DONE."

    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.

  • tbrown (unregistered) in reply to Dirk Diggler
    Dirk Diggler:
    Kent's Predecessor:
    See, this is what happens when you code in a high-level language like assembly, and don't drop right down to machine code, which performs far better.

    I've learned my lesson.

    Plus you don't get a bunch of 'I know a better way' comments from back seat programmers.

    Except from Mel, of course (http://catb.org/jargon/html/story-of-mel.html)

  • f0dder (unregistered)

    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.

  • Romwell (unregistered) in reply to emurphy

    Is this going to be the new IT meme ? =)

  • hexatron (unregistered)

    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:

    1. Awful way: Learn an assembler and write code.
    2. Less Awful: Write in C and output an assembler listing (.s file) or 2+. Use asm's in the C code.
    3. Better way. Do not write assembler unless you really need the speed or size advantage.
    4. Even better. Do step 3. Measure the advantage. There isn't any. Don't write assembler.

    Assembly code has been useless for mortals for at least 10 years.

  • Duke of New York (unregistered) in reply to chrismcb
    chrismcb:
    I mean round about entering $2.03 into the table wouldn't most sane people be thinking "There has to be a better way?"
    Not if they're getting paid $100 per hour to do it.
  • Hector (unregistered) in reply to emurphy

    Exactly.

  • f0dder (unregistered) in reply to hexatron
    hexatron:
    2+. Use asm's in the C code.
    Not supported for 64bit VC++, and it's smarter to use external assembly modules anyway - at least you're only architecture bound then, not compiler bound.
    hexatron:
    4. Even better. Do step 3. Measure the advantage. There isn't any. Don't write assembler.
    Depends on the field you're working in... if you're writing business logic, sure, not much advantage to be gained. If you're doing graphics, audio, encryption, compression then there's possibly a chance to beat the compiler. Sometimes by a lot, sometimes only modest gains.

    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.

  • (cs) in reply to Charles400
    Charles400:
    I'm not sure where my shock is greatest:
    1. An invoice application in assembler, or
    2. The application made it into production in the first place.
    I'm sure even in the 70s there was quite a lot of mainframe apps written from scratch in assembly. Till this day some of this code is still being maintained.

    Heck, I still write some embedded assembly from time to time, and it's not really hard if you have some experience...

  • Duke of New York (unregistered) in reply to Kuba
    Kuba:
    Heck, I still write some embedded assembly from time to time, and it's not really hard if you have some experience...
    On the other hand, someone who has experience will at least have a clue about jump labels. Those were introduced in what, the 60s?
  • mithanon (unregistered)

    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

  • mos (unregistered) in reply to campkev
    campkev:
    Kent's hands in a silent message to his brain: Dude, we almost fell off the last time. We will kill you, choke you to death right here in front of Bob, if you try to make us do that many numbers.
    1. write craploads of numbers
    2. Get bionic hands
    3. ????
    4. PROFIT

    scnr

  • b0ttomfeeder (unregistered) in reply to jmt
    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.

    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".

  • (cs)
    Nothing in DOLLARS was above 999, and nothing in SENSE was above 99.

    Looks like this company had more DOLLARS than SENSE.

  • (cs) in reply to b0ttomfeeder
    b0ttomfeeder:
    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".
    Oh wow. And as recently as 1997? Double oh wow.

    It's a shame you've forgotten the specifics as that would otherwise be great Article material.

  • b0ttomfeeder (unregistered) in reply to dkf
    dkf:
    b0ttomfeeder:
    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".
    Oh wow. And as recently as 1997? Double oh wow.

    It's a shame you've forgotten the specifics as that would otherwise be great Article material.

    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...

  • dan (unregistered) in reply to amischiefr
    amischiefr:
    "That's right, all 100,000 (0-999 dollars, 0-99 cents) entries in the array were entered manually by the previous developer."

    Wow, just wow. I can't even imagine sitting there typing in that many entries. Must have been 6 months of job security.

    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).

  • jim (unregistered) in reply to ThePants999
    ThePants999:
    Nothing in DOLLARS was above 999, and nothing in SENSE was above 99.

    Looks like this company had more DOLLARS than SENSE.

    LOL - I like that one!!!

Leave a comment on “DOLLARS and SENSE”

Log In or post as a guest

Replying to comment #:

« Return to Article