Day by Day Daily Cartoon by Chris Muir

The Mad Scientist... Mwahahahahahahahaha

Wednesday, January 14, 2009

Programming Languages and Salvation

Ooh, I'm on a roll here.

How do these two compare? But first, some digression to set up the topic.

Here is a 1 year old comparison of the top 5 most popular programming languages in use (source is TIOBE, go ahead and quibble with their stats if you want, but I just want to make a point here).

19.022% Java
15.931% C
10.116% C++
9.161% Visual Basic
8.882% PHP

What do these languages have in common? You won't think they did, really, but here's what - they're not as 'correct' as Ada. Let's take them one at a time.

Java is really popular because it supposedly allows you to write code that's easy to port - move to a different system altogether. It is not strongly typed, though, and it is quite easy to write very buggy code.

C is the quintessential old-school programming language, and has been called the portable assembler, not without reason. Usually, you would use C to write really low level stuff such as device drivers, operating systems, and code for embedded systems. And it is super easy to write WTF code.

C++ is an object-oriented superset of C, which simply means you can write WTF code in even more ways. What fun.

Visual Basic is a Microsoft offering, and it should come as no surprise to everyone that a lot of Windows software is written using VB. And because it looks easy to use, WTFs wander everywhere amongst the VB community. A lot of programmers look down on VB programmers, to be honest.

PHP is really a web-centric scripting language; but even using it in its proper environment WTFs are also everywhere.

Now, let's look at the more 'safe' languages - where it's harder to write code because the language (and the compiler which enforces the language) forces you to write proper code which is more correct and more bug-free - and what are the numbers associated with them? Well...

Pascal (an Algol-variant, and hence kin to Ada) comes in at ~0.67%, and Delphi (another Algol variant) weigs in at 3.3%. C#, a stonger-typed language with Java-like (and hence C-like) syntax, comes in at 5.6%. Ada isn't even in the list.

We now know, therefore, that despite the various weaknesses of the top 5 programming languages, they are in use by over half of the programmers around. But why? All general-purpose programming languages are Turing-complete; that is to say, whatever you want to compute in one, you can theoretically compute in all the others. So why use an unsafe language, when there are plenty of safer ones around? Well, the answer is that programmers don't like safe languages. Let the runtime or the garbage collector take care of potential memory leaks, why should I have to write code that manages this? Why do I have to explicitly typecast? Let the language do the conversion for me. Now I must note here that not all programmers are like this; many just grew up with C, for instance, or its descendants, and Ada is very verbose.

Never mind that. In the early era of Windows, it was a cooperative multitasking environment. Windows 3.x as I mentioned earlier had no notion of security whatsoever. Microsoft assumed that if you screwed stuff up, it was because you didn't mean to (why would anyone deliberately stuff up, after all) , and so its safety precautions were based on that.

Strange, because the first PC virus came on the scene 1986 as a joke. And now, of course, we know that given the right way and the wrong way of doing things, people will inevitably choose the wrong way if it seems easier than the right way. Raymond Chen's blog is replete with examples of such behaviour.

Software engineers and developers, especially those who write operating system code, now know that they can no longer assume the 'user' or programmer to be benign. In fact, their default position is now to consider all the many millions of ways someone can try to break their system, and toughen it up even more. This is why system administrators lock down corporate and public computers, after all.

And now you begin to see how this ties in with salvation. You will not find a single IT guy out there worth his salt, who believes that people are by nature well-behaved on computer systems, they just need the proper knowledge and tools. Not one. To a man they will affirm that most if not all users are either incurably stupid, incorrigibly pig-ignorant, or far more convinced of their skills than they actually are skilled. To make things worse, they themselves slip up too.

Which is what Christians including myself have been saying all this time, really. People are not good by nature. We're lazy. We prefer the easy way, even if it's the wrong way. We're plain bad.

And we need someone who's like us, and yet not like us, to break the cycle.

No comments: