Creating Open and FAIR Code Yourself
If you structure your code from the start so that it is easy for you and others to use, you save effort later, for example when publishing or after a review. The goal is code that is open and FAIR: free to use and at the same time findable, accessible, interoperable and reusable. The following points will help you achieve this.
Before you start
- If possible, choose an open programming language such as Julia, Python or R.
In the code repository
- Manage your code with version control, for example on GitHub or GitLab. This makes changes traceable and makes working together easier.
- Make your code understandable:
- consistent file and folder names (see tips)
- good readability and documentation
- a README file
- Where possible, read and save data in open standard formats, e.g. CSV instead of .dta or .xlsx.
- Record which packages and program versions your code requires, for example in a renv.lock or requirements.txt file. For complex requirements, a code notebook or a container may be an option.
- Choose an open licence and store it as a LICENSE file.
- Add machine-readable metadata in a CITATION.cff or codemeta.json file, and list all authors with their ORCID.
When publishing
- Create a release, i.e. a fixed, versioned state of your code.
- Archive the release publicly in a repository such as Zenodo, which assigns a DOI. GitHub alone is not permanent. Find out more under Publish Open Code Yourself.
- Link your code to the associated data and publication, for example via their DOIs in the README file.
