top of page

Mind Your Language!


For anyone not familiar with it, Mind Your Language (https://en.wikipedia.org/wiki/Mind_Your_Language) was a British sitcom running in the late 1970’s. The series focused on an ESL (English as a Second Language) class made up of a group of absurdly stereotypical students from multiple countries. Interestingly, the BBC executive who cancelled the show described the stereotyping as being offensive, even though it was quite popular in the countries portrayed. Also, the British cast members were all stereotypes as well, including the easy-going but rather repressed teacher, the “stuffy, imperious” principal, the “tea lady”, and the school caretaker, Sid. In one vastly-entertaining scene, the students thought they were becoming comfortable with English, until they tried to talk to Sid, whom they found entirely unintelligible, with his thick Cockney accent and rhyming slang (https://en.wikipedia.org/wiki/Rhyming_slang). Hilarious.


Getting back (https://www.til-technology.com/post/computer-languages-setting-the-stage) to programming languages, there are a number of factors influencing their evolution, but the two I find most interesting are the technological and the human.


Terms like “low-level” and “high-level” are relative by their nature, and the bar has shifted significantly over the years. In the early 1970’s, C was considered a high-level language, while it would now be considered (relatively) low-level.

Why?

Well, one of the key values of high-level languages is that they try to shift the focus away from how you do something, and toward what you want to do. In years past, this meant things like the ability to execute the same program on different processors, but you still had the ability to access memory directly, and needed to be very careful about storage and variables. In fact, I would say that C’s biggest strength is that it is extraordinarily flexible and powerful, while it’s biggest weakness is that it is extraordinarily flexible and powerful.

What C is not, however, is forgiving. It assumes that if you do something “stupid”, like storing a 10-character value in a 5-char string, you must want to do that for some reason. This, of course, can make it very difficult for beginners.

Apologies if I have mentioned this before, but the very first C program I built from scratch was a program to build a set of form letters based on a number of database queries. I built it, tested it, and everything was fine... until it came time to actually use it. At that point, I spent far more time than I should have needed (we live and learn) in order to figure out that the template letter I loaded had become corrupted and exceeded the size allocated for it in the program. All I could see at first was that it broke with an utterly meaningless error message, but that all the code looked perfectly fine.

But why, if C is so unforgiving, is it so popular?

The main reason, I think, is that the very power and flexibility that makes C so challenging for beginners also makes it very popular among experienced programmers - it allows them to do a lot of low-level work that would previously have been done in assembly language. That’s also why C has had such a powerful influence on language development. As the technology evolved, many languages tried to take the power of C and leave behind the dangerous parts, by improving so-called “memory management” to avoid issues like the one I describe above, adding support for “object-oriented” programming, which I may discuss at some future date, and by adding other tools to simplify programming or make it “safer” in any way possible.


Another side of this is the relationship between C and Unix (https://en.wikipedia.org/wiki/Unix). While earlier versions of Unix were written in assembly language, Version 4 Unix was written in C, setting the stage for portability of the platform.


This, of course, led to the wide availability of C, and most programmers being at least somewhat familiar with it.


Fast forward a few decades, and what you have is an ecosystem with vast amounts of code based on C, against the backdrop of a number of languages descended from (or influenced by) C. Younger programmers are generally exposed to C at some point, but do the bulk of their work in these younger languages. So now, C is considered a lower-level language, and is mainly used for niche applications such as device drivers (ie, programming which allows the operating system to interact with a device such as a mouse), operating system design, or security research.


In theory, a good programmer can (and should) build secure and well-structured code, with robust error-handling, logging, and so on. But in the real world, vast amounts of legacy code, increasing time constraints, increasing demands for functionality, the need for interoperability, and lack of time/experience/understanding are only some of the reasons we need to build tools which make it harder to make mistakes.

I just now thought of a good analogy – shaving. Assembly languages are like a straight-razor – if you know how to use it, you can shave very well, and also use it for other purposes, but can (almost certainly will) hurt yourself (or others) badly if you don’t know what you’re doing.



Languages like C are more like an old “safety-razor” – able to provide a good shave and safer, but less versatile as well. You can still do damage, though... I have a scar on my hand from a safety-razor – I was about 8 years old, and reached to fill a glass of water from the tap while my Dad was shaving. He didn’t know I was there, and cut me when he was reaching down to rinse his razor. (Not a big deal for me, but my mother freaked out a bit.)



More recent languages are more like the modern multi-blade razors (or electric razors). Much safer in many ways, but you can’t really do much with them aside from shaving.


I won’t include them here, but I also found links to an Onion article describing a five-blade razor (which later became reality – The Onion is frighteningly prescient, sometimes...), a Saturday Night Live sketch describing a 14-blade razor, and a MADtv sketch about a 20-blade razor. Some languages do go a bit overboard in some ways...

One final note is that we are now building more and more tools that build code for us. These can be as simple as text-editors that make it easier to view and modify code, to artificial intelligence platforms that are already building code for us. Who knows how far this will go? One thing I’m sure of is that this is all far from over.

Cheers!

Comments


bottom of page