In computational social sciences, like in other software-intensive sciences, code is a vital tool for science making. Therefore, it should be expected that code maintains the same level of clarity as any research method. It is not sufficient just to write code, run an analysis and report findings. Instead, we should be confident that the results are clearly explained and correct (we examine these further in Chapter 10.1). Therefore, there are increasing calls to highlight code management and maintainability across disciplines (for further discussion, see Wilson et al., 2016).
For me, these calls are justified but also indicate how the complexity of the research process changes when code and coding enter it. It requires some basic understanding of software engineering and software project management. For example, something I have come to regret many times is to think my code is quickly disposable. Surprisingly often, I need to return to the code. I need to check some details I have forgotten, there is a similar enough need in a future project that I think I can use some of the work I have already done or I have forgotten how to do something and instead of reading the documentation, I just look at how I did it previously. This brings up the importance of leaving the code in a shape that someone - maybe yourself in the future - can return to and read and understand what the code does (and hopefully what the code should do).
There are many advanced practices that software engineers have developed to improve the maintainability and management of code. There are several lengthy books written on this topic. Naturally, as researchers, we are not professional software developers. We have many responsibilities and interests other than writing high-quality clean code. This can create a conflict and even disregard software development practices. However, given the importance of the code, we ought to think about what we could learn from software engineering. The following gives a brief introduction to the topics.