“Programming is like writing a book… except when you miss a single comma on page 126, the whole thing makes no sense” – Programmer humour
Many talented publishers think that they could never learn to code. They might think that it is too technical or too dry. They might assume that their proficiency with language has no application to computers. But programmers and publishing people have more in common than you might think. Programmers and writers both need to distill complex problems into clear, readable and actionable messages. Coding can be as aesthetically driven as any other art form and like writers the best programmers have technical ability and creative flair. So, what are some of the most common ways that coding overlaps with publishing?
Publishing people understand that a book must be well structured in order to be successful. When editors make structural edits, they consider all the elements of the narrative and see how they work together; what could be rearranged, cut or improved upon. We are all familiar with the sensation of noticing a lapse in the internal logic of a fictional world that can throw us out of a book. The equivalent in programming would be a logical error that either breaks the code or causes it to have an unintended outcome. Variables represent values that change within a computer programme and they are evaluated within what is known as an execution context. Like sophisticated writers who weave intricate plots, programmers can use context to do creative and surprising things with their code.
Publishers pride themselves on their excellent grasp of grammar and written English but syntax has a second application in programming. Syntax in this context sets out the rules of what will be accepted as a valid instance of any given programming language. Without correct syntax the compiler which translates your code into the machine language that the computer can understand will return an error. Compare this to a novel that is full of typos and grammatical errors that is unlikely to find a wide readership. And it is not only in writing where word choice can have a dramatic impact. Selecting proper variable names in coding is an important skill as names should have a clean, obvious meaning and follow a consistent pattern.
Code refactoring is the process of restructuring existing computer code without changing its external behavior. Like copy-editing, refactoring involves editing and cleaning up existing code to make it more efficient and easier for humans to read. Just as it is better to copy-edit the manuscript before publication and avoid costly errors, refactoring takes place before the product goes to market. Publishers will remove redundant language from a work in order to improve the quality of the writing and programmers follow a similar maxim known as “don’t repeat yourself”. This principle aims at reducing the repetition of code by using abstraction layers which hide away the details of a function to make them more universally applicable.
The qualities that separate good code from bad such as elegance, design, abstraction and attention to detail are all skills that publishers already have. It is easier to teach people the syntax and vocabulary of coding than it is to instill in them an appreciation of the quirks of language. It is time publishing people approached code with confidence.