Programming Language Wars are Dumb

If you’re a grad student in economics, you’re likely to encounter “language wars” from time to time. There will be folks claiming “Stata is better than R”, “Python is the best choice”, and whatever. You need to ignore them completely (or as completely as possible - your advisor might be crazy about their personal preferences). The claims people make are useless, largely uninformed, and mostly wrong.

There are a ton of good options for doing research these days. It’s very different from the state of the field when I started writing my dissertation in the late 1990s. Every single option back then was horrific.

Today you can use R, Python, Stata, Julia, Matlab, and a bunch of others. Some, like RATS and SAS, might not get as much attention, and they’re clearly not my first choice, yet they’ll do the job. One reason it’s pointless to engage in debates about choice of language is interoperability. R can call Python, Python can call R, SAS can call R, and so on. You don’t even have to choose, but if you do, you’re not going to miss out on any functionality.

This is what you should be worried about as a grad student:

  • Correctness. Are you writing tests? Are you sure your code is giving you the right answer?
  • Sharing. Especially with coauthors. Be ready to share your code with others once the paper is published. Be ready to hand over all of your files to a coauthor if you get sick.
  • Readability and returnability. How easy is it to read your program? Do you have functions that are hundreds of lines long? If so, break them down so they each do one small thing. By returnability, I mean the ability to come back to your program after two years and figure out what you did. Your brain will have forgotten everything, so your only option is to read your program.
  • Replicability. If you submit a paper, you need to have all your files in one place, and when you run the programs, you need them to print out exactly the results you’ve reported in your paper.

Programming languages don’t disappear. They do get less attention from bloggers and on social media. If you’re tempted to start looking for a new language, keep in mind that programming languages don’t write papers, they don’t analyze datasets, and they don’t handle hostile referees. Don’t get distracted from your research. By all means, have fun evaluating alternative languages, but keep in mind that it’s a hobby, not something that’s going to help you get tenure.

Having said that, there are times a change in language is a good idea. I made such a change in 2005/2006 when I dropped GAUSS as my main research language and moved to R. It turned out to be a great career decision. Ask yourself these three questions when choosing a language:

  • Do you know the language? It takes a long time to become proficient with a new language. Are you sure it’s worth the investment? Are you sure you’re seeing all of its warts? You might use a new language only to discover problems two months down the road that make it unsuitable. On the other hand, if you keep using a language you’ve been using for years, you don’t have to invest anything in it.
  • Do you enjoy using it? One reason I gave up on GAUSS was that I hated the language. It was really, really painful to use. The only reason I used it was because my advisor told me to, and back then it was the primary language for time series econometrics. Man, it was painful. R was such a breath of fresh air.
  • Is it able to help you do what you need to do? If so, you should really be cautious in moving away from it. Your career is a business. You need to make decisions that offer a good return. In my case, GAUSS was not able to do what I needed. I was having to write a lot of my own functionality. It was really hard to write code I could trust to be correct because it was such a primitive language. In contrast, I’ve always enjoyed the D programming language more than R, and really more than any other language, but R has continued to be my main research language. It’s hard to share D programs with anyone else (they probably don’t run Linux or use WSL) while I can always send them an R program. From a business perspective, R is by a wide margin still my best choice.

Last updated September 6, 2024