Monday January 14, 2013

The Unreasonable Effectiveness of C

As a fascinating followup to the link I just posted on Objective-C pitfalls, here’s a great post by Damien Katz, the creator of CouchDB. CouchDB is a schemaless database that represents the “documents” it stores as JSON structures. Damien originally built the whole thing in Erlang because of the promise of high availability, scalability, immutable data structures for simplicity, and all the other buzz words that make a language sound great.

Now, he is slowly converting the CouchDB codebase over to straight C. His report is a fascinating confession for how the simplicity of higher level abstractions trades off the understanding of what is really happening under the hood. Summarized:

For years I’ve tried my damnedest to get away from C. Too simple, too many details to manage, too old and crufty, too low level. I’ve had intense and torrid love affairs with Java, C++, and Erlang. I’ve built things I’m proud of with all of them, and yet each has broken my heart. They’ve made promises they couldn’t keep, created cultures that focus on the wrong things, and made devastating tradeoffs that eventually make you suffer painfully. And I keep crawling back to C.

Working on non-trivial software is hard.