It’s okay for academic software to suck
Bozhidar Bozhanov wrote an blog post titled “The Low Quality of Academic Code“, in which he observed that most academic software is poorly written. He’s makes plenty of fair points, e.g.:
… there are too many freshman mistakes – not considering thread-safety, cryptic, ugly and/or stringly-typed APIs, lack of type-safety, poorly named variables and methods, choosing bad/slow serialization formats, writing debug messages to System.err (or out), lack of documentation, lack of tests.
But, here’s the thing — I would argue that this lack of engineering quality in academic software is a feature, not a bug. For academics, there is basically little to no incentive to produce high quality software, and that is how it should be. Our currency is ideas and publications based on them, and those are obtained not by creating wonderful software, but by having great results. We have limited time, and that time is best put into thinking about interesting models and careful evaluation and analysis. The code is there to support that, and is fine as long as it is correct.
The truly important metric for me is whether the code supports replication of results from the paper it supports. The code can be as ugly as you can possibly imagine as long as it does this. Unfortunately, a lot of academic software doesn’t make replication easy. Nonetheless, having the code open sourced makes it at least possible to hack with it to try to replicate previous results. In the last few years, I’ve personally put a lot of effort into having my work and my students’ work easy to replicate. I’m particularly proud of how I put code, data and documentation together for a paper I did on topic model evaluation with James Scott for AISTATS in 2013, “A recursive estimate for the predictive likelihood in a topic model.” That was a lot of work, but I’ve already benefited from it myself (in terms of being able to get the data and run my own code). Check out the “code” links in some of my other papers for some other examples that my students have done for their research.
Having said the above, I think it is really interesting to see how people who have made their code easy to use (though not always well-engineered) have benefited from doing so in the academic realm. A good example is word2vec and how the software that was released for it generated tons of interest in industry as well as academia and probably led to much wider dissemination of that work, and to more follow on work. Academia itself doesn’t reward that directly, nor should it. That’s one reason you see it coming out of companies like Google, but it might be worth it to some researchers in some cases, especially PhD students who seek industry jobs after they defend their dissertation.
I read an blog post last year in which the author encouraged people to open source their code and not worry about how crappy it was. (
I wish I could remember the link, so if you have it, please add in a comment. Here is the post, “It’s okay for your open source library to be a bit shitty.“) I think this is a really important point. We should be careful to not get overly critical about code that people have made available to the world for free—not because we don’t want to damage their fragile egos, but because we want to make sure that people generally feel comfortable open sourcing. This is especially important for academic code, which is often the best recipe, no matter how flawed it might be, that future researchers can use to replicate results and produce new work that meaningfully builds on or compares to that work.
Update: Adam Lopez pointed out this very nice related article by John Regehr “Producing good software from academia“.
Addendum: When I was a graduate student at the University of Edinburgh, I wrote a software package called OpenNLP Maxent (now part of the OpenNLP toolkit, which I also started then and which is still used widely today). While I was still a student, a couple of companies paid me to improve aspects of the code and documentation, which really helped me make ends meet at the time and made the code much better. I highly encourage this model — if there is an academic open source package that you think your company could benefit from, consider hiring the grad student author to make it better for the things that matter for your needs! (Or do it yourself and do a pull request, which is much easier today with Github than it was in 2000 with Sourceforge.)
Update: Thanks to the commenters below for providing the link to the post I couldn’t remember, It’s okay for your open source library to be a bit shitty.! As a further note, the author surprisingly connects this topic to feminism in a cool way.
Was this the post in question? http://www.drmaciver.com/2015/04/its-ok-for-your-open-source-library-to-be-a-bit-shitty/
Is this the blog post you mentioned?
Yep, that was the one. Thanks to both of you!
While I agree overall, I think that there should be a caveat- once models and methodologies are well-established (and you’re no longer hacking around while trying to pin down an unknown and elusive natural phenomenon), scientific software should undergo rigorous refactoring and performance tweaks so that it is easier to build upon. I have no doubt that there are some scientific packages out there that are unlikely to be revised too much further and yet run as slow as molasses in spite of the availability of GPUs, multicore, etc. It would do the world good to have these pieces of software updated so future packages that might depend on them can take full advantage of computational advances.
Also, it’s interesting to note (regarding Google) that even PageRank needed to be refactored quite a bit before it was commercially viable (the original version of Google’s site crashed quite a lot allegedly; I think I heard somewhere that the error message involved telling a horse to slow down, although that memory’s a bit fuzzy).
I absolutely agree that better software can lead to more progress, not only for industry, but also for academic work. But often the people who came up with the fundamental algorithm are not the right people to take it to the next level, in terms of software engineering. I think a lot of companies probably do this in house, so I’d be surprised if there weren’t lots of amazingly good implementations that are kept in-house. Sometimes a research unit focused on software picks this up and makes things better. A really nice model is how the Apache Spark code was started at Berkeley and that led to Databricks, which has a profit motive to make the code better and to keep it open.