Copy
View this email in your browser
Arch-Engineer
Code better

Software Design Tip: Understanding Alien Data

I admit it. I really like C. There is a true magic in having "list of bytes" as a fundamental datatype. Sometimes in higher-level languages, I don't understand what's really going on at runtime, but C is close to assembly, and assembly never lies.

There's an idea floating around that C is the obsolete language of yesteryear, only still used because not enough people have learned Rust or Go yet. What advantages does C have except performance?

Lots, it turns out. In his essay Some Were Meant for C, Stephen Kell argues that we've misunderstood the benefits of C for years. People use C, he argues, not for performance primarily, but for a number of reasons that don't fit into the usual classification of language features. The chief one is what he calls communicability.

Communicability means that C can access data structures created by other systems without jumping through hoops. Whether you want to access kernel data structures or muck around with the bytes representing other programs, C makes it easy. Imagine parsing a network packet containing some data structures. C can just say "I know what this is," put its own structure over it, and read it as is. Java would need to deserialize it into its own data structure.

And that's about as much justice as I can do it in a couple paragraphs. On Monday, one of my colleagues in the systems group walked up to me and told me Kell's essay changed his world view.  Maybe it will change yours as well?

There's a more general lesson to be had here too: the power of sharing a format. Not just of being able to read and write the same format, but natively using it in internal computation. 40 years of the Unix philosophy has shown just how much power you can get from having pipes of programs that communicate through plain text. This contrasts with the competing philosophy of proprietary file formats for everything, so that all interaction must go through a converter. And so the lesson of C is one that we can imitate in daily life as well: to communicate with others, we should learn to speak a common language, and not constantly translate back and forth.

And, remember, when you think some technology has succeeded in spite of its technical inferiority, think again.
Copyright © 2018 James Koppel Coaching, All rights reserved.