10 thoughts on “Writing Unmaintainable Code”

  1. Seek out and use Hungarian warts that have meaning in languages other than your current language. For example insist on the PowerBuilder “l_” and “a_ ” {local and argument} scoping prefixes and always use the VB-esque style of having a Hungarian wart for every control type when coding to C++. Try to stay ignorant of the fact that megs of plainly visible MFC source code does not use Hungarian warts for control types.

    That alone is a nuclear bomb.

  2. One that I didn’t see (maybe I just didn’t look hard enough) is “use extra long variable names”. Ada encouraged this; you’d see code that had all variable names at least 48 characters long, so that only one name would fit on an 80-character line on a VT220 TTY. Everybody seemed to think that, since the Fortran 77 6-char variable name length limitation was now lifted, you had to have your variable names be complete sentences with prepositions and gerunds and everything…

  3. There’s an idea called Genetic Programming where you basically ‘sandbox’ all of your individual operations so that they fundamentally can’t crash (adding MAX_INT + MAX_INT might just return MAX_INT, or something – so your answer might be wildly off base – but it won’t crash.)

    Then you start making literally random programs. You take, say 10,000 programs and grade them on ‘correctness of desired output.’ Naturally, they all completely suck. But you prorate them anyway … then have the better programs “breed” by swapping random chunks of code.

    This sounds completely bizarre, but it actually does work – and work fairly quickly for calculator-level sorts of problems.

    But the code, is more incomprehensible than pigden Hungarian could even manage. You see, things like spacing, indenting, sane variable names are all things humans like to impose … but that don’t actually affect program performance. So every program is fundamentally a ‘one-liner’.

    At least -one- programmer had some concept of the program they wrote. But with Genetic Programming, there’s literally no one that groks even a fully functional program without adding a review period.

  4. Remember the Far Side cartoon, of the cattle owner about to brand his cow, which is looking on in horror as the brand makes use of “long variable names” — something to the effect of “This cow is the property of Hank Jones so keep yer hands off!”

    What about software package installs using a tree-directory structure to organize the files, but to use as many levels of subdirectories as humanly possible, to make each subdirectory name as long as possible, and to liberally sprinkle subdirectory names with spaces, requiring you to quote them when you put them on “build lists”?

  5. This is a little off topic, but how about designing a car where the backup lamps come on, not when the car is in the reverse gear and actually about to back up, but when the owner is halfway across the parking lot and has pressed a key fob, leaving you standing there waiting for that car to back up as the owner moseys on over?

    A car that does this is actually in violation of Wisconsin State Law, and there is only one auto maker that has this feature (cough, GM, cough), but the inquiries I have made on the subject suggest that they are outside the reach of any laws these days.

    My remark is on-topic inasmuch that the whole problem with unmaintainable code is that if there is a standard way of doing things, violate that standard because standards are for wusses and the original author of the code has some higher reason for doing it the nonstandard way.

    By the way, there is a workaround to the GM backup lamps issue. If you see backup lamps and the car is a Toyota or a Ford, let that person back out because they probably don’t see you and you don’t want to bend metal. If that car is a late model GM car, appears to be an option-laden high-end trim level, and you see backup lamps but no brake lights, the car is probably unoccupied and the owner is halfway across the Lot 17 Parking Ramp at the University of Wisconsin-Madison Engineering Campus. Quickly get out of your car, slap a “Scott Walker for President” sticker on the back bumper, and then get back in your car and speed off.

  6. Computer programming is still more art than science. We’re still exploring what 8 bit computers can do (in the guise of microcontrollers) and all this best-practice stuff for higher level languages is obviously still getting thrashed out by trial and error.

    Al’s point about genetic algorithms is well-made. At some point AI techniques like GA and neural networks and other such organic software will become ubiquitous, making code maintenance in the current sense impractical.

  7. Back in my old satellite operations days, I had to study the DSCS-III ram patch source code. It was written in PDP-11 assembly language which limited the variable names to perhaps 6 letters long. The ram patch programmer used the names of Hindu gods for all variable names (e.g. VEDA, GHETA, SHIVA, etc.). Perhaps in the rich tapestry of the Hindu religion, those names meant something to him. To me, not so much. I wanted to hurt him.

  8. One that I didn’t see (maybe I just didn’t look hard enough) is “use extra long variable names”. Ada encouraged this; you’d see code that had all variable names at least 48 characters long, so that only one name would fit on an 80-character line on a VT220 TTY.

    A number of senior developers of my acquaintance are of the opinion that real programmers don’t write code, they cut and paste it. So, type that 48-character name once; then between c-‘n’-p, keyboard macros, and auto-complete, your 10,000 line source module only takes a few dozen keystrokes to complete.

    (I don’t agree with them, but I see their reasoning; off-shore mainframe “software engineers” generally range from barely adequate to ignorant, incompetent, and dishonest.)

Comments are closed.