mmcirvin: (Default)
[personal profile] mmcirvin
is here.

It contains Dijkstra's famous remark:
It is practically impossible to teach good programming style to students that have had prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration.
Didn't hurt me none. Hee-yuk, hee-yuk.

Also, I object to the sample of "everyday C code", intended to demonstrate how cryptic the language is:
for( i=0; (c=getchar())!=EOF && c != '\n'; i++ )
    s[i] = c!='\t' ? c : ' ';

Everyday, perhaps, but that's not what good C code looks like; that's what you get from a smartass kid who thinks that cramming everything into one statement in the source code makes it go faster.

update: It links to this list which has many, many more languages, but doesn't say much about them. I'm happy that it mentions RPL.

Date: 2004-06-05 12:06 am (UTC)
From: [identity profile] scoth.livejournal.com
I don't know about that C code... a comment would definately help, but how much time do you want to spend writing something to run this regex on the first line of given text: 's/\t/ /g'? ;)

I like the link though, it's missing many languages, but it's neat to see examples of actual code from some "historic" or different dicipline languages that you may never encounter in the normal day-to-day.

Date: 2004-06-05 09:56 am (UTC)
From: [identity profile] mmcirvin.livejournal.com
Writing it with braces and if-else blocks and separating out the getchar() from the for statement and such would maybe take a few minutes longer (though I think I'd actually find it faster to write it the long way). But every other programmer who has to modify those two lines, or (even more likely) make sure the problem isn't in those two lines while debugging a problem in the surrounding code, will save twice as much time in the process of analyzing the algorithm.

It's a fairly simple case, but if the whole file is like that, and dozens of programmers have to look at it over a decade or two, it adds up. You don't want to have to waste any cogitation on analyzing something simple while you're chasing down a complicated problem.

Date: 2004-06-05 10:03 am (UTC)
From: [identity profile] mmcirvin.livejournal.com
...At the very least, put some more parentheses in that second line. I mean, geez. I can't remember the operator precedence on that stuff most of the time.

I suspect that many compilers would even flag this with a warning or two under typical settings.

Date: 2004-06-05 10:09 am (UTC)
From: [identity profile] mmcirvin.livejournal.com
Holy shit! I just realized: that code also has a wide-open buffer overrun vulnerability. So not only is it a little hard to read, it's actually hiding a very serious problem.


Date: 2004-06-05 10:41 am (UTC)
From: [identity profile] mmcirvin.livejournal.com
...And, AND, even if you don't stomp on unallocated memory, the string will end up incorrectly terminated (by C standards) unless you do something else to it.

Yeah, that code example sucks. Actually, I'll admit that the mere possibility of writing that is a genuine problem with C.

Date: 2004-06-05 12:33 am (UTC)
jwgh: (Default)
From: [personal profile] jwgh
Aw, neither list mentions the LambdaMOO programming language.

Date: 2004-06-05 10:17 am (UTC)
From: [identity profile] mmcirvin.livejournal.com
The really big list is hosted on a site devoted to Java; the funny thing about it, as the linking page mentions in German, is that Java isn't mentioned on it (it's from 1995, an interesting snapshot in time in that a whole lot of Web-related languages were about to explode or beginning the process of doing so).

Date: 2004-06-05 11:10 am (UTC)
From: [identity profile] swinehund.livejournal.com
I'm pretty glad that I've had graydon breathing down my neck and complaining about scientists' code while learning to program (and also being 26 when starting rather than 15). It's made me a bit refreshingly anal, I think. Still not quite his exemplar, but at least I do have minor pangs of guilt when I know I'm writing something too sloppily. I also feel like I'm getting a bit too smart to be clever anymore. Clever is for teenagers. Clever is like 'I invented a secret code that no one else can read, so I am better than everyone else!'. I'm leaning more on the notion of someone who is really a master of the subject being able to clearly communicate the ideas to absolutely anyone.

Date: 2004-06-05 03:50 pm (UTC)
From: [identity profile] mmcirvin.livejournal.com
Yeah, and the thing about C is, if you learn it from Kernighan and Ritchie, they lean a little too heavily on examples designed to be clever rather than good.

I always tell people to read Steve Maguire's books, "Writing Solid Code" and "Debugging the Development Process"; they're full of true wisdom on this subject and related ones. Don't be put off by their Beast of Redmond provenance; Maguire's baby is Excel, which is one of the least sucky programs Microsoft ever produced.

Date: 2004-06-05 05:49 pm (UTC)
From: [identity profile] dumplechan.livejournal.com
Hooray!

"Writing Solid Code" is perhaps the best book I've ever read about programming. Clear, well-reasoned, and generally applicable. It does beat some topics to death at the expense of others (objects and source control being two topics they could have done more with), but even so, it's great.

Date: 2004-06-05 06:11 pm (UTC)
From: [identity profile] mmcirvin.livejournal.com
Actually, I think the sequel, "Debugging the Development Process", is even better; it's about software project management, so if you're a programmer you may not think you can benefit from reading it, but sometimes squeaky wheels can change things a little. It is not as well known as "Writing Solid Code", but it should be.

Date: 2004-06-05 12:05 pm (UTC)
From: [identity profile] pentomino.livejournal.com
Dijkstra seems to be a great source of 70's-era dramatic evangelism for programmers. I want to use GOTO's just to piss him off.

I notice Python's absence. And Ruby's.

Date: 2004-06-06 04:29 am (UTC)
From: [identity profile] kerri9494.livejournal.com
Won't someone think of Befunge????

Date: 2004-06-06 07:59 pm (UTC)
From: [identity profile] pentomino.livejournal.com
Certainly.

I wouldn't mention Brainfuck. It's close enough to a pure Turing machine that some computer scientist weenies might actually LIKE it.

Date: 2004-06-06 06:21 pm (UTC)
From: [identity profile] avocado123.livejournal.com
prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration.

Sigh. Guilty as charged. I couldn't even learn to code on a MUD, thanks to BASIC.

February 2026

S M T W T F S
1234567
8910 11121314
15 161718192021
22232425262728

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Apr. 9th, 2026 11:51 am
Powered by Dreamwidth Studios