Hacker News new | ask | show | jobs
by anilakar 2916 days ago
Should everyone learn C? Yes. Should it be taught as the first language? Nope.

First of all, the quality of C learning material is abysmal. Most of the literature has been written before the era of C99 and encourages bad practices such as useless casting, single-letter variables, variable declarations separate from assignment and so on. At least some of this bad literature will inevitably find its way into the hands of newcomers.

That said, too many books also teach C as if it was the reader's first language. Were we not looking for a book for newcomers? Great! Now our glorious ANSI C book will be mostly about basic programming concepts and language constructs. The last chapter is most probably named "Advanced features" and this is where pointers are first introduced. In reality C is all about pointers and they should be taught as soon as the programmer knows how to write and call functions.

Learning C is also hard and requires shaolin monk-like self discipline. The Zen of C is satisfying but the path there is paved with segmentation faults, bus errors and endless hours of watching Valgrind logs. If anyone claims they've never had similar problems, they haven't really grasped the essentials of the language - see the previous paragraph.

1 comments

> That said, too many books also teach C as if it was the reader's first language.

I feel that's quite a general problem with programming languages. Many languages could actually profit from books that assume that the reader knows a couple of mainstream languages and explain the respective language's intricacies from that perspective -- also in a much smaller format.

I'd buy a small book (say the size of K&R or "the AWK programming language") for many interesting languages in a heartbeat.