How learning to program can make you a better writer

Perhaps you’ve considered learning how to program. The benefits are enticing. You could create complex visualizations, process reams of public data from your local municipality or even create a Carlos Danger Name Generator.

As reporting and storytelling continue to converge with technology, the case for journalists learning to program gets stronger. For example, it might help in better understanding what’s possible in the digital realm, whether it’s contributing to a data visualization, interactive narrative or a new form of digital storytelling. Picking up some programming jargon can improve communication on multidisciplinary teams, and learning specific tools and processes can help reporters, visual journalists and others do more in their newsrooms.

On the other hand, some argue that pushing journalists to program erodes the value of specialization and puts unfair demands on folks who already are juggling many responsibilities. And the point gets made that involving more people with coding leads to more bad code. It’s easy to learn just enough to be dangerous, but becoming adept at producing stable, secure code takes time.

I suspect there’s merit to each of these points. Certainly, learning to program isn’t for everyone — and perhaps shouldn’t be a priority for most. But some stand to gain. If you’re going to learn to program, the key is to get the most value not only out of the new skills you learn, but also from the learning process itself. That’s why it’s worthwhile to focus on how learning to program might enhance your existing repertoire, especially your writing.

The link between programming and writing

If the idea that learning to code can make you a better writer — especially a better journalistic writer — seems far-fetched, consider this: Programming is, in the end, a kind of communication. True, programming often means relaying information to computers, but that really means we’re communicating with someone via a system they’ve already built.

For programmers to be successful in this endeavor, their code needs to meet several criteria. It needs to be concise, precise and descriptive. It needs good organization and sequencing, even when there are many possible ways to bring structure. And it needs to be free of grammatical errors — even problems with style.

Sound familiar? On closer look, good code and good writing have more in common than you might think. That’s why programming — whether it’s building large-scale systems or hacking on little side projects — provides new ways to practice the same skills that contribute to writing a news brief or feature story.

Learning to code can help you:

1. Become a better self-editor. Small discrepancies in code can mean the difference between a happy website and a crashed server, with one misplaced comma potentially toppling a site. With stakes this high, it’s no surprise programmers are strong self-editors. They’re used to double- and triple-checking their work for problems and continuously testing their code. And being vigilant isn’t just about averting immediate calamity. Some of the most pernicious programming bugaboos arise when there’s a hidden problem in code not discovered until weeks or months later. Poorly editing code today means software bugs tomorrow.

2. Organize your thoughts. Programming takes strong organizational skills. A complete program can be thought of as a set of subparts — systems or routines, to use the technical vernacular. The quality of code is as much about how these components fit together as it is about any one line. This means programmers spend a lot of time thinking about how their scripts are organized — where their programs begin, how they progress and, yes, even how they end. They may not use inverted pyramids or nut grafs, but they do employ templates to impose structure and write more efficiently.

3. Write precisely. There’s little room for ambiguity when programming. Computers need instructions, and aren’t terribly good at interpreting context or intuiting our underlying meaning. Vague, indirect, approximate code isn’t going to work. Programming successfully means expressing exactly what we want to do, in no uncertain terms.

4. Write concisely. Programmers like to write the least amount of code possible. There’s a good reason to be terse: More code means more potential points of failure. When it comes to software design, the best systems are the ones just complicated enough to fulfill their purpose, but no more. Lots of code makes maintenance a challenge and can often result in slower performance. Writing short code can be a challenge — just like writing short — but there are big benefits to doing so.

5. Explain complex ideas simply. Programming isn’t just about giving computers instructions. It also involves providing fellow programmers with a road map they can use to decode what’s been written. These guidelines take the form of comments — short bursts of explanatory text sprinkled between arrays, objects and integers. Good comments take time to craft. They should provide relevant context without repeating what’s evident when reading the code itself

6. Follow a style guide. Every programming language has its own subgroups that work together to build software. If you’re a PHP programmer, the Drupal and WordPress communities are two places you may find yourself roaming (these content management systems are both based on the PHP server-side scripting language).

To make collaboration easier, these groups have developed their own style guides to promote consistency in how code is written. If you want to make software that gets adopted by the community — and has a shot at being used — it’s important to know and follow these guidelines. Code will run just fine even if it’s not in tune with a community’s standards. But coding style guides ensure the kind of uniformity that makes it easier for everyone else to understand what’s been written.

To code or not to code

Should coding become a part of your repertoire? It depends. What’s your employer looking for? Are you interested in doing more digital work? Do you need to code to bring your next project idea to life?

Here’s another way to look at it: Some of the same skills that make you a good writer can come in handy when you’re hacking code. At a time when you’re expected to wear more and more hats, it’s important to find the connection points between seemingly disparate skills. The challenge is in seeing those points of contact. Perhaps, though, writing a personal narrative and a web-scraper in Perl aren’t as disconnected as they might seem.

Coding is like writing in one other way. There isn’t a magic moment when you “become” a programmer. The act of programming makes you a programmer, just as the act of writing makes you a writer. Once you get started, it’s all about improving. That’s a process that takes time — years, even – with likely setbacks along the way. But the best writers and programmers have something else in common: They never stop learning.

We have made it easy to comment on posts, however we require civility and encourage full names to that end (first initial, last name is OK). Please read our guidelines here before commenting.

  • cfrech

    Hi David. The best way to start, I think, is with something specific you want to build. Figure out what you want to do, then learn the code necessary to pull it off. Learn by doing, and by playing with others’ code. Here’s a simple bit of jQuery that dynamically changes a headline. http://jsfiddle.net/qE43d/1/ A bit silly, but similar techniques can be used for more useful effects. (You can experiment with the code in the link to create your own variations.)