Why do we have different programming languages?

I made a little girl cry recently.

"But why do I have to learn Python?" She wailed, "I like Scratch!"

"I know," I said, "But there are different programming languages for different sorts of tasks."

"That's stupid" she said, with all the perception of 6 weeks Code Club experience. "You can do everything in Scratch."

I found it hard to argue with the twelve-year-old - you can do just about anything with the child-friendly Scratch programming language. You can even build an entire Operating System.

Here are some analogies, of increasing complexity, to try and describe to a non-technical person why we have different coding languages.

The Orchestra

A guitar and a violin are both stringed instruments, but they make very different noises.

You can hit a guitar with a drum stick, but playing a drum kit is easier and produces a wider range of percussion sounds.

Sometimes, you just want to do one thing and do it well. Playing the Triangle gives you one sound, consistently.

You can, of course, use a synthesiser to play more-or-less any instrument. But synthesisers require you to play everything on a keyboard, and they are complex instruments to understand and learn.

Different programming languages are usually specialised to particular tasks. Sure, you can build a 3D adventure game in Excel, but it is easier to use the right tool for the job.

We learn and evolve

In 1934, a young Alfred Hitchcock released "The Man Who Knew Too Much". A tense thriller which opened to worldwide acclaim. In 1956 he remade it.

The newer version doesn't just have a more technically advanced production - Technicolor! Hi-Fi sound! Widescreen! - it has 20 years more film-making experience behind it.

The same is true of programming languages. As we learn what computers can and can't do - and how humans like to work with them - we build new languages to take advantage of that knowledge.

Man's monstrous ego

Some people just want to create something in their own image. Someone, somewhere, didn't like the way one programming language handled certain features - so they split and created a new language.

A cult can develop around a charismatic leader. Entire conferences can be dedicated to obscure languages which attract acolytes. Each convinced they've found the "one true way" to program - and that everyone else is heretic scum.

Humans, eh?!

A counterpoint

But, you don't always need to use the right tool for the job.

My favourite example of this is colour recovery from black-and-white TV broadcasts. How would you take a B&W film and recover the colour information from it? Not artificially add realistic colours.

Perhaps you'd use OpenCV? Experimental C++ bindings? Write some AI tool to burn through parallel GPUs?

Nope. A dedicated team built an accurate program in 3,400 lines of BASIC!

Because the world is round

Is poetry more romantic in French? Is Shakespeare best performed in the original Klingon? Is demon summoning most effective in ancient Latin or Sumerian?

Some of these are a matter of taste. Some are just what we are used to. And some are just tradition.

Computer languages are an abstraction. We don't want to deal with the messy business of flinging electrons around circuit boards. Different people have different preferences for how they like to code.

Perhaps, once everyone has finished rewriting their websites in flavour-of-the-month JavaScript frameworks, we'll see a renaissance in hand-crafted bits and bytes.

Or, just perhaps, the next generation will rewrite everything in Scratch!

Share this post on…

6 thoughts on “Why do we have different programming languages?”

  1. Mark Heath says:

    It would be like asking, what’s the best camera? is it a DSLR, mirrorless, phone camera, ENG, Red? The strengths of one camera/language conflict directly with the strengths of another language. You cannot have one programming language to rule them all.

    Lets take for instance a little project I wrote recently, my daughter and I like to play Boggle, but not competatively against each other, so I wrote a python script to find every word possible in the current boggle board we were searching. The python program took 7 and a half minutes to run. I then wrote it in c/c++ (non oo c++) and it took 8 and a half seconds to run (with some optimisation I got that to 7 seconds) I tried swift and it took 4.5 minutes to run. And then Rust (45 seconds), so if speed was your only goal, why program in anything other than c/c++ ? Why did I write it in python first? Or what if making iOS applications was my goal?


What links here from around this blog?

What are your reckons?

All comments are moderated and may not be published immediately. Your email address will not be published.Allowed HTML: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <p> <pre> <br> <img src="" alt="" title="" srcset="">