loving C

Over on the Beautiful Code blog, Michael Feathers has written about loving C:

“I remember flipping through the Kernighan and Ritchie book decades ago, trying to pick up the language. I remember a lot of frustration, but I also remember a lot of satisfaction. C has its quirks, but in retrospect, they are a lot less mysterious than the quirks of many other languages. They don’t require deep reasoning. The behavior of a construct is either defined or it isn’t…”

There’s a discussion going on in the post’s comments too, mostly between proponents of C versus C++.

The thing I value most about C is its simplicity. As simple as possible, and no simpler. I feel that pretty much everything that came out of the Ritchie / Thompson / Kernighan / McIlroy group has that same quality — a deep deep cleanliness. C++ has none of that, in my opinion. It was designed specifically as a hybrid, an attempt to bring the features of one “desirable” language into the space of a different language. The cracks show, and have been made worse and worse over time. The fact that C pretty much stopped evolving very early on is perhaps a factor that helps keep it young and fresh. It does one job and does it well, and has no pretensions to be all things to all men.

There’s a trend in British politics (I’m sure the other major democracies must have it too) in which our political parties seem to be playing catch-up all the time. Instead of saying “this group stands for X”, and then dying out when X is no longer popular or relevant, they say “this group stands for being popular”, acquiring new policies and values simply in order to remain “current”. C++ seems a bit like that to me, and Java too. Everything but the kitchen sink gets thrown in, instead of simply admitting that some problems might just be better solved using a different language. C didn’t do that (much), and has remained clean and simple as a result. I’m not ashamed to say that I love it too.

(I fear that Ruby may be taking its first steps down the “kitchen sink” road…)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s