Coding reproducibly

April 05, 2017

When an individual programs a piece of code, be it for university, research or hobby, it is very likely that the code will change multiple times. A code can always be 'better', by adding improved functionality, fixing bugs, adding comments, etc... In all these changes it is important that one keeps track of which versions work, so that if any change inadvertently brings new errors, the mistake can be corrected. One way of doing this would be to save multiple versions of the same file. However, as many of you may know first hand, one will end up having tenths of different versions of the same file. "So which version of my code did I use three weeks ago? Hm..........".


There is a better way to control the version of your code files. In fact, the same approach can be used with any text file, such as your report. Version control systems have been developed in order to track changes in text files. Effectively, such tools monitor the differences between text files in the different versions that one 'saves'. Then, one can compare the current version with the version of two weeks ago. This alows easier troubleshooting if new bugs appear after certain modifications. You only need one version of the actual file, and the version control tool is doing the rest.


One such version control system is called Git. Git is a tool that you can install in your PC. You may also be familiar with Github. Github is an online hosting platform for Git repositories. You make a Git repository in your computer, and you can then upload it in Github. Github is very convenient for collaboaration as well, as different users can copy the full repository and make changes in the files (that will be tracked).


Leaning Git is not very difficult for basic use. You first need to learn how to 'save' the Git-way, which is in adition to the save function of your e.g. Word program. Subsequently, a few more commands allow you to inspect differences in the text files and go back in time, if you want to restore your files to an earlier version.


Using Github is also a very good way of backing up your files. You should know that, having  a copy of your files in an external hard drive, next to your monitor, is NOT a backup. This is a second copy, which will be destroyed if there is a fire or earthquake. A backup is meant to be remote, so that it is not suceptible to the same physical disasters as your original copy. Github provides free public repositories, and if you want your private ones you can purchase them separately.



Resources others found helpful

GCSE Exam Papers (new 1-9 specification)

Perfect practice equals top grades!

11+ English exercises for home

Here is a list of a few little exercises to follow at home to help with creative writing and building synonyms.