After Simon's interesting talk on Thursday I got to thinking about using the correct tool for the job; is it better to use smaller specific tools, such as sed, or one general purpose tool like Perl.

Using sed, for example, to perform text transformation does have a couple of advantage
  1. Performance -- the specialist tool can often complete the job a lot faster

  2. A more appropriate way of expressing a solution -- specialist languages, such as sed, can provide more elegant way of solving a particular problem. As Simon pointed out, this may actually suggest a completely different and better way to write the program.

However there are two counter arguments.

  1. The amount of mental effort required to learn and program in, possibly many, different mini languages. This can make maintenance in particular very expensive

  2. Over time programs often grow and become more complex. Mini languages can have trouble scaling with this complexity and elegant solutions can become nightmarish very quickly. It was interesting to see some of the larger example scripts on Wednesday, they made the worst Perl script look elegant and expressive.

So what is the answer? Well in true consulting style the answer is 'It depends'.

Small jobs with very fixed scope may well benefit from the use of specialist tools, in particular when these jobs are running frequently and performance improvements accumulate each time it is run.

However often several different small tools have to tied together into a script and very quickly it becomes apparent that a more powerful tool such as Perl (or Python, Ruby etc.) should have been used. Unfortunately if can also become an exercise in self indulgence to see how many 'clever' solutions can be packed into a single script.


powered by performancing firefox