Writing vs. Coding
If you have a lot of experience writing and a lot of experience programming, I’m confident you’d agree with me: coding dilemmas and the programming principles used to solve them are eerily similar to the same kinds of dilemmas you have in essay writing. Here are just some parallels I’ve observed, written in the form of dilemmas:
Writing: this paragraph is getting really long, should I split my points up into multiple paragraphs?
Coding: this function is getting really long, should I split it up into helper functions?
Writing: should I have this in my introduction, or just keep it in my body paragraphs?
Coding: should I have this in my
main
function, or just keep it in my helper functions?
Writing: I know what I’m trying to say here, but I can’t seem to find the right words for it. Let me look in the thesaurus.
Coding: I know what I’m trying to implement here, but I can’t seem to find the right commands for it. Let me look in the documentation (or more realistically, stackoverflow).
Writing: this sentence is technically what I want to say, but it’s damn near incomprehensible.
Coding: this line does what I want to do, but it’s damn near incomprehensible.
Writing: how general should I be when drawing insights from this idea, vs. just drawing insights from the one specific instance I was writing about in the first place?
Coding: how general should I be when implementing this functionality, vs. just implementing the specific use case I wanted it for in the first place?
Writing: what order should I lay out my ideas?
Coding: what order should I lay out the program execution?
Writing: do I keep using this same kind of ambiguous word over and over again, or should I define a purpose-built jargon and use that?
Coding: do I keep using these same variables over and over again in this naïve way, or should I define a purpose-build data structure and use that?
Writing: should I start talking about this now, or leave it to my other paragraph where I cover this idea in more detail?
Coding: should I start implementing some of this feature here, or leave it to my other function that mainly deals with this feature?
I can keep going and going. Maybe writing and coding are basically the same. Why they seem very different is because the audiences are very different. Essayists write for humans, and coders write mainly for machines. But not just for machines; one of the first things that gets drilled into you when you take any intro programming course is that you’re writing for you. If you don’t understand what you’re writing, you’re not going to write a good program.
Another reflection I have after writing all this out is that in my academic training, I’ve learned much more exact ways to deal with these dilemmas on the coding side than I have on the essay writing side. It makes me wonder if essayists can become better writers by learning to code & applying good programming practice to their writing, or vice versa. I’ll have to try it myself the next time I write an essay.