Share via


Programming and writing are similar things

At least, that’s my opinion. They’re both ways of recording and communicating ideas, and they’re both best when they’re clear and brief and unambiguous. I do believe that similar skills go into each. But they’re for different audiences and those different audiences have different natures. So maybe that’s why we think of programming and writing as being so different, and we say that someone who’s good at one isn’t necessarily good at the other. But I feel that if you genuinely are good at the one then you would be good at the other if you tried it and gave it as much time and energy.

The audience of source code is a compiler (sure, it’s also you when you have to re-read your own code in a month’s time, but that’s secondary). The audience of the written word is people.

A compiler always knows when it has misunderstood you. People don’t always know when they’ve misunderstood you. But in either case the fault lies primarily with the communicator. Still, it’s durned convenient to always know when you’ve been misunderstood. Imagine the disasters that would have averted in history if people gave compiler errors and warnings.

When a compiler knows it's misunderstood you, it will tell you so. When a person knows they've misunderstood you, they won’t always tell you. But they should. Perhaps they feel it’d be impolite to do so; perhaps they’re in a hurry; perhaps they don’t think it matters; perhaps they think it’ll become clearer over time. Perhaps.

So there you go. If from time to time you think your compiler is a PITA, just try writing for people! :P

-Steve

Comments

  • Anonymous
    August 20, 2014
    Writing is writing. It doesn't matter if you are inventing a new algorithm or new genre of fiction. In either case, you really should be writing so that another person can understand. Sure, a compiler will let you know when something isn't clear (or plainly illegal according to its rules). But, the compiler also doesn't have any problem following very convoluted instructions. We should always write our source code as if it will be read by someone who is not very experienced with software development. Chances are, the person that will have to open up your source code in a year or two will have no familiarity with your code. That person can even be yourself. I look at the things I wrote six months ago and complain about the idiot that did that. :) Compilers will always improve and be able to do things differently and optimize our code (within reason, of course; spaghetti will never turn into a great substitute for lasagna). If we write code that is intimately tied to a specific compiler's optimization, we run the risk of utterly destroying performance when that compiler is rewritten and it begins to tell you all things that it understands but doesn't like (new warnings, escalated warning levels, upgrade errors).