Use the right tool for the job

It amazes me time and time again that I see so many people struggling to program a website to do what they want, but the language they are using has too many restrictions. It also amazes me when I see a website that would be so much better if they'd just used a different approach or a different tool.

I worked at IBM for 6 years and during time I realised that the IBM staff are no more talented and no more intelligent than their counterparts in much smaller companies. Sometimes quite the reverse because of the ego that being accepted into such a prestigious company frequently clouded their judgement and made them to confident in their own opinions.

I am drawing specific reference to my time at IBM because when I was on the payroll, there was a big thing about java. Java was invented in the early 1990s and underwent a good marketing campaign and quickly became a huge buzzword. Everything had to be java.

Unfortunately, nobody seemed to realise that java was just a tool. In the same way that it would be nonsense to suggest that a hammer is all you need for your home DIY needs, it is also nonsense to suggest that java should be used for every programming task.

And yet, this is exactly what happened.

Graduates were coming out of university and starting at IBM (and other IT companies) that were only able to program in java. All of the decades of experience that had been learned about other programming languages were being thrown out of the window and the wheel was being reinvented all over again.

Now java is a very easy language to pick up and learn. It is very straight forward and ordered. So, it is used as the first language to teach by many IT courses. Unfortunately, most then stop there and the students do not learn any other languages.

A hammer is very easy to learn how to use. But you wouldn't dream of using a hammer for every DIY task. I agree that a hammer can quite successfully insert a screw into a piece of wood with enough force. But a screwdriver is likely to be quicker, last longer, and cause less damage. Saying that you only know how to use a hammer isn't good enough. You will be expected to learn how to use a screwdriver or be branded a fool.

I shouldn't restrict my attack to just java developers, most people have a favourite or preferred programming language. I focussed on java because that affected me directly while I was at IBM. Poor products were being produced and I was embarassed by my association with them.

I have friends who have their own favourite languages and 9 times out of 10, they will use it for any programming task that arises. I try to instill in them that they should use the tool that matches their criteria, and sometimes it works. Frequently, however, they are not even aware of the criteria, only a vague idea about the end product.

If you are putting up a shelf on a wall, you can just get some nails and a hammer, and it might even work for a few days. But if you consciously think about the criteria for this shelf, you may decide that it needs to be strong and securely attached to the wall. As it is a cantilever design, nails would be easily ripped back out of the wall, so screws would be better. This job requires a screwdriver, maybe a drill and some rawl plugs too.

The tools have been matched to the job.

When choosing a server side language, choose your criteria first. Is it going to be handling a lot of strings? Does it need to give nice user messages in case of a catastrophic failure? Does it need to run within the apache process or can a new CGI process be spawned (your host may place restrictions on the number of processes). Once you have outlined your criteria, you can choose the best language from those allowed by your host.

The same goes for client side languages. Would asking a visitor to install a plugin frighten them away? Are there cost restraints for the job restricting the tools available?

Is performance an issue? Different languages can be faster at different tasks. Perl is very fast at handling text and large data files, PHP starts up quicker though so shorter scripts may run quicker and it has less reliance on external libraries that may not be available on your host. Java is better at handling numerical data but has a huge performance hit if it has to start a new process and failures are ugly with no ability to display a pretty message to the visitor.

Don't be the sort of programmer who is too in love with his hammer to do a better job with a screwdriver. Maintain your objectivity, no language is good for every task, even your favourite one. Choose your criteria first and then choose the best tool for the job. It is not acceptable for one of your criteria to be that it uses a particular language. You wouldn't buy a £1000 shelf just because it was designed to be used with nails when a £10 screwed in shelf would suit the job better.

Newsletter

Regular advice and tips on

  • Website marketing
  • Improving sales
  • Avoiding pitfalls
  • SEO
  • ...and much more