How to learn how to code

Over the course of ONA, many sessions have covered the different things you can do with code. Maybe you want to learn to make interactive graphics. Maybe you want to investigate government datasets for a big scoop. Maybe you just want to automate a menial task you have to do every day.

But getting started writing code can be daunting and frustrating. I talked to a few fantastic news developers here at ONA to get some of the best tips for learning to code. This advice is more focused on process and attitude, which will be useful regardless of what you’re trying to learn.

Here’s what they had to share.

Build something small

The faster you get out of a tutorial like Codecademy and start working on an actual project, the better. Pick something small that you want to learn. Rome wasn’t built in a day, and neither was that fancy New York Times graphic that you want to emulate. Don’t let your ambition stymie your learning. Almost everybody I talked to at the conference talked about building something small first.

Thomas Thoren, a former developer at the Lens, said he started by making small tweaks to his campus magazine’s website. “It started with something as simple as ‘I don’t like this color’ or ‘something is aligned wrong.’” Eventually those little tweaks built up and he learned the skills to be able to make more meaningful changes to the code. “It’s kinda incremental over years until you step back and realize, ‘I am a programmer now.’”

Thomas added that a key question you need to answer is why do you want to learn to code. Having direction is key because “you can quickly spread yourself too thin in programming.”

Build something for you

This seems like a no-brainer, but having a project that excites you can be key to getting the momentum going to actually making something.

“The thing that helped me get started learning how to code was making my own website,” said Priya Krishnakumar, a graphics and data journalist at the Los Angeles Times. “It took a long time, but it helped me really understand the basics of how to set up a webpage and got my design chops flowing.”

At the Northwestern Knight Lab, we often tell eager people to learn to code by having them build a portfolio site so that they are personally invested in the work.

The news nerd community is there for you

You are not alone. “It’s important to reach out in the community and talk to people who are also journalist-developers because a lot of the time if you run into a really big roadblock, and you don’t know how to fix it, people in the community are totally down to help,” said Krishnakumar.

I’ve benefited so much from asking people for help on Twitter when I can’t get my code to work. This is especially important when you’re trying to use open source software that was built in other newsrooms.

“Find people whose code you admire and pick their brains,” said Brittany Mayes, a freelance data journalist. “Ask them to walk you through their code and tell you about what languages they use, what frameworks they use, and that will give you a good starting place.”