The Art of the Code

Asjad Naqvi
The Stata Guide
Published in
12 min readAug 27, 2021

--

Reading published code is hard work, and trying to emulate it is even harder. We can untangle complex code block into smaller parts, but the skill lies in putting them back together to form a coherent whole.

In this guide we discuss the art of coding, why the coding is not given the attention it needs, why it seems difficult, and how we can approach these issues. And yes, we should all learn to code early on.

Coding requires the ability to interweave a lot of small parts into an intricate, and functioning, tapestry. In the early stages, we can usually patch together scripts to give us the outputs we want. These outputs, like graphs and tables, are usually valued more than the code itself. This is especially true for the field of economics, where code is rarely shared, although this practice is now slowly changing in the name of open science. A key part of writing readable scripts is also file organization which I have repeatedly touched upon in earlier guides (especially here and here). This not only makes our folder and file structure easy to follow but also allows others to replicate our work. The more coherent, and neatly commented a code is, the easier for it to live on. Assuming others don’t even have to use our code, but if we ourselves cannot read our old files, even replication of our own files becomes challenging.

--

--

Asjad Naqvi
The Stata Guide

Here you will find stuff on Stata, data visualizations, data wrangling, workflows, and programming.