Programming languages are not like hand tools

I have seen the “right tool for the job” comment one too many times, and felt like writing something about it.

Real tools are pretty simple, really. Things like saws and hammers have been around for thousands of years, and don’t require a great deal of thinking to understand. Some people are masters with hand tools and create wonderful works of art with them, but the tools themselves are not complex.

My programming language, Hecl, is a pretty simple one in a lot of ways (it has to be, to fit on cell phones), and at last count, the core has 7670 lines in a rough count that includes comments. That entails quite a few “moving parts” compared to even something like an electric drill. Programming languages are complex. Certainly to create, but even to use well; to understand the nooks and crannies and ramifications of the language’s design is not something that is accomplished in a few days for most people.

Your average programmer really doesn’t know all that many languages, and even those who know many probably don’t use most of them on a day to day basis. I like learning new languages, yet still wouldn’t relish the idea of going through the mental task-switch required to move between too many in one day.

What this means, is that when there is a job to be done, most programmers will reach for what they already know, rather than the best possible system, and that makes sense. If you know Python, why not write web software in Python, if you get asked to create something for the web? Or if you know Tcl because you create gui’s with Tk, you’re still likely to pick it when you need to create a little server. There are reasons why something like Erlang might make for a better server platform than Tcl, but is it that much better to justify dropping everything, learning a new language, committing to a new set of infrastructure requirements, and adding another thing to ask of people joining your organization? Most likely, it is not, unless the server you’re writing is for a telephony switch that has to be on all the time, in which case, yes, maybe you do need Erlang. If, as is often the case, it wasn’t something that had to be the best in the world, all that extra time to learn a new language would have been mostly “wasted” (ignoring, of course, the fact that for individuals, learning new things is almost always good, but that’s not what we’re talking about). Even the smart folks who hack away in languages like Haskell are fond of using what it has to offer, rather than jumping ship to something else at the first hint of the “something else” being better at their language of choice for a given task.

So both Tcl and Erlang were up to the task of creating a little server. You could have used Ruby or Python as well. Java might prove a bit more verbose, but it’s certainly up to the task. Any number of languages would be, of course. So it’s not like there is a “right tool” and a “wrong tool”.

Maybe a better analogy is languages are like toolboxes, or even whole workshops, full of tools. Most of them have most of the common tools like hammers and saws, some sort of web libraries or the means to create tcp/ip servers. Where they differ is in things like the amount of tools available, the specialized tools that you get for free, the craftsmanship and ease of use of the tools in the hands of both experts and beginners… or in some cases (lisp, say), some fancy tools and supplies that make it possible to build yourself some new tools if you need to (that only you know how to use, but that’s another topic). Some sets of tools really aren’t very good for some jobs – you don’t want to build blazing fast 3-d shooter games in PHP, just as you wouldn’t want to use a regular set of screwdrivers on a delicate watch. However, even though you’d want to use a toolset that also has some specialized tools for working on the watch, you’d rather own a toolbox that came with the watch tools as well as the regular Phillips screwdrivers, because those are pretty handy around the house, and it wouldn’t do to have only the watch tools for fixing common household items.

The point being, languages are big investments, so those that do more, even if they’re not the absolute greatest or first choice for a given task, are generally going to be more useful to more people, especially those just starting out who want a “safe” choice, a language they know will let them do a variety of things, rather than only one or two things (pound nails, say) really well.

Leave a comment