Magical inheritance

  • About 20 years ago, I worked with two guys who were charged with implementing a utility to automate a bunch of tasks to support a production environment. Rather than just writing a simple shell script for each task, one guy wrote a single option-driven C program to perform the ever increasing list of tasks. The other guy decided he could do it better, and since he had time, he built a shell script that supported the same set of options and tasks, plus a few more. For a few months, they kept one-upping each other with their respective implementations.

    At some point our project kicked into high gear and we didn't have time for this, so I took the shell script, stripped out everything the C program did, added a check for script-only functionality and passed anything else to the C program.

    After that, every time the C program was updated, the shell script would magically inherit its new functionality - without any programming effort, and the guy couldn't figure out how we did it.

    We tortured him with that one for months.

  • 1) Modify the C program to detect whether the script is running.

    2) If the script is running produce embarrasingly wrong results.

    3) Announce new functionality and bet money that the script can't do it.

    4) Extra pocket money.

  • @DOA - that made my day 🙂


  • @DOA: devilish. Also makes good fun when implemented in a C++-class with the results depending on typeid(this). That'll teach people a thing or two about reuse.

Log in to reply

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.