Hacker News new | ask | show | jobs
by yyyk 2117 days ago
The link seems a bit old, modern day development has added many new and exciting methods for making unmaintenable code:

- Use exceptions for control flow. With different exceptions leading to entirely different flows. On C you can use setjmp/longjmp + globals for a similar effect. This will help the maintenance programmer develop thinking in multiple dimensions.

- To save space, do not declare separate constants for every magic number/string. Instead use one large constant pooling all the constants, and then deduce the other constants from parts of the one large constant. You'll be teaching the maintenance programmer an advanced optimization technique.

- Abuse localization rules whenever a case-insensitive operation is operated (e.g. Turkish i, German eszett, etc.). You'll be broadening the mind of the maintenance programmer, teaching cultural differences.

For extra points, when dealing with fixed string constants in the code, abuse Unicode's right-to-left rules to make the shown data rather different than the actual data the compiler sees, and zero width characters the make the shown length different than the actual length. This is particular useful with the "one large constant technique" from above.

- Do use locals when the locals shadow the global variable. This will teach the maintenance programmer to pay attention.

- Supply more precise overrides in files/projects included in partial compilation as to make code that will behave differently depending on compilation order, included files/projects, etc. This will help teach the importance of a build system.

Bonus points if the included code is actually similar, but relies on subtle differences in the behaviour of a previous version of the framework or included packages.

4 comments

> Use exceptions for control flow. With different exceptions leading to entirely different flows. On C you can use setjmp/longjmp + globals for a similar effect. This will help the maintenance programmer develop thinking in multiple dimensions.

Exceptions? Pfsh... that's so early 2000s.

If you really want to mess with a dev these... make everything async and don't bother to check if it completes.

And don't forget the flip side... the ui thread shouldn't be responding to messages when it could be blocking on a long running process!

Colleague I worked with "resolved" the second problem (UI thread blocking) brilliantly by just spin waiting Application.DoEvents() in WinForms.
> Use exceptions for control flow. With different exceptions leading to entirely different flows. On C you can use setjmp/longjmp + globals for a similar effect. This will help the maintenance programmer develop thinking in multiple dimensions.

I recommend writing a CustomException class instead. So everytime you see a third-party error, catch it and throw a new CustomException() (Without arguments, otherwise you may carry some bad third-party classes/exceptions in your codebase). And don't forget to catch CustomException at strategic places too, so you can actually throw a new CustomException().

I saw a version of this dating back to 1997, so that's why it probably seems old.
The second to last paragraph states that the author gave a version of the document as a talk at a conference in 1997. So it appears that your memory is spot-on.
I remember seeing it in the early 2000's, so yeah.
Just a short side note there is a capital esszet (ẞ).

https://en.m.wikipedia.org/wiki/Capital_ẞ