Coding as a Communicative Act

Let’s get philosophical for a minute, shall we?

Programming languages aren’t languages in the technical sense. To be a real actual language, it has to be able to communicate ANY idea, and programming languages are finite. You can tell a computer to do things, but that’s all you can do; you can’t ask it nicely, and you can’t tell it how this command makes you feel, and you can’t tell it what you had for lunch. (If you use comments, that’s cheating: you’re now writing in English). But certainly coding IS a communicative act. If it’s not language, it’s what you might call wibbly-wobbly, languagey-wanguagey… stuff.

And where it diverges from human language is really fascinating. Because when you code, you’re not carrying on just one conversation, but two, simultaneously, asynchronously, and orthogonally. Along one vector you’re commanding the machine to do things (and, unlike humans, it has no choice but to obey both completely and completely literally). This conversation happens every time you run the code. But along the other vector you are talking to humans – every human who ever comes after you who has to deal with this code, extending long into the years after it has ceased to be your problem. You’ll never meet them. But you’re talking to them.

Do you want their side of the conversation to be cursing your name?

Your goal is to communicate to the humans what you are commanding to the machine.

You’d think this wouldn’t require much extra effort, since, presumably, any human reading your code knows the programming language. But it’s easy to lose the train of thought as abstraction and complexity increase.

Look, the machine doesn’t care how pithy you are. The machine doesn’t care if you name all of your variables “a1, a2, a3…”. But I sure do. I need to be able to infer your intent so that I can alter or build upon what you’ve made without accidentally breaking stuff. The machine doesn’t care about your intent. If you’re using a dynamically typed language, please give me a clue as to what you’re expecting a variable to be filled with. Use conventions. Organize your files. Write tests. Be 10% more explicit than you think is necessary.

Be a good conversation partner. Future generations will thank you.

Leave a Reply

Your email address will not be published. Required fields are marked *