New: Book Report: The Elements of Programming Style

Non-programmers might not realize it, but some computer program source code is even harder to read than the rest. Some of this code is so messy that an experienced programmer looks at it and says "I have no idea what is going on here. Maybe I could figure it out, but... what's on TV?" This book talks about some general principles of writing readable code; and there are examples to illustrate good and bad code.

This book is from the 1970s. The examples are in the FORTRAN and PL/I programming languages. They are in an old FORTRAN--I think FORTRAN has changed a bit since then. I think this book uses an old dialect. I'm not really sure, though. I don't know FORTRAN nor do I know PL/I. Actually, that was a problem with this book. The book had "before" and "after" examples to show how to "clean up" code to make it more readable. I couldn't always understand the "after" examples. Well, I could, but only after the head-scratching I associate with my attempts to read poorly-written code. For example, DO 2 I=1,N After looking at some other examples, I think that means "Loop N times over the block of code that starts here and ends with the line of code labeled "2".

As it was... I think this book might be of more interest to the historian than to the programmer.

Labels: , ,

Posted 2009-04-09

 Dan said...

I believe that book uses FORTRAN 66. In computer terms, that is practically prehistoric. When someone looks at old FORTRAN code and throws up their hands and says "oh my god this is that *old* stuff, I don't even know how to read this ridiculous punch-card-oriented line-numbered nonsense" and then some old geezer gets misty-eyed, they're talking about FORTRAN 77, which is *eleven years newer* than what the book uses. FORTRAN 77 has been thoroughly displaced by FORTRAN 90 which was revised in '95 and '03.

So what I'm saying is that's some ancient shit.

You're right about the interpretation of that line, by the way. My understanding is that PL/I should be a lot more palatable to modern programmers than old FORTRAN dialects; did you not find it so?

09 April, 2009 11:59
 lahosken said...

Maybe the PL/I was easier? But even in those parts of the book, I didn't really gain insight into elegant coding (historical and/or current). It was more like I gained insight into how I'd rather go out for burritos.

09 April, 2009 15:40