Programming Languages Oddity

Programming languages can be (and should be) clear to write and read, and no doubt that some of them, especially the new generations of languages, are just that. But we can’t escape the fact that a programming language is still an artificial, human made product, and so it sometimes looks and behaves quite, well, strange.

In this post I’ll show some of the most strange and bizarre programming languages constructs, structures or syntax. Things that always make me wonder — what were they thinking of? Let’s be honest — we’re not writing things like that anymore –

mov dptr, #10hmovx a, @dptrinc dptr

Those days are over, thanks god, but still, sometimes the code we write can look as bad. Here are some examples that form, in my opinion, some of the worst constructs in programming languages. Enjoy!

Compilers have this annoying thing — they must know when a block of code begins and when it ends. Before the clever invention of curly brackets entered, each language found its own way. Remembered for good is the Pascal’s way with its “begin” and “end” keywords. But why use English words when we can invent some? How do you end a while loop in VB6? Well, it’s called “wend” meaning “while end”. And the python “elif” word for “else if”. I don’t know about you, but every time I read and write it I have a vision of Lord of the Rings with its elves.

But the prize for the most gruesome invented words go to the “Cool” programming language — I know, I know, it’s not a “real” language but it’s quite real for those who learn compilers theory. In this language there is a nice way of ending a block. The keyword for ending a block is the keyword that begun it, in reverse. “if” ends with “fi”, “case” ends with “esac”, “loop” ends with “pool”. Oh my.

Sometimes a language must express certain ideas, and those ideas must be different from another, that should be yet different and so on. That makes the code very, very verbose and oh so strange. C++ is the definite queen of defining things with all possible ways. Look at this –

const int*const myFunction(const int*const&)const;

Say “const” one more time!

We all love arithmetic signs, they make our life easier. When you write “a + b” you just mean what is written. The equal sign is a little bit problematic. It can mean an assignment, like a = 5, but how would we ask if a is equal to 5? We got used to it, but guys, come on, writing ‘==’ is not natural! But as mentioned, we got used to it. But then came Javascript and boom, we got ‘===’. When I show this operator to my students they start to laugh.

Speaking of signs — sometimes the language designers forgot that we are human beings and make us write all kind of encrypted-like code that looks like a monkey hit randomly on the keyboard. I just love the C pointers and addresses:

**p = &(*q)

Or

int **a = (int*)(malloc(sizeof(int)*10);

and all kind of weird mutations like

&a[i], *(a+1), *a[9], &&a

Ok, the last one is a compilation error but you must admit it looks just as rational as the rest.

So, what is your worst code list? Which languages win the most unreadable? Tell me in the comments :)

--

--

I’m an academic and freelancer instructor, teaching computer science and software engineering for more than 17 years now.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Shay Tavor

I’m an academic and freelancer instructor, teaching computer science and software engineering for more than 17 years now.