Linked by Thom Holwerda on Wed 3rd Oct 2012 01:41 UTC, submitted by MOS6510
General Development "Originally published in 1978 and updated in 1988, The C Programming Language is considered a 'must-read' classic by most programmers and is generally known simply as 'K&R'. To mark the publication of an ebook version of the 1988 second edition, we interviewed coauthor Brian Kernighan about the C programming language, the book, and future trends." And an Oxford comma to boot. The way it should be.
Thread beginning with comment 537391
To read all comments associated with this story, please click here.
How it should be done
by kwan_e on Wed 3rd Oct 2012 02:22 UTC
Member since:

How to write good code that works well and does something useful. In the early assignments in the class, I ask students to modify existing code, perhaps by rewriting it in a different language. Or I might ask them to write a library that implements part of a standard, or that interfaces with a database.

That should be the way to teach programming. The exercises and assignments in programming classes are contrived and boring and not very pedagogical.

Nothing makes you learn better than by implementing standards, etc. I feel like I learnt more about programming by implementing stuff from standards, like a PDF parser, a DEFLATE decompressor and an HTTP/1.1 server than anything I had to write in university.

It also teaches you how to read documentation and figure out the author(s) intentions and implied requirements, and thus how to be better at technical writing and communication in general.*

* Seriously, has anyone tried to implement DEFLATE from the RFC? It is one of the least readable standards I know of.

Reply Score: 5

RE: How it should be done
by ssokolow on Wed 3rd Oct 2012 09:25 in reply to "How it should be done"
ssokolow Member since:

Agreed. Not only would it be less boring, but some of my best low-level learning has come from implementing and optimizing a pure Python metadata-extracting GIF parser.

(I'm primarily a Python and PHP programmer, but the only existing Python imaging libraries decoded the entire image into memory when all I wanted was to check whether the GIF was animated, maybe count frames, and maybe do a quick, superficial corruption check.)

In fact, python -m cProfile -s cumulative ... was where I got clued into how expensive syscalls are... and I'd already taken the entry-level and C/C++ programming courses my University offered.

(Sadly, I'd also read K&R when I had to make that discovery myself. It's an excellent book but makes the assumption that some other resource has already taught you things like what a buffer overflow is and why it's bad.)

Edited 2012-10-03 09:37 UTC

Reply Parent Score: 3

RE: How it should be done
by Lennie on Wed 3rd Oct 2012 11:19 in reply to "How it should be done"
Lennie Member since:

The biggest problem with RFCs is they usually don't give a good introduction so people with no knowledge on the subject can't wrap their mind around it.

In other words, a lof assume (deep) knowledge of other things.

Edited 2012-10-03 11:24 UTC

Reply Parent Score: 3

RE: How it should be done
by dnebdal on Wed 3rd Oct 2012 12:28 in reply to "How it should be done"
dnebdal Member since:

If you think that's bad, try to write a program that outputs a bare-minimum font in OTF format (that will show up with the right names on more than one OS). It's all written by people who assumes the readers will already know the general idea, none of the standards agree (or even address) what parts are optional vs. required, and certain parts (CFF, I'm looking at you) are horribly obtuse - not to mention that you have to guess which random old adobe-produced reference it's actually documented in.

(And don't get me started on the variable-length integer encoding used only in the CFF block. )

Edited 2012-10-03 12:33 UTC

Reply Parent Score: 2

RE[2]: How it should be done
by kwan_e on Wed 3rd Oct 2012 13:01 in reply to "RE: How it should be done"
kwan_e Member since:

If you think that's bad, try to write a program that outputs a bare-minimum font in OTF format...

You've piqued my interest and I'll probably try it. I pretty much have the same experience with the PDF parser, in that Adobe "standards" "documentation" is really poor and all over the place.

The good thing about RFCs is that they do make it easy to look for references.

Reply Parent Score: 2