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?

48 of 683 comments (clear)

  1. Here's one... by Quartz25 · · Score: 5, Funny

    Right before I left from Microsoft: int security = *NULL; // eat it!

    --
    Most people don't get why the integral of "e to the x" is so funny. Most math majors don't have a sense of humor.
    1. Re:Here's one... by pinkushun · · Score: 5, Funny

      Were you also responsible for #DEFINE RND_BSOD = 1 ?

  2. One word.. by consonant · · Score: 5, Funny

    GOTO :-) (or is that two..?)

    1. Re:One word.. by wilx · · Score: 5, Informative

      The goto statement is very useful. Your dislike of it is irrational. Do you even know why you do not like it? Often, goto is the best solution to given problem.

    2. 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.
    3. 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.
    4. Re:One word.. by Derleth · · Score: 4, Interesting

      decent languages support labeled for/while cycles and apropriate "break label" constructs.

      You often cannot develop software with the language you want, but must develop it with the language you have. C has no such features and, therefore, goto is used more often than in languages that have them. Fit the strategy to the tool.

      if you do this kind of thing, you are MUCH better off separating lookup code to method or function

      This is reasonable, but it assumes some other function can do the needed cleanup code or other data massaging just as cleanly. If the goto is being used because finding the value is an error condition, you often have to do certain things as soon as possible in the code so you do not lose important debugging information.

      And, no, exceptions are not part of C, and setjmp/longjmp is, if anything, even less likely to pass code review. An advantage of goto is that you can keep the cleanup code in the same function, visually close to the rest of the logic and sharing the same locals.

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

      But as below says, they make error handling an easier task as well as some oddly structured loops for which try/catch logic doesn't get you all the way

      Ugh. Magic invisible gotos FTW!

    6. Re:One word.. by hairyfeet · · Score: 5, Interesting

      I like the way my former VB teacher put it (and yes I use the occasional GOTO, but then again I learned in the real BASIC-Commodore BASIC) he said "The GOTO is like a chainsaw. yes, some folks can actually make good things, and even make really nice carvings with a chainsaw. most just make a big fucking mess."

      Of course me and him both laughed our asses off when some 19 year old tried to rip off my code and pass it off as his own. After laughing and giving the kid a big F the kid said "How do you know that he didn't steal it from me?". So he asked the kid where he learned VB and which OS and the kid said "Windows 98 and the VB I got from this class!" and the teacher projected the code onto the board and said "Now class, does anybody notice something a little...weird about this code?" and a girl popped up and said "Why are their numbers before the lines, and what is a GOTO?".

      The teach just laughed and said "once upon a time their weren't any GUIs on personal computers. All you got when you turned it on was a blinking CLI and you had to write your own programs, using VERY old syntax. The person who wrote this is used to working in teeny tiny amounts of memory and using the old style, which works just fine if you know what you are doing, but if not it'll blow in your face like Mr. Greene found out when he tried to snatch this code and incorporate it into his own without knowing how it works" he then turned to me after staring at the code for a minute and said "Atari or Commodore?" and I looked shocked and said "Commodore VIC20, but how did you know that?" and he said "because I have been around long enough to have coded on just about everything, and that looked liked Atari or Commodore code. Very efficient, but about as subtle as a chainsaw." which is when he gave me the chainsaw quote.

      So I have never forgotten the chainsaw quote, and while I can wield the chainsaw without making a mess, I saw first hand when others in the class tried to use GOTO what a mess you can make if you don't know EXACTLY what your code is doing. He caught me outside a month later and said "thanks a lot, I hadn't seen a GOTO in ages and then you come along and it spreads like the damned clap. Giving these youngsters GOTO is like handing a monkey a sledgehammer and letting them loose in a bomb factory. There is no doubt they are going to go boom, the only question is when." but what can I say, I'm just an old greybeard that was used to numbered lines and GOTO.

      --
      ACs don't waste your time replying, your posts are never seen by me.
    7. Re:One word.. by FourthAge · · Score: 4, Insightful

      Hardly pedantic or lunacy. For example, pick one of the drivers from the Linux kernel, e.g. this one. Look in particular at the "geode_aes_probe" function.

      The structure looks like a pyramid. On one side is the setup phase, on the other side is the cleardown phase. If one of the setup operations fails, then the "goto" jumps to the appropriate cleardown operation and continues from there. If the top of the pyramid is reached, then return #1 (success) is used. Otherwise, return #2 (failure) is used.

      This function could be written in C without using goto. But would it be as easy to read and as easy to maintain? Doubt it. As it is, it's perfectly obvious what you would need to do in order to add a new capability to the driver. Tricks to work around "goto" would only obfuscate the functionality.

      --
      The tao of democracy: the government you can vote for is not the real government.
    8. 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.
    9. 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;
      }

    10. Re:One word.. by geminidomino · · Score: 5, Funny

      Pyramid? It looks more like the players' ship sprite from Galaga, rotated 90 degrees...

      Damn, now I want to play Galaga...

    11. Re:One word.. by geminidomino · · Score: 4, Funny

      So formatting is worthless, then?

      No, formatting is for successors and maintainers. As fellow coders, they're not human, strictly speaking.

    12. Re:One word.. by EvanED · · Score: 4, Informative

      How is this so hard to understand?

      It's not. But nor is code that uses goto in the idiom that FourthAge posted above.

      My objection to that code is that if you do even just three or four allocations, you start getting very large indentations pretty fast, especially if you like 8-character indentations. (They get pretty long even with 4, which is what I like!) This causes a problem if you restrict yourself to 80-columns.

      Arguably this is a problem with restricting yourself to 80 columns, but that's not entirely unreasonable even if I'd rather the limit be ~100. But guess how many your code uses? Your longest line is 109, longer even than my longer preference. Even if you use 4-character indentations, your longest line is still 80 characters.

      If you reformat your code to use 8-character indentations and 80-character column limits, your code would become a bit uglier as you'd have to wrap four lines (a couple of which don't really have a good breaking point), and hence a little harder to understand on its face.

      By contrast, the original code fits entirely within 80 characters (admittedly only just) without anything remotely like an awkward line break.

      Further, in some sense it doesn't entirely follow the flow of the code. Perhaps this is a vice and not a virtue, but I tend to think of places where there's an unusual condition (like a failed allocation) as not on the same "level" as normal control flow. In this sense, I would think of that procedure as basically linear "with some provisions for exceptional conditions". In that sense, your proposal of the cascaded ifs doesn't really match my mental model of how the code behaves -- the indentation of the normal code changes depending on how many exceptional conditions might arise, and there's not really any reason why it should by that model. By contrast, the original code matches it.

      (Incidentally, "linear with some provisions for exceptional conditions" is basically how I'd write it either in a language that supports exceptions or a language that has RAII. In the former case, there's a decent chance do just one try block for the body of the function, and in the associated catch test to see if each item is allocated in turn. (This doesn't match the structure of the real code exactly, but it's closer to it than it is to your nested-if code.) In the latter case, you'd have basically the real kernel code except that the deallocation would be in the RAII objects' destructors. Again, no nested ifs.)

  3. Balancing act by Tubal-Cain · · Score: 4, Interesting

    If you have short deadlines, you end up with issues similar to the bugs Ubuntu needs to smooth out every release. If you go with "It'll be finished when it is finished", Your stable releases can become ridiculously out of date between versions. Debian did a good thing by abandoning the open-ended release cycle in favor of the extremely long but predictable two-year deadlines.

  4. University Assignments. by Anonymous Coward · · Score: 5, Funny

    Once I had an assignment due and at the last minute before being evaluated, realized I had made a huge mistake, even though the code looked OK...

    Too much time playing games in class and I was about to fail the course unit if I didn't pass that one test (right at the end of a semester)

    So I ran the program, adjusted the output in a word processor, saved it as a file and threw some code hidden in the comments that read the file, outputted it and exited.

    Three minutes later my code was evaluated... I was the only one who passed.

    Fortunately, no one investigated too carefully at the time why I was the only one who passed, because after trying to fix the code later in my own time, I realized the source data we were all supplied was corrupted.

    Inevitably, Later the same lecturer came to the same conclusion when his program didn't work either and cornered me to ask why mine worked (of course he was suspicious). Thinking quickly, I told him my source data was corrupted and that I fixed that first so my program would work. I don't know if he believed me, but he accepted the story.

    Fortunately, I got away with it and I got to keep the pass.

    1. Re:University Assignments. by TheRaven64 · · Score: 4, Interesting

      My Physics teacher caught me doing that once. He pointed out that the intended learning outcome of the experiment was to understand the relation between the properties being graphed, and if I already understood this well enough to work out what the results should be then I had achieved the objective. One of the few teachers I've had who really understood what education was meant to be about.

      --
      I am TheRaven on Soylent News
    2. Re:University Assignments. by geminidomino · · Score: 4, Funny

      To this day I continue to find typos in my code but less and less bugs-in-libraries.

      That's because the ratio of code-bugs to library-bugs increases with the programmer's age, even if both the code and the library remain unchanged. </zen>

  5. Re:Wow. Talk about old news. by melikamp · · Score: 5, Funny

    The editor might have approved this submission just to meet some kind of deadline or a minimum requirement.

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

    1. Re:Wrong question by Opportunist · · Score: 4, Funny

      Probably. But reading a stream of "nope", "sorry", "you're kidding", "good one" ... answers leads to a lot of redundant mods but no good entertainment.

      --
      We used to have a Bill of Rights. Now, with the rights gone, all we have left is the bill.
  7. 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
  8. Sucker punch by Anonymous Coward · · Score: 4, Funny

    When my deadline comes up and I haven't produced I wait for my boss to ask me for the code then I sucker punch him and run away. The trick is to hold down short term contracts and give false references and hire someone to back them up (another dirty trick). That also makes it easier to dodge the cops when your boss presses charges. It's getting harder though with all this talk of test driven development and short incremental releases. Then the trick becomes to write the most meaningless trivial unimportant tests first - but crucially tests that you can make pass quickly so you don't have to do any real work.

    (For anyone insane enough not to realise it, this is a joke. Don't try this at home...or at work).

  9. Game Art by j-stroy · · Score: 4, Interesting

    A 3d model export would break regularly screwing up the texture map orientation on certain polygons. The godawful export couldn't be fixed on the deadline, and risk management said best not to touch it cuz EVERYTHING might bust, let alone all the coders being nailed to the wall by the ship date. So I fixed the model files in an ascii editor. All the art builds that had tweaks needed this "touch" Since it was a hockey game, you can imagine how many goalie pads that was. Oh yeah, you couldn't see if the fixes were correct except in the game engine after more pipeline.

    Technically not a code fix, but still a valid solution.

  10. seen some bad shit. by Ziest · · Score: 5, Interesting

    I once worked at a Fortune 25 company in Chicago. They had this ENORMOUS mainframe program written in COBOL that ran their order inventory system which accounted for 20% of the companies revenue. All the guys who wrote this grunting pig of a system had either retired or had passed away. In the middle of the code was the following;

        *
        * We don't know what this does.
        * Please leave it alone !
        *
            SET INSIDE-INDEX TO 1.
        *
        * We don't know what this does.
        * Please leave it alone !
        *

    If this statement was commented out or removed the system stopped working. No one could find the problem. People had spent years looking for it but the code was such a mess and the documentation was so useless that they just left it alone and made a note that when the order inventory was re-done to make sure they left this "feature" out. I have been told that many old system have similar problems.
     

    --
    Another day closer to redwood heaven
  11. 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
  12. Train simulation by LucidBeast · · Score: 5, Interesting

    Way back we had a project where we had to simulate entire train traffic entering Helsinki train terminal. Someone else had made the simulator and it ran pretty neatly, but unfortunately crashed mysteriously after about four - six hours of simulation time. Our customers were coming the on monday and I spent my sunday trying to figure out how this simulation worked and what crashed it. Finally I caught the problem, which was as simple as some null pointer to a train schedule or something similar which needed to be referenced. I couldn't figure out why it was null in time, so I just added test for null pointer, which skipped said code. Program ran fine and we got our money. Never figured out what was wrong with it. Luckily it was only a simulation.

  13. Re:Really? Not Slashdot's fault, if so... by fractoid · · Score: 4, Funny

    John Titor sent it just before disappearing.

    Where'd he get to anyway?

    --
    Rampant carbon sequestration destroyed the Dinosaurs' tropical paradise. I'm here to help repair the damage.
  14. Study Assignment by LKM · · Score: 5, Funny

    This was a pretty important assignment back when I was studying computer science. It added to the final mark mark for that particular class. The task was to write a reasonably complex application in Prolog or some functional programming language, I can't remember which it was. I think the goal was to pair males and females based on their preferences, and find the optimal solution. Of course, I screwed up royally, and nothing worked five minutes before I had to demonstrate my solution.

    So in the final five minutes, I changed my code so it would avoid the parts which put it into an infinite loop, and instead simply output a random result. My goal was to tell the prof that it had worked a few minutes earlier, and that I didn't know what had gone wrong, and could I please have another week?

    So I demonstrated my app, it gave its random output, and I was about to start with my "damn, it used to work properly" spiel when he said (and this is actually true, even though it sounds unbelievable):

    "That's great! The result is correct, and your app is also quite a bit quicker than my own implementation of the problem. Congratulations, I think you're the only one so far who managed to get the correct result so far."

    I was so taken aback that I probably just stared at him for a few seconds. Then, I stupidly said "So... You want to see my code?" but he was like "No, the result is correct, and your implementation is very fast, so I don't need to see the code. Good job. Send in the next guy."

    And so I did.

    1. Re:Study Assignment by u.hertlein · · Score: 4, Insightful

      "That's great! The result is correct, and your app is also quite a bit quicker than my own implementation of the problem. Congratulations, I think you're the only one so far who managed to get the correct result so far."

      I was so taken aback that I probably just stared at him for a few seconds. Then, I stupidly said "So... You want to see my code?" but he was like "No, the result is correct, and your implementation is very fast, so I don't need to see the code. Good job. Send in the next guy."

      This is so sad. He notices your code is faster and he's not the least bit curious? (I presume he's some kind of CS prof.) Anyway, good for you, but still... :-(

      --
      Geek by Nature - Linux by Choice.
  15. Re:Really? Not Slashdot's fault, if so... by Trahloc · · Score: 4, Informative

    He's fighting in the civil war we're apparently not having, guess he fixed our timeline.

    --
    The Goal: A long simple life filled with many complex toys.
  16. Example by Anonymous Coward · · Score: 5, Interesting

    Example?  Right here:
    #include <stdio.h>

    void    *f(void)
    {
    a:
        printf("Here!\n");
        return &&a;
    }

    int     main(int ac, char **av)
    {
        goto *f();
        printf("There\n");
        return 0;
    }

    1. Re:Example by 7+digits · · Score: 5, Informative

      OMG. I didn't even knew you could write that in C (and I have my name in the comp.lang.c FAQ...)

      Of course, I checked C99, and, no, you can't write that:

      3.6.6 Jump statements

      Syntax

                          jump-statement:
                                          goto identifier ;
                                          continue ;
                                          break ;
                                          return expression<opt> ;

      identifier being defined as:

      identifier:
                                          nondigit
                                          identifier nondigit
                                          identifier digit

      So, goto *f() is a no-no (as is probably &&a)

      But, anyway, wow. Gcc actually compiles that to something that somewhat runs...

  17. Re:Deadline is not the problem by oldhack · · Score: 5, Funny

    Slashdot sorely needs "douchebag" moderation.

    --
    Fuck systemd. Fuck Redhat. Fuck Soylent, too. Wait, scratch the last one.
  18. Who hasn't? by Opportunist · · Score: 4, Funny

    After years of programming, I guess everyone had to cut some corners sometimes. It's also not (always) a problem of goofing off, a module you depend on not shipping in time but you being required to keep your deadline can already force you into doing just that: Delivering a hack that 'kinda-sorta' works, or at least the customer won't notice 'til we can ship the patch.

    Yes, that happens often. It's dubbed "Bananaware". Delivered green and ripens with the customer.

    --
    We used to have a Bill of Rights. Now, with the rights gone, all we have left is the bill.
  19. Re:Wow. Talk about old news. by 7+digits · · Score: 5, Funny

    > it's the comments that are worth reading

    More specifically the comments in the article. I loved this one:

    "Back on Wing Commander 1 we were getting an exception from our EMM386 memory manager when we exited the game. We'd clear the screen and a single line would print out, something like "EMM386 Memory manager error. Blah blah blah." We had to ship ASAP. So I hex edited the error in the memory manager itself to read "Thank you for playing Wing Commander.""

    That's awesome.

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

  21. Even worse stuff! by syousef · · Score: 4, Interesting

    Some of the worst I have seen:

    In critical C code:

    if (some condition)
            i *= 0;
    else
            i *= 1;

    And I was the actual variable name.

    Even worse, on a different project, an Easter egg that told the user their hard drive was about to be erased, and another that popped up about 30 dialog boxes full of banter between Spock and Kirk. Worst of all this code written in VB and was licensed for megabux then we got hold of it for orders of magnitude more megabux (Most of the original coders were hired fresh out of highschool). It ended up being rewritten (thankfully NOT by me) but we had to get the source to work out how it worked in the first place.

    I wish I was making this up.

    --
    These posts express my own personal views, not those of my employer
  22. Prolog Assignment by becker · · Score: 4, Interesting

    That's completely understandable in this case of programming in Prolog.

    Prolog is a declarative language.

    You declare the rules, and the system figures out a result that matches those rules.

    The problem is that this basically doesn't work. So a Prolog programmer has to write the "declarative" rules in a procedural order so that the run-time system doesn't have to try every possible combination to find (or fail to find) a matching result.

    The proper ordering of declarations can be quite subtle. With a modestly complex program you can make a seemingly unimportant change in the order of the declarations and have the runtime go from a second to a week.

    In this case the professor didn't (couldn't) know how long a Prolog program to solve this problem should take. He just assumed that you had found a more efficient ordering for the declarations. He might even have thought it was luck rather than deep insight that your program was faster than his. But you have to a decent understanding of the limits of Prolog to get a complex program to complete in a reasonable time, so you had to be good before you could get that lucky.

    If you couldn't already tell, I have a low opinion of Prolog and declarative languages. They are "parlor tricks". Much like computer 'Life' and neural networks, simple programs can produce unexpected seemingly-sophisticated results. But they don't get better from those initial results. To compute the answers or results you want in a reasonable time, you end up with at least the complexity of writing things in the traditional explicitly procedural method.

    The promoters of declarative language typically don't mention that you end up writing rules in an explicitly procedural order if you want the program to work. If you press them on the issue, they then say "well, OK, it's not actually any easier to write, but it's easier to verify that you've correctly specified the desired result." But if you have to carefully shuffle declarations around, and even then some results unpredictably take centuries to compute, pretty much no one cares.

  23. VB6: Lost source code - Ultimate repack by netsavior · · Score: 5, Interesting

    So it was 1999 and I was working for a mom and pop software shop, we had been acquired by a dot com. All our money and toilet paper stock options were held until we delivered the re-branded product with source. Part of the "rules" said we had to have only C/C++ and VB6 source, NO OTHER LANGUAGE.

    . We finished converting a few rogue scripting modules and things like that, which creep in over time. But we COULD NOT find the source code to one of our VB6 DLLs (an old one that had not been changed since it was first compiled in VB6). We searched and searched and eventually the fastest coder(not me) started rewriting it. We were 1 day from delivery date and there was no way he could finish it, so I ran it through a disassembler.

    the C++ code we delivered looked like this:

    int functionName(int parm) {
    _asm {
    push esi
    mov esi, dword ptr ds:[esp+8]
    mov dword ptr ds:[edi], esi
    retn
    }
    ....(you get the idea)
    It was unreadable, but it compiled and worked and we got our money. I still wonder what they ever did with that... since the software is still in use...

    1. Re:VB6: Lost source code - Ultimate repack by mrwolf007 · · Score: 5, Funny

      Yeah, just think what those guys thought when they saw the code.
      "Wow, assembler code."
      "It must be highly optimized."
      "Told you it was a good idea to buy it."

  24. Easter egg dependency by plover · · Score: 4, Interesting

    We had an easter egg in our code that was in a routine scheduled to be executed only at 0-dark-30 when our users were long gone. But someone later called the routine as part of the loading process, and the users ended up seeing it anyway as they signed on at start of day. It made people smile, so we left it in.

    A few years later, we were telling a client that we couldn't add their new feature X because we don't have the memory. At that point the director said to get rid of the easter egg and then it'd fit. (A few hundred bytes was not going to make a difference, but our director didn't care, it was a perception thing.) What we got instead was a hundred bug reports that the easter egg wasn't displaying, and that they "needed" to see it so they'd know when start of day was complete.

    --
    John
  25. Re:Here's another one... by Tuna_Shooter · · Score: 5, Interesting

    This is the code for the Apollo 11 lunar lander flight computer.

    http://code.google.com/p/virtualagc/source/browse/trunk/Luminary099/LUNAR_LANDING_GUIDANCE_EQUATIONS.s?r=258

    and yes some of my code is in there along with the equivalent of a few "goto's

    Lots of bright people worked on this and in some circumstances a "goto" is required.

    --
    *--- Sometimes a majority only means that all the fools are on the same side. ---*
  26. Re:char Str[255] by dkleinsc · · Score: 4, Insightful

    I believe another name for that little snippet is "buffer overflow vulnerability".

    --
    I am officially gone from /. Long live http://www.soylentnews.com/
  27. The Fucksort Incident by ari_j · · Score: 5, Funny

    Back in college, we were at a programming competition and I was the on-the-keyboard coder for one of the problems. We had 10 minutes for the problem and I coded it quickly, having decided on the best algorithm before sitting down. Part of the solution was a sorting routine on a list. We were using Visual C++ although we were all not C++ experts at the time, and so rather than mess with the STL and the possibility of having to read documentation, I did it all from scratch. I knew that sort was already in use by the standard library, so I called my routine mysort.

    Apparently, however, Visual C++ includes a mysort in its standard library. So, with the clock ticking down and the solution's only impediment to our victory being an identifier conflict, I renamed the routine the way that any one of us would have: myfuckingsort. We won the competition.

    In this particular competition, the judges were not supposed to read our code - they just run the output of your code on the input and check for correct output - so I felt safe when I typed what I did. However, one of them came up to us afterwards and told us that they do in fact usually read the code of the winning team to see if we did anything unique in our solution. Yep. Sure did. And my classmates and professors never did let me live down what was affectionately nicknamed the fucksort algorithm.

  28. Re:Deadline is not the problem by russotto · · Score: 4, Insightful

    Nope. Deadlines are often unreasonable. Welcome to the real world. But as a good software developer, you should be able to cope with that too, and without last-minute hide-the-problem hacks.

    Wait, you were serious? Does your hair come to points on the side of your head, by any chance?

    If I could cope with unreasonable deadlines without some sort of nasty compromise, I wouldn't be developing software. I'd be turning water into wine, holding back the tide, etc. "Good software developer" doesn't mean "miracle worker". If the time isn't there before the deadline to solve the problem correctly, either the deadline will be missed or the problem will be unsolved or poorly solved. That's close to a tautology; it's implicit in the term "unreasonable".

  29. Not the only lesson by Jonathan · · Score: 4, Insightful

    Well, in part, but another important lesson in science labs is learning to report the truth, even if is disappointing and not what you want. This is an important lesson and unfortunately even some well known scientists don't learn it,