Tue, 06 Nov 2007
Bruno
De Wolf blogs about programming languages. His statement: "all
programming languages suck". Not sure whether I agree. But's let look at
his arguments. In his words, a good programming language, among others,
is readable by a guy who didn't write the original program and who
doesn't know all the language details or libraries
.
Personally, I don't agree. Code readability, above all, depends on
the programmer. Programming languages that impose structure can probably
help, but it's possible to create unreadable code in any
language—that doesn't need goto.
Since I went to the 'karel de grote' institute of higher education, I
learned quite a number of
programming languages. Hairy code is possible with all of them.
Unreadable code is easy with some of them, and some of those I do
consider good programming languages. I guess my criteria are
different:
- Flexibility. In theory any programming language
that is turing-complete will allow one to write any imaginable program.
In practice, some programming languages will require you 100 lines of
code to do stuff which can be done in three lines in another language. A
programming language that doesn't require you to turn your brain upside
down three times to figure out how to get something done is a better
language in my book than one that does. A language that provides
multiple ways to do any given thing is very strong for this particular
requirement; it allows you to pick the best way to do anything in order
to prove readability. The alternative is for you to have to write some
extra hairy code because the language requires you to jump through silly
hoops.
The Turing Machine utterly fails this criterion. Any language that lacks
pointers or references or something similar fails it, too, though not in
such a dramatic way. Perl is very good in this particular
requirement.
- Compactness. I blame COBOL for this particular
requirement, but it's still rather important, in my opinion: a
programming language should not require me to write an entire novella
for a simple 'hello world' program. Obviously COBOL utterly fails this
requirement. Large parts of Java's libraries do, too. Perl and C are
rather good at this particular requirement.
- Resembling english. COBOL fails this requirement,
too—COBOL is english, not a programming language.
Brainfuck fails, as well. Obviously. Mostly everything else passes.
Except for windev, that is, which
resembles French. Hah.
That's it, I guess. In my book, a programming language is a tool to
get a job done. A good tool is flexible, not too unwieldly, and somewhat
intuitive. Like a hammer. If you want to build a table, you probably
need a hammer, among other things. The better the hammer, the more
likely it is that you'll get a nice table. But even the best hammer
won't get you a wonderfully crafted table if your carpenter sucks at his
craft.
And so it is with programming languages: it might help if you use a
proper language, but any good programmer can write readable code in
any programming language.
/en/computer/code
PermaLink