Slashdot Mirror


Dirty Coding Tricks To Make a Deadline

Gamasutra is running an article with a collection of anecdotes from game developers who had to employ some quick and dirty fixes to get their products to ship on time. Here's a brief excerpt: "Back at [company X] — I think it was near the end of [the project] — we had an object in one of the levels that needed to be hidden. We didn't want to re-export the level and we did not use checksum names. So right smack in the middle of the engine code we had something like the following. The game shipped with this in: if( level == 10 && object == 56 ) {HideObject();} Maybe a year later, an artist using our engine came to us very frustrated about why an object in their level was not showing up after exporting to what resolved to level 10. I wonder why?" Have you ever needed to insert terrible code to make something work at the last minute?

8 of 683 comments (clear)

  1. Wrong question by julesh · · Score: 5, Insightful

    Have you ever needed to insert terrible code to make something work at the last minute?

    Wouldn't "have you ever shipped a product without needing to insert terrible code to make something work at the last minute?" be a more sensible question?

  2. Re:Wow. Talk about old news. by shish · · Score: 5, Insightful

    This is one of those stories where the story isn't the point, it's the comments that are worth reading, so it's only a problem if we have the same comments :-P

    --
    I mod down anyone who says "I will be modded down for this", regardless of the rest of their comment
  3. Re:Deadline is not the problem by 93+Escort+Wagon · · Score: 5, Insightful

    In the real world there are deadlines, and it's entirely the developer's responsibility to be able to meet those deadlines without using such "dirty coding tricks". Good developers should have tested their code so as to not have serious problems to fix at the last minute, and designed it so as to be able to extend it easily.

    Yes, because deadlines are always reasonable and never pushed up. And change orders are a myth.

    --
    #DeleteChrome
  4. Re:One word.. by Derleth · · Score: 5, Insightful

    Breaking out of a deeply-nested loop, as can happen when you’re looking for a specific element in a multidimensional array. The alternative involves adding state variables and complicating the logic terribly.

    --
    How can you use my intestines as a gift? -Actual Hong Kong subtitle.
  5. Re:One word.. by Derleth · · Score: 5, Insightful

    I’m a goto-user, but this is a bad reason to use them: If you regard language features as ‘just’ syntactic sugar, why aren’t you programming in raw machine code? That is what everything eventually gets turned into anyway.

    You use gotos when the normal control structures are inadequate somehow. It doesn’t matter what the compiler does; source code is for humans.

    --
    How can you use my intestines as a gift? -Actual Hong Kong subtitle.
  6. Re:yuck by quintesse · · Score: 5, Insightful

    Basically ALL the software you use works like this.
    Welcome to the real world, no need to feel bad.

  7. Re:One word.. by FourthAge · · Score: 5, Insightful

    I'd agree with all of that. Like C itself, goto is a powerful tool that is easily misused by beginners, but is still very useful in the right circumstances.

    --
    The tao of democracy: the government you can vote for is not the real government.
  8. Re:One word.. by robfoo · · Score: 5, Insightful

    I can't figure out if I'm the only sane one or the only crazy one. Especially given the 'pyramid' referred to - I don't see a pyramid unless it's rewritten to use nested ifs.

    To me, nested ifs are much easier to read - they convey the meaning/intent of the code a lot better. As in 'if this function call works, then do this. Otherwise, just clean up and exit'

    How is this so hard to understand?

    geode_aes_probe(struct pci_dev *dev, const struct pci_device_id *id) {
            int ret;

            if ((ret = pci_enable_device(dev)))
                    return ret;

            if (!(ret = pci_request_regions(dev, "geode-aes"))) {
                    _iobase = pci_iomap(dev, 0, 0);
                    if (_iobase == NULL) {
                            ret = -ENOMEM;
                    }
                    else {
                            spin_lock_init(&lock); /* Clear any pending activity */
                            iowrite32(AES_INTR_PENDING | AES_INTR_MASK, _iobase + AES_INTR_REG);
                            if (!(ret = crypto_register_alg(&geode_alg))) {
                                    if (!(ret = crypto_register_alg(&geode_ecb_alg))) {
                                            if (!(ret = crypto_register_alg(&geode_cbc_alg))) {
                                                    printk(KERN_NOTICE "geode-aes: GEODE AES engine enabled.\n");
                                                    return 0;
                                            }
                                            crypto_unregister_alg(&geode_ecb_alg);
                                    }
                                    crypto_unregister_alg(&geode_alg);
                            }
                            pci_iounmap(dev, _iobase);
                    }
                    pci_release_regions(dev);
            }
            pci_disable_device(dev);

            printk(KERN_ERR "geode-aes: GEODE AES initialization failed.\n");
            return ret;
    }