Too many languages

Seriously, how many programming languages are really needed?

A bit of context here. The first programming language I learnt was Basic on a ZX Spectrum (that ages me, doesn’t it!?) and I knew it inside out. Professionally I started out as a Cobol programmer on an IBM mainframe (seriously, I’m old!), wrote code in Visual Basic 3, 5 and 6 (VB 4 seemed to pass us by) before getting serious and writing a reasonably sizeable project in C.

I’ve written a big project in Perl, used PHP both standalone and as part of the WordPress ecosystem, toyed briefly with Java and played with Python. In between I’ve written odds and ends as Bash shell scripts, REXX, Javascript, and had a look at Groovy and C#. As part of other projects I’ve had to become familiar with SQL and once upon a time wrote a few routines in PL/SQL.

There are probably a few I’ve forgotten – I definitely remember a mainframe language for generating input screens whose name I can’t recall.

I haven’t used Ruby. Or Swift, Go, Lua or Scala. Or indeed any one of the huge number of other languages that exist.

Why so many? Wouldn’t it be better if there were fewer languages and programmers could really get to grips with them? There is an argument that a good programmer can use any language, because good programming is about understanding algorithms and concepts rather than syntax, and it’s easy to pick up the peculiarities of a specific language. Languages are tools, and you should use the right tool for the job.

That’s true only to an extent. Every language has its nuances and most importantly gotchas – little things you expect to work a certain way and just don’t. When you start using a new language you have to figure out all the simple things from scratch – how to I read a file in this language? How do I use regular expressions? What’s the best way to handle exceptions? All syntax, but you can spend a lot of time searching for how to do the basics before you can even get to the problem you’re trying to solve in the first place.

Let’s say you need to write a little data conversion script to convert a text file from one format to another. Are you better off using a language you know inside out or one that’s well suited to that kind of work? Perl is great for that and writing and compiling a Java program would take longer and be overkill. However, if you’re a great Java programmer it might be quicker than learning Perl. Conversely if you’re writing a big system and you start out writing it as a combination of Perl scripts, is there a point at which you should step back and decide you really ought to be using something better suited to the job?

I’m not intending to start a flame war on the pros and cons of each and that’s just a rather contrived example. I’ve done both. I’ve written a short script like program in Java simply because it had to interface to another system that only provided a Java API. On the other hand my magnum opus, my coding Lord of the Rings as it were, is a Perl system that sort of evolved from a few scripts into an epic. Both were pragmatic choices – one because it was the only choice, and the other because it was what I knew and by the time the codebase had grown it wasn’t worth starting from scratch in an arguably more appropriate language.

I’m not suggesting there should be one language to rule them all. Writing a major client server suite requires different tools to writing a quick script. I just don’t understand the impulse to solve problems by inventing entirely new languages. Apple are now promoting Swift as a language to replace Objective C for developing on iOS. I’m sure it has advantages, but did the world need a new language? Surely there are already languages that meet the requirements of being simpler than Objective C?

Swift sounds like a classic case of NIH – Not Invented Here – syndrome, whereby a company will reinvent a wheel just so it’s their wheel. Other new languages may be invented to use new ideas in programming theory that are difficult to retrofit to older languages. It’s probably fair to say that languages designed as object oriented from the ground up are more elegant than languages with object terminology and features bolted on.

There are reasons, some good, some bad, for new languages, but it’s a headache for programmers. Which to learn? As a professional developer, you need to specialise but you also need to keep your skills current. It’s hard enough with a single language, keeping up with new frameworks and libraries, but there’s always the risk that your language of choice will fall by the wayside in favour of the new flavour of the month.

Even for a hobbyist it can be a pain. I’ve been playing with Samsung SmartThings development and that means learning Groovy. I can see why they chose it – I’m guessing the underlying platform is Java based, and Groovy is a natural fit for scripting in that environment. For those of us with other languages under our belt, though, it’s just another one to learn to use the platform.

So I’ve rambled on, but what’s the answer?

For professional developers Java is still a good choice. It’s widely used, cross platform and many of the other domain specific smaller languages use a Java-like syntax.

In the Windows world C# is the current winner, and to me it looks like a more modern Java with some of the rougher edges removed. There is an open source implementation, making it nominally cross platform.

Web developers need to know Javascript, PHP and maybe Ruby or Python for larger scale applications. I’m ignoring HTML and CSS as they’re display languages rather than programming languages, but obviously they’re essential as well.

Everyone should know a scripting language. Ad-hoc scripting can be a major time saver. Perl used to be a good choice when you wanted to move beyond simple shell scripts, but it is rather quirky and Python might now be a better bet. Knowing the shell language of your platform, whether it’s Bash on Linux or Powershell on Windows, is always going to be useful.

That’s the status quo now, but I think the options can still be streamlined and I’m starting to think that Python might be the language to do it.

It’s great for small scripts and system management tools, and is already used extensively for that purpose on Linux. Frameworks like Flask and Django show that it can be used for web development and be a potential replacement for PHP. Standalone web servers such as Gunicorn help to take it into the sort of application server territory occupied by the likes of Tomcat and Java. The jython implementation is ideal for embedding it as the scripting language for Java applications.

To cap it all, it’s being taught in schools. Primary schools, at that. It really has a chance of becoming ubiquitous.

That is, if the Python world can finally get the transition from version 2 to version 3 completed. But that’s another story…

in Random Musings

Related Posts

2 Comments

  1. David Worton 21st August 2017
  2. seanbAuthor 21st August 2017

Add a Comment

Your email address will not be published. All comments will be reviewed.

This site uses Akismet to reduce spam. Learn how your comment data is processed.