About Archive Tags RSS Feed


The evolution of a shell script

24 December 2005 21:50

The script starts out small and does a single job.

You realise that you can do so much more, so it gets bigger and more arguments get added to it.

Passing more than four parameters, in the correct order, gets painful so you add some option parsing code.

Suddenly the number of options grows, so you add a manpage to try to explain the parameters and what they are used for.

Other people start using the script and wish to change the behaviour, so you add yet more command line switches and complexity.

Gradually you realise your once-tidy script is now a complete mess, so you remove 50% of the code and move it into external "plugins", or helper scripts.

The small script is now much neater, but suddenly users cannot find the code they wish to change - they have to grep through all your helper scripts and plugins to find the code to change.

Beacuse users cannot find the right code they submit patches making your script bigger and more complex.

Repeat indefinitely.

p.s. xen-tools 0.6 is out. It has plugins ;)

| No comments