Slashdot Mirror


How To Write Unmaintainable Code

An anonymous reader writes "Make sure you're irreplaceable -' In the interests of creating employment opportunities in the Java programming field, I am passing on these tips from the masters on how to write code that is so difficult to maintain, that the people who come after you will take years to make even the simplest changes. Further, if you follow all these rules religiously, you will even guarantee yourself a lifetime of employment, since no one but you has a hope in hell of maintaining the code. Then again, if you followed all these rules religiously, even you wouldn't be able to maintain the code! You don't want to overdo this. Your code should not look hopelessly unmaintainable, just be that way. Otherwise it stands the risk of being rewritten or refactored. '"

437 comments

  1. FoxPro for DOS 2.6 by donnyspi · · Score: 4, Funny

    Our company's main system is written in FoxPro for DOS 2.6. The FP programmers here seem to have guaranteed lifetime employment :-)

    1. Re:FoxPro for DOS 2.6 by Anonymous Coward · · Score: 1, Funny

      You must work for Premiere Technologies in Atlanta. If that's the case, your post shouldn't be modded funny at all, but more like "fucking scary because it's true!"

    2. Re:FoxPro for DOS 2.6 by Wikipedia · · Score: 0

      If it works, why replace it?

      --
      P2P Anonymous Distributed Web Search: http://www.yacy.net/
    3. Re:FoxPro for DOS 2.6 by rubycodez · · Score: 2, Insightful

      scary, my companies main quoting/billing system was also written in foxpro by the owner, maybe ok when the operation was a mom & pop retail computer store, but now they deal with enterprise grade systems and services. The application doesn't really scale, one person can sieze up the whole application for the whole company (over 30 employees and dozens of contractors). Note this is not saying a bad thing about Foxpro itself, I've seen financial trading companies use it for dozens of people, this mainly is saying our president should not be using his time to crank out/maintain code to run a company with a couple million in sales each year. Too cheap to buy an off-the-shelf app, and that's foolish.

    4. Re:FoxPro for DOS 2.6 by freedom_india · · Score: 1

      Hey welcome to the club. Ours is FoxPro 2.6 for Windows ! I wrote it in 1995, and people still are terrified to change and rebuild the app. I have only one huge method that does everything. (Hey i was young)

      --
      "Doing what i can, with what i have." ~ Burt Gummer
    5. Re:FoxPro for DOS 2.6 by Anonymous Coward · · Score: 1, Funny

      Or write a whole bunch of code in .sh or .csh. Allows for much more obfuscation and call different scripts from different scripts. Irritates the hell out of everyone but youself.

    6. Re:FoxPro for DOS 2.6 by Anonymous Coward · · Score: 1, Insightful

      True... but it has to be tempered with, "if it broke tomorrow, could you fix it?"

    7. Re:FoxPro for DOS 2.6 by devnull17 · · Score: 2, Interesting

      Having worked at a similar mom-and-pop software shop that has outgrown its humble beginnings, I can say with confidence that there is nothing more dangerous to a company (and a programmer's mental health) than a boss who tries to involve himself in the software development process.

      Our flagship product was written (illegibly) in VB6. The codebase hadn't changed since VB3, and it wasn't very well-written to begin with. Our small development team spent about half of our time cleaning up after his architectural mistakes, and the other half trying to keep the creaking mess intact.

      I spent three years there. I never saw a programmer last even half as long as I did. One lost all hope and just decided to ignore his marching orders and develop UI controls all day. Another ended up working hundred-hour weeks and went completely, literally insane. Everyone currently on the tech staff there has needed leaves of absence of at least three months to keep their shit together. I eventually just gave up and quit. Better to be unemployed and sane than keep a job that makes you foam at the mouth.

      The bottom line: In every case I've ever seen, the boss belongs far, far, far away from the code. At all costs.

    8. Re:FoxPro for DOS 2.6 by nogginthenog · · Score: 1

      We're still using FoxBase. I *wish* we was using Fox 2.6 for DOS.

    9. Re:FoxPro for DOS 2.6 by McFadden · · Score: 1

      Bah... I dream of FoxPro. I used to work for a fairly large record label which still uses Clipper running on a Honeywell Bull XPS 1000 (Bull OS) for the main product calalogue.

  2. Until you get fired by Stonent1 · · Score: 0

    For writing unmaintainable code, violating company development practices, or they catch on to you.

    1. Re:Until you get fired by Thud457 · · Score: 2, Funny

      Why on Earth would you erroneously infer that writing unmaintainable code violates company development practices?

      --

      the preceding comment is my own and in no way reflects the opinion of the Joint Chiefs of Staff

    2. Re:Until you get fired by Anonymous Coward · · Score: 0

      Depends on the company you work for. The one I work at they are pretty strict on this to the point of not allowing certain editors. You would get fired if you pulled crap like this.

      Although in another company after giving my 3 months notice they hired in the bosses nephew whos experience with a computer is someone probably hit him with it. They also refused to pay my holidays owned so I wrote a program that went though and removed all the lovely comments from my code, changed all the descriptive variables like "incoming_ticket" to "a" and reset when it entered a new method.

    3. Re:Until you get fired by typical · · Score: 1

      The one I work at they are pretty strict on this to the point of not allowing certain editors.

      You view this as a *good* thing? That's the most idiotic thing I've ever heard of.

      "Yeah, you're going to be using vi instead of emacs on this project. Because I like vi."

      Gah.

      --
      Any program relying on (nontrivial) preemptive multithreading will be buggy.
    4. Re:Until you get fired by Rhoon · · Score: 2, Funny

      Is it bad that this article outlines our company development practices???

      --
      "If all the world's a stage, I want to operate the trap door." - Paul Beatty
    5. Re:Until you get fired by Fx.Dr · · Score: 2, Funny

      Some bosses not only encourage it, but applaud it. Lifetime employment indeed :P

    6. Re:Until you get fired by GWTPict · · Score: 1
      Silly programmer, you ensure you help set the development standards, variables to be undeclared with names no more than 3 characters long, goto mandatory for exiting nested conditional statements and loops, preferably 4 or 5 levels down, functions and sub routines are right out and comments are only allowed if at least cryptic, ideally they should be down right misleading. Ensure that wherever possible the same business rule is coded in more than one place with subtle differences such that it will only produce the same result in 95% of cases. All links to other systems should obviously contain hard coded server names, remember hard coding is your friend, you can't be accused of obfuscation.

      Oh yes, don't forget large chunks of code that will never actually run.

      I could go on but at this point I'm off to cry in a dark corner with a stiff drink. Welcome to my world.

    7. Re:Until you get fired by Anonymous Coward · · Score: 0

      I got hired to my current position to clean up the abortion of a mess someone created in Perl amidst a .NET crew of people. His code was very obfuscated and it was very easy to get on my boss' good side by poiting out how crazy the code was...something he'd suspected all along but did not know if it was just his own incompetence

  3. missing icon? by BushCheney08 · · Score: 4, Insightful

    Ummmm, where's the foot icon? It's good to know that the author considers this a joke, but I'm afraid that Hemos might not be in on it...

    --
    Be a real patriot: Question authority. Think for yourself. Formulate your own conclusions.
    1. Re:missing icon? by gbjbaanb · · Score: 2, Interesting

      Well, it did mention Java so it must be full of new funny ways you can break Java coding styles... forget that it contains references to all the old bad programming jokes from years past - eg. one section describes where the compiler only recognizes the first 8 characters so use_unit_update is the same as use_unit_setup.

      Its an old joke. with a new header. That's all. Next submission please.

    2. Re:missing icon? by Golias · · Score: 5, Funny

      Ummmm, where's the foot icon? It's good to know that the author considers this a joke, but I'm afraid that Hemos might not be in on it...

      If you've seen the Slashcode, you would know why this joke would be lost on Hemos and the rest of the staff here.

      Zing!

      --

      Information wants to be anthropomorphized.

    3. Re:missing icon? by alw53 · · Score: 1

      Actually standard Java Coding Styles break two of these rules by decree -- capitalization varis (color versus getColor) and use of vague over-generalized
      words like "object", "entity", etc. Then again, using the words "Java" and
      "style" in the same sentence constitutes a sin in and of itself.

    4. Re:missing icon? by Clueless+Moron · · Score: 1
      Ummmm, where's the foot icon? It's good to know that the author considers this a joke, but I'm afraid that Hemos might not be in on it...

      He's just following the advice of the article itself.

      He didn't do a very good job, though. An expert would have used something more unrelated, like the "Patents" or "Handhelds" icon.

  4. I realize that it's supposed to be humor by rolfwind · · Score: 2, Interesting

    but why would you want to burden yourself by being bound to a program for the rest of its useful life?

    1. Re:I realize that it's supposed to be humor by slvi · · Score: 3, Insightful

      And what's more, why would you want to be bound to program for the rest of your useful life?!

    2. Re:I realize that it's supposed to be humor by Beatbyte · · Score: 3, Interesting

      if the program is utilized at a level that a business cannot operate without it, then you are forever a needed man/woman/slashdot reader.

      it's a dirty way to have great job security.

      i'm not sure what would make it harder to sleep at night... knowing that there are outsources ready to take your well maintained project over and remove your source of income, or knowing that you're intentionally putting effort into making a project complex and making a sort of symbiotic leech relationship with your employer.

      if i were a programmer full time, i would like to think that there are other ways i could have 100% job security and keep my geek pride.

    3. Re:I realize that it's supposed to be humor by Anonymous Coward · · Score: 0

      if i were a programmer full time, i would like to think that there are other ways i could have 100% job security and keep my geek pride.

      hahahahah. there aren't. welcome to the real world.

  5. Don't write it too bad.... by HexaByte · · Score: 1

    If you have any code review mechanism in effect. That could get you fired right off the bat.

    --
    HexaByte - he's a square and a half!
  6. Or just write it in perl by espergreen · · Score: 5, Funny

    #!/usr/bin/perl
    &!@&/*!QW(*()@!@(I!@()!@)(!@*/\()!@&*(@!/*(&

    Ok, I admit it. I just banged on the keyboard :(

    1. Re:Or just write it in perl by TangoCharlie · · Score: 1

      Isn't that the Perl code to deCSS?

      --
      return 0; }
    2. Re:Or just write it in perl by Anonymous Coward · · Score: 4, Funny

      Dude ... you just wrote a web browser.

    3. Re:Or just write it in perl by ErroneousBee · · Score: 1

      Wow! DeCSS, a browser and a rootkit in one line of code. Perl really is a wonderful tool.

      --
      **TODO** Steal someone elses sig.
    4. Re:Or just write it in perl by chris_eineke · · Score: 1

      No shit. That's a perl interpreter right there. :>

      --
      "All you have to do is be fragile and grateful. So stay the underdog." Chuck Palahniuk, Choke
    5. Re:Or just write it in perl by Marsala · · Score: 5, Funny

      That may be, but you managed to create a pretty solid SMTP server anyway.

    6. Re:Or just write it in perl by zootm · · Score: 2, Funny

      Wow! DeCSS, a browser and a rootkit in one line of code. Perl really is a wonderful tool.

      The principle is clearly that if you can do absolutely everything in 20 indecipherable characters, your code will never need to be maintained.

    7. Re:Or just write it in perl by kellar · · Score: 2, Funny

      what about putting a couple of $sys$'s in there somewhere

      --
      k e l l a r
    8. Re:Or just write it in perl by IMarvinTPA · · Score: 1

      You see, the browser needs to run as root, so it has a root kit. And the browser is needed so you can select the DVD you need decrypted. I'm not certain, but I think it also plays the movie too.

      IMarv

    9. Re:Or just write it in perl by hkb · · Score: 5, Funny

      Ok, I admit it. I just banged on the keyboard :(

      Yet it still does something in Perl. Witness the power!

      --
      /* Moderating all non-anonymous trolls up since 2004 */
    10. Re:Or just write it in perl by Haeleth · · Score: 2, Funny

      The principle is clearly that if you can do absolutely everything in 20 indecipherable characters, your code will never need to be maintained.

      Then the future of programming must be HQ9+!

    11. Re:Or just write it in perl by zootm · · Score: 1

      Someone should really create HQ9++, with some more library operations. DeCSS, web browser, stuff like that.

    12. Re:Or just write it in perl by theonetruekeebler · · Score: 5, Funny
      I admit it. I just banged on the keyboard

      That's odd---I do the same thing when I'm coding Perl. Usually with my forehead, though...

      --
      This is not my sandwich.
    13. Re:Or just write it in perl by advocate_one · · Score: 2, Interesting
      The principle is clearly that if you can do absolutely everything in 20 indecipherable characters, your code will never need to be maintained.

      no, you'll just be replaced by a genetic algorythm with a random input for seeding, then let loose to select for the desired behaviour.

      --
      Donald 'Duck' Dunn: We had a band powerful enough to turn goat piss into gasoline.
    14. Re:Or just write it in perl by zootm · · Score: 4, Funny

      It's all fun and games until your "iPod sync" Perl script becomes self-aware and threatens life as we know it.

    15. Re:Or just write it in perl by databyss · · Score: 1

      H:\>temp.pl
      Array found where operator expected at H:\temp.pl line 1, at end of line
                      (Missing operator before ?)
      Bareword found where operator expected at H:\temp.pl line 1, near "*!QW"
                      (Missing operator before QW?)
      Array found where operator expected at H:\temp.pl line 1, at end of line
                      (Missing operator before ?)
      Array found where operator expected at H:\temp.pl line 1, at end of line
                      (Missing operator before ?)
      Bareword found where operator expected at H:\temp.pl line 1, near "@(I"
                      (Missing operator before I?)
      syntax error at H:\temp.pl line 1, near "&!@&"
      Execution of H:\temp.pl aborted due to compilation errors.

      --
      Hmmm witty sig or funny sig? Maybe elitest techy sig!
    16. Re:Or just write it in perl by kzinti · · Score: 1

      Dude... you just ripped off Scott Adams.

    17. Re:Or just write it in perl by operagost · · Score: 1

      Works kind of like Internet Explorer.

      --

      Gamingmuseum.com: Give your 3D accelerator a rest.
    18. Re:Or just write it in perl by rsd · · Score: 1

      Unfortunally Slashdot's lameness filter consider this junk.

      So here is my contribution to obfuscation in perl: http://www.dias.com.br/

    19. Re:Or just write it in perl by jonadab · · Score: 1

      > Ok, I admit it. I just banged on the keyboard

      Yeah, it was obvious. To make this joke more plausible, next time start with ''=~( and include a lot of parentheses, so that it looks like your keybanging might potentially actually *do* something.

      --
      Cut that out, or I will ship you to Norilsk in a box.
    20. Re:Or just write it in perl by Anonymous Coward · · Score: 0

      good thing you didn't close the braces. You are exactly 10 characters away from writing a sentient being, in perl.

    21. Re:Or just write it in perl by Mercano · · Score: 1

      Whats it do, convert the input into CamelCase?

      --
      #include <signature.h>
    22. Re:Or just write it in perl by hey! · · Score: 1

      It's all fun and games until your "iPod sync" Perl script becomes self-aware and threatens life as we know it.

      Or perhaps it decides to upgrade you, along the lines of Queery Eye for the Straight Guy.

      Remember Star Trek 1? V'Ger's mission was expanded/reconstructed into finding all information and returning it to the creator. The script may decide it's reason for existence is getting all the parts of your life working smoothly together, with a bit more style.

      --
      Post may contain irony: discontinue use if experiencing mood swings, nausea or elevated blood pressure.
    23. Re:Or just write it in perl by objekt · · Score: 1

      Ya beat me to it! :)

      --
      -- Boycott Shell
    24. Re:Or just write it in perl by rsd · · Score: 1

      You could try it and find out :)

    25. Re:Or just write it in perl by CaptainCarrot · · Score: 1
      Even Perl must bow before the file-mangling prowess of TECO!

      Damn know-it-all kids think they invented obfuscation. Ha! And get the hell offa my lawn!</GEEZER>

      --
      And the brethren went away edified.
    26. Re:Or just write it in perl by cloudmaster · · Score: 1

      I'm a professional perl programmer, and that's generally how I generate code as well. :)

    27. Re:Or just write it in perl by !Freeky2BGeeky · · Score: 2, Funny

      Yeah, I'd recognise those security holes anywhere!

      --

      Visualize Whirled Peas

    28. Re:Or just write it in perl by prog-guru · · Score: 1

      and what would a mail server be without a root exploit

      --

      chris@xanadu:~$ whatis /.
      /.: nothing appropriate.

    29. Re:Or just write it in perl by poopdeville · · Score: 1

      OK, that was kind of cool. I was expecting it to be a JAPH, though. How hard would it be to modify?

      --
      After all, I am strangely colored.
    30. Re:Or just write it in perl by HappyMeal · · Score: 1
      Good perl programmers knows it's a lot more fun to be banging on a bed with a significant other, than on the keyboard. :-)

      I mean, think about the 'keyboard rash'...

    31. Re:Or just write it in perl by Anonymous Coward · · Score: 0

      The code you sent didn't compile. I have the correct version, but I wasn't able to include it here (Slashdot said: Lameness filter encountered. Post aborted! Reason: Please use fewer 'junk' characters.) Copy-paste it from here:

      http://www.inf.bme.hu/~pts/slashout.html

  7. Funny by IAmTheDave · · Score: 1

    I guess not every joke has to wait until April 1.

    --
    Excuse my speling.
    Making The Bar Project
  8. If I were the manager... by nevergleam · · Score: 0, Redundant

    I would fire this person, and hire someone to rewrite the code from scratch.

    1. Re:If I were the manager... by nevergleam · · Score: 1

      And now the foot comes out...

    2. Re:If I were the manager... by DirePickle · · Score: 2, Insightful

      Ah, I see your sarcasm detector is turned off. You are already well on your way to managerial status!

    3. Re:If I were the manager... by Beatbyte · · Score: 1

      and if this tool is critical enough, you will have a crippled business while it's being rewritten. got enough cash lying around to float a company for a half a year or so?

    4. Re:If I were the manager... by level_headed_midwest · · Score: 1

      How many managers can actually READ code? Good code and bad code looks the same to them- gibberish.

      --
      Just "gittin-r-done," day after day.
    5. Re:If I were the manager... by catch23 · · Score: 1

      unfortunately, your manager would fire you and replace you with someone who will get it done faster. Who has time to rewrite the 500,000 line accounting & billing system when we have customers waiting at the door?

    6. Re:If I were the manager... by Anonymous Coward · · Score: 0
      And would you do that even if it would be cheaper to keep things the way they are, just for the sake of executing a vendetta against the programmer? In that case, your manager ought to get rid of you.

      Idealism has no place in management.

  9. not how it works. by yagu · · Score: 5, Insightful

    Assuming this is tongue-in-cheek. My experience has been no matter how poorly written or unmaintainable something is, it offers little insurance to the author for keeping a job. I've been handed the reins to maintain countless "gone" employees' code. And, if the code isn't maintainable and the program is important or desirable enough, companies just limp along with the deficiencies. I can't think of a single occasion where someone was kept because of fears of maintaining their code, nor where someone was brought back to maintain their 'unmaintainable' code.

    (+/- 2 sigma complainers -- reply here)

    1. Re:not how it works. by Billosaur · · Score: 2, Interesting

      Exactly. I was the indispensible guy, the only person doing my job for 3 1/2 years. You needed it done, I did it. Mind you it was stressful being the only resource, but I was getting paid good money.

      Then one day the head honcho was reviewing the budget and determined that I was being paid way too much for what I was doing, and whacked me out of the budget with his red pen. Result: I lose a good job and am replaced by a Canadian programmer, who works far cheaper than I do. [Note: I am not denigrating Canadians; I am an avid Rush fan. And this guy had skills.]

      So now my code is being maintained by someone else, and he's having a much easier time than I was, because I so thoroughly documented everything I did. This article may be meant to be tongue-in-cheek, but it really points out the state of the inustry right now. Those of us with decent skills are being phased out in turn, replaced by lower-paid and often poorly-skilled labor, simply to save a buck. And if it takes the new guy an extra 6 months to figure out the code, so what? He's getting paid next-to-nothing for it, so it doesn't cost the company much. And who knows? The cheap new guy may do all the documenting for them, just in time to be replaced by the newer, cheaper guy.

      --
      GetOuttaMySpace - The Anti-Social Network
    2. Re:not how it works. by kellar · · Score: 1
      companies just limp along with the deficiencies

      from a scientific computing coder's point of view, watching industry's response to changes in their vendors' offerings, i've even seen companies change the nature of their core scientific 'truths' after a particular functionality tweak or slowdown means that otherwise they wouldn't be able to get out of the office at 5.00pm on a friday.

      --
      k e l l a r
    3. Re:not how it works. by AviLazar · · Score: 1

      Yea I agree. I think what happens. A person gets fired, they hire someone new. The new person is like "oh-vey", spends his first couple of weeks trying to figure things out and writes new code. The company gets inconvenienced for a little while, and if you are lucky, someone says "maybe we shouldn't have fired that last coder"...or they probably say "what a jack-ass he was for making this assbackward code. good riddence."

      --

      I mod down so you can mod up. Your welcome.
    4. Re:not how it works. by NewWorldDan · · Score: 0

      I can. In fact, I currently am. A previous employer of mine has me on retainer to maintain the code I wrote for them. I'm also maintaining the servers I setup. Any time they call, I fix their problem and charge a couple hundread bucks for it. Once I rack up a few more former employers, I could really start raking in the consulting $$. Always remember, if you're not part of the solution, there's a lot of money to be made in prolonging the problem.

    5. Re:not how it works. by greenrd · · Score: 1
      watching industry's response to changes in their vendors' offerings, i've even seen companies change the nature of their core scientific 'truths' after a particular functionality tweak or slowdown means that otherwise they wouldn't be able to get out of the office at 5.00pm on a friday.

      What does that actually mean? How can you change something like a physical constant?

    6. Re:not how it works. by irablum · · Score: 5, Funny

      I was once brought back in even though my code was absolutely maintainable. I had left the company for other reasons ( Inner Mongolia ) but they brought me back because something didn't work. I spent 10 minutes figureing out that the problem was hardware, 5 minutes directing the tech on how to fix the hardware, and 2 hours and 45 minutes bullshitting with my former co-workers, all at $75 an hour.

      Ira

    7. Re:not how it works. by Anonymous Coward · · Score: 0

      I was originally hired by an Engineering department to support some enterprise off-the-shelf apps. Due to political infighting, I was transferred to the IT department who had always been jealous that application support was being done by another department. Needless to say, the next time jobs were being cut I was at the top of the list.

      Well, when the Enginnering director heard this he blew a gasket and they made room for me back in Engineering. They knew they would be absolutely helpless if they didn't have me.

      And it isn't like I refused to document what I was doing. The problem was they didn't have anyone with nearly the skillset to understand what decisions to make about how they wanted it to work. The vendor documentation was actually pretty good, but the people who were my 'backups' were for the most part willfully ignorant. Even if I documented every button (which was already in the vendor docs) they just couldn't understand how everything fit together.

    8. Re:not how it works. by kellar · · Score: 1
      What does that actually mean?

      convergence criteria, choice of modelling levels, error/accuracy tolerance, that sort of thing.

      --
      k e l l a r
    9. Re:not how it works. by EwokMolester · · Score: 0

      Wow, you made $225?!?!

      Got anymore stories like that?

  10. Re:April Fool's Right???? by MindStalker · · Score: 3, Funny

    Yes of course this is a joke. Turn your humor sensors on NOW!

  11. Re:April Fool's Right???? by mymaxx · · Score: 3, Interesting

    Wow, I couldn't disagree with you more. This is an excellent....joke! Lighten up!

  12. Re:April Fool's Right???? by TangoCharlie · · Score: 4, Funny

    Sheesh! Irony, it's lost on Americans!!

    I think we're supposed to take this with a certain amount of salt.

    OOps, I see you're Canadian. Well, nobody's perfect :-)

    --
    return 0; }
  13. +5 Funny by Anonymous Coward · · Score: 0

    C'mon, people, lighten up.

    "Here's some thing people do to make code unmaintainable. Don't do them."

  14. Windows by Anonymous Coward · · Score: 0

    "Your code should not look hopelessly unmaintainable, just be that way. Otherwise it stands the risk of being rewritten or refactored."

    So that's what's taking Vista so long...

  15. How to write unmaintanable code by ThatGeek · · Score: 5, Funny

    How to really write unmaintainable code:

    Apply equal parts of Perl and Guinness

    --
    What are you eating? isItVeg?.
    1. Re:How to write unmaintanable code by Anonymous Coward · · Score: 1, Funny

      Apply equal parts of Perl and Guinness

      At my college, we call that "intoxicoding."

    2. Re:How to write unmaintanable code by shadowbearer · · Score: 1


        Drunken perl is probably more comprehensive than sober Perl. One has to just loosen up a bit... :)

      SB

      --
      It's old. The more humans I meet, the more I like my cats. At least they are honest.
  16. Re:April Fool's Right???? by Anonymous Coward · · Score: 1, Insightful

    Whoa, talk about knee-jerk reaction. The article is obviously meant to address people who think this way, not an actual advocacy of this behavior. Also, on a slightly sadder note, being a great programmer/problem solver does not automatically guarantee you will be irreplacable; it'll just mean that a lot of the time, you'll be known as 'that guy'. Sometimes, it's the social skills that win the day, not just your abilities, no matter how obvious they might seem.

  17. just right here by munehiro · · Score: 1

    I have a code in Fortran 77, with a first comment:

    this code has no comments. It was hard to write, it must be hard to understand

    followed by ten thousands lines of a single, not indented main, full of goto's and undecryptable variable names.

    thanks god I never had to put my hands on it.

    --
    -- "If A equals success, then the formula is A=X+Y+Z. X is work. Y is play. Z is keep your mouth shut." - Einstein
    1. Re:just right here by gnasher719 · · Score: 1

      >> I have a code in Fortran 77, with a first comment:

      this code has no comments. It was hard to write, it must be hard to understand

      followed by ten thousands lines of a single, not indented main, full of goto's and undecryptable variable names.

      thanks god I never had to put my hands on it.

      What's the problem? Just use f2c which will turn it within seconds into ten thousands of lines of C code, full of goto's and undecryptable variable names...

  18. Off to a bad start by Golias · · Score: 0, Offtopic

    The page begins by attributing a quote to Napoleon which he probably never said.

    "Never ascribe to malice, that which can be explained by incompetence."

    The most reliable available evidence out there is that "never attribute to malice what can adequately be explained by stupidity" was originally said by Robert J. Hanlon, a relatively unknown humorist who wrote it for a contest to extend Murphy's Law. It's sometimes called "Hanlon's Razor."

    If you think I'm wrong, please cite the publication in which Napoleon is recorded as having said it.

    --

    Information wants to be anthropomorphized.

    1. Re:Off to a bad start by sammy+baby · · Score: 1

      The origin of the saying isn't known definitively. Wikipedia notes that it has been attributed to Bonaparte in the past, but a more likely (from where I'm sitting) scenario is that it's a corruption of Heinlein's Razor, after a short story in which the sci-fi author wrote, "You have attributed conditions to villainy that simply result from stupidity."

      All this (and more!) where you'd expect to find it.

    2. Re:Off to a bad start by Anonymous Coward · · Score: 0

      If you think I'm wrong, please cite the publication in which Napoleon is recorded as having said it.

      I'll take you up on that! Right here!

    3. Re:Off to a bad start by lisaparratt · · Score: 1

      "It is a poor man who can not make up Oscar Wilde quotes" - Oscar Wilde

  19. Growth by TheRealFritz · · Score: 5, Interesting

    I've heard fellow programmers suggest this before, but the way I see it, you are hurting yourself and here's why: when you become an absolute specialist in one area (in this case your particular implementation), you will be pigeon-holed into this role with no chance for growth.

    A much better approach to job security is to adapt to the needs inside the company and make sure your skills are needed. This will also lead to more opportunities for pay increases and general healthiness of your psyche.

    In the end, what makes you interesting as a developer should be your ability for problem solving and not your ability to obfuscate your work, unless, of course, your intention is not to work ;)

    1. Re:Growth by kin_korn_karn · · Score: 1

      You're absolutely right. We had a layoff here in june and all of the guys that followed this philosophy were let go. All of us who made an effort to diversify our skills stayed.

  20. Jeez, just run an obfuscator by 0kComputer · · Score: 5, Informative

    In skimming the article, I realized that an obfuscator does exactly what hes describing. I know its a joke article, but if you really wanted to have unmaintainable code in .net for example... just compile, obfuscate, disassemble, check in viola!.

    --
    Top 10 Reasons To Procrastinate
    10.
    1. Re:Jeez, just run an obfuscator by Soruk · · Score: 5, Funny

      What version control system is it you use that allows you to check in 4-stringed musical instruments slightly larger than a violin?

      --
      -- Soruk
    2. Re:Jeez, just run an obfuscator by Surt · · Score: 1

      Is the obfuscator reversible if you have some sort of key? Otherwise, how will you be able to maintain the code better than anyone else?

      --
      "Who is the Journal of Quantum Physics going to believe?" --Stephen Hawking
    3. Re:Jeez, just run an obfuscator by WWWWolf · · Score: 2, Insightful
      In skimming the article, I realized that an obfuscator does exactly what hes describing.

      Well, you know, there's an old saying along the lines of "to err is human, but to screw up really good you need a computer"; since programming is the yang to computer hardware's yin, I'd say "to make unmaintainable code you can use code generators, but to really screw up your code you need a human to write it". =)

      Well-designed, but obfuscated, code is decipherable (in theory); code written without any coherence whatsoever, either due to lack of coding standards or due to different coders throwing together features without any planning, tend to be the most difficult to understand.

    4. Re:Jeez, just run an obfuscator by Phae · · Score: 1

      Err, well not to put down your idea... but... I think the whole point is that you can still maintain it... I can't imagine lasting very long when the boss comes and says "I need you to fix this bug." and you say "It will take me two days"
      "But it's like a one line fix!"
      "One line? Okay... three days."
      "Fine, I'll ask Jenkins."
      "It will take him a week, since I wrote the code."

    5. Re:Jeez, just run an obfuscator by Anonymous Coward · · Score: 0

      Does it run on a Cello browser?

  21. Also, see this link with essays. by antdude · · Score: 3, Informative

    A co-worker sent me these unmaintainable code essays back in August 2005. Taken from AQFL.

    --
    Ant(Dude) @ Quality Foraged Links (AQFL.net) & The Ant Farm (antfarm.ma.cx / antfarm.home.dhs.org).
    1. Re:Also, see this link with essays. by darthnoodles · · Score: 1

      I sent this link to co-workers in 2001!

  22. Don't execute that... by Mr.+Underbridge · · Score: 5, Funny

    ...it generates a root exploit.

    1. Re:Don't execute that... by roman_mir · · Score: 3, Funny

      Don't execute that... (Score:3, Informative)
      ...it generates a root exploit.

      - Don't read that, the Mod Points generate a brain dump!

    2. Re:Don't execute that... by TheDauthi · · Score: 1

      Damn!
      I thought it was a web browser!

    3. Re:Don't execute that... by Blue_Wombat · · Score: 1
      1. Quick, sell it to Sony

      2. Profit!

  23. When I was a plumber.... by MajorDick · · Score: 4, Insightful

    I used to employ similar tactics on large non-residnetial contracts, not for myself but for our company, I leared this from my Grandfather and Uncle who did the same, 40 years after the construction a hospital my Uncle was called out of retirment (as a consultant to the firm that got the expansion) To show them "the lay" his price tag $250,000 for 1 year at 35 hrs/wk. He is in the process of building a new home with the proceeds.

    On the code side, things I wrote 10 years ago I look at and think who the F*** wrote this, but back to my plumbing, that was the first lesson I was "Taught" NEVER EVER Say something like who the hell did this this way and why, more often than not after being in the business IT WAS YOU !, sure enough about 6 major jobs I went on to think to MYSELF , who did this holy shit is this complex, well after a day on the job I realized it was ME!!!

    Never say "Who the Hell wrote this" out loud...a sure way to hang yourself when you practice this method of job security.

    1. Re:When I was a plumber.... by jimicus · · Score: 1

      Or "Who the hell wrote this?"

      "Well, that'd be the highly respected developer sitting opposite you who's got 5 years' experience with this code, whereas you have about 5 weeks. Next question?"

    2. Re:When I was a plumber.... by mariox19 · · Score: 1

      I'll second the "never say, 'Who the hell did this...'" advice. I was a house painter once. I proclaimed the very same thing, and it turned out it was our company who did the thing I was complaining about. We were working for a repeat customer (who never got up on a ladder, I presume).

      --

      quiquid id est, timeo puellas et oscula dantes.

    3. Re:When I was a plumber.... by Sviams · · Score: 1

      Point well taken and a good rule to apply.
      I'm currently lucky enough to work in a shop with mandatory code reviews on all submissions to any production codeline, which makes it more of a "Who the hell approved this submission" question.

    4. Re:When I was a plumber.... by shadowbearer · · Score: 1


        But copper is still superior to Pex*! ;-)

      SB
      *Insert favorite label here :)

        (Actually, in my job I'm frequently heard using various forms of the phrase "who the * did this?". It's part of the job description of a hardware store monkey :)

        To Hell with them, too...

      --
      It's old. The more humans I meet, the more I like my cats. At least they are honest.
    5. Re:When I was a plumber.... by airdrummer · · Score: 0

      well, my 1st unix project (after several yrs on vms...now_that_was a developers' environment:-) was on a configuration mgmt system(yup, reinventing the wheel...ur tax $$$ @ work;-) so this cms aped the dec editor's auto-incrementing versioning system: filename;0 specified the latest version, but unlike the vax system, checking in a new version resulted in the previous version zero being renumbered 1, prev.#1->2, etc. this meant that checkpointing on a particular version number was impossible: the numbers constantly changed:-P so during a team meeting where us new members were introduced to this brilliant design, i said what moron came up with this??? it was the project manager's, who was conducting the meeting;-} but i outlasted him on the project;-)

  24. Code Obfuscation by Anonymous Coward · · Score: 1, Informative

    In the Java-script world and other arenas in which the source cannot be hidden there are already many programs that will automatically obfuscate your code using many of these techniques (such as single-letter vars).

  25. Not So by AnalogDiehard · · Score: 4, Insightful
    Writing unmaintainable code does not make you irreplaceable and does not sustain your work duration.

    I have had way too many times in my contract work that I was assigned to upgrade unmaintainable code.

    In fact, I earned a reputation as a saving grace and the original coder was never called back and he earned a black eye as a poor coder.

    Now who do you think stayed on the job longer?

    --
    Eternity: will that be smoking, or non-smoking? I Corinthians 6:9-10
    1. Re:Not So by trollable · · Score: 3, Funny

      If you could upgrade the code, it means the original coder wasn't good enough. Writing unmaintainable code is not given to every one. Unmaintainable code is code you can only delete, not upgrade.

  26. *yawn* by hyperstation · · Score: 1

    this has been around for years in one form or another, how is it news?

  27. guilty as charged by LWATCDR · · Score: 2, Insightful

    I just can not stop using i as an index. My programing teacher learned FORTRAN first and when the taught me Pascal he used i in for loops so I do this day.

    --
    See my blog http://ilovecookes.blogspot.com/ for light hearted technical information.
    1. Re:guilty as charged by psavo · · Score: 2, Insightful

      I just can not stop using i as an index. My programing teacher learned FORTRAN first and when the taught me Pascal he used i in for loops so I do this day.

      If 'i' is obfuscation of 'index' then 'for' is obfuscation of 'for_as_long_as_expression_between_semicolons_is_t rue'.

      --
      fucktard is a tenderhearted description
    2. Re:guilty as charged by LWATCDR · · Score: 1

      Actually it is a bad practise because it is hard to search for. The reason why people tend to use i,j,k,l for indexes is because in Fortran those where predefined as integers. i is short for integer not index. It has become tradition since then.
      inx would be a good replacement but I just go into auto pilot and type for(int i=0; itermval;i++) without thinking.

      --
      See my blog http://ilovecookes.blogspot.com/ for light hearted technical information.
    3. Re:guilty as charged by NilObject · · Score: 2, Insightful

      "i" is a standard indexing variable name. Anywhere it's used in code, you can usually assume that you;re doing some sort of scanning over an array of some sort.

      So it's standard enough, I think.

    4. Re:guilty as charged by pclminion · · Score: 1
      Actually it is a bad practise because it is hard to search for.

      Search for "; i"

      Anyway, why would you ever need to search for a loop index? "I might have to some day" isn't a good enough reason. I've coded C full time for six years and never had a reason. For that matter, I've never had reason to search for anything except perhaps function names, and cscope makes even that obsolete.

    5. Re:guilty as charged by LWATCDR · · Score: 1

      I have to admit that I can not remember ever searching for an index var. Well everyone says it is bad practice:)
      I have been writing code for over 20 years. Pascal, Modula, c, PHP, java, perl, and c++. And I still use i for my loops in each of them. I guess old habits die hard.

      --
      See my blog http://ilovecookes.blogspot.com/ for light hearted technical information.
    6. Re:guilty as charged by Zathrus · · Score: 1

      Actually it is a bad practise because it is hard to search for.

      Only if you use bad tools.

      In vim, /\ will find all instances of the word "i" alone, while not matching it as part of a word. It will also match its use in expressions (since +, -, ;, etc. are considered word boundary markers).

      Certainly other names can be better -- even changing to "ii" is a vast improvement -- but saying that it's particularly hard to search for just indicates poor usage/knowledge of tools on your part.

      And, really... teach yourself to stop using the postfix increment operator except where it's really needed. The prefix operator is more efficient, especially in OO languages (you don't have to make a copy of the object first; if you're not using the pre-incremented value for anything then there is no point in doing x++ instead of ++x).

    7. Re:guilty as charged by Zathrus · · Score: 1

      Wow, that's what I get for not previewing. Oops.

      Actually it is a bad practise because it is hard to search for.

      Only if you use bad tools.

      In vim, searching for \<i\> will find all instances of the word "i" alone, while not matching it as part of a word. It will also match its use in expressions (since +, -, ;, etc. are considered word boundary markers).

      Certainly other names can be better -- even changing to "ii" is a vast improvement -- but saying that it's particularly hard to search for just indicates poor usage/knowledge of tools on your part.

      And, really... teach yourself to stop using the postfix increment operator except where it's really needed. The prefix operator is more efficient, especially in OO languages (you don't have to make a copy of the object first; if you're not using the pre-incremented value for anything then there is no point in doing x++ instead of ++x).

    8. Re:guilty as charged by psavo · · Score: 1

      I don't really see the point. It's not every-year task that you do something like 'grep -ri --color some_obscure_index c:\windows\vista\source'.

      It sorts of makes sense if you want to highlight some portion of code in editor to see how a variable is used, but that's a tool limitation if it can't parse.

      FWIW, I only use 'i' as variable name in a clear-cut 'this has no real name' situations. For example if indexing through book-vector I'd use 'booknum' as variable name. But in java, when dealing with mixed-type ArrayList I'd just use 'i'.

      I also consider bad style and try to avoid modifying the index variable withing the loop. It rarely makes much sense and often bites.

      --
      fucktard is a tenderhearted description
    9. Re:guilty as charged by igny · · Score: 1

      So it's standard enough, I think.

      In real life, this is more complex than that. After all, the indexes are imaginary.

      --
      In theory there is no difference between theory and practice. In practice there is. - Yogi Berra
    10. Re:guilty as charged by ceoyoyo · · Score: 1

      And the reason i,j,k etc. were defined that way is that they're standard indicies in math. If you do scientific coding (or graphics) it's very much nicer to use i,j,k and x,y,z,w lots of places for indicies. I don't really understand why anyone would want to search for a purely loop-local index variable anyway. Search for "for" instead.

    11. Re:guilty as charged by LWATCDR · · Score: 1

      "And, really... teach yourself to stop using the postfix increment operator except where it's really needed. The prefix operator is more efficient, especially in OO languages (you don't have to make a copy of the object first; if you're not using the pre-incremented value for anything then there is no point in doing x++ instead of ++x)."
      Is that in all OOPs or just the pure OOPs? I don't do python or smalltalk so I was wondering. Good point but like I said, "Old habits die hard".

      --
      See my blog http://ilovecookes.blogspot.com/ for light hearted technical information.
    12. Re:guilty as charged by Erik+Hollensbe · · Score: 1

      I was wondering the same exact thing.

      Then again, if you're searching the guts of a function/method/subroutine, chances are you're coding poorly as it is and your functions are too long. Break them out so all you have to do is search for the names of the routines.

      My $.02, but it tends to be very effective.

    13. Re:guilty as charged by Erik+Hollensbe · · Score: 1

      Someone should give you an obscure math pun award.

    14. Re:guilty as charged by Zathrus · · Score: 1

      Is that in all OOPs or just the pure OOPs?

      Technically it's in any language with that functionality for prefix/postfix increment/decrement -- when you do postfix then the code must make a copy of whatever's being incremented first, return that copy, and then increment the original. If it's just a 4 byte integer -- no big deal. If it's a 4k object, that starts getting to be a bigger issue. Particularly if you're doing it in a loop or all over the code.

      So unless you need the pre-incremented value for something (and there are entirely valid reasons for doing this), use prefix -- it's faster.

    15. Re:guilty as charged by LWATCDR · · Score: 1

      Good point thanks. Makes me wonder why all the examples in books use post. Even with an int it will save a few ticks.

      --
      See my blog http://ilovecookes.blogspot.com/ for light hearted technical information.
  28. TheDailyWTF.com by Str8Dog · · Score: 4, Informative

    If you need a daily reminder of "what not to do", I highly suggest bookmarking TheDailyWTF.com.

    --


    Str8Dog
    using System.Darkside; public
    1. Re:TheDailyWTF.com by Anonymous Coward · · Score: 0

      Similar in humor, if not so coding-related, is at http://www.sysadminco.com/
      I especially like the "broken" section. Good stuff!

  29. This is ancient... by zimbu · · Score: 5, Informative

    Roedy started this back in the 90's, you could at least have the decency to link to the latest version.

    1. Re:This is ancient... by javaxman · · Score: 1
      Roedy started this back in the 90's

      That explains a lot. This thing goes on forever. I was worried that someone had just way, way, way too much free time.

      Of course it's ancient. It talks about FORTRAN... probably the best bit in the whole thing. "Write all your code in FORTRAN."

      For what it's worth, as much as this is a joke, it does appear to be what a number of government contractors and research scientists do, if they do it to secure their jobs or not I don't know...

    2. Re:This is ancient... by Tough+Love · · Score: 1

      It talks about FORTRAN... probably the best bit in the whole thing. "Write all your code in FORTRAN." For what it's worth, as much as this is a joke, it does appear to be what a number of government contractors and research scientists do, if they do it to secure their jobs or not I don't know...

      Fortran consistently outbenchmarks C in numerical applications. One reason is, the compiler can optimize more aggressively in the absence of pointer aliasing. Fortran doesn't have pointers.

      To this day, Fortran does the heavy lifting on supercomputers. C is banned in some numerical shops because it has earned a reputation for resulting in code that engineers can't maintain.

      --
      When all you have is a hammer, every problem starts to look like a thumb.
    3. Re:This is ancient... by javaxman · · Score: 1
      Fortran consistently outbenchmarks C in numerical applications. One reason is, the compiler can optimize more aggressively in the absence of pointer aliasing. Fortran doesn't have pointers.

      The guy using pointers in seriously time-sensitive numerical computation loops should be strung up anyway. My C code can be optimized pretty aggressively as long as I use fix-length data structures, as Fortran is limited to.

      . C is banned in some numerical shops because it has earned a reputation for resulting in code that engineers can't maintain.

      Is that *really* the reason, not just the justification? These shops obviously haven't seen the poorly written, convoluted, uncommented Fortran routines I've seen... or they're FORTRAN experts looking to protect their turf, most likely...

      Don't get me wrong, FORTRAN is fine for many uses, but it's neither portable nor easy to maintain, and it's performance benefits have been way over-hyped, at least in my own personal benchmarking experience. Fill two fixed-length arrays with doubles and multiply them, it's going to be just as fast whichever language you write the routine in, and the I/O is going to be a hell of a lot easier to code ( and friendlier to the user ) using C libraries... if I/O doesn't matter to you, then fine, use FORTRAN, just don't hire me to maintain it...

  30. Its Funny. Laugh. And a jab at the IT industry. by C0deM0nkey · · Score: 2, Insightful
    My Lord, you just completely missed the point of that article, didn't you?

    Did you miss the "Humor" tag?

    Did you even read the article or are you responding to the blurb on the front page?

    Its a jab at the IT industry (and an old one at that - been around for quite some time - this is the second time this thing has appeared on Slashdot that I can remember); think of it as an article on Worst Practices. No one is supposed to be doing these things; they are illustrations of things that *still* happen that should never be done - a humourous jab in the eye to get our attention and encourage *good* programming styles and techniques by highlighting the ridiculous stuff that does happen.

    1. Re:Its Funny. Laugh. And a jab at the IT industry. by Anonymous Coward · · Score: 0
      This is the second time this thing has appeared on Slashdot that I can remember);
      Mmmm.. you called this a dupe without waving your hands or shouting... Smooth. ;)
  31. IMHO by Anonymous Coward · · Score: 0

    All java programming, when done according to the principle of model view controller, sprinkled with a hot sauce of the gang of four becomes immediately unreadable, because it multiplies the number of lines of code a thousand-fold easily.

  32. Biased, much? by Luscious868 · · Score: 3, Insightful
    Sheesh! Irony, it's lost on Americans!!

    Who said he or she was an American? I've seen plenty of posts on Slasdhot writen in English from people who were not American. Biased, much?

    1. Re:Biased, much? by TangoCharlie · · Score: 3, Funny

      See, I told you! :-)

      --
      return 0; }
    2. Re:Biased, much? by sedyn · · Score: 1

      When we need to remind people to RTFA, what makes you think they can read between the lines?

      (FTA: "This essay is a joke! I apologise if anyone took this literally. Canadians think it gauche to label jokes with a :-). People paid no attention when I harped about how to write __maintainable code. I found people were more receptive hearing all the goofy things people often do to muck it up. Checking for unmaintainable design patterns is a rapid way to defend against malicious or inadvertent sloppiness.")

      (RBTL: Chaotic Spyder (896445), website: http://www.olivers.ca/, therefore is assumably Canadian (.ca)
      When someone says "OOps, I see you're Canadian. Well, nobody's perfect :-)" "I see" usually implies they have some insight.)

      FTA: "Use acronyms to keep the code terse. Real men never define acronyms; they understand them genetically." - To explain my use of RBTL

      --
      Am I open minded towards open source, or closed minded towards closed source?
    3. Re:Biased, much? by John+Nowak · · Score: 1

      Even if irony isn't lost on Americans, a bit of friendly ribbing almost always is. Lighten up Americans. And yes, I live in New York...

  33. Hard Drive Size... by lostraven · · Score: 2, Insightful

    I agree that though intended to be "humour", it has to be recognized
    that there are people that think that way in the programming industry.
    Not to start flaming, but I've always maintained that the expansive
    hard drive sizes over the years certainly hasn't aided in the idea of
    creating (and maintaining) tight, clean code. Yes, the topic has been
    beat around a lot; however, it's perfectly valid. I certainly I have
    spoken to more than a few long-time programmers that - though not
    outright - have indicated that the leaps in hard drive space gave more
    than a little breathing room in software development.
    -Shawn

    1. Re:Hard Drive Size... by AKAImBatman · · Score: 2, Insightful

      Not to start flaming, but I've always maintained that the expansive
      hard drive sizes over the years certainly hasn't aided in the idea of
      creating (and maintaining) tight, clean code.


      Just to play devil's advocate for a moment, small hard drives and less powerful systems didn't exactly encourage readable code either. Unrolled loops, cycle saving "tricks", and millions of premature optimizations were a large part of the earlier days of computing.

      Java is actually quite interesting because it's one of the first (the first?) languages to encourage readable code. Sadly, anyone who's been introduced to Microsoft C++ (Hungarian notation, damn underscores in front of everything, etc.) may be beyond hope of ever properly utilizing the language.

    2. Re:Hard Drive Size... by poopdeville · · Score: 1
      Java is actually quite interesting because it's one of the first (the first?) languages to encourage readable code.

      Perl did it first.

      --
      After all, I am strangely colored.
    3. Re:Hard Drive Size... by Anonymous Coward · · Score: 0

      That's a joke, right? (Please tell me you're joking.)

  34. Meanwhile In Redmond... by should_be_linear · · Score: 1

    These rules established quite strongly among employees of one Redmond Company. When developer eventually decided to leave, boss furiously demolished furniture in his office. Every time, complete code sub-tree had to be removed and major product postponed for another 2 years.

    --
    839*929
  35. Practical tips for same purpose, but C instead by TERdON · · Score: 1
    --
    I have a really elegant proof for Fermat's last theorem. If this sig was only a bit longer...
  36. Using bad code to maintain your employment. by markv242 · · Score: 4, Insightful
    The kind of coder who deliberately writes bad code just to maintain their employment is always the first coder shown the door. Always. It is a complete urban myth that not commenting spaghetti code will keep you in a job. There is always someone else willing to do your job, no matter how specialized you think you may be.

    1. Re:Using bad code to maintain your employment. by Anonymous Coward · · Score: 0

      Well... there are anecdotes in this very thread that disprove your "always".

      But I like to think you're right in general.

    2. Re:Using bad code to maintain your employment. by amck · · Score: 1

      Not necessarily - in my first job I was hired specifically to replace a contract programmer who had moved country. Six months later he was still on the payroll, working remotely, as it was not possible to fix his code - only he could effectively maintain it, so I had to rewrite from scratch.

      Note: he was hired first as the only IT person in a telecoms reseller; he was hired to create
      some software as part of a contract they had won. Only later was a second computer professional hired: a manager to expand the role of the new 'software department', who realised the state of the code.

      --
      Anyone who believes exponential growth can go on forever in a finite world is either a madman or an economist
    3. Re:Using bad code to maintain your employment. by caller9 · · Score: 1

      I don't think he mentioned just using piss poor logic or insanely brute force methods whenever possible. I once had to clean up some code from a Masters CS degree holder, who did a thesis on fuzzy navel recognition using visual systems comprised of just this one picture. Not really sure but he couldn't code for sh#*.

      His method of updating a row in a SQL table was this: Create recordset from "SELECT * ..." Fill array with all the rows values. Do a sequential search until the record in question was found, change that record accordingly, complete loop to n anyway. "DELETE FROM ..." Then using the array, repopulate the table with INSERTS.

      I was shocked that I could barely think of a less efficient algorithm...possibly doing an n^3 sort on the elements before rot 3 'encryption' and emailing them to himself. Manually saving that file and starting the second module up to do the decryption and inserts... that would've been worse I guess. Did I mention I only saw the code because it didn't actually work.

      I let him look over my non-masters-degree-having shoulder when I deleted 90% of his code and replaced it with "UPDATE ... SET x='foo' ..." Good thing he made more than me, or I would've felt smug. :(

      It had nothing but a negative effect on his job, and if I didn't know better, sullied the reputation of his university.

  37. Lesson on how To Write Unmaintainable Code... by nother_nix_hacker · · Score: 1

    Just 'view source' on this very page!

  38. Did you notice... by Anonymous Coward · · Score: 0

    He said that he was putting this out to CREATE employment opportunities in the field. IE...follow this advice and you are actually out the door, thus increasing a good programmers chance of finding work.

  39. It's easy... by Anonymous Coward · · Score: 0

    Everyone knows that the best unmaintainable code is written in perl.

    *_=\$#;

  40. priceless by nubbie · · Score: 1, Insightful

    Priceless: Guaranteed to never get a promotion or pay raise!

    --
    'Go for the eyes, Boo, go for the eyes, aaarrrrrrrr!' -- Minsc
    1. Re:priceless by Alphi1 · · Score: 1
      Priceless: Guaranteed to never get a promotion or pay raise!

      With this economy, isn't that a given anyways?

  41. Uhm... Quark.. by Rosyna · · Score: 1

    Say the same thing to the people that worked on QuarkXPress. If you get too good at a job, chances are you'll believe you're irreplaceable and ask for more money (or deserve it in mandatory raises). They'll just hire 3 people at a tenth of the cost to replace you.

  42. Anybody is Replaceable by slashfun · · Score: 2, Insightful


    ... *even those who spend all their time reading slashdot* .....

    --

    Slashmail.org "The Open Source Email Company"

  43. Nice of y'all to join us by realinvalidname · · Score: 1

    This is news? Was the poster not aware that Roedy's unmaintainable code doc has been growing for at least five years? http://web.archive.org/web/*/http://mindprod.com/u nmain.html

  44. If I were the manager...I would fire *you* by C0deM0nkey · · Score: 1
    Wow. I would fire *you* for making uninformed hiring/firing decisions. Better to get you out of the way than to face a lawsuit for wrongful termination.

    How about reading the FA before you sound off:

    This essay is a joke! I apologise if anyone took this literally. Canadians think it gauche to label jokes with a :-). People paid no attention when I harped about how to write __maintainable code. I found people were more receptive hearing all the goofy things people often do to muck it up. Checking for unmaintainable design patterns is a rapid way to defend against malicious or inadvertent sloppiness.
  45. If you do this, you're a crappy programmer by Anonymous Coward · · Score: 0

    If you feel like you need to write unmaintainable code just to give yourself job security, that means you think you can't keep your job on your abilities alone.

    Given the inflated opinions most programmers have of their abilities (the only programmers I've run into that don't have an inflated estimate of how good they can code are the real gurus...), if you don't think you're good enough to keep your employment on your abilities alone, why the hell should I think you're good enough to keep employed?

  46. If you were the manager... by Anonymous Coward · · Score: 1, Insightful

    I would fire this person, and hire someone to rewrite the code from scratch.

    You yourself would get fired for not having properly supervised the rogue programmer in the first place and prevented them from having sabotage-written the code and wasting the money spent on their salary that resulted in the development of a "defective" product. Then the money that would have been used to pay YOUR salary will next be used to hire someone who will rewrite the code... under close scrutiny this time.

  47. hmmm.... by psycobrat · · Score: 0

    i really thought this was a dupe, but it might be the drugs for my broken arm and nasty head bump making me think double.

  48. Great guide by Anonymous Coward · · Score: 0

    Seems a lot of people missed the sarcasm. This is a guide on bad coding practices. Even the quotes are quite indicative of that. Good thing to read and think about when your programming to find practices that you might be doing without even thinking about (I freaking hate the _ character in code I work on)

    1. Re:Great guide by Anonymous Coward · · Score: 0

      Oh my God -- was he looking at my code?

      Let's see:
      A) variables Fred and Barney -- check
      B) Single letter variable names -- Oh hell yeah. Weren't you taught that way too?
      C) Abstract labels/functions/whatever? Do second-order concepts count?
      D) ACRONYMS? Yeah, usually the ones abbreviated on the spot. Speaking of which, he shoulda mentioned multiple abbreviation schemes for the same names, used in the same parts of code.
      E) Thesaurus? sorry, I don't employ a thesaurus. Multiple expressions that serve the same purpose come naturally. For that matter, I employ the same concept for subroutines: never do the same task in the same way twice, I always say.
      F) Capitalization? the trick is only to mix it up when it comes to the case-sensitive stuff.
      G) Reusing Names? Ideally, in a subordinate scope, recycle only a few. That really keeps 'em on their toes.
      H) Mix languages? I usually keep it to English, Latin and Italian -- so it's pretty easy to guess, especially for my names. As TFA points out, German is often quite compelling.
      I) Conventions: the only conventions we are held to are the ones the compiler requires. Everything else is strictly window-dressing. Hell, I don't even know how to tab properly.

      My god -- it's all there! My secrets unmasked!

  49. Need an IOJC... by Anonymous Coward · · Score: 0

    Why go through that article when I already learned all the coding skills I need from from the IOCCC and OPC contests? (acronym redundancy intentional)

    Java? Pah! Don't make me laugh. Nobody's going to take that language seriously for securing permanent indenture until it has its own IOJC, especially with all those self-documenting and de-obfuscation tools floating about. Sheesh, Postscript has an OPC. Get with the 21st century! Automated code obfuscation tools, such as exist for java, are poor substitutes. There's nothing that can obfuscate as effectively as hand-tuned code.

    -- This message brought to you by The Department of Redundancy Department.

  50. Re:April Fool's Right???? by Chr0nik · · Score: 0

    If this is a joke, then discussing it in a serious manner is kind of pointless right? So, not to be overly critical or anything, but, what's the point?

    I mean, I had my little guffaw, and slapped my knee, but what are we discussing here?

    --


    ... what did you expect, something profound?
  51. Stuff for the CV? by Soruk · · Score: 1

    Maybe this is the right time to mention your winning IOCCC submission on your CV/resume?!

    --
    -- Soruk
  52. Group Projects by TCFOO · · Score: 1

    Writing good maintainable code will help secure your future in any organization. Plus writing code that is not maintainable is a good way to get your self removed from a project. Heck, I got a talking-to for not running javadoc on my code before sending out the update once.

    Maybe this is a good idea if you want to leave the company, but due to internal politics you can't actually quit.

  53. Obligatory by Anonymous Coward · · Score: 0

    In Soviet Russia, code maintains YOU!

  54. I can. by Ungrounded+Lightning · · Score: 5, Interesting

    I can't think of a single occasion where someone was kept because of fears of maintaining their code, nor where someone was brought back to maintain their 'unmaintainable' code.

    I can.

    My very first programming job - which went on for years and where I did a bunch of stuff - but was quite underpaid. There were two of us programming when the institution in question had a financial crisis and could only keep one. My code was maintainable, the other guy's wasn't. So I got the boot.

    And had a new job at higher pay in a better situation 25 minutes after letting it be known that I was available.

    Before it was a matter of writing code that *I* could maintain. After it was a matter, not just of principle, but of practicality. By making myself NOT indispensible I made myself valuable.

    I went on to a long carreer of mixed consulting and salaried positions, doing software for 35 years, and now hardware and system architecture. (And I once got the layoff because my code was the only stuff that worked, if you can imagine that. From another doomed company.)

    The potential value-added in software and computer hardware has been so extreme that management can be AMAZINGLY pathological and still keep a company afloat for a couple years - and then find another job after it crashes. (Investors prefer someone with management experience crashing companies to someone with talent but no management experience. B-( Meanwhile the ones with management experience NOT crashing companies are too expensive or too busy.)

    I'm now at six figures, stock options, one house paid for and another in progress, three cars, yacht, putting non-working (at the moment) wife with four degrees so far through more school (so she can do something she LIKES professionally), and held on to the current position through the slump, chapter 14, and out into the recovery. A big part of that was achieved by religiously making myself dispensible.

    --
    Bantam Dominique roosters crow a four-note song. Once you've heard it as "Happy BIRTHday" you can't NOT hear it that way
    1. Re:I can. by pclminion · · Score: 1
      I'm now at six figures, stock options, one house paid for and another in progress, three cars, yacht

      This is honestly just a question, not a dig at you. Does any of that stuff actually make you HAPPY? Because if so, I want to know so I can realign a few priorities...

    2. Re:I can. by bataras · · Score: 5, Funny
    3. Re:I can. by Anonymous Coward · · Score: 0

      Since he doesn't have to worry about money any more, probably yes.
      Not because of what he has bought, but because he has the money to buy them.
      Although the yacht probably is fun.

    4. Re:I can. by Anonymous Coward · · Score: 0

      Ah, another bitter divorced guy. Hang in there man, the old cliché really is true: it gets better with time.

      (from a formerly bitter divorced guy who survived the divorce from hell 4 years ago)

    5. Re:I can. by Hatta · · Score: 1

      putting non-working (at the moment) wife with four degrees so far through more school (so she can do something she LIKES professionally)

      Have you considered that maybe the only thing she likes is school? She could at least go to graduate school and get a stipend.

      --
      Give me Classic Slashdot or give me death!
    6. Re:I can. by daviddennis · · Score: 2, Informative

      I'm not the original poster, but I earned a low six figure income for quite a while and can tell you about its relationship to happiness.

      (1) It's much nicer to have money than not to. I'd rather shop at Gelson's or Whole Foods than Ralphs any day. It's just plain fun to go to nice places and be able to afford nice things.

      (2) During this time, I worked for someone who was not very nice. Doing so can severely damage your life and happiness level, no matter how much money you earn. At the same time, working for someone who's not nice is a lot better when you have lots of money and can enjoy yourself outside of work than it would have been if I'd been paid little.

      (3) For most of this period, I was unable to find a girlfriend. Again, that's a worse problem than not having money. But at the same time, it's far better to have money and no girlfriend than it is to NOT have money and still have no girl.

      (4) I no longer work for the mean guy. I work for some nice people now. But I do it in Pittsburgh, PA, an area I detest. I don't like the cold, I don't like the poor quality services and lack of interesting singles compared to LA, and so on. I'm still not happy, but for reasons unrelated to money or my boss.

      So overall, I would say that I am far happier when I have money than when I don't. And I've been in both places, believe me.

      In order to be happy, it is necessary to have a balance. You have to like where you live (as I did in LA), like your work (as I do now) and have a companion of the sex you desire. If there is no balance you will not be happy even if you're making US$1m a year.

      But on the whole I would say you'd be happier than people who don't. The money lets you have a life away from your problems, and gives you at least a somewhat better shot at the girl.

      Hope that helps.

    7. Re:I can. by TilJ · · Score: 4, Interesting

      Exactly. What many posters don't seem to realize is that if you make your irreplaceable, you've also made it impossible to be promoted. This isn't just internal to your current organization -- doing the same thing for year after year without making career progress looks like hell on a resume.

      --
      "The purpose of argument is to change the nature of truth." -- Bene Gesserit Precept
    8. Re:I can. by xappax · · Score: 1

      It's much nicer to have money than not to.

      I hear this a lot. While the statement itself is true, the implication seems weird to me. When people say this, they're basically saying "Yes, money isn't everything, in fact it's much more important to be happy. But being rich can be nice some times, so hell, why not be rich?"

      This is an excellent point - if a fairy popped up and said "I can either give you 5 million dollars or steal your wallet...what'll it be?" I don't think there's any question what I'd pick. I think the weird part is that people either believe or try to believe that the world really works that way.

      True, there are some people who are born with a silver spoon in their mouths, and from day one can decide "Should I be rich, or not?". Most people who decide they want to be rich, however, have to organize a huge part of their lives around the goal. They have to do lots of things they don't want to do, and what's more they have to convince themselves that they actually do want to do them.

      I'm not saying it's bad to try to be rich, just that it require a huge amount of work and sacrifice for most people, which suggests to me that they associate it with some really great goal - for example "happiness". I mean really, if money isn't the ultimate key to happiness, as we all seem to agree, why do folks spend such a disproportionately huge part of their time, mindshare, and life trying to get rich?

    9. Re:I can. by ConnortheMad · · Score: 1

      The wife is schooling? Or is she going through four degrees of finding out how dispensible you truly are? Excuse me, I've got dispensible golf balls to hit off of the back of my yacht.

    10. Re:I can. by mabinogi · · Score: 1

      I think the point is that, striving to be rich purely because you think it'll make you happy is a mistake.

      But it's equally a mistake to think that posession of more money than average is going to affect your happiness in a negative way - it most likely will make you happier, but not to the degree that it's worth making your life miserable obtaining it. There are other things that will have a greater effect on your happiness that are eaiser to obtain.

      --
      Advanced users are users too!
    11. Re:I can. by daviddennis · · Score: 1

      Well, let's see. If being in a certain place, like Los Angeles, improves my happiness, then I'd better be rich, because the good parts of LA are horrendously expensive.

      If I want to live near the ocean, or get a great view of the ocean from my window, as I do, then I'd better be rich.

      And of course if I want a charming and lovely wife, well, they tend to be attracted to people with money.

      So money can't buy happiness directly but it can help, and it's nice to hear the purr of the Mercedes engine even before you achieve your goals.

      I guess it all depends on what your goals are. I took a peek at your web site, and I'm sure you know the only way to get affordable housing in Washington DC is to raise a few zillion dollars and build it yourself. Thus, a motivation to get rich.

      D

    12. Re:I can. by shadowbearer · · Score: 1


        Mods on crack again ;-)

      SB

      --
      It's old. The more humans I meet, the more I like my cats. At least they are honest.
    13. Re:I can. by Ungrounded+Lightning · · Score: 1

      Does any of that stuff actually make you HAPPY?

      Hell, yeah!

      Only down thing lately was not cashing out a couple million before the bubble burst. I could have been retired, have more toys to play with (like another 75 acres behind the paid-for house) and time to enjoy it all more, rather than working away through the lean years for a company that didn't have enough resources to do some of the interesting projects.

      --
      Bantam Dominique roosters crow a four-note song. Once you've heard it as "Happy BIRTHday" you can't NOT hear it that way
    14. Re:I can. by pugugly · · Score: 2, Informative

      My own reaction is that money solves almost no large problems, but resolves a *lot* of small problems. Indeed, if the problem can be resolved with money, it is almost always a small problem - there are other solutions, but money is an easy one.

      And being able to resolve it by tossing some money at it gives you time to deal with all the larger problems that money can't resolve.

      Pug

      --
      An Invisible Entity of Vast Power whose existence must be taken on faith alone: Liberal Media
    15. Re:I can. by saltydogdesign · · Score: 1

      You can always rent a girlfriend.

      --
      // This is not a sig.
    16. Re:I can. by xappax · · Score: 1

      I appreciate the thoughful responses, because I really am curious what's up with the ubiquitous draw of money. It seems that a lot of things in modern society, including the obsession with job security which leads people to take TFA half-seriously, stem from the relatively recent idea that although money may not quite equal happiness, it's more or less an essential ingredient.

      If being in a certain place, like Los Angeles, improves my happiness, then I'd better be rich

      This is the most popular explaination for why being rich is a requirement for being happy. Again, the statement seems reasonable by itself, but the unspoken implication seems flawed. There are lots of things which would improve my happiness that cost lots of money, but just because they could make me happy doesn't mean I have to be unhappy without them. Happiness isn't like Pokemon where you have to "collect them all"! I think the bigger problem is that consumerism, or to be more specific the idea that the cost of something is correlated to how happy it can make you, is widely accepted as truth today. I'd like to live in Los Angeles, but I can't afford it, and somehow I'm very happy anyway. I currently have an expensive computer as a "hobby toy" which makes me happy, but if I lost it (I can't afford to replace it), I'd just find something else to make me equally happy, like reading novels or fixing bicycles.

      Now that I think about it, I guess the main problem is that most people don't realize the vast, practically infinite amount of things there are to do that can make us as human beings happy - for free. And if you can't figure out what will make you happy, there are plenty of advertisers, marketing execs, and lifestyle-pushers who will be happy to decide for you. (hint: money is involved)

    17. Re:I can. by rjshields · · Score: 1
      And of course if I want a charming and lovely wife, well, they tend to be attracted to people with money.
      You seem to be confusing the terms "charming and lovely" with the term "gold digger".
      --
      In this world nothing is certain but death, taxes and flawed car analogies.
  55. Also, streamline your code to IKEA format by digitaldc · · Score: 1

    Use pictograms and arrows to ensure that everyone will understand what you are writing.

    My favourites:
    "Always look for the most obscure way to do common tasks."
    "People who come after you have no business modifying your code without thoroughly understanding every line of it."
    "Wherever the rules of the language permit, give classes, constructors, methods, member variables, parameters and local variables the same names."
    "Never perform code coverage or path coverage testing. Automated testing is for wimps."
    "Join a computer book of the month club. Select authors who appear to be too busy writing books to have had any time to actually write any code themselves."

    Thanks for brightening my day.

    --
    He who knows best knows how little he knows. - Thomas Jefferson
  56. Had to stop by 00_NOP · · Score: 2, Funny

    I was laughing too much and getting strange looks in the office. Personally I use perl to guarantee employment, but there's a look to work on here.

  57. Hey, no fair! by mrchaotica · · Score: 1

    All you British people get an advantage 'cause you'll recognize the Monty Python foot icon. Cheaters! : P

    [I mean that collectively, by the way -- I'm not saying that TangoCharlie is British]

    --

    "[Regarding the 'cloud,'] ownership was what made America different than Russia." -- Woz

    1. Re:Hey, no fair! by TangoCharlie · · Score: 1

      Well, as it happens, I am! (English to be more specific.)
      However, I browse with images switched off so I missed the foot! Duh!
      Also, as it happens, anyone who watches the Simpsons can't seriously
      believe that irony is lost on Americans!

      --
      return 0; }
    2. Re:Hey, no fair! by JustOK · · Score: 1

      The Simpsons are the most poignant and relevant reality tv show on the air!

      --
      rewriting history since 2109
  58. Re:Dupe by Anonymous Coward · · Score: 1

    Oh my $[DIETY] if I read this comment again I think I'm going to cry.

    Message from the Please Please Please get a life foundation: SLASHDOT IS NOT DIGG! Do not complain about articles getting cross posted. and GET A LIFE.

    -1 Flamebait here I come
    -1 Troll maybe

  59. Re:April Fool's Right???? by Anonymous Coward · · Score: 0

    "A sarcasm detector, that's a real useful invention."

  60. Pay no attention to good programming practices by suitepotato · · Score: 1

    Simple, easy, effective, it's standard in the industry by default, works a good percentage of the time as long as management is in one of those rock and hard place situations. If they are at ease and stupid, they will simply cut you and let someone else struggle to fix it later. Oops. Also standard in the industry by default.

    --
    If my grammar and spelling are off, I am [distracted/tired/careless] (take your pick)
  61. Re:April Fool's Right???? by P3NIS_CLEAVER · · Score: 0

    Its not very well written either. It is okay use single letter variable names, as long as they are used right where they are intialized. I do naming this way, the wider the variable is scoped, the more descriptive it's named. Pretty easy to figure out the difference between a class property and i.

    --
    Please sign petition to restore sanity to our banking system!!!

    http://financialpetition.org/
  62. They missed an obvious one by mustafap · · Score: 1


    Write it in assembler

    "I'm doing this for speed, man"

    Purists would do it in machine code. Assemblers are for wimps anyway.

    --
    Open Source Drum Kit, LPLC deve board - mjhdesigns.com
    1. Re:They missed an obvious one by imsabbel · · Score: 1

      Its there, under the "choice of language" section.

      --
      HI O WISE PRINCE. WHT TOOK U SO DAM LONG?
  63. Re:And Microsoft rule by ergo98 · · Score: 3, Insightful

    The kind of coder who deliberately writes bad code just to maintain their employment is always the first coder shown the door. Always. It is a complete urban myth that not commenting spaghetti code will keep you in a job. There is always someone else willing to do your job, no matter how specialized you think you may be.

    I am amazed that so many people don't realize that this was a joke. It's a joke people. Are all of these people replying seriously 16? I have to suspect so, because this was immediately identifiable as the same sort of joke that has been repeating for years and years - if you've been in the industry more than a year, if anything it sounded cliched.

    Having said that - there is some truth to the claims. The reality is that most programmers out there are terribly, terribly lazy, and they'll immediately declare as undecipherable any code that isn't written for a mentally handicapped pigeon. If you've ever developed code to solve a problem of any complexity at all (e.g. more than some sub-100 IQ CRUD type data forms), you've had it declared "spaghetti code" by someone else, and they've probably thrown up their hands and declared that the only solution is to rewrite it (I'm proud to say that I've had this said about some of my historical code. Not because it was written poorly, but rather because it wasn't just a lightweight, superficial wrapper around calls to library functions. Per the prior point, every lazy programmer would rather just write something new themselves than expend the effort understanding existing code). I've seen this in shops where the lazy, lazy, lazy developers always defer all decisions and judgements to the original programmer (and that original programmer is probably wishing they never had anything to do with it, wishing they stuck to implementing high-level scripts).

  64. Missing quote in the FA by xv4n · · Score: 1

    "My code was hard to write, it should be hard to read".

  65. Re:Dupe by Anonymous Coward · · Score: 5, Funny

    The joke's on you! Slashdot beat digg by 6 YEARS: How To Write Unmaintainable Code Posted by Hemos on Thu Nov 18, '99 10:32 PM
    Yeah... still a dupe.

  66. The Daily WTF by boa13 · · Score: 1

    Get your daily dose of unmaintainable code straight from the guys who were just tasked to maintain it! Alex Papadimoulis provides it at http://www.thedailywtf.com/. There hasn't been a week yet where I've not said "WTF?" looking at the incredible production code snippets (or screenshots) that despaired programmers around the world send to him.

    The best one, so far:

    enum Bool
    {
            True,
            False,
            FileNotFound
    };

    1. Re:The Daily WTF by Haeleth · · Score: 1

      Don't bother reading the comments, though. If you thought Slashdot was a mess of trolls and predictable in-jokes that stopped being funny five years ago, then TDWTF takes it to the next level.

      (And the real WTF is the forum software. [pi])

    2. Re:The Daily WTF by Anonymous Coward · · Score: 0

      That's actually understandable.

      It's attemption 'troolean'...
      Logically, something can be true, false, or "unknown".
      Sometimes things aren't true or false, and that enum accounts for it.
      Granted, there may be better ways and there may be misuses of that, but I wouldn't call it stupid.

    3. Re:The Daily WTF by Hognoxious · · Score: 2, Informative

      Since when has FileNotFound been synonymous with unknown? True or false can be an answer to any yes/no question (e.g. is the customer's credit card number valid?). Unknown can too, but FileNotFound can't. It might not be wrong per se to mix general and specific values in one variable like that, but I'd see it as evidence that the person writing it hadn't got his concepts right before coding.

      --
      Confucius say, "Find worm in apple - bad. Find half a worm - worse."
    4. Re:The Daily WTF by theTerribleRobbo · · Score: 1

      On top of that, depending on the compiler, True is defined as 0, and False is defined as 1. WTF?

  67. Have you not had your coffee yet?! by Whyzzi · · Score: 1

    Obviously a satirical article. Much akin to the satire contained in A Modern Proposal by Jonathan Swift (1729).

    --
    "BSD is about people pissing each other.." (Moid Vallat)
  68. Not bad... but I can do one better by thePowerOfGrayskull · · Score: 1

    Good (from TFA):
    openParen = (slash + asterix) / equals;
    Better:

    equals = minus + times - open_paren(max * divided_by + min) * modulus % close_paren(square) / log_base_e

  69. Re:April Fool's Right???? by cparisi · · Score: 1

    The big foot to the right of the story is a dead giveaway...

  70. Instructions! by decipher_saint · · Score: 3, Funny

    I don't need no instructions to know how to rock.

    --
    crazy dynamite monkey
    1. Re:Instructions! by Anonymous Coward · · Score: 0

      Wow, it's like that movie, the Matrix, but, instead of writing code, he's like, crapping.

  71. Re:April Fool's Right???? by Digital+Vomit · · Score: 1
    Sheesh! Irony, it's lost on Americans!!

    How ironic...

    --
    Modern copyright is theft of culture from everyone and it retards the progress of the useful arts and sciences.
  72. 1997 ... dupe from 1999 by oneiros27 · · Score: 4, Funny
    It even states it at the bottom of the page:
    An early version of this article appeared in Java Developers' Journal (volume 2 issue 6). I also spoke on this topic in 1997 November at the Colorado Summit Conference. It has been gradually growing ever since.
    And, let's not forget, it's technically a dupe ... it was posted on /. in 1999 ... by um... the exact same editor.
    --
    Build it, and they will come^Hplain.
    1. Re:1997 ... dupe from 1999 by Anonymous Coward · · Score: 0

      JESUS FUCKING CHRIST. News organizations rerun stories on slow news days all the damn time. Finding a "dupe" from 1999 is just petty. He phoned it in. Get over it.

  73. This is unmaintainable code... by Anonymous Coward · · Score: 0

    Kicking the staff out that do this always happens first. Unfortunately some poor bugger (ie me) has to sort it out.

    Here's a good example of a product I'm working on. I was taken on to clean it up and make it work properly... (C#)

    /* Not used anywhere */
    public DateTime CalculateShippingDate(String customerID, string cartID)
    {
    Random x = new Random();
    double myrandom = (double)x.Next(0,3);
    return DateTime.Now.AddDays(myrandom);
    }

    Not only is it not documented, but it has incorrect parameter types (yes those are both ints in the database), it RANDOMLY generates the shipping date, does a really dangerous conversion and it says its never used (which it is in 4 other locations). There is 2Mbytes of this shit!

    Just remember that the determined employee can get the home address of the culprit and beat his head in...

  74. required reading by Anonymous Coward · · Score: 0

    If I was a Computer Science professor, I would make that article required reading for my class. All programmers who never had to read other people's code have a lot to learn from reading it. Since I am not, I'll just require ever new employee to read this as part of their training.

  75. Re:April Fool's Right???? by beef+curtains · · Score: 1

    Please tell me which nation you hail from, so that I might hurl generalizations and stereotypes at you.

    Thank you.

    --
    Just once I'd like someone to call me 'Sir' without adding 'You're making a scene.'
  76. Re:April Fool's Right???? by absinthminded64 · · Score: 1

    NJ if I know where the meaningful discussion is supposed to come into play. Your guess is as good as mine!

    We generally offer a nice carboard box and the proverbial pink slip in reward for this kind of work. Code reviews are good for preventing this type of thing.

  77. Or, how to... by Anonymous Coward · · Score: 0

    Or, how to become the target of a geekhunt by angry nerds armed with Coke cans and wired mice.

  78. I 'm in this situation by digidave · · Score: 5, Interesting

    Right now I have to maintain an unmaintainable web app. Let's put it this way...

    - This app was originally written in PHP/FI 2.0 in 1997. There were also some C cgi apps and a few Perl scripts.

    - Due to performance problems the entire dynamic site was changed to a statically rendered site, so after changes were made to a page that page was rendered as an HTML file.

    - In 2000 it was updated to PHP 4 and the app had a core feature bolted on, essentially confusing the difference between a city and a county. This resulted in a worst DB design I've ever seen. I'm talking about splitting up core pieces of data that need to be together, using ambiguous field names (rid means different things in different tables. Some tables relate to each other on field names that seemingly have nothing in common. Some field names have typos, etc).

    - The code was written first by a team of six programmers, then by a smaller team of three other programmers and finally by some weird guy who I was supposed to work with when I got hired, but a few days before I started he decided he didn't like computers anymore and he went into the grow-op business instead. My boss claims that maintaining the horrible code base made him go crazy and I'm inclined to believe that.

    - Two records in the same table of the database may look the same in all ways, but they are actually entirely different things. The only way the app knows which one to use where is because that data's unique id is hard-coded into the app.

    - I am rewriting our site search engine from scratch because touching the old one is dangerous. Altering small harmless-looking bits of code can actually break unrelated pages, but that breakage isn't noticed until that other page is re-rendered into a new HTML page, so I was finding out about problems weeks after I caused them. Arrrg!

    - I have been unable to get the app working on any server I have setup. If the live server goes down we're toast because there is no dev box. The app relies on a horrific web of interconnected scripts, cron jobs, strange directories, and it even uses an older version of itself to perform some mysterious actions. I've got an image of the server's hard drive I can use to recover it from.

    I have finally convinced my boss that this thing needs to be rewritten *now*. It's a house of cards with our business resting on top.

    --
    The global economy is a great thing until you feel it locally.
    1. Re:I 'm in this situation by HikeFanatic · · Score: 2, Insightful

      Well spoken. As someone who's had the displeasure of having to work with unmaintainable code, it's not fun. In fact I threatened to quit unless they allowed me to write a large portion of the code base from scratch in order to make it scalable and more reliable.

      The article is somewhat amusing and does cover some interesting points that I've run into over the years. However, writing unmaintainable code just makes you even more likely to get fired.

      Unmaintainable code just leads to bugs that can't be fixed without bringing the rest of the system to its knees.

    2. Re:I 'm in this situation by asdfghjklqwertyuiop · · Score: 1

      it even uses an older version of itself to perform some mysterious actions.


      Use of recursion to ensure the unmaintainability of code... interesting technique.

    3. Re:I 'm in this situation by Generic+Guy · · Score: 1
      I have been unable to get the app working on any server I have setup. If the live server goes down we're toast because there is no dev box. The app relies on a horrific web of interconnected scripts, cron jobs, strange directories, and it even uses an older version of itself to perform some mysterious actions. I've got an image of the server's hard drive I can use to recover it from.

      I don't know if you get email responses. But I just wanted to say this is just about the most amusing piece I've read in the past week. Sorry about your bout, and thanks for the smile.

      --
      { - Generic Guy - }
    4. Re:I 'm in this situation by Anonymous Coward · · Score: 0

      You should check out the anti-patterns book:

      http://www.antipatterns.com/

      Has good tips (I think) on analyzing and categorizing the problems, and then strategies for dealing with them. Some of it might be obvious, but it is so reassuring to read about the same problems you are seeing with some practical advice on what to do next - I found it both therapeutic and entertaining.

      Looks like you have lots of spaghetti code, and a poltergeist thrown in for good measure. I'll bet some cut and paste code in there also.

      Good luck!

  79. Another good one (Re: *yawn*) by Geek+Dash+Boy · · Score: 4, Interesting

    Thankfully, the OP provides a link to the original author, Roedy Green.

    Here's another good article he wrote in the same vein called How to Code like a Newbie.

    I was in stitches the first time I read it several years ago.

    --
    I say we take off and nuke the entire site from orbit. It's the only way to be sure.
  80. J-O- by Run4yourlives · · Score: 1

    K-E

    Luser.

  81. Obfuscated C by BenjyD · · Score: 1

    I think I've seen most of the obfuscation techniques described so far in my career as a developer. The worst I've seen was code which did multiplication using a switch statement (switch (i){ case 1: n = 2; case 2: n = 4;...}) and used magic numbers *in hex* everywhere for no reason.

    1. Re:Obfuscated C by tendays · · Score: 1

      multiplication using a switch statement (switch (i){ case 1: n = 2; case 2: n = 4;...})

      I think you got it wrong, your code always stores 4 into n. A proper way to do multiplication is as follows:

      n=0;switch(i){case 4:n+=2; case 3:n+=2; case 2:n+=2; case 1:n+=2;} // this assumes i is positive and smaller than five of course.

    2. Re:Obfuscated C by Eli+Gottlieb · · Score: 1
      Or you can write a skip counting algorithm.


      c:= a;
      for i:= b - 1 downto 1 do
        c:= c + a;
  82. Bookmark this thread for future use so ... by Anonymous Coward · · Score: 0

    ... you can use it to help you filter any future posts from people who did not get the joke. Sheesh, we don't have a very bright lot online today, do we.

  83. nothing new by micromuncher · · Score: 1

    From working with code that's not maintainable... on projects that cannot possibly effectively be upgraded... its not a career path. I know this is satire, but there is no job security in obscurity. We are in a disposable work force. Some poor fool will come along and get crappy projects unloaded on them. They are the ones that will reap the benefit of figuring it out, and or re-writing it. So its really all about frustrating our colleagues.

    And the worst possible thing you can do is use the wrong technology or architecture for the solution to a problem. For example, make a 2-tier app into a 3-tier one, or using MOM to provide what you could do with simple database replication. Most of those problems are caused by inexperienced developers or overexperienced architects....

    But I must say, Roedy sure does write some ass pounding funny stuff.

    --
    /\/\icro/\/\uncher
  84. Re:April Fool's Right???? by RingDev · · Score: 1

    So true. In the consulting world, the faster/better you code, the sooner you are out of a job. If you don't have the social networking skills to keep contacts and jobs lined up, you may have to resort to the methods described in TFA. (shudder)

    -Rick

    --
    "Most people in the U.S. wouldn't know they live in a tyrannical state if it walked up and grabbed their junk." - MyFirs
  85. This is old by Deaths+Hand · · Score: 1

    This web page has been around for ages. The original version is at http://mindprod.com/jgloss/unmain.html and has been updated loads since. I remember reading this when I first started work after university, back in 1999. Still funny though.

    1. Re:This is old by jtorkbob · · Score: 1

      Yeah, I can't fathom that this hasn't been on /. before. Oh wait, it has...

      http://slashdot.org/article.pl?sid=99/11/17/214824 9&tid=133

      --
      AC: Only on slashdot... could the sentence "My hovercraft is full of eels." be moderated "+4, Insightful
  86. Old old old by po8 · · Score: 5, Informative

    Roedy Green's fine How To Write Unmaintainable Code has been widely cited all over the web since its original publication in 1997. Surely at least a mention of the author and date of the article could have made the front page, so that those of us who've already seen it multiple times could know to skip it?

    1. Re:Old old old by Jerf · · Score: 1

      It has been frequently updated. I visit it every few months (often showing co-workers or something) and it seems to be bigger each time.

      That said, it's probably approaching near completeness right about now (there are a finite number of ways of screwing up that actually occur, after that you're just being silly/stupid), so it's a good time to post it.

      And I don't know if you've noticed, but those Slashdot UIDs keep going up and up... we're in at least the mid-nine-hundred-thousands now. Presumably some significant proportion of those are true new people.

  87. Anyone ever found well maintained code? by stuckinarut · · Score: 1

    I'm still waiting for the first day of a new job not to consist of utter terror as you begin to pick through the previous employee's code. I've yet to find anything that's half readable.

    I'd like to think that all my old code was a welcome sight to my replacement but they're probably thinking exactly the same thing of me.

    Coding conventions and naming schemes are excellent to minimise variations but everyone still has they're own style that makes code other than your own much less easy to read.

  88. How about dc? by ion_ · · Score: 3, Funny

    [l:l;s<s=0l>x]s"[1+l<dd*l=d*-l;+ds<rl=2**l:+ds=d
    *rd*+4<-d15>>]s>[q]s-[d77/3*2-s;47l"x-P1+d78>`]9
    ks`0[d23/.5-3*s:0l`xr10P1+d24>$]ds$x

    1. Re:How about dc? by tendays · · Score: 2

      Behold my shell script for generating random passwords.

      How's that for clean readable code?

      It does look like it contains a hardcoded password but it really is a dc script :-)

      k=
      while [ "$k" != '********' ] ; do
          echo $RANDOM '[48+aPq]sa[55+aPq]sb62%d10>ad36>b61+aP' | dc
          k=*$k
      done

    2. Re:How about dc? by rcamera · · Score: 1

      nice... -------- home/rcamera/tmp> ./tmp.sh stack empty 141 is unimplemented stack empty 141 is unimplemented stack empty 141 is unimplemented stack empty 141 is unimplemented stack empty 141 is unimplemented stack empty 141 is unimplemented stack empty 141 is unimplemented stack empty 141 is unimplemented /home/rcamera/tmp> --------

      --
      Wave upon wave of demented avengers March cheerfully out of obscurity into the dream
    3. Re:How about dc? by phre4k · · Score: 1

      Reminds me on a sed script from http://www.kernelthread.com/hanoi/

      (I tried to paste it, but it contained too many juck characters) http://www.kernelthread.com/hanoi/html/sed.html

      Apparently it solves the towers of hanoi problem. Pretty impressesive. I have no idea how any human can keep track of all that noise.

      --
      "Nobody really checks their email any more. They just delete their spam"
    4. Re:How about dc? by kernel_dan · · Score: 1

      you're supposed to run it from the shell, and it pipes data to dc

      --

      Illegal? Samir, This is America.
    5. Re:How about dc? by rcamera · · Score: 1

      'tmp.sh' was a copy/paste job (i admit, i prepended '#!/bin/sh') of the posted script which DOES pipe to dc.

      --
      Wave upon wave of demented avengers March cheerfully out of obscurity into the dream
    6. Re:How about dc? by tendays · · Score: 1

      I suspect your version of dc is too old (I have dc 1.3 and that code works fine for me)

      141 is unimplemented: 141 is the 'a' command that converts a number into a character.

  89. Re:April Fool's Right???? by TangoCharlie · · Score: 1

    I am English, old chap. Please feel free to generalise all you like!

    --
    return 0; }
  90. Be afraid... be very afraid. by Anonymous Coward · · Score: 0

    My God! The last time this many people didn't get a joke I think a war ensued.

    ITS A JOKE PEOPLE, LAUGH!

    (Comedian begins:)
    Two men walked into a bar...

    (and the slashdot response:)
    Did they walk in single-file or side-by-side?
    How did they walk into a cylindrical object? That doesn't make sense
    Microsoft sucks!
    They wouldn't have had to if they'd used Open Source.

  91. Refactoring... by Ungrounded+Lightning · · Score: 1

    Back in 1969 I called it "ironing".

    The particular refactoring I was doing was regenerating the source of an OS from a distant predecessor's listing plus the object, in order to resurrect a broken piece of its functionality (the batch processor).

    During that I "ironed" the later patches into consistency with the overall structure, then augmented the API in roughly the same style (creating a larger overall consistency) to support replacements for subroutines written during the no-source period that had modified OS code in fixed locations. Once that was done I had a source I could modify without breaking things, and could fix or add functionality at will.

    Back in those days an OS was small enough that one research assistant COULD do something like that in just a couple months.

    --
    Bantam Dominique roosters crow a four-note song. Once you've heard it as "Happy BIRTHday" you can't NOT hear it that way
  92. Unicode is your friend by Pang+Mao · · Score: 1

    Roedy's a Java programmer, he missed a really obvious one (or else I missed it in the FA) - use Unicode to give your variables names using glyphs that the other programmers don't understand: Of course if they know Chinese, pick something else like Devanagari, unless they know that... try right-to-left glyphs, etc.

  93. Re:Until you get promoted ... by rewinn · · Score: 4, Interesting

    ... for enforcing the Corporate Coding Standards.

    In a rational world, Corporate Coding Standards, enforced by code reviews, would have something to do with maintanability. In some organizations, they are ... probably those that live or die by the quality & maintainability of their code.

    But quite the opposite was true in the large insurance company (nearly 1000 programmers alone) where I held my last salaried programming gig. Their Coding Standards were all about Not Rocking The Boat. They included several elements of "How To Write Unmaintainable Code" as Enforcable Standards. Remember when "Structured Programming" was a new idea? I got me bottom kicked for arguing that coding units should not end with a wholly unnecessary "Go To End" ... because the STANDARD was that ALL modules exits were via "Go To End".

    Fortunately, their coding quality algorithm had to do with number of lines of code changed ... again, nothing to do with actual quality. Deleting redundant code merely enabled me and the software to work faster & better, which did not count as quality. When I learned to comment out redundant line, so they counted as "lines changed", my coding quality scores vastly improved!

    Perhaps the insurance industry is so darn profitable that optimizing its software is not nearly as important as maintaining internal discipline. The ideal employee was the scion of two current employees who had met in the cafeteria, and was engaged to another employee who they'd met the same way (I Kid You Not!) If these programming methods imposed excessive costs, they just upped their premiums.

    It was a soul-destroying experience.

  94. This is not news by arantius · · Score: 1

    This page: http://mindprod.com/jgloss/unmain.html
    Says: ©1996-2005 Canadian Mind Products

    Not to mention being much more comprehensive.

    --
    Health is simply dying at the slowest rate possible.
  95. Re:April Fool's Right???? by thesnarky1 · · Score: 1

    Yea, it's a joke.

    And I must say, I got quite a few good laughs out of it. My favorite is the Obscure Film References. If I said I wasn't gonna try that in my CS homework, I'd be lieing. (Hey, if the teacher writes poor code, I can write poor code. They don't read it, only make sure it compiles).

  96. From TFA: by killermookie · · Score: 1

    marypoppins = (superman + starship) / god;

    That would explain the flying bed and communicating with sea animals.

    1. Re:From TFA: by MikeyToo · · Score: 1

      You're confusing "Mary Poppins" with "Bedknobs and Broomsticks" methinks.

      --
      "Well Ranger Brad, I'm a scientist. I don't believe in anything." - Dr. Roger Fleming
    2. Re:From TFA: by killermookie · · Score: 1

      Ah, yes. Replace sea creatures with dancing lambs.

  97. Amazing... by Alpha_Traveller · · Score: 0, Offtopic

    This article is exactly like "How to Talk to a Liberal", but in code!

    --
    "Love is like pi - natural, irrational, and very important." (Lisa Hoffman)
    1. Re:Amazing... by hawkeye · · Score: 1

      My favorite quote regarding the book in your post is:

      "If you aspire to be the sycophantic idiot who used to follow the school bully around, a noble calling if ever there was one, this book is for you. When engaged in theoretical debate with liberals, it will supply you with endless gems that you can use to make yourself appear more intelligent than you really are."

      Cheers,

      - hawkeye

      --
      "...The smart and lazy ones I make my commanders." - Erwin Rommel
  98. Oh yeah! by EvilMonkeySlayer · · Score: 1

    This is my new bible.
    Say hello to code that only I can understand, lets see how much my boss wants to offshore me now!

    1. Re:Oh yeah! by mabu · · Score: 1

      "Oh yea"

      If you think those tactics are worthwhile, you're fooling yourself. We live in a world now where it's more economical to replace things entirely, rather than upgrade or maintain them, including code, and your mediocre job.

      My advice to you is to check out how you look in a smart neon blue vest with a name tag. It'll be your next uniform the way you're going.

    2. Re:Oh yeah! by Anonymous Coward · · Score: 0

      I see you failed to see the obvious joke, well done.

  99. Can come back to bite you... by DreadfulGrape · · Score: 2, Insightful

    While I thought at one time that this was a good idea, actually if you choose to leave your coding job it can be a pain. My successor called me on the phone for almost 6 months asking "What does this do - what does this mean..." etc. until I finally had tell him "Man, I just don't remember anymore. Sorry!"

    --
    sig has been sent away for a few small repairs...
  100. Unmaintainable employee by wuice · · Score: 4, Insightful

    I know this article is somewhat tongue-in-cheek but it's actually a prevelant mentality. As someone who have watched people write unmaintainable code to ensure their own job security...

    If the code is unmaintainable, the end product is probably bad. If the end product is bad, you're not protecting your job but making a case for your worthlessness. Even if the end product is good, most companies would favor a fresh, new person who can differentiate themselves from you by writing a more friendly, maintainable version of the same. When I have come in (back in my indie days) to update or maintain a system that is unmaintainable, I have always made a good case for a more ambitious bid (and more money) to recreate the system from scratch (or recreate as much of it as is necessary) in a more standard, maintainable format.

    Besides, as all you open source geeks know, this is (job) security by obscurity, and while it may cause a major inconvienence for your employer, it's not going to force them to keep someone they want to can. IT kids are in for a rude awakening (or have already gotten one) if they think we're still in the era where you're irreplacable, where some other code monkey couldn't come in and do the same or better of a job of what you're doing for less money in a heartbeat.

    Here's a hint, find a place that you actually ENJOY working for, that treats their employees well and isn't looking to pull the plug on them at the most convienent time.. And then give them the best work you can offer. Be willing to take the lumps as a line employee for a while and actually earn a career in that company.

  101. This is why Open Source is better by Anonymous Coward · · Score: 0

    There are far too many crappy coders doing this. In open source, the project simply dies off. Natural selection weeds out the crap code in open source.

  102. Wow by tgd · · Score: 4, Funny

    You must've been the plumber for the house I just bought.

    Bastard.

  103. Favorite Quote by keithmo · · Score: 1
    Hungarian Notation is the tactical nuclear weapon of source code obfuscation techniques; use it!

    Hungarian is a great idea, but it doesn't go far enough. Function names should encode the return type and the type of each parameter. For example, a simple:

    int main( int argc, char * argv[] );

    Becomes the much more readable and instantly understandable:

    int imaincapsz( int cArgs, char * apszArgs[] );

    Of course, this is C, and arguments are typically pushed on the stack in reverse order. If you use a low-level symbolic debugger (not one of these new-fangled IDEs), you can save yourself a few debugging headaches by reversing the order of argument types. In other words:

    int imainapszc( int cArgs, char * apszArgs[] );

    Now, when you see imainapszc in a stack trace, it will be trivial to decode the functions parameters.

    </sarcasm>

  104. Meta application of these rules in real life: by NecrosisLabs · · Score: 4, Funny
    A couple years ago, I showed these rules to another developer. We had a good chuckle, particularly about
    Misleading names
    Make sure that every method does a little bit more (or less) than its name suggests. As a simple example, a method named isValid(x) should as a side effect convert x to binary and store the result in a database.

    The next day we had a meeting to examine a legacy application that we were going to be re-writing. Another dev was discussing the DataLoad method. Which loaded a flat CSV file.

    And validated the data

    And stored the result in a database.

    It is very hard to look professional in a meeting when your face is beet red and your eyes are screwed up tight to keep from breaking out it gales of laughter.
    1. Re:Meta application of these rules in real life: by Karma+Farmer · · Score: 1

      Another dev was discussing the DataLoad method. Which loaded a flat CSV file... And validated the data... And stored the result in a database.

      In my experience, that kind of code is usually called from the constructor of a class called "HashTable".

      That constructor will also store an open database connection in an untyped global variable.

      The "Encrypt()" method in an unrelated class will use the database connection, close it, open a file, and leave the handle in the same global variable.

      The file handle will be used elsewhere, and only close on program exit.

      The above described methods will be executed from conditional statements in two two different scopes, based on values in a database table.

      The order the rows are returned from the database table will depend on a database index.

      I really wish I was joking.

    2. Re:Meta application of these rules in real life: by yerM)M · · Score: 1
    3. Re:Meta application of these rules in real life: by Raphael · · Score: 1

      A day after re-reading this essay on unmaintainable code, I was hit by a nice example of what is described as "Code That Masquerades As Comments and Vice Versa" in the chapter "Camouflage". Here is the code (sorry for the missing indentation - blame Slashdot):

      <%
      String submit = request.getParameter("submit");
      // if (submit == null) {
      // /* if the user did not confirm, go to the exit page */
      // %><jsp:forward page="./SomeExitPage.jsp" /><%
      // }
      do.something(useful);
      %>

      Guess what? The scope of the "//" comments is probably not what you expect. I have written a blog entry about this funny case.

      --
      -Raphaël
  105. Bad, BAD Advice! by Roofus · · Score: 4, Insightful

    Make sure you're irreplaceable

    First rule of business: Don't be irreplaceable. If you can't be replaced, you can't be promoted!

    1. Re:Bad, BAD Advice! by JTek · · Score: 1

      First rule of business: Don't be irreplaceable. If you can't be replaced, you can't be promoted!

      ...or go on extended vacation. I'm currently in the process of training another programmer to be my backup so I can take a few weeks off.

    2. Re:Bad, BAD Advice! by MoogMan · · Score: 1

      Funny. I thought the first rule of business was: Get a job.

    3. Re:Bad, BAD Advice! by erichill · · Score: 1
      Make sure you're irreplaceable

      First rule of business: Don't be irreplaceable. If you can't be replaced, you can't be promoted!

      Another rule of thumb I've run into essentially says that, "An employess you can't afford to lose is an employee you can't afford to have."

      --
      Credo sim. - I think I am.
    4. Re:Bad, BAD Advice! by Procyon101 · · Score: 1

      Who wants to be promoted from programmer? Think of what's above that:

      Dev Lead -- Show up at 7am instead of 10am and get blamed for everyone's mistakes instead of your own for a measily 10% pay raise.

      CTO -- Get blamed for everything that goes wrong in the company on the technology end. Show up at 6 or 7am every day and spend 12 hours a day in meetings.

      No thanks.

    5. Re:Bad, BAD Advice! by JuggleGeek · · Score: 1
      The Mack Truck theory explains that any employee from the CEO down must be replaceable. Your company must be able to survive if they don't show up tomorrow, because they may be hit by a Mack truck.

      A related theory is "The Irreplaceable Man". If you can't replace him, then the theory says you need to find him and fire him. Because if you don't, he has your company by the balls, if he chooses to squeeze, and he's putting you at serious risk of dying off due to the Mack Truck theory.

    6. Re:Bad, BAD Advice! by Anonymous Coward · · Score: 0

      You forgot middle management. That's where both your employees and your superiors yell at you for everything they need and you're stuck screwing the little guy any time there's a conflict. Especially when it comes to underpaid, overworked salary requirements.

  106. I don't know what's worse..... by ShyGuy91284 · · Score: 1

    The fact that there are probably actually a few people following this guide, or the fact that someone typed up something that long and "pointless"........

    --
    In undeveloped countries, the consumer controls the market. In capitalist America, the market controls you.
  107. I've seen this over and over by Anonymous Coward · · Score: 1, Informative

    In my 20+ years as a programmer, I've seen this over and over. And yes, those who program like this are more likely to retain their jobs when layoffs come. I've seen code that I was able to re-write in 200 lines stretched to 5000 (no joke). I've seen sleep statements stuck in tight loops so during a crucial moment the programmer can show significant speed-ups. I can't tell you how many times I've seen 50,000 line programs without a single comment. I had a boss once who ordered us to not use comments to protect the group I was working in (no joke). But here's the rub: IN EVERY SUCH CASE NO ONE IN SENIOR MANAGEMENT WAS THEMSELVES A PROGRAMMER.

  108. Re:Until you get promoted ... by Hognoxious · · Score: 1

    I worked at exactly the same place, but it wasn't an insurance company.

    --
    Confucius say, "Find worm in apple - bad. Find half a worm - worse."
  109. Hey, we're talking about Java here by Anonymous Coward · · Score: 0

    No need to even try, just code in Java any way you want. It's impossible to maintain this load of crap.

  110. Ethical Development by Anonymous Coward · · Score: 0

    This post sickens me.

  111. Re:Still people try it by LordWill · · Score: 3, Interesting

    My niece's boyfriend seemed to think he could get security like this by being the only network guy to know the passwords to the company's routers.

    I had to point out that if he had a boss who would not know why such a situation shouldn't exist would probably also not know why the network guy shouldn't be laid off.

  112. Fireable offence by GeckoX · · Score: 1

    We fire people for writing code that way.

    You see code like that, and the programmer responsible is either a) incompetent or b) too smart for their own good. Either way, they need to be replaced ASAP.

    I'd rather have 3 run of the mill programmers that write clean well documented simple code that does the job than have one single uber programmer that always gets the job done, but nobody can figure out how, or what to do with it in the future. There is no question here.

    If you were EVER taught that code obscurity == job security, you need to go have a very serious chat with whomever taught that to you.

    --
    No Comment.
  113. PL/I is great for unmaintanble code by Rick+Genter · · Score: 2, Funny
    From a language processor I worked on eons ago; I use it as an example of what's "great (:-/)" about PL/I:
    IF IF = THEN THEN THEN = ELSE ELSE ELSE = IF;
    Yes, it compiles (if IF, THEN and ELSE have the appropriate types).

    And how can you not love a language that has a data type for Pounds Sterling?
    --
    Don't underestimate the power of The Source
  114. COBOL self-documenting. Maybe not by AppyPappy · · Score: 1

    I worked for an S&L data bank and we bought some ATM software from a company from India. The mainframe part was all in COBOL. We insisted and paid extra for the source code. We got the source and found all the variable names were esoteric (WA1, WA2, XB4, etc). When we complained, they offered to sell us the book that contained all the definitions of the variable names.

    They gave us a free Star Trek game with the book so it wasn't a total loss.

    --

    If you aren't part of the solution, there is good money to be made prolonging the problem

    1. Re:COBOL self-documenting. Maybe not by AdamWeeden · · Score: 1

      They gave us a free Star Trek game with the book so it wasn't a total loss.

      Yeah at least you got an ATM cource code manual!

      --
      I was quoted out of context in my autobiography...
    2. Re:COBOL self-documenting. Maybe not by Shano · · Score: 1

      Sadly, this is standard practice in COBOL. I was taught (but never used) a very long-winded and tedious way of designing COBOL programs, largely designed to overcome the complete lack of structure in the language itself.

      The good news: sensible variable names were allowed. The bad news: program labels were all of the form P100, P200, and so on (I can't remember the prefix we actually used). You'd need to go back to the paper design documents to figure out what any of it meant.

      Aside from being a truly awful language from a theoretical perspective, COBOL has spawned some horrendous design methodologies.

    3. Re:COBOL self-documenting. Maybe not by DavidTC · · Score: 1
      That design methodolgy makes sense only when you realize hw stupid COBOL is.

      Problem: Every part of the language is too wordy in COBOL.

      Solution: Shorten the only thing you can control, variable names.

      If COBOL programmers had to type:

      ACCEPT InterestRate
      CALL "MultiplyNums" USING BY CONTENT InterestRate, TotalBalance
      DISPLAY "Interest due is " InterestDue

      CalculateInterest.
      MULTIPLY InterestRate BY TotalBalance GIVING InterestDue.

      they'd haul off and kill someone. Possibly themselves. Hence using short variable names.

      --
      If corporations are people, aren't stockholders guilty of slavery?
  115. Obfuscation by kcarlin · · Score: 2, Funny

    True story, ca. 1977. A manager takes over the development group for Administrative Services at a major university. Inheriting essentially a COBOL shop, there is one clever fellow maintaining an essential enterprise application written in something called autocoder (described to me as a technological precursor to assembly language that didn't really resemble a functionally oriented programming language or much else anyone but an historian or fellow dinosaur might be familiar). Having a safe niche in an obscure language, he coded all of the variable names as a sequence of zeroes and O's and kept a data dictionary in a notepad that he kept on his person.

    The new manager came in and Mr. Zero was summarily given a quick bum's rush. Mom never wasted much time on such things.

    --
    Free Adam Smith! (Or best offer.)
  116. Re:April Fool's Right???? by NickFitz · · Score: 1

    The article is obviously meant to address people who think this way

    Actually, the article is obviously a joke.

    In fact it's a joke stolen from Roedy Green; the original starts with the words, "This is my most popular essay. It is amazing how many people don't realize it is tongue in cheek."

    (And, as others have pointed out, it's a dupe.)

    --
    Using HTML in email is like putting sound effects on your phone calls. Just say <strong>no</strong>.
  117. Re:Lifetime aint always that long by vertinox · · Score: 4, Informative

    Our company's main system is written in FoxPro for DOS 2.6. The FP programmers here seem to have guaranteed lifetime employment :-)

    I worked for a rather large ISP who in the process up and switched from a rather large home grown custom database program it had used for years to the corporate Vantive which cost them millions at the time.

    I asked my manager why would they bother doing such a thing when the old program worked just fine. He said "The guy who made the program died and know one knows how to code for it."

    I laughed for a moment and then by his blank face realized he wasn't joking...

    --
    "I am the king of the Romans, and am superior to rules of grammar!"
    -Sigismund, Holy Roman Emperor (1368-1437)
  118. More than just a joke... it's a teaching tool by SeanDuggan · · Score: 3, Insightful
    I had a professor assign this essay as required reading for our Computer Science class. While none of us (hopefully) are deliberately employing the tricks and techniques in there, I'll bet every one of us can look through there and find one thing that we've been guilty of doing whether it was inane variable names, inaccurate comments, or bizarre variable scope issues. By reading through, it forces you to confront your laundry list of faults and decide which ones need to be fixed.

    And as for the maintainer interpretting it, you're absolutely right that most people just throw up their hands. It's hard to interpret someone else's code for anything past the trivial. Doable, but hard enough that rewriting it often is a good way. Heh, besides which, it's amazing how many times I've thrown up my hands, rewritten the code, and by the experience found that I understood the original code.

    --
    This sig has absolutely no significance and serves only to take up screen space and waste the time of the reader.
  119. Irreplaceable? by Lijemo · · Score: 1

    Irreplacable? More like extinct.

    Most likely outcome is they fire you and the boss that let you get away with this, scrap your code, and hire someone else to re-write it from scratch in a maintainable way.

    This "joke" is a dinosaur, thirty years out of date. In the 70's there might have been some truth to it, but "maintainability" is now a mainstream concept not just among developers, but in management circles as well.

    This was a humorous joke once, but now it's at least a decade past it's expiration date.

  120. so.... by recharged95 · · Score: 1
    Hence, creating code is that's maintainable is soley for one reason:

    So the next guy can understand it.

    Since work (a la free market society) is a competitive environment, is that counter-productive for one's gain? It's like you write great code for Microsoft Office 12, get laid off, then the next guy finishes it up and gets the credit for the smashing success of the product...

  121. Chrge them! by Anonymous Coward · · Score: 0

    "My successor called me on the phone for almost 6 months asking"...

    They stop calling you when you start charging them for every phone call! Make sure it's worth the hassle!

  122. Chester Abramowitz COBOL Savant by gelfling · · Score: 2, Funny

    Once worked with a high functioning austistic named Chester (Cheddy) Abramowitz who typically coded COBOL as a monothlithic bloc from col 6-80 with no spaces, breaks, indents or lines. Moreover his dataset names were things like MASTER.BATE

    It kept him employed.

  123. Forth beats all by Anonymous Coward · · Score: 0

    That's why someone wrote FreeBSD boot loader in Forth...?

    forth code for a PPM image of the Mandelbrot Set

    fvariable ci fvariable c fvariable zi fvariable z
    : >2? z f@ fdup f* zi f@ fdup f* f+ 4.0e f> ;
    : nextr z f@ fdup f* zi f@ fdup f* f- c f@ f+ ;
    : nexti z f@ zi f@ f* 2.0e f* ci f@ f+ ;
    : pixel c f! ci f! 0e z f! 0e zi f! 150 50 do nextr nexti zi f! z f! >2? if i
    unloop exit then loop 0 ;
    : left->right -1.5e 400 0 do fover fover pixel emit 0.005e f+ loop fdrop ; : top->bottom -1e 400 0 do left->right 0.005e f+ loop fdrop ; .( P5) cr .( 400 400) cr .( 255) cr top->bottom bye

  124. Re:And Microsoft rule by Rimbo · · Score: 1

    You speak as if this laziness is a bad thing.

  125. Uh, Y2k? by egrass · · Score: 0

    No examples of this?

    How about all the old programmers brought back to deal with Y2k? I know the Y2k disaster was a bust, but it put a lot of old programmers back to work.

  126. Really? by Anonymous Coward · · Score: 0

    Assuming this is tongue-in-cheek

    Ya think? What gave it away, the winking smilie in the subtitle?

  127. Re:April Fool's Right???? by DurendalMac · · Score: 1

    Sheesh, it seems that nobody in this whole article has made a reference to Microsoft yet. What the hell, Slashdot? Don't let me lose faith in you!

  128. Along similar lines... by NormalVisual · · Score: 1, Funny

    Not 100% on-topic, but this article brings to mind this little jewel I found online some years ago:

    12 Things A Klingon Programmer Would Say:

    12. Specifications are for the weak and timid!

    11. This machine is a piece of GAGH! I need dual Pentium processors if I am to do battle with this code!

    10. You cannot really appreciate Dilbert unless you've read it in the original Klingon.

    9. Indentation?! -- I will show you how to indent when I indent your skull!

    8. What is this talk of 'release'? Klingons do not make software' releases'. Our software 'escapes' leaving a bloody trail of designers and quality assurance people in its wake.

    7. Klingon function calls do not have 'parameters' -- they have 'arguments' -- and they ALWAYS WIN THEM.

    6. Debugging? Klingons do not debug. Our software does not coddle the weak.

    5. I have challenged the entire quality assurance team to a bat'leth contest. They will not concern us again.

    4. A TRUE Klingon Warrior does not comment his code!

    3. By filing this SPR you have challenged the honor of my family. Prepare to die!

    2. You question the worthiness of my code? I should kill you where you stand!

    1. Our users will know fear and cower before our software. Ship it! Ship it, and let them flee like the dogs they are!

    --
    Please stand clear of the doors, por favor mantenganse alejado de las puertas
  129. LightWave, explained!!!! by Anonymous Coward · · Score: 0

    of all the excuses for the bugs in that software, this explains the most.

  130. I'm with you.... by Belial6 · · Score: 2, Informative

    I always try to write code with a bus in mind. No, not a data bus, but a big steel diesel passanger carrying bus. The question is what happens if I get hit by a bus tomorrow. The company that I am currently contracting to, started at needing ~12 a month of work. After a few applications that even their least talented coders could make modification to, I am now at a steady 40 to 50 hours of work a week.

    Another benefit of coding to for a bus is that after a couple of successes, the people you work for will soon start to just take your word for it when you tell them that you should spend more time on a piece of code because it needs to be done right.

    I was the 4th or 5th contractor they had for this job, and each of the others lasted long enough for one to two applications before things started to fall apart. I am 6 years into this contract, and on application 17 or 18.

    Integrity has been very profitable for me.

  131. It's no joke, alas. by LoneWolfiNTj · · Score: 1

    I swear, this article must have been the source of inspiration,
    the bible, the standard-operating-principles manual, of the
    former chief programmer here where I work. He thought he was
    making himself irreplaceable by coding according to those
    standards. He thought wrong! His code was so un-maintainable
    that even HE couldn't maintain it, so the bugs piled up, and
    he eventually got fired.

    Which means, unfortunately, that I get to disentangle his code,
    which is proving to be quite challenging.

    I wonder how many programmers out there actually do program
    that way on purpose? I suspect a lot. The idea of (supposedly)
    insuring one's job security by making one's code impossible to
    understand is alluring. But ultimately disastrous.

    --
    Cheers, Robbie Hatley
  132. Code by certel · · Score: 1

    I think everyone at Microsoft has been given the ability to write unmanageable code. Everyone can learn from them. :)

  133. Works for a while by ebvwfbw · · Score: 1

    Works for a while then they hire 100 Chinese (or 25 Indian) programmers to rewrite your whole application. They also put in features you never thought of. As a bonus they might even through in flight simulator with a hotkey.

  134. Re:April Fool's Right???? by greylouser · · Score: 1

    I think we're supposed to take this with a certain amount of salt. I don't see any reason why I should have to consume salt while reading your post. Salt has been linked to a number of serious health problems, including hypertension, osteoporosis, and stomach cancer. In fact, I find it disgusting that you're encouraging me to damage my health simply because I didn't get the (completely immature and childish in my opinion) irony of the story. Sickening.

  135. Java obfustication tip ... Passive/Agressivness by Jboy_24 · · Score: 2, Interesting

    When writing a method that will do_something. Ask yourself, is this really the place to do that? Maybe you're being a little too forceful to do it right there?

    Perhaps you should create an interface (make it an inner interface to a public static inner class, yes its possible).
    Make sure you use a common naming convention so you can look up the class using Reflection.
    Then once you get your class, make sure you use another factory to get the class you feel comfortable to finally do something.

    Finally, put your "do_something" code in the constructor of the class.

    When your code base becomes 1,000,000 lines of this, you'll achieve the final Zen obfustication moment, when a new director of engineering asks you to document this and you can say, with a straight face, and in total honesty, "Its too complex to document"

    1. Re:Java obfustication tip ... Passive/Agressivness by Erik+Hollensbe · · Score: 1

      In INTERCAL, you just say "PLEASE".

  136. Easy! by sammcj2000 · · Score: 0

    Write it on a mac!

  137. Re:And Microsoft rule by gmack · · Score: 1

    Advising that you do it on purpose is the joke but the examples seem like things I've seen programmers do by accident. It's usually a sign of incompetance rather than an attempt at job security.

    I'm proud to say that people don't complain about my code being unmaintainable even though my current project is a series of daemons written in C that direct network traffic for our backend comms system.(yes I'm being cryptic.. stupid NDA) Thanks to the fact that I nicely sort the hard parts into functions that everyone else users the less experianced programmers have no trouble adding on to my system.

  138. It seems like a joke... by Flyboy+Connor · · Score: 3, Interesting
    Such bad code actually exists.

    For five years I worked for a boss who was in the habit of taking jobs that nobody else wanted. The good thing was that he would get paid a lot. The bad thing was that I had to dabble in unmaintainable code. At one time I even had to make changes in a program for which no source code existed anymore. That was not the worst job, though. The worst was a change I had to make to a program that had the simple task of printing a list of articles in stock, with their locations. It printed the articles in two columns: the left column contained articles of types 1 and 2, and the right column contained articles of types 3 to 9. I had to change the program so that it would print three columns: left column the same, but the right column split into types 3 and 4, and 5 to 9. Does not sound too difficult, right? I mean, even without looking at the code, purely knowing the function of this program makes you think "that should been done in no more than 2 hours."

    It took me two weeks. The program was peppered with functions that were copies of other functions with a very small change. The original programmer used ridiculous methods to fill print lines. The general way of printing a line is collecting information through a central function, and when that function has all the information it needs, print the line. In this case at dozens of points in the program the programmer tried to predict whether or not he would have enough information to print a line, and then do it. If I would have a design document, I would have rewritten the program from scratch, but of course no such document existed.

    Every little change I made to the program had unforeseen effects. When I started, I had (of course) made a test-print, which I could use to compare outputs. I made a small change, and suddenly the list contained less articles than the original list. Another small change, and suddenly the list contained more articles than the original list. I tried to assess what reasoning the program would use to include or exclude articles, but there was no way to determine that from the code.

    After two weeks of work the program printed three nice columns, with all the original articles there, and a few, very few, that were not on the original list. I could not understand why these extra articles were there, but if they should not be there, I thought it would be best if I would just implement a condition to exclude them, if I would know what that condition should be. So I called the company who used the programs and asked them about these extra articles. Their answer was, "My God, we have been missing those for YEARS. Now we'll finally be able to find them again."

  139. Custom measurement units by Rick+Genter · · Score: 1

    From TFA: "If you are feeling particularly malicious, make up your own unit of measure; name it after yourself or some obscure person and never define it. If somebody challenges you, tell them you did so that you could use integer rather than floating point arithmetic."

    I've seen this! I actually worked on code (I won't say what or where to protect the guilty) where the author defined all sorts of angular measurements and corresponding functions in units named after himself. The unit turned out to be something like 1/4096 of a radian, just so that it could use integer rather than floating point arithmetic.

    The sad part: after working on that code long enough, I could actually think in those units :-(.

    --
    Don't underestimate the power of The Source
    1. Re:Custom measurement units by Bassman59 · · Score: 1
      I've seen something similar, too. I had to fix some embedded (8051) code that ran a simple PID loop for a temperature controller. The hardware was simple -- a refrigerator did the cooling, and a small heating element was controlled in order to keep things at the proper temperature. Here's what the Original Programmer did. He modeled the whole thing in Matlab/Simulink. In his 8051, a timer interrupt was set up, and every time the timer ISR was called. In that ISR, he read an ADC to obtain the current temperature sample. He converted the 12-bit ADC value into the actual temperature, in degrees Celsius, and in floating point, too. His PID loop was then updated, and the loop's output was a floating-point number representing the amount of power (in watts) to the heater, which had to be converted to a 12-bit value to drive a DAC. Again, he did (or tried to, at any rate) all of that in the ISR.

      The first problem was that his program hung in the timer ISR. Yep, kids, the floating-point routines are not re-entrant, so they couldn't be used in the ISR. It took him a while to figure this out. His solution was to rescale everything and do the PID loop calculations in 32-bit fixed-point arithmetic. (On an 8-bit processor still ...) Of course his conversion routines and such were non obvious and commented poorly.

      It still didn't work all that well. A host PC communicated to the temperature controller over an 9600 bps RS232 link. The problem was that the communication didn't work all that well. He blamed "bad cables" and "noise in the system" and such. Turns out that he was spending so much time in the timer ISR that the micro was missing serial-port interrupts and basically dropping the received characters on the floor.

      My fixes should be obvious: I remodelled the loop in units of ADUs (ADC units, or LSBs) and so I never needed to convert from bits to temperature or from watts to bits. Second, all the ISR did was to set a flag indicating that the timer tick had occurred. The serial receive interrupt simply saved the incoming character and set a different flag. The program main() simply looped and tested the two flags; if it saw the timer tick had occurred, it then did the loop calculation and updated the heaters.

      The Original Programmer had a PhD in control systems and apparently knew his stuff, but he was worthless as either a hardware engineer or an embedded programmer.

  140. Re:And Microsoft rule by ergo98 · · Score: 1

    Advising that you do it on purpose is the joke but the examples seem like things I've seen programmers do by accident. It's usually a sign of incompetance rather than an attempt at job security.

    Yes - that's the whole foundation of the joke.

    I'm proud to say that people don't complain about my code being unmaintainable... Thanks to the fact that I nicely sort the hard parts into functions that everyone else uses

    Then they aren't maintaining your code - they're using the API. Good for you, and that's pretty much the norm. However someone in the future is going to come along and have to maintain your code and they will, almost without fail, say "What was this dumbshit thinking? This is an unmaintainable mess! I would have X and Y and Z, and I would have made yet of a [not existing at the time] library and I would have used the new [meme] pattern!". It is pretty much a given.

    And don't think I'm saying this defensively about my own code - I've gently corrected coworkers quite a few times for berating some other parties code (even when they've left the company) because I think it's a self-serving, lazy way out most of the time.

  141. This article is out of date by Anonymous Coward · · Score: 0

    Sure, he talks about obfuscating your code with Macros, but doesn't say a word about the STL. There's no provision in the STL classes to support a runtime debugger. If you want to know what's in that container, you have to instrument your code, rebuild and watch what gets sent to you debug dump. So much for actually debugging the problem on the production code.

  142. Management Rule #437 by ty_kramer · · Score: 1

    When you find someone in your organization is indispensable, fire him. It's counterintuitive but makes sense in the long run, based on much of what we're seeing in these threads. Of course, bad management won't know to do that, so if the management is as poor as the development practices, you've got a match made in heaven.

  143. Re:Lifetime aint always that long by Ironsides · · Score: 1

    I asked my manager why would they bother doing such a thing when the old program worked just fine. He said "The guy who made the program died and know one knows how to code for it."

    The HUD office where my father works uses a custom made database for keeping track of the welfare recipients. The sole programer just died the other month. He was the only one who knew the code. They are currently trying to figure out what to do.

    --
    Fly me to the moon Let me sing among those stars Let me see what spring is like On jupiter and mars
  144. Spanish by Anonymous Coward · · Score: 0
    Extended ASCII characters are perfectly valid as variable names, including ß, Ð, and ñ characters. They are almost impossible to type without copying/pasting in a simple text editor.
    I never use extended ASCII nor Accented Letters, but it has it's problems: int año becomes int ano. So I usually write anno.
    And I use usually 3 languages mixed: Catalan, Spanish and English.
    So i have functions like getNombre or setAnno ,because you must use get and set in some languages. But I use also other english words like newNombre and oldNombre because it's easier than viejoNombre and nuevoNombre, and has the same number of letters.
  145. Old Joke by Ironsides · · Score: 4, Funny

    Programming is like sex: One mistake and you have to maintain it for the rest of your life.

    --
    Fly me to the moon Let me sing among those stars Let me see what spring is like On jupiter and mars
    1. Re:Old Joke by Anonymous Coward · · Score: 0

      One difference: slashdot readers do it...

    2. Re:Old Joke by Xytheril · · Score: 1

      And also, it's much cheaper to abort a piece of code and start over.

  146. Job security by ebh · · Score: 1

    About 25 years ago, I knew someone who for exactly that reason made all his names "diamonds" on the keyboard, like ESXD or BGYH. He knew, and never documented, what each variable's use and purpose were, based on which diamond it was, whether it started at the topb, bottom, left or right point, and whether it went clockwise or counterclockwise around the diamond.

    Didn't help him much when the whole project got canned.

  147. Insecure Programmers by mabu · · Score: 4, Insightful

    I find it really disturbing that programmers are so insecure they need to deliberately make their code difficult to understand. That's just stupid. If you're a good programmer, you will have job security. If you're a crappy programmer, all the obfusification in the world won't give you job security.

    1. Re:Insecure Programmers by argent · · Score: 1

      Do you know the word "gullible" isn't in the dictionary?

    2. Re:Insecure Programmers by Anonymous Coward · · Score: 0

      It's a joke. Duh.

  148. A moment of silence, please... by Anonymous Coward · · Score: 0

    My company just last month stopped entering data into a dBase application that was initially programmed in 1985.

  149. You're Fired! by Anonymous Coward · · Score: 0

    Forget about lifetime employment, you're outta there if your peers can't double check your code. The company, if it's rich enough, will just ask you or another to code the whole thing over again. (And even if the company isn't rich, do you really want a lifetime employment there?)

  150. Rule #19 by RedLaggedTeut · · Score: 1

    Rule of coding #19: Anything that is coded well gets decorated with as many levels of tweaks, configuration options and features till it is undecipherable, "Turing-complete" code.

    --
    I'm still trying to figure out what people mean by 'social skills' here.
  151. Many do understand. by Belial6 · · Score: 1

    Many do understand that the original post was a joke. Unfortunaly, many of us have met many developers that are completely serios about writing unmaintainable code on purpose. While many of the posts here are obviously jokes, some are not. It is an unfortunate reality that our industry is loaded with almost as many unethical people as car dealerships. For example, I cannot count the number of times I have been in a meeting where it is openly stated that we should "never leave money on the table".

  152. Re:April Fool's Right???? by Anonymous Coward · · Score: 0

    It's a joke. It's also a bit late. Why is it that alot of the articles on http://www.digg.com/ get reposted here? Are the submitter's not fast enough to get a story before them?

  153. Games are played in other feilds as well by Anonymous Coward · · Score: 0

    This essay is so damn good. Life for anyone taking over anyone else's job can be hell.

    I reminds of a buddy of mine who will remain nameless for good reason. Straight out of UNI he was hired in the accounts receivable department of a major oil company. His desk was piled 2 feet thick with paperwork. He had no idea what was going on.

    So he spent the first week opening every letter and if it contained cash or a cheque he recorded it and put it in his BANK pile. Everything else was chucked into the trash.

    Since he was depositing over $500,000 per day there were a substancial number of cheques and cash.

    By the end of the week the mess was cleared up. There were some questions raised about some accounts and he simply stated he never saw anything. After all he did take over the other guy's position and he did have everything ship shape in a week. Who was to be the wiser?

    When he told me this I was just agast. What a bold move!

    Well he was a VP of marketing in a major oil company before he was 30. It seems success comes to those who are ruthless about getting what they want.

  154. Corollary to rule #19 by RedLaggedTeut · · Score: 1

    Corollary to rule #19: In order to write undecipherable, unmaintainable code, just do what the PHB (aka the boss) says within the asked for timeframe. This practice is also named "pointed-haired programming" and has lent its name to a popular web programming language.

    --
    I'm still trying to figure out what people mean by 'social skills' here.
  155. Just reliably deliver on your commitments by jabelar · · Score: 1

    Your job security and promotion opportunities will be greatest (but never 100%) if management recognizes that you deliver your commitments on time. You will also be guaranteed to keep getting interesting work that expands your expertise and makes you more employable in general. Hunkering down to maintain some piece of code indefinitely is weak and deserves to be replaced! No guts, no glory kid!

  156. Oh, but it does work that way, sometimes... by Gruneun · · Score: 4, Interesting

    I can't think of a single occasion where someone was kept because of fears of maintaining their code, nor where someone was brought back to maintain their 'unmaintainable' code.

    I can. In fact, I can think of two people at two different companies.

    One kept the only copy of his source code on a laptop that he carried with him. The code was so horribly unmaintainable that none of us would touch it, though it was hardly an issue since we rarely got more than the pre-compiled libraries from him. The boss was so scared that he would lose the source that he falsified and submitted timecards for almost three months when the guy decided he was "unappreciated" and stopped coming to work. It goes without saying, but this manager was just as incompetent. In fact, I'm convinced the only reason either one survived as long as they did was through their symbiotic, parasitic relationship.

    The other guy put his code through an obfuscator, literally, that removed all the indentation, carriage returns, and comments, meanwhile renaming all of his class, method, and variable names to random strings of the characters n, e, and w. It also added random comments made up of the same random strings sprinkled with semicolons. Yeah, cute. During the unemployment interview, he stated that he had fulfilled his requirements, the code compiled and worked, there was never a formal standard for the format, and he couldn't be held responsible for the additional work of his former co-workers. I think what clinched his unemployment benefits was stating he had no hard feelings and maintaining that he was available for consulting work if the company had acted too quickly.

  157. Re:Still people try it by BVis · · Score: 1

    I can think of another reason that this is a bad idea. If you create a situation where only you know the password to mission critical systems, it won't keep you from being fired. What it will do, is get you sued after the fact if you refuse to divulge the information.

    --
    Never underestimate the power of stupid people in large groups.
  158. My own unprintable code. by irablum · · Score: 1
    I have to put this in only because taken out of context it looks ridiculous and probably corresponds to some of the principals of the article. but my software system contains this line of code:

    HomeHome homeHome = (HomeHome)

    the worst thing is that I wrote it and THEN realized how stupid it was.

    well, actually thats only the second worst thing. The worst thing is that it is 100% valid and makes perfect sense in context.

    Ira

  159. Code by mysterious_mark · · Score: 1

    Funny, sounds like you plagiarized the coding style guidline from WIPRO or EDS! M

  160. Re:Until you get promoted ... by Kjella · · Score: 2, Insightful

    Fortunately, their coding quality algorithm had to do with number of lines of code changed ... again, nothing to do with actual quality. Deleting redundant code merely enabled me and the software to work faster & better, which did not count as quality. When I learned to comment out redundant line, so they counted as "lines changed", my coding quality scores vastly improved!

    Sounds like a way to learn a bad habit on top of a bad habit:
    /*
    100 LOC
    */
    = 2 LOC changed

    // 100 LOC
    = 100 LOC changed

    --
    Live today, because you never know what tomorrow brings
  161. Har har by Anonymous Coward · · Score: 0

    While this maybe intended to be funny, I think that this is part of the reason that out sourcing software development has become popular in recent years.

    There are a lot of cowboys in the software industry, the type that lack the profesionalism and think that this sort of thing is funny, or just fact.

    It's no wonder that jobs are going to labourers that are not only cheaper, but also a lot more rigourous and serious in their approach.

  162. No, no no. The author has it all wrong. by Anonymous Coward · · Score: 1, Funny

    Don't try to make the code itself unreadable. That's a dead giveaway. Use good programming procedures to hide your wickedly complex object and data models.

    The way to make your code unmaintainable is through proper use of design patterns. Don't skimp. Combine many design patterns together to make your code so complex that nobody can ever figure it out, even by stepping through your code with a debugger. Use factories to produce composite visitor objects that bridge each other recursively. God, that just gave me a tent thinking about it.

    If anyone complains that they can't figure out your code, tell their manager that you're worried about poorly trained programmers that don't keep up with good programming practices. So-and-so doesn't know even the most basic design patterns. Express your concern that such low-level programmers might screw up the code and require you to have to return to the site for maintenance, with your very high fee.

  163. that's easy: use Perl; by wardk · · Score: 0, Redundant

    I love perl, but I could not resist. this was low-hanging fruit

  164. Obfuscation by miyako · · Score: 1

    Obfuscated code is more often the mark of ineptitude rather than expertise, and I think that most people- managers as well as other coders, realize this. I'm not saying that people who win the IOCCC for example do not understand the language they program in, but more often than not really obfuscated code (especially of the type described in the article) is a result of a programmer who either doesn't understand what they were trying to write, or is trying to make up for a lack of confidence by making the code unreadable.
    That said, I think deadlines come into play a lot on how maintainable the code is. I know that I've worked on projects where the deadline was extremely short and my priority was getting the code done as quickly as possible while making sure that it ran as fast as possible. I know that some of the other programmers at the shop would have had a hard time understanding the code that I wrote, but when you've been working for 18 hours a day for a week and the program is finished literally 15 minutes before the deadline there isn't always time to go through and document the code, make sure it's maintainable, etc.

    --
    Famous Last Words: "hmm...wikipedia says it's edible"
  165. I can, too by BaudKarma · · Score: 5, Interesting

    I worked security at this place while I was going to school. Think mid '80s

    They had won a contract from a major hotel firm to design and run their reservation system. The whole system was written by one guy, who by all accounts did an absolutely superhuman job. Of course, the company had to choose whether they wanted the job documented well, or completed by deadline. You can guess what they chose.

    Our hero stays busy for a few years, maintaining code and writing new modules, but there are still a long row of empty loose-leaf binders where the documentation should be.

    Company gets bought out. After a couple of months, the new owners announce that they're going to rewrite the whole reservation system from scratch, and retire the old system. Our hero comes in next day and demands a large raise. Management declines, hero gives his two weeks, and management cuts him his check and escorts him out the door.

    Management then brings in a team of consultants to keep the old system up and running until the new system is ready. Problem is, the team can't get anywhere. Nothings documented, calling the code "spaghetti" would be a compliment, etc etc etc. Meanwhile, they're getting requests from the customer for changes and updates which they can't process. In addition, system crashes now take hours to solve instead of minutes, which is bad because part of the companies revenue is based on system uptime.

    After a few weeks, management finally throws in the towel, and realizes they'll have to bring the guy back and pay him what he wants. Except... they can't find him. He's moved, and left no forwarding address. Nobody knows where he is.

    Management had to hire a private detective to track the guy down, and they finally found him up in the mountains in Colorado, doing whatever. They convinced him to come back, but I wouldn't want to be managements negotiator in that meeting.

    --
    It's the land of the brave, and the home of the free
    Where the less you know, the better off you'll be.
    1. Re:I can, too by SilverspurG · · Score: 1

      That's so beautiful. :) You should copyright that before Hollywood steals it.

      --
      fast as fast can be. you'll never catch me.
    2. Re:I can, too by Anonymous Coward · · Score: 1, Funny

      Dear friend,

      My name is Naorumi Hajan, I own a large scale of hotels in Swede Arabia. You probably don't know me, but I was very scared by your comment. We can lose millions ($16000000USD) of dollars because our profits depend on uptime. The analyst told me the other day that we make $1M per minute at average. Imagine what can happen! I don't understand anything about what these programmers are doing. I wish not to risk looosing all this dollars. You can help me. I want to buy your book on good coding practices. You deserve to be rich because I am very afraid by your story. I will also buy any encyclopedias you sell.

      Send me your credit card info.

    3. Re:I can, too by covertbadger · · Score: 1

      Management had to hire a private detective to track the guy down, and they finally found him up in the mountains in Colorado, doing whatever.

      Private detective?! FFS. If it had been me, that alone would have accounted for a couple of extra zeroes on the end of my salary demands.

    4. Re:I can, too by Anonymous Coward · · Score: 0

      Thank you kind Sir, I now know what I should strive for in my life!

    5. Re:I can, too by Anonymous Coward · · Score: 0

      No, no... PATENT the storyline! ;)

  166. A wise man once said... by Anonymous Coward · · Score: 3, Funny
    Give a million monkeys each a computer, and one of them will write a Java program.


    All of the rest will write a Perl program.

  167. Re:Lifetime aint always that long by benjamindees · · Score: 4, Insightful

    Why is this so difficult for employers to comprehend?

    If you're paying someone to do a complex job (hint: if it costs $1 million to replace them, it's a complex job), and they die/quit/retire, find a smart person to replace them. Don't find two dipshits to replace them. Don't give Suzy the secretary a $2 raise to do their job (unless Suzy the secretary really is a smart person, in which case, why weren't you paying Suzy more to begin with?)

    I've seen it happen over and over again. Smart person runs entire company single-handedly. Smart person quits/dies. Company panics. Company spends ungodly sum of money to completely redesign whatever it is the smart person was doing. New system ends up missing functionality and costing the company loss of productivity.

    Every time, something tells me that if this person was smart enough to do everything they were doing, there was probably a reason for it. That's not to say they can't be replaced, just that they probably can't be replaced with any random dipshit, or any random piece of off-the-shelf software.

    So, if you're a manager/owner, and you find yourself in this situation: when smart person quits, put an ad in the paper, hire a headhunter, find someone with an IQ of 130 to replace them. Pay them 20% more than you were paying the previous person. Don't worry about whether the new person has experience doing exactly what the previous person did. Don't worry about redesigning anything. If something needs to be changed, the new smart person will be perfectly capable of changing it.

    --
    "I assumed blithely that there were no elves out there in the darkness"
  168. For a great example... by eyegone · · Score: 1


    ... just have a look at the RPM code.

    --
    "They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety."
  169. APL by CrazyTalk · · Score: 1

    You want unmaintainable code? I have three letters for you - APL! Problem solved.

    1. Re:APL by antispam_ben · · Score: 1

      You want unmaintainable code? I have three letters for you - APL! Problem solved.

      I'm not so sure. Much APL code certainly is very dense (because of lots of powerful one-greek-character operators), but I've seen lots of C code (and not just from the Obfuscation Contest) that's harder to read and understand.

      It's often easier to rewrite a long line of APL code (or a large single-line APL program) than to modify it, but as far as managers may need to know, that's maintenance.

      --
      Tag lost or not installed.
  170. Java by BestNicksRTaken · · Score: 1

    Best way to generate unmaintainable code: use Java

    All that Public Static Void Private Uses Extends crap is confusing enough as it is.

    --
    #include <sig.h>
  171. Job Security, Customize the Compiler by Anonymous Coward · · Score: 0

    The most outrageous Job Security play I've ever come across was a guy who customized the GNU C compiler with a few new operators (!!) to "simplify" a small project he was on...

    Second was a guy who managed to write a great big NeXTstep program that was totally driven by callbacks posted to the NSNotificationCenter (the whole thing was just a great big side-effect as it was written - impossible to trace and fix).

    Ick...

  172. Re:Lifetime aint always that long by Guru84 · · Score: 2, Funny

    Wow... the only reason they upgraded was because the guy died. That guy should feel pretty good.... wait, he died.

  173. It's called teaching by negative example by JSBiff · · Score: 1

    Yes, the article is intended to be funny, but a lot of people also seem to miss the point that it is intended to TEACH good programming by listing bad programming habits. I.e if you want to be a good programmer, don't do this stuff. It amazes me how so many 'smart' slashdot readers can completely miss the point of something like this.

  174. Re:Lifetime aint always that long by hpavc · · Score: 3, Funny

    They would say "we never really planned on keeping that peice of software [dead guys name here] wrote, but we never decided on a package or got funding for a package to replace and we had so many things going on ..."

    --
    members are seeing something, your seeing an ad
  175. Buy his book for $49.99 by Anonymous Coward · · Score: 0

    For a second I thought you were selling a system for buying distressed real estate

  176. Here's a really good example! by RoadWarriorX · · Score: 1

    How about this masterpiece? Whoever gets stuck maintaining this application will continue to be employed for the next 20 or so years figuring it out. I guess the authors have very good documentation and auto-obfuscation!

  177. Anonymous reality by Anonymous Coward · · Score: 0

    I'm posting this anonymously because at the moment, this is exactly the situation I am confronted with. I am maintaining a huge app that
    a)was started in asp on iis with an access db
    b)was then moved to an oracle db
    c)then perl scripts were added to do db maintenance
    d)then it was discovered that vbs lacked some of the functionality that was needed and a whole new section was written in java
    e)the bridge between iis/asp and wls/java is a fantastic hack that no one understands
    f)the guy who wrote the asp code was fresh out of uni
    g)he did a good number of the don't mentioned in TFA, such as:
    1.mispelling class names and then using using correctly spelled instance names
    2.using c++ notation in vbs
    3.doing zilch zero nada comments anywhere except for single line random cryptic comments in the middle of a class
    4.adding "impl" to all the interface implementations
    5.leaving broken dao classes that weren't fully implemented
    6.using single letter variable names, often

    Fortunately, thank god, the guy was fairly consistent in his ways so it is possible to find out what his code does. It is quite a trick to make sure that changing some piece of code doesn't break the whole app though.

    Funky.

  178. Very good as real "coding not-standards" by bheading · · Score: 1

    I wouldn't recommend that anyone follow the "write unmaintainable code to make your job secure". If you're working for a fairly sane company and a boss who knows some of what they are doing, they'll have a pretty good idea of how maintainable your code is whenever they ask other people in your group to work on it. If your company is an outsourcing operation, your customers will more than likely be inspecting the code at random and they'll be peeved if you're doing stupid stuff.

    Same time, the article is good in that it's a really good essay about what NOT to do in order to be a successful software developer.

  179. isn't it easier to... by Drachasor · · Score: 1

    ...write a program that turns your code into something unmaintainable? Perhaps one that converts between an "unmaintainable" format and back? That or you could keep the good source and make it seem like the bad source is what you wrote.

    With this you can be the wunderkind who can somehow easily maintain this monsterous code when anyone else can't. Now that's job security.

  180. Re:Lifetime aint always that long by AugstWest · · Score: 3, Insightful

    Have you ever tried to hire that One Smart Person? Hell, even if s/he existed, they'd never make it past HR.

  181. My favorite... by Bilestoad · · Score: 1

    Make sure all your code is as condensed as possible. It not only looks like you know what you're doing to the uneducated observer, it will hinder any attempt to follow flow of control while stepping with a debugger.

    e.g.

    something=fn(getptr(x),*gg,goddamnhugevariablename )?fn2(x):fn3(x);

    this works even better with case!

    switch(x) {
    case stupidconstantnamedefinedinfaroffincludefile1: return;
    case stupidconstantnamedefinedinfaroffincludefile2: continue;
    case stupidconstantnamedefinedinfaroffincludefile3: break;
    case stupidconstantnamedefinedinfaroffincludefile4: etc. etc.

    And don't leave it at that. You know the people trying to follow your code will be hating your guts - rub it in. Leave cute little comments all over the place, designed to really get under their skin. "What the hell does this do?" and "This is such a cool implementation!" and "I learned to do this in 2nd year C class" are some of the classics I have found... Even better, get cute with your variable names. Name them after Ewoks. Or Smurfs. The mental image you want to create is of you, behind the maintenance programmers shoulder, giggling.

    Lastly, NEVER use parentheses unless you have to. You spent months of your life memorizing binding order, you should force everyone else to do the same. You don't want the casual observer to be able to interpret

    if(*p++ && x || *qq->a * 3 && y)

    without stopping to take a good long look, do you?

  182. As seen on digg by RickySan · · Score: 1

    who's copying who now?, is /. dotting dig, or is digg slashing dot?

    --
    "If it's true that our species is alone in the universe, then I'd have to say that the universe aimed rather low
  183. Think about the legacy you're leaving... by Anonymous Coward · · Score: 0

    I realize that this is supposed to be a joke, but to me it is not very funny. I am currently on a team that has to maintain spaghetti code (Perl, no less) left by a previous developer. His old code does some amazing things, but the complete lack of comments or documentation has left such a sour taste in the rest of the team's mouth that they start muttering expletives whenever his name is mentioned. This is a real shame because he was a nice guy as well as being very smart, but because of his code he has left a legacy that has insured that no one would ever recommend him for anything.

  184. Secrets of the Master by Anonymous Coward · · Score: 0

    I once worked for a large corporation I'll call MotorFrdCrys. I worked with a guy who had an amazingly long career as a programmer, from the early 1960's to the mid-1990's. He was the sole creator, over a period of decades, of a "program" that performed an absolutely essential function in designing a car.

    As the person who documented the user portion of this "program", I became privy to his secrets.

    First, the program was both absolutely essential *and* rarely used, since you only needed it at one point during the design cycle. Back when it took six years to design a new car, this program was probably needed once or twice a year.

    Second, it was a classic work of spaghetti code written over decades in FORTRAN. He never threw anything away that (sort of) worked, and he never cut out anything that no longer worked.

    Third, he liberally used "fudge factors" at every juncture of the program to get the answers that engineers already expected to get when they used the program.

    Finally, and most impressively, it was not possible to use the program to get the final design answers *unless he personally ran the program*!

  185. All too true! by bobalu · · Score: 1

    I laughed my butt off reading that. My predecessor used many of these techniques, and when the staff asked him how something worked he actually said "What, and let you know all my secrets?"

    Include files copied into each folder so if you changed a structure you had to know to do it 5 places, constants defined as enums, non-std abbreviations, no vowels in any variables, the one-char names, on and on.

    I really liked the text file hidden in an .exe, for which there was no project whatsoever. He hid a bunch of interpreted instructions there and had to seek past the .exe stuff to read and write it. I'm sure he cackled gleefully doing that one.

    Oh, and he named the program after himself.

    --
    The revolution will NOT be televised.
  186. Most people will miss it by elhedran · · Score: 1

    But its actually a plug for NetRexx.

    Scroll to the very end of the article and read the last to paragraphs. Apparently he is trying to make a point about not restricting ourselves to text files when coding. Might have made it better if he had made the rest of his article shorter

  187. Re:Until you get promoted ... by Anonymous Coward · · Score: 0

    I am working in the same company (except is about portfolio management, not insurance) and yes, it is soul destroying.

    Actually I have to recompose my soul every morning just to get it destroyed every afternoon.

    The sad is, they pay me a lot more than any job I have ever applyed to and there is a mortgage in my sad life :-(

  188. Re:Lifetime aint always that long by iamhassi · · Score: 1
    "...when smart person quits, put an ad in the paper, hire a headhunter, find someone with an IQ of 130 to replace them."

    Welcome to /., where IQ of 130 is average... they should just forget the 90 IQ headhunter and advertise on here :)

    you've been around here long enough, you should know that by now.

    --
    my karma will be here long after I'm gone
  189. Re:Until you get promoted ... by rewinn · · Score: 1

    >I'd rather argue against a hundred idiots than have one agree with me.

    I must agree with you ... sorry!

  190. Re: The Indian Solution by cashman73 · · Score: 1

    Of course, most of these problems is nothing that an indefinite number of Indians, given an indefinite number of dollars, and and indefinite amount of time, could solve.

  191. Funnier and Shorter by lamz · · Score: 1
    --

    Mike van Lammeren
    It will challenge your head, your brain, and your mind.

  192. Re: What does it matter? by OverflowingBitBucket · · Score: 4, Interesting

    I worked at a company that had let it slip that they were taking metrics on number of lines of code submitted to the revision control system. This was a directive from the higher-ups, so of course against all logic the next line of management down from them (and above me) went along with it blindly. I tried to argue about the uselessness of such metrics to deaf ears. So, being me, I decided to have a little fun with this.

    One section of the code consisted of a number of modules that were basic copies of each other with small local customisations. Think hundreds or thousands of lines in common. No, I didn't write them, but I had to maintain them. So I took these, pulled out some code into common libraries, and wrote a code generator to produce much of the rest from input files. I was also careful to work on non-coding tasks for the remainder of that week; essential stuff but the sort that had been put off for a while. My net code contribution that week: Negative several hundred lines of code. The code also became infinitely more maintainable, and I fixed countless copy/paste bugs in the process.

    No doubt someone fudged my negative figure upwards when it went back up through the management chain to avoid rocking the boat, no doubt to a nice small number of positive line chances to ensure I looked bad. But, if only to myself, I had proved my point.

  193. onBlur by argent · · Score: 1

    Whoever used "blur" instead of "unfocus" or "defocus" in Javascript was clearly a skilled practicioner of this kind of tomfoolery.

    Yes, yes, if you defocus a lens the image blurs. That doesn't mean "blur" is the opposite of "focus" EVEN IN OPTICS, let alone where it's only being used as a metaphor. Oh, if any smartarse wants to make a comment about how they didn;t invent it (if indeed they didn't), I don't care. I don't care if Schroodleheim and Wurzelburg used "blur" in this context on page 451 of their seminal work on user interface design, or if it's even common slang at some lab or campus or prestigious project, it's a stupid bloody name.

  194. Unmaintainable code in just In 3 easy lessons. by Man+from+Trantor · · Score: 2, Funny

    1.) Use global variables for everything. Make sure you give them funny names like 'beeblebrox' and 'Wookie' that give absolutely no hint of what thier purpose might be. This will give the poor sl.., er, maintainer a good laugh as they tweeze thier way through your code. And yes, please feel free to reassign thier values often for whatever purpose you need in any give place.

    2.) Avoid specialized classes and functions like the plague. Place everything in gigantic Sub or void methods, trying to pack as much of your programs functionality as you possibly can into each block.

    3.) Thoroughly document your code by scattering non-sequitor comments at random points.

    This is a proven tecnique. In fact it works so well that anyone with a brain that gets a look at it will recommend that your app be shitcanned immediately rather then waste another dime maintaining it.

    --
    <!-- /. bot -->
    while(!am) r2();
  195. Easy!!! by ToasterofDOOM · · Score: 1

    1. Download perl
    2. start coding

    just kidding, perl is awesome, albeit cryptic at times.

    --
    I am Spartacus
  196. It's way too complex... by creative_Righter · · Score: 1

    The code may be way too complex, but I'm certain this designer is not intelligent...

  197. I've found Perl just perfect for that task! by porky_pig_jr · · Score: 2, Insightful

    Perl, with its 'do the same thing gazillion different ways' is a perfect language to write completely unmaintaintable code.

    I've leared that the hard way, by starting my Perl education maintaining the code written by someone else. I've fought back by writing the number of apps in Perl, as well. Poor suckers kept calling me at my new job, long after I quit.

  198. left out the easiest way by Filthysock · · Score: 1

    through in a few regular expressions, those things are usually a mystery to anyone else.
    Hell a,fter 6 months my own ones seem like arabic :(

  199. True story by Anonymous Coward · · Score: 0

    Several times I've been brought in by companies as a hired gun to try to understand umaintainable code so that they could fire the authors. In one place, an investment bank, the code, which was crucial to their business, was so obsfucated and bloated that after months of struggle I simply had to give up. Not only was the 1,000,000 lines of code impossible to understand, but it required constant HUMAN interaction that only the guys who wrote it knew how to do. The programmers had been demanding "special" bonuses for several years, and getting them. The year before I showed up they got $500,000 each. I KID YOU NOT. Eventually the company started an entire shadow division, built the system from scratch, then closed down the original division (with about a dozen innocent victims getting the axe).

    Their punishment: they moved on to another investment bank WHERE THEY DID THE SAME THING AGAIN!

  200. Nonsense by Heretik · · Score: 1

    Everyone knows that in taking operator overloading out of Java, they made it impossible to write confusing code.

  201. God is thought to write unmaintainable code. by NRAdude · · Score: 0

    It's a "given" that the lazy people need pray with such words to ask God for things that have already been given and forgiven to them. This aside; I think God used too many of those sleep() subroutines, and the return from the life(void) syscall has too many race conditions caused by malicious microcode on various architectures mis-interpreting the core logic.

    Please be humble before you read the following, knowing that many of us can't use that Bible as truth, but its application can be used to discern between people that hold it as truth or use it for malicious purposes. All this considered, think about that Someone that was too quick to engage a "talking snake theory", and was yet to recognize that there is a two-headed talking snake slithering around, and none knows the true head. (this in mind, crossed with what we think is reality, depending on your left-brain and right-brain psychopathic application; there are natural snakes with a blunt tail that distracts predators from attacking the true head.)

    [KJVAV1611] Genesis 3:1;
    "Now the serpent was more subtil than any beast of the field which the LORD God had made."

    [KJVAV1611] Genesis 3:14-15;
    "[14]And the LORD God said unto the serpent, Because thou hast done this, thou art cursed above all cattle, and above every beast of the field; upon thy belly shalt thou go, and dust shalt thou eat all the days of thy life:[15]And I will put enmity between thee and the woman, and between thy seed and her seed; it shall bruise thy head, and thou shalt bruise his heel."

    [KJVAV1611] Genesis 4:13-24;
    "[13]And Cain said unto the LORD, My punishment is greater than I can bear.[14]Behold, thou hast driven me out this day from the face of the earth; and from thy face shall I be hid; and I shall be a fugitive and a vagabond in the earth; and it shall come to pass, that every one that findeth me shall slay me.[15]And the LORD said unto him, Therefore whosoever slayeth Cain, vengeance shall be taken on him sevenfold. And the LORD set a mark upon Cain, lest any finding him should kill him.[16]And Cain went out from the presence of the LORD, and dwelt in the land of Nod, on the east of Eden.[17]And Cain knew his wife; and she conceived, and bare Enoch: and he builded a city, and called the name of the city, after the name of his son, Enoch.[18]And unto Enoch was born Irad: and Irad begat Mehujael: and Mehujael begat Methusael: and Methusael begat Lamech.[19]And Lamech took unto him two wives: the name of the one was Adah, and the name of the other Zillah.[20]And Adah bare Jabal: he was the father of such as dwell in tents, and of such as have cattle.[21]And his brother's name was Jubal: he was the father of all such as handle the harp and organ.[22]And Zillah, she also bare Tubalcain, an instructer of every artificer in brass and iron: and the sister of Tubalcain was Naamah.[23]And Lamech said unto his wives, Adah and Zillah, Hear my voice; ye wives of Lamech, hearken unto my speech: for I have slain a man to my wounding, and a young man to my hurt.[24]If Cain shall be avenged sevenfold, truly Lamech seventy and sevenfold."

    This post, I assert it of a truth, and stand on my words;
    Gregory-Thomas: Mundt

    --
    without prejudice
  202. Re:Lifetime aint always that long by cloudmaster · · Score: 1

    It's all about having the right keywords in the resume. And people say that meta tags aren't useful anymore... :)

  203. Re:Lifetime aint always that long by Midnight+Thunder · · Score: 3, Interesting

    Have you ever tried to hire that One Smart Person? Hell, even if s/he existed, they'd never make it past HR.

    Yup, especially since HR adheres to the "check-box" policy off hiring. Do you have such a skill yes/no? This totally eliminates the people who actually can learn the stuff. I was speaking to one headhunter who said that one company wanted someone who could hit the ground running, because they had a tight deadline, and then as the project got closer to the finish date, and they still hadn't found such a person, they became fussier about thre criteria. This is akin is trying to find the ideal girl friend and upping the criteria when you don't find her.

    Okay must admit since taking a sabatical trying to find another job is proving to be a little harder than expected. And the fact that I am in IT doesn't seem to help me find the "beautiful girl, who is smart and funny and I spend my time with" ( match.com didn't help either ;) I will get both one day, but I am not sure how (maybe just a hopeless optimist?)

    --
    Jumpstart the tartan drive.
  204. At least you have source code by oldCoder · · Score: 1

    I actually worked for a company that had lost the entire source code for one of its main applications. They kept the binary and ran it as needed -- and just kept on working around it's problems. I was impressed with their creativity and shocked at their stupidity.

    --

    I18N == Intergalacticization
  205. Amazing... by WgT2 · · Score: 1

    This is exactly the kind of behavior I dispise in a "programmer": it's petty, full of selfishness, insecurity, and incompetence.

    I thoroughly believe that if a "programmer" is worth his salt, he/she can do any project without fear of being canned when it's completed, not because they know their boss can't do without them, but because they know their skills are such that they are a valueable asset to any company.

    And, I would HATE to work at a company, as a programmer, that did not recognize such behavior or allowed it to continue.

    While this article can have lots of humor in it, it just brings up a point of contention I have had with former coworkers.

  206. Re:And Microsoft rule by Piquan · · Score: 1
    "It is easier to write an incorrect program than understand a correct one."

    - Alan J. Perlis, "Epigrams in Programming"

  207. Re:And Microsoft rule by Anonymous Coward · · Score: 0

    Funny of you to say it's a joke and insult anyone who believes it to be true.. then in your next paragraph you say how it actually is true.

  208. We had a contract programmer like that, by Anonymous Coward · · Score: 0

    named Mark [not his real name!], who, when asked to integrate two small systems, wrote code to have one system email him when data changed, so that he could then enter that data into the other system.

    The managers of the user community thought Mark was great, because he did exactly what he was asked to [even if that was totally stupid!] and he also did it almost instantly.

    Of course, when he was fired for running a first-run movie server from within the corporate firewall, all those system integrations failed, because the emails were never opened.

    We eventually found all the little tricks Mark had used to implement the stupid requirements his users asked for, and removed them, and made the users follow the rules.

    Unmaintainable code is only a protection until a real developer finds out what's going on, and get the ear of management. I really liked Mark, but his coding ability couldn't keep up with his lack of ethics!

  209. Re: What does it matter? by rewinn · · Score: 1

    > I decided to have a little fun with this .... I took these, pulled out some code into common libraries, and wrote a code generator to produce much of the rest from input files

    Ah, congratulations, how delightful! I *loved* code generators. Ya bring back memories ... at my first really good gig, management just stood out of the way while I wrote a mainframe BASIC program that generated COBOL reporting programs as fast as they could think of new stuff they wanted out of their data; the reports were basically the same anyway except for the sort, select, summarization and output. So the generator wasn't really as hard as it might sound.

    Of course, this was in a commercially competitive environment where we were rewarded by results, not by metrics. Those were true Dilbert Moments ... ever so much more satisfying than Kodak Moments!

  210. you can also do this without code by Anonymous Coward · · Score: 0

    With graphic-heavy layouts becoming the norm in the 56k and higher age, I revel in the fact I can put together layouts that look simple but employ enough layers of subtle effects and elements that they are nearly impossible for someone to duplicate exactly. Of course - I retain all of the .psd files for future updates. Most updates only take an hour or less so it's no huge dip into their petty cash. By the middle of next year I should have 8 hours a day doing "updates" in addition to my normal client load. Of course, this is also the case with Flash-based projects which can be massively more complex.

    Of course some of my clients have been catching-on.

    I had one company demand the .fla files for some streaming video interstatials that I did. Some entry-level plebe didn't know that I never signed any agreement on terms for material release. It was fun bitch-slapping him down when he asserted that all material was their property.

    Quite fun in fact.

  211. Re: What does it matter? by OverflowingBitBucket · · Score: 1

    Ah, congratulations, how delightful! I *loved* code generators. Ya bring back memories ... at my first really good gig, management just stood out of the way while I wrote a mainframe BASIC program that generated COBOL reporting programs as fast as they could think of new stuff they wanted out of their data; the reports were basically the same anyway except for the sort, select, summarization and output. So the generator wasn't really as hard as it might sound.

    My current project (E.V.E. Paradox) uses a fair amount of automatic code generation. Basically as I add a new game and object to a game, it creates the code to let you edit it in the Editor GUI, base code to load and save it in various formats, the basic game code, doco, and all of the annoying little hooks required. It's a neat little Ruby program, and it produces reasonably readable C++. It's not perfect, but reduces the amount of copy/paste for common code. It reduces errors due to simple typos dramatically; I haven't looked at some of this code for quite some time, it just works.

    The downside is that it is hard to maintain and can get a bit bulky. I can think of a few improvements that I could have made to use more generics and a bit less automatic codegen, but shoestring budget and all...

    Of course, this was in a commercially competitive environment where we were rewarded by results, not by metrics.

    Those gigs are getting harder and harder to find. :(

  212. Funny by Anonymous Coward · · Score: 0

    That was incredibly funny.
    When I first read it.
    I think it was three years ago.
    Possibly linked from slashdot.

  213. Scary but true... by !Freeky2BGeeky · · Score: 1

    In the company I work for, it doesn't matter how bad (or good) you right your code, your position will be outsourced overseas by next year... So there's little incentive to make it work to begin with.

    --

    Visualize Whirled Peas

  214. Don't forget design patterns... by rickmode · · Score: 1

    I'd add this one to the mix:
    A strong attempt should be made to apply as many design patterns as possible onto the problem at hand. This should be done without consideration of the downside of the use of these patterns since no one gives you credit for not using a design pattern.

  215. Sure you haven't been praying on the side? by gd23ka · · Score: 1

    This is interesting... most of the other people on the "God Channel" I heard about, whose life exploded into the "Middle Class Pipedream" they got this far by submitting to the Lord and through prayer.

  216. needs to be taken to a higher level by rubycodez · · Score: 1

    How do we take this to the next level, how to have a team-oriented Rational Unified Process of making unmaintainable software, or even better Extreme Unmaintainable Coding.

  217. Obligatory link .. by AceyMan · · Score: 2, Informative

    I can't belive this hasn't been posted yet, but discussions like these always take me back to the story of Mel.

    I smile every time I read it.

    --
    -- Experience is a wonderful thing. It enables you to recognize a mistake when you make it again.
  218. Re:And Microsoft rule by ergo98 · · Score: 1

    Funny of you to say it's a joke and insult anyone who believes it to be true.. then in your next paragraph you say how it actually is true.

    No, that isn't funny. I said there is a kernel of truth to it, as there is with virtually all humor. There is nothing particularly funny about that.

  219. Re:Lifetime aint always that long by NateTech · · Score: 1

    Fire the HR person, then.

    --
    +++OK ATH
  220. Re:Lifetime aint always that long by dwandy · · Score: 1
    Yup, especially since HR adheres to the "check-box" policy off hiring. Do you have such a skill yes/no?

    Of course listing "MS Office" on the resume doesn't qualify where the requirement was "MS Word" ... that's the mark of the true checkbox-HR officer.

    --
    If you think imaginary property and real property are the same, when does your house become public domain?
  221. Re:April Fool's Right???? by MBraynard · · Score: 1
    No, it's not a joke, it's an important strategy.

    I recall my office having a tectronic lazer color printer that we could run transparencies through. Except Tectronic built the printer so that any transparencies other than their special proporietary sheets would melt in the printer.

    If the firm does not require you explicitly to write maintainable code - than the tips they give in this are quiet good.

    Or if they want code that others can maintain, to be well commented, you should - ceteris paribus - ask for more mo-nah!

  222. Whoa. by scott_karana · · Score: 1

    I think the most particularly evil one is pointing out that "myArray[i]" is equivalent with "i[myArray]" in C.

  223. Re:Lifetime aint always that long by markhb · · Score: 1

    Cool! Recursive exit interviews!

    --
    Save Maine's economy: write stuff down. All comments are exclusively my own, not my employer.
  224. Oh no... by Anonymous Coward · · Score: 0

    This is so OLD NEWS, that it couldn't get anyolder... I remember sawing that "how to write unmaintable code" allmost five of six years ago. I am not sure where I got the link, but I guess it was in http://rinkworks.com/stupid/ :)

  225. a cherished classic by miles+zarathustra · · Score: 1

    The first time I read this essay I was simultaneously laughing and crying. The code I was working on at the time contained examples of every single technique -- all written by programmers who had (voluntarily) left the company!

  226. Re:Lifetime aint always that long by EwokMolester · · Score: 0

    "This is akin is trying to find the ideal girl friend and upping the criteria when you don't find her."

    As in life, all metaphors break down to the difficulty of finding a girlfriend. Well on /. anyway.

  227. It's INTRINSICALLY OBVIOUS to Real Programmers by flyfisher · · Score: 1

    My first job out of school was maintaining a program called CODAN written in FORTRAN 4. It was layered on a custom shell written by a guy who'd wanted to add some capabilities to the manufacturer's shell (Cyber 170 mainframe running NOS). Somewhere along the line the source code had been lost and they only had the binary. So every year when Cyber upgraded NOS, the shell would break and this guy would come out of retirement (He'd retired early because he had this nice cash spigot to supplement his income) and for $250/hr he'd debug and fix the problem. The Cyber 170 was a 60 bit machine and his debug method was to do an OCTAL dump of the crash and pick through it (a 12 inch stack of 132 column fan-fold, impact printer output) until he found the problem(s), then use a binary editor to patch the binary.

    I asked once why we didn't just re-write the program (CODAN was itself an horrendous piece of cut-and-paste architecture) and was told that we had a budget for maintenance, not new development. Since this was a defense contractor to the DOD, we couldn't move money from one to the other.

    So this guy had an annual gig that brought in about 40K a year until he died. The satelite booster that this program supported is still being used with the same Z80 based flight computers, so the program COULD still be in use, IF he's alive. Go figure.

    --

    d4,...,Nf3, or maybe I should use a Ratfaced Mcdougal?
  228. Another gem by Rick+Genter · · Score: 1

    Again, from TFA: "Imagine having an accountant as a client who insisted on maintaining his general ledgers using a word processor."

    My ex-wife is an accountant who does a variation of this: she insists on doing all of her word processing in Excel. She writes letters, takes notes, and even designs brochures, all in Excel. She hates Word. She loves Excel. There is no arguing with her.

    --
    Don't underestimate the power of The Source
  229. Re:April Fool's Right???? by TangoCharlie · · Score: 1

    I think if I ever met you in person.... I'd like you :-))

    --
    return 0; }
  230. Thanks for the tips by Eli+Gottlieb · · Score: 1

    I'll use these when I enter the International Obfuscated C Contest.

  231. Meant chapter 11 by Ungrounded+Lightning · · Score: 1

    Which chapter 14?

    Were you age discriminated?
    Or were you a whaler?


    Oops. Meant chapter 11.

    (Mixing up the bankruptcy chapter numbers: Yet another reason I'm not a CEO. B-) )

    --
    Bantam Dominique roosters crow a four-note song. Once you've heard it as "Happy BIRTHday" you can't NOT hear it that way
    1. Re:Meant chapter 11 by bataras · · Score: 1

      Umm, chapter 11 is a company reorganization, not personal bankruptcy.

    2. Re:Meant chapter 11 by Ungrounded+Lightning · · Score: 1

      That's right. I didn't go bust. But the company I worked for came close. I survived the layoffs and thus didn't have to go job hunting in the midst of the crash.

      --
      Bantam Dominique roosters crow a four-note song. Once you've heard it as "Happy BIRTHday" you can't NOT hear it that way
  232. Not unless you're a contractor by Kashif+Shaikh · · Score: 1

    Quit from the Company then rake $$$ in consulting fees. As time goes on increase your fees as you have the upper hand.