John Benton

So, You Want to Refactor an Old Research Project?

Usually, you can move about your day without having to think about theoretical computer science. Unfortunately, destiny comes for us all, and you’ll be asked to improve an old research project. When I first started, I had absolutely no idea what I was doing and made a ton of mistakes. Below, I’ll go over some things I wish I knew before I started (though, in the spirit of honesty, I probably would have made the same mistakes again).

1. Research Papers

A lot of the time, a repository will have a research paper associated with it. I cannot stress enough how important it is to read and fully understand all of the concepts mentioned in the paper. When you’re trying to analyze a block of code, it’s very helpful to have some kind of reference to work off of. If you ever get stuck (and you will) having a solid understanding of the theory will help move you forward.

2. Weird Languages

Sometimes, you’re going to be asked to refactor code in a language you have never seen before. When I started working on BPA, there were two: Datalog and Ocaml. Before jumping into the project, I would encourage you to learn more about the syntax and structure of the language(s) from simpler projects. You’re never going to succeed in understanding a huge repository in a language you don’t understand, you will only infuriate yourself.

3. Dealing with a lack of documentation

Academic research projects can sometimes have very convoluted codebases with very sparse documentation. If this happens to you, I recommend creating documentation as you go along. It doesn’t have to be anything substantial, but this will really help you gain a deeper understanding of the project. For example, when I started to research BPA, I created a diagram depicting the runtime of the program. Once again, when you inevitably get stuck, having some kind of reference point to fall back on is indescribably helpful.

4. Don’t Despair

If you weren’t already aware, this is going to be difficult. My advisor was telling me about how academic projects are slightly infamous for having convoluted codebases. But don’t fear what you don’t yet understand. For me, it helps to focus on simply enjoying what you learn as opposed to the results.

In conclusion, you got this. Don’t worry about how long it takes or how difficult it seems right now. Let your enthusiasm for the subject guide you to along the path to coding enlightenment.