The journalist’s guide to coding: Part I

Welcome to the first part of our series on coding for journalists. In this explainer, we’ll start by demystifying some of coding’s most common buzzwords.

What do journalists need coding for?

Journalists use coding for two main purposes: Analysis and Storytelling.

Analysis refers to researching a topic, typically with the help of data. The journocoder (journalist/coder) sources datasets and carries through with some data wrangling in order to uncover unusual patterns, changes, or trends that could make a good story. Sometimes the story is already known, and the data is used to add credibility or to fact-check.

Storytelling refers to presenting the story in innovative formats; it includes data visualisation, interactive design, graphics and gamification. Although coding can enhance storytelling in traditional media outlets (such as graphics on TV or print), it is online that it flourishes into visual extravaganzas. The sky’s the limit – and your editor (the human, not the program).

Coding in RStudio

Some jargon first

Before we embark into talking about programming languages, let us first define our first jargon:

Front end and back end

Front end is what the user of an application sees, the visual design and functionality that comes with it, such as clicking buttons, swiping and typing. Back end is what runs under the hood to produce the results you see on screen. In the case of an application that uses the internet, typically your browser or app calls a server somewhere in the Globe, which performs actions and calculations and returns something back.

And that brings us to…

Website vs Web application vs Mobile application

Applications don’t have to use the Internet, but, apart from some desktop programs and some very simple mobile apps, e.g. games, they all do.

A website is any page or collection of pages that live in a server and are sent to a browser by request.

A web application lives on a website but is much more complicated than a simple static page. Think a banking or e-commerce website.

A mobile application is an app that runs on your phone by itself, instead of using a browser.

And now…

What programming languages are best for journalists?

In a nutshell,

  • Python and R are used for data analysis and visualisation
  • The HTML/CSS/JavaScript bundle is used for visualisation and interactive online content

Roughly speaking, the first group are back end languages and the second are front end – although you could do client-side development with Python/R and server-side with JavaScript (with Node.js).

Where to start?

Up to you, your newsroom and whether you are interested more in the analytics or the storytelling part. To give my two pennies, if you are a complete beginner you would probably want to stray away from JavaScript for a bit (not that it is that difficult, but the endless frameworks and front-end complications add too much noise). HTML and CSS are not of much use on their own and even if you learned all three, you would only implement a front end; you would need a back end to have a complete, useful application.

Python would be my go-to, a general-purpose, tidy language which will introduce you to basic programming concepts and allow you to build small applications quickly. R is a more specialised language, originally built for statisticians, although it has been expanded considerably in recent years, to the point that you can even do web development with it.

Python and R are the most common programming languages

What do I need to start?

The language, an IDE and a tutorial.

The language

You don’t really download a language, but a code-translator and its programming-libraries, so that the computer can execute what you write (more on that later!). For example, you can download R here.

Sometimes a language is already installed, such as Python on Macs, but you would still need to upgrade to the latest version. As for JavaScript, it’s already built-in in all modern browsers.

The IDE

You could write your code in a plain text editor. Save the file with the right extension. Then run it by typing a command in a console window. And then watch it crash because of a typo.

Fortunately, there are software programs that make your coding life easier. They have a clever text editor that can find some of your errors, make suggestions, help you navigate the lines, format the text and more. In addition, there are pre-installed features that allow you to build your code (“bring it all together”) run it and manage external packages, to name a few. You can even extend them by installing plugins!

This software package is called an Integrated Development Environment (IDE).

RStudio is a popular IDE for R. There are a few beginner-friendly IDEs for Python, one of which is IDLE (installed with the language).

The tutorial

Everyone learns differently. Some people like video tutorials, some want to copy-paste code snippets and others enjoy learning from big fat books. Just find what works best for you.

I will compile a list of resources for R and Python that you will be able to find at the end of this series.

Don’t give up!

And if you ever feel intimidated by “hackers”, remember that no one was born knowing how to code. If you put in the effort, you can become one of them!

Next: Basic programming notions, console vs script, documentation, libraries and APIs.

Leave a Reply