Search This Blog

Saturday, February 2, 2013

C in Education and Software Engineering – Retrospective

Its more than 20 years ago that I wrote C in Edu and SE[1]  I had mostly forgotten about it until I saw Mahesh's review. So thanks Mahesh for your kind words.  The trouble is I dont exactly agree with myself from 22 years ago ;-)  You see even in 1991 what I was saying was that C is a stupid language to teach programming with – education – unlike say C++ which is a stupid language – period.

IOW what I was trying to say back then was that if learning to program is the goal, then a path that goes through C-land is going through bad-lands.  In short an argument not against C but against an ill-conceived learning-curve.

What has changed now?

Just as it was fashionable to diss Fortran, Basic and Cobol in 1991, today the stoopid languages are php and javascript. Now if we take the current ubiquity of php and javascript, this means that today the number of programmers who are growing up with half-assed languages nowadays is much larger than then.

And what about the negative contributions of today's mainstream languages like Java?
Java is not, generally, a hard enough programming language that it can be used to discriminate between great programmers and mediocre programmers

Joel Spolsky – The Perils of Java Schools
Now this looks like a silly statement right? After all if our languages become simpler isn't the world a better place?

Well unfortunately no.  And this is where I need to disagree with what I said 23 years ago: that a language with firstclass data structures is a wonderful thing.

The fact of the matter is that Java supports better first class data structures than C.  And yet to conclude from this that Java programmers have more profound wisdom on that account is a bit naive.
The programmers you'll be able to hire to work on a Java project won't be as smart as the ones you could get to work on a project written in Python. And the quality of your hackers probably matters more than the language you choose. Though, frankly, the fact that good hackers prefer Python to Java should tell you something about the relative merits of those languages
Paul Graham – Great Hackers
In fact I have repeatedly received anecdotal evidence that a Java programmer is asked in an interview to explain quicksort and the answer is java.util.Arrays.sort!! Which suggests that if anything the average programmer going from C to Java tends to slip down the knowledge hierarchy from knowledge – of data structures and algorithms – to mere information of what is where in the Java libraries.

In all fairness, in the 10 years since Paul Graham wrote that, Java has moved from mainstream to old-fashioned and python has become mainstream, so now I dont believe it is as true today as when he wrote it.

Speaking in the rather different context of making quantum physics accessible, the notable physicist David Bohm came to the need to rejig our common language. He called this new language

The Rheomode

and in it are a few new words, one of which was the word relevate  – a verb form of 'relevant' having also an element of 'elevate' as in 'lift into focus'. [2]

So now coming to programming languages, we see that different languages relevate different sets of concepts and correspondingly unrelevate others.

Now why use the verb relevate instead of the adjective relevant?

Because the adjective puts the emphasis on a static noun whereas the verb puts it on the action (or better act-ing) itself.  Think of relevating as using a camera's zoom/pan.
  • Too much zoom-in and I dont have a camera but a microscope
  • Too much zoom-out and I have not a photo but the universe (And then where does the photographer stand?)
  • Just right and I have an elegant shot
So much for a still shot.  When we come to moving shots (aka movies) we can:
  • Show the moving object – say a fast car – as still and blurring the background – panning
  • Capture different parts of the movie at different shutter speeds, zooms etc – lets call it virtual panning
The details of the techniques/technology of course are not what I am talking about (nor do I know about). The main point is that to show (off) a certain something, focus on that something is not more important than the right level of defocus on the background.

Here's an infobyte:  The blue whale at 30 meters is twice the size of a sperm whale – 16 meters – and is the largest animal on earth.  Now look at these pics. 


Which conveys more largeness? Why? Clearly

Context Relevates

And so what the movie-maker's tools and techniques do for her, programming languages do for us.

Programming languages are relevating tools

For example:
relevates type-correctness in a very delicate way – just so much that much of a program's semantics are guaranteed once type-correctness is given. And yet not so much as to lose type inference and static type-checkability.  This is what spj calls the Damas-Milner cusp [ref?]
relevates a certain paradigm neutrality ie a programmers can write functional or OO or imperative or scripting or... without python itself taking a side.

relevates a certain finely balanced level.  Not so low that it can be called assembly language and yet low enough to do whatever is needed whenever its needed.
Prior to Erlang, we had processes that were clean and inefficient; or threads that were efficient and messy. Erlang takes head-on the ''impossible idea' that a process can be as efficient as a function call and as elegant as a classic unix process.  What FP relevated as first class higher order functions, Erlang relevated into first class higher order processes.

Finally… coming to
What does Java relevate??  I have not a frigging clue!
And so when I wrote this in 1991, I was saying – perhaps too strongly – that 'thinking like a machine' (operational thinking) is a terrible idea.  Now the pendulum has swung the other way and modern kids are not able to think like a machine even when the need arises.  Hence my need to redress the balance.

[1] Published in ACM SIGCSE here
[2] Cant find stuff that has the quality of Bohms original.  Some starting points are Relevant and Rheomode.

1 comment:

  1. this was a good discussion about languages and about which languages are better to use these days.