Want to read Slashdot from your mobile device? Point it at m.slashdot.org and keep reading!

 



Forgot your password?
typodupeerror
×
It's funny.  Laugh. Programming IT Technology

How To Write Unmaintainable Code 437

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. '"
This discussion has been archived. No new comments can be posted.

How To Write Unmaintainable Code

Comments Filter:
  • by 0kComputer ( 872064 ) on Monday November 21, 2005 @12:48PM (#14082501)
    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!.
  • by antdude ( 79039 ) on Monday November 21, 2005 @12:49PM (#14082506) Homepage Journal
    A co-worker sent me these unmaintainable code essays [mindprod.com] back in August 2005. Taken from AQFL [aqfl.net].
  • Code Obfuscation (Score:1, Informative)

    by Anonymous Coward on Monday November 21, 2005 @12:50PM (#14082520)
    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).
  • TheDailyWTF.com (Score:5, Informative)

    by Str8Dog ( 240982 ) on Monday November 21, 2005 @12:51PM (#14082537) Homepage Journal
    If you need a daily reminder of "what not to do", I highly suggest bookmarking TheDailyWTF.com [thedailywtf.com].
  • This is ancient... (Score:5, Informative)

    by zimbu ( 99236 ) on Monday November 21, 2005 @12:51PM (#14082538)
    Roedy started this back in the 90's, you could at least have the decency to link to the latest version [mindprod.com].
  • Old old old (Score:5, Informative)

    by po8 ( 187055 ) on Monday November 21, 2005 @01:21PM (#14082854)

    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?

  • by Anonymous Coward on Monday November 21, 2005 @01:49PM (#14083097)
    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.
  • by vertinox ( 846076 ) on Monday November 21, 2005 @02:13PM (#14083318)
    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...
  • Re:The Daily WTF (Score:3, Informative)

    by Hognoxious ( 631665 ) on Monday November 21, 2005 @02:20PM (#14083399) Homepage Journal
    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.
     
  • I'm with you.... (Score:3, Informative)

    by Belial6 ( 794905 ) on Monday November 21, 2005 @02:35PM (#14083530)
    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.
  • Re:I can. (Score:3, Informative)

    by daviddennis ( 10926 ) <david@amazing.com> on Monday November 21, 2005 @02:37PM (#14083551) Homepage
    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.
  • Obligatory link .. (Score:2, Informative)

    by AceyMan ( 199978 ) on Monday November 21, 2005 @10:49PM (#14087554)
    I can't belive this hasn't been posted yet, but discussions like these always take me back to the story of Mel. [catb.org]

    I smile every time I read it.
  • Re:I can. (Score:3, Informative)

    by pugugly ( 152978 ) on Tuesday November 22, 2005 @02:48AM (#14088389)
    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

"If it ain't broke, don't fix it." - Bert Lantz

Working...