• (disco)

    Bad software, written by people with better things to do with their time than read manuals...

    Yup. Sounds like a situation where a ruptured blackwater line hit a ventilation device.

  • (disco)

    Even simple things were done in the least efficient way. While the function to put a single character to the device's display worked efficiently, the software guys created this to output strings to it:

        int print( char *text ) { 
           int i; 
           for ( i=0; i < strlen(text); i++ ) {
                putChar( text[i] ); 
           }
        }
    

    On a 1MhZ computer, there's a visible price to pay for re-calculating the length of your output string on each pass of the loop. When the screen clear function was called, you could watch the spaces crawl over the display.

    Hmm. I'm certain - even back then - an optimizing compiler should have done something about caching that value rather than recalculating it every loop. Unless, of course, the real code modified text in the loop....

  • (disco) in reply to PJH
    PJH:
    I'm certain - even back then - an optimizing compiler should have done something about caching that value rather than recalculating it every loop.
    The compiler needs to know that `strlen` is a pure function in order to do this optimization. Not sure if that was done back then...

    Or maybe optimization was turned off, because everything broke when it was enabled?

  • (disco) in reply to VinDuv

    Since everything broke anyway, according to the story, I don't think it really mattered....

  • (disco) in reply to PJH
    PJH:
    Since everything broke anyway, according to the story, I don't think it really mattered....

    Picture this scenario: "The program's not working! I bet it's the compiler's optimizations again. Optimization is so broken. Well, I'll disable it and the program will start working." i.e. Tool Blame

  • (disco)

    Operations that took an instant on a PC took upwards of 10 seconds to compute on this gizmo.

    With a PC VS 8051, that's likely to be the case with a regular program, even back in those days.

    ... and the production people got to dispense with the silly wrist-straps.

    Fast forward to 6 months when the stressed hardware began to fail due to static discharge, and the perfected software was again suspect.

  • (disco) in reply to accalia
    accalia:
    Sounds like a situation where a ruptured blackwater line hit a ventilation device.

    Causing a massive green explosion.

  • (disco) in reply to Shoreline
  • (disco) in reply to accalia
    accalia:
    not exactly

    Oh :(. I wondered why Tyrion wasn't mentioned.

    TRWTF is the Red Keep's IT department.

  • (disco) in reply to Shoreline

    yeah, i was making a extremely elaborate fit hits the shan analogy.

    didn't know that GoT would have ruined it by having a place named after sewage...

  • (disco)

    "Vice President and a Marketing Drone"

    "the VP and MD"

    Oh dear, sigh. Two nations divided by a common language and all that.

    In British, "MD" normally stands for "Managing Director", which lent a certain air of surrealism to the whole proceedings. (So they sacked a dev for incompetence and rehired him as Managing Director? That would explain a great deal.)

  • (disco) in reply to accalia
    accalia:
    yeah, i was making a extremely elaborate fit hits the shan analogy.

    It's the only way for subscribers to the It's Just Typing philosophy to learn a lesson.

    Of course, those people are probably very good at wilfully not learning lessons.

    Steve_The_Cynic:
    In British, "MD" normally stands for "Managing Director", which lent a certain air of surrealism to the whole proceedings.

    Maybe it was a subtle jab at the poor skill-level of the MD. I could be wrong.

  • (disco) in reply to Steve_The_Cynic

    In the U.S., this is the first time I've ever seen it not stand for "Medical Doctor." Sounds like it could have used one.

  • (disco)

    Yup - I used to have a boss (who knew nothing about s/w dev or computers for that matter) who would always end a verbal request for a new feature with "how hard can it be?"

    One of the worst jobs I ever had - it as my first s/w dev job.

  • (disco) in reply to Developer_Dude
    Developer_Dude:
    Yup - I used to have a boss (who knew nothing about s/w dev or computers for that matter) who would always end a verbal request for a new feature with "how hard can it be?"

    One of the worst jobs I ever had - it as my first s/w dev job.

    Well, duh, you tell him exactly how hard it can be, every time, in excruciating detail. It won't take too long before he stops saying it to you. 'Course, that might be because he cans you, but in that case you're clearly better off without him...
  • (disco) in reply to Developer_Dude
    Developer_Dude:
    Yup - I used to have a boss (who knew nothing about s/w dev or computers for that matter) who would always end a verbal request for a new feature with "how hard can it be?"

    I always say that sarcastically, when things are going to be really complex and/or difficult. If you are giving someone a hard task, you may as well do it with some levity. :smile:

  • (disco) in reply to tharpa
    tharpa:
    In the U.S., this is the first time I've ever seen it not stand for "Medical Doctor."

    That's why, after being fired as a Marketing Drone, he was hired back again as a surgeon. The other MDs were spending too much time in the OR so the company needed someone who could design operations that would just work right the first time.

    After all, what could possibly go wrong?

  • (disco) in reply to Developer_Dude
    Developer_Dude:
    I used to have a boss (who knew nothing about s/w dev or computers for that matter) who would always end a verbal request for a new feature with "how hard can it be?"

    I prefer the ones who buttume they know how complex something is. Of course, they buttume wrong, so the "ultra hard" request boils down to changing a CSS class, followed by a "20 minute task" of redesigning half the database because half the spec just changed...

  • (disco) in reply to Onyx

    Those dreaded words in a triage meeting when the stakeholder says "this should be a really simple change..."

  • (disco) in reply to Onyx

    I love when business people try to prematurely optimize the solution before the tech folks have even looked at it. "Why didn't you ask for X? You seem like you actually want X." "X sounded complicated, we'd be fine with only Y" where Y is twice as hard as X.

  • (disco)
    getting updates to the customers was it's own little Circle of Hell

    @snoofle: "its", not "it's"

  • (disco)

    C support for something like the 8051 would have been cutting-edge back then, and probably only vaguely resembles what you know as C. Microcontroller C compilers did (and still do) have lots of proprietary extensions to handle weird addressing schemes and other hardware limitations. I've never used an 8051 specifically, but Wikipedia says it used a Harvard architecture, which means completely separate address spaces for code and data. Usually this means that the pointer 0x1234 means something completely different depending on which address space you're in. Given what a hack-job it already is I wouldn't count on any μC optimizer for anything.

    Replacing EPROMs was pretty much the only way to upgrade firmware back in the day. The customer should be thankful the device actually had a socketed chip rather than one that was soldered in place.

    Doubles may not be the best for financial data (and I'll bet that these were actually single-precision floats given the hardware) but you can't just blithely assume that because all numeric values are whole numbers that you won't need fractions somewhere along the line. Try buying 1 item priced at 2 for $5 and you'll see what I mean. At the very least if you're switching from floating point to integer you might need to change your units (from dollars to cents, or even tenths of cents).

    Static discharge can do real damage, and they should have been using static straps in any case. I've blown some very expensive equipment due to lack of a strap.

  • (disco) in reply to PJH
    PJH:
    Hmm. I'm certain - even back then - an optimizing compiler should have done something about caching that value rather than recalculating it every loop. Unless, of course, the real code modified text in the loop....
    To do that, it would have to determine that `text` isn't modified in the loop and know that `strlen` is a pure function, as VinDuv pointed out.

    I don't know which of those falls down, but even GCC today (well, a couple years ago anyway) doesn't do this.

    $ cat test.c
    #include <stdio.h>
    #include <string.h>
    
    int print( char *text ) { 
      int i; 
      for ( i=0; i < strlen(text); i++ ) {
        putchar( text[i] ); 
      }
    }
    
    int main(int argc, char** argv) {
      print(argv[0]);
      return 0;
    }
    
    $ gcc -O2 -c test.c
    

    Then we disassemble:

    .text:00 ; int __fastcall        print(char *s)
    .text:00       public print
    .text:00 print proc near
    .text:00       push    rbp
    .text:01       mov     rbp, rdi
    .text:04       push    rbx
    .text:05       mov     rbx, rdi
    .text:08       sub     rsp, 8
                                        ;;; Jump to the check within the loop
    .text:0C       jmp     short loc_23
    .text:0C ; ---------------------------------------------------------------------------
    .text:0E       align 10h
    .text:10
                                              ;;; loop head
    .text:10 loc_10:
    .text:10       movsx   edi, byte ptr [rbx]      ; c
    .text:13       mov     rsi, qword ptr cs:stdout ; fp
    .text:1A       add     rbx, 1
    .text:1E       call    _IO_putc
    .text:23
    .text:23 loc_23:
    .text:23       mov     rdi, rbp      ; s
                                              ;;; strlen(s) within the loop
    .text:26       call    strlen
    .text:2B       mov     rdx, rbx
    .text:2E       sub     rdx, rbp
                                              ;;; loop check and jump to head
    .text:31       cmp     rax, rdx
    .text:34       ja      short loc_10
    .text:36       add     rsp, 8
    .text:3A       pop     rbx
    .text:3B       pop     rbp
    .text:3C       retn
    .text:3C print endp
    

    (And before you ask, no, -O3 doesn't help. Tested with GCC 4.7.3.)

    Edit: MSVC 2010 makes the optimization with /O2. GCC 4.9 does not with -O2. clang 3.5 does not with -O2. Even icc (ICC) 14.0.3 20140422 does not make that optimization with -O2 or -O3.

  • (disco) in reply to Steve_The_Cynic
    Steve_The_Cynic:
    It won't take too long before he stops saying it to you.

    Not if he knows what's good for him.

  • (disco) in reply to narbat
    narbat:
    I've never used an 8051 specifically

    I have. There's no other way to use an 8051. Odd little beast.

    The idea of trying to make it do anything meaningful in anything other than 8051 assembler strikes me as wildly optimistic.

  • (disco) in reply to narbat
    narbat:
    C support for something like the 8051 would have been cutting-edge back then, and probably only vaguely resembles what you know as C. Microcontroller C compilers did (and still do) have lots of proprietary extensions to handle weird addressing schemes and other hardware limitations. I've never used an 8051 specifically, but Wikipedia says it used a Harvard architecture, which means completely separate address spaces for code and data. Usually this means that the pointer 0x1234 means something completely different depending on which address space you're in. Given what a hack-job it already is I wouldn't count on any μC optimizer for anything.

    Yeah, the 8051 was designed for direct assembler-banging, not any of the niceties of C, which is part of the reason it's so deeply weird as a C (or any other high level language) target, compared to even, say, the AVR or MSP430, which are supported (as cross targets, ofc) by GCC.

    narbat:
    Static discharge can do real damage, and they should have been using static straps in any case. I've blown some very expensive equipment due to lack of a strap.
    Yeah, no doubt; I had a $200 video card go south on me during a memory upgrade for that reason!
    narbat:
    Doubles may not be the best for financial data (and I'll bet that these were actually single-precision floats given the hardware) but you can't just blithely assume that because all numeric values are whole numbers that you won't need fractions somewhere along the line. Try buying 1 item priced at 2 for $5 and you'll see what I mean. At the very least if you're switching from floating point to integer you might need to change your units (from dollars to cents, or even tenths of cents).
    I would use fixed-point here as well; unless you are in the land of 754r floating decimal support -- which still isn't all that portable -- a decently wide fixed-point type works as well as anything for representing money. (The system I worked on as an intern uses a 64-bit fixed point representation for all currency values, and it works quite nicely -- it's a back-office system for payment card transactions, btw.)
    flabdablet:
    I have. There's no other way to use an 8051. Odd little beast.

    The idea of trying to make it do anything meaningful in anything other than 8051 assembler strikes me as wildly optimistic.

    Quite: with ARM Cortex-Ms being available for sub-$1 in onesies any longer, there's no reason to *ever* design in an 8051-derivative in this day and age.
  • (disco)

    And you know that, regardless of how bad the VP and MD screwed up, and despite the fact that this guy saved their business, those two got bonuses several orders of magnitude higher than he did.

  • (disco) in reply to s73v3r

    They're visionaries!

  • (disco) in reply to Jaloopa

    A simple change? I've heard that so many times! To the person uttering the words, it is a "simple change" because they don't have to do it. To the person doing the work it is an entirely different situation. There can be things that one might assume to be "hard" that are actually quite easy (see speed up loops), and things that look easy "land a man on the moon" that are actually quite difficult (you wanted him to be alive and return? You didn't say that!). Oh, well, better luck next time!

  • (disco)

    "1MhZ 8051 processor" I'm thinking, what is this, the 80's? "But this was still in the '80s..." ok, never mind. :-/

    "Customers != Tech People" I LOL'd at this, +1

    "sent via com port" When read as "sent via CORN port," you know that either:

    1. the font you're using is messed up, and/or
    2. time to get new prescription eyeglasses, and/or
    3. Cornify? Nah, too simple...
  • (disco) in reply to Yamikuronue
    Yamikuronue:
    I love when business people try to prematurely optimize the solution before the tech folks have even looked at it. "Why didn't you ask for X? You seem like you actually want X." "X sounded complicated, we'd be fine with only Y" where Y is twice as hard as X.

    Rule one of software architect-ing: never trust the customer when it comes to requirements. (Or much else either, but I digress…) If they knew exactly what they were doing, they wouldn't be asking you to do it for them.

  • (disco) in reply to narbat
    narbat:
    and I'll bet that these were actually single-precision floats given the hardware
    8051 has zero hardware support for floating point1. All of the FP operations they were doing, they were doing in software. On an 8-bit processor. With one accumulator. To manipulate 80(?)-bit double-precision (according to the article) numbers. Wow.
    narbat:
    Static discharge can do real damage, and they should have been using static straps in any case.
    QFT

    1Maybe somebody somewhere designed a variant with hardware FP, but I've never used nor heard of one, and we use 8051s in some of our products.

  • (disco)

    Hardware guys usually get it right (because chips can't sort-of or mostly-work; they need to work)

    Not always entirely true. Sometimes you can sell chips in which some feature doesn't work as cheaper versions without that feature while you work on fixing it.

    However, if you discover a problem with chips that you've already sold, it's just a little harder and more expensive to fix than releasing a software update. (Anyone remember FDIV?) Even if you don't have to recall chips from millions of consumers, just tooling up to make the new, improved chips may cost $2M or more. If you're really lucky, you can fix what's wrong by using the logic gates that are already there and connecting them differently, in which case you might be able to get away with spending only $200k - 400k. Just for the tooling; not counting engineering time to diagnose the problem, come up with the fix, and implement it, nor the loss from scrapping the defective chips.

    This is why hardware guys put so much effort into getting it right before committing a chip design to silicon. The effort to make sure it works is roughly double the effort to design it.

  • (disco) in reply to VinDuv

    Ah, these decadent days of compilers that (sometimes) fix the programmer's lame code.

    Back in those dark days of microprocessors with 64K memory pages, well, what you wrote...was what you got.

    If you wrote bad code, it worked...badly! Your incompetence was directly translated to lost market share, instead of just showing up in a TDWTF article. There were no flashy GUI's to hide behind.

    Hmmmmm...actually, I guess it could be bad then and make TDWTF, now, couldn't it?

  • (disco) in reply to CoyneTheDup
    CoyneTheDup:
    microprocessors with 64K memory pages

    8051 coders can only dream of 64K memory pages.

  • (disco) in reply to herby
    herby:
    A simple change? I've heard that so many times! To the person uttering the words, it is a "simple change" because they don't have to do it. To the person doing the work it is an entirely different situation. There can be things that one might assume to be "hard" that are actually quite easy (see speed up loops), and things that look easy "land a man on the moon" that are actually quite difficult (you wanted him to be alive and return? You didn't say that!). Oh, well, better luck next time!
    But Mr Kennedy **did** say he wanted them to be alive on the Moon *and* to return safely...
  • (disco) in reply to EvanED
    EvanED:
    To do that, it would have to determine that text isn't modified in the loop and know that strlen is a pure function, as VinDuv pointed out.

    I don't know which of those falls down, but even GCC today (well, a couple years ago anyway) doesn't do this.

    It might be able to do it in your old compiler if you declare that text is a const char *. I think newer compilers (not much newer!) can detect that the argument is effectively constant and pull the strlen out. (Clang 4.2 seems to be able to do the optimisation.)

    I prefer to pull that sort of thing out explicitly. I don't like a compiler making too many assumptions about what is safe; some things are only safe if you can prove something non-trivial first (such as “no concurrent thread will modify this memory” which requires knowledge about much more than the compilation unit).

  • (disco) in reply to Yamikuronue

    I currently have to make a datepicker for a field on a form. Which isn't an unreasonable request, but it's clear that they don't actually mind not having a datepicker, the current text field is fine except that it doesn't validate that the date isn't in the past. The customer is clearly under the impression that the text field doesn't 'allow' this validation and a datepicker would. But because a datepicker is a reasonable request, I can't go back to them and say 'you don't need a datepicker to validate it's not in the past'.

    Would have been little more than a copy-paste job from the last time I had to implement date validation on a text field in a similar form. Instead I have to implement the validation AND make a datepicker.

  • (disco) in reply to CarrieVS
    CarrieVS:
    Would have been little more than a copy-paste job from the last time I had to implement date validation on a text field in a similar form. Instead I have to implement the validation AND make a datepicker.

    Can't you use some off-the-shelf date picker? There must be a squillion different ones out there for just about any GUI implementation strategy you might be using…

Leave a comment on “Marketing Software”

Log In or post as a guest

Replying to comment #:

« Return to Article