Friday, December 21, 2012

Book Review: 21st Century C by Ben Klemens

21st Century C: C Tips from the New School21st Century C: C Tips from the New School by Ben Klemens
My rating: 4 of 5 stars

All engineering students take a one semester course fairly early in their education. My experience as a professor is that most of them promptly forget it and never make use of it again. I get alternately amused and discouraged at the lengths some of the students I work with go to avoid programming again. Because that one semester course teaches a programming language, but does not teach someone how to program. This book is meant to take someone through that step. It is sometimes hard to follow (my heavy programming in C was years ago) but it gets someone to where they can be productive.

When someone is referred to me an claims to have some programming background, I have learned to ask a simple question: have you programmed with libraries? I usually get a blank stare, and I know that this person may have taken a class, but cannot do anything useful. What this is how to make programming in C useful. So it builds in working with the various utilities that make C programming useful (I learned pkg-config and profiling with valgrind with this book. And before I used to be able to edit Makefiles but I would not try to write one from scratch) And, of course, working with C using some fairly useful libraries (if I am programming I am general pulling data from databases and using numerical methods, so I am rather pleased at the use of SQLite and GSL as example libraries).

The various tools are very useful. Programming without learning to use the various utilities such as debuggers, library managers, packaging, etc. is an exercise in frustration (and is how the standard introduction to programming course is set up).

Am I a convert? I still regard Python and R as my preferred environments, and I'm not swayed by his arguments that C is a "punk" language. I still find that all the little cruft such as pointers and their management something I'm glad to avoid. But I also regard one of the best features of Python and R the fact that I can dive into C when I need something fast and efficient. So being able to do this more effectively is good to improve my toolkit.

The book is not really for pure beginners. If you did not already have some background in C, you need to get that somewhere else. I got in trouble with some of the examples, so it helped that I have used many of these tools before (even if not all that effectively). It also is opinionated, presenting one way to do things. (of course, that is very useful to someone starting out, knowing one good way is better than having a dozen options in front of you when you don't know what is what). But it can be very good for someone who needs to go from "I have learned C" to "I know how to effectively use C."

Note: I received a free electronic copy of this book from the O'Reilly Bloggers program.

View all my reviews

I review for the O'Reilly Blogger Review Program

No comments: