This guide aims to introduce computational researchers to the fundamentals of Open Code/code sharing and provide best practices and resources across several important topics in this area.
Why share my code?
There are many reasons why you may want to share your research code:
What if my code is ugly?
Many computational researchers are not formally trained software developers and may feel uncertain about presenting their work for public scrutiny. You can build confidence in your abilities by starting with sharing your code on a small scale - find a code sharing group, have others in your lab review your code, look at co-authors' code.
Many code authors will use an online version control system, like Github or Bitbucket, which allows code to be shared openly and discovered via the side's search as well as links and web search engines. This is an excellent idea, and there are many benefits to using a modern version control platform like this. However, use of a version control website is not considered sufficient to preserve your research code.
It is recommended that you share and archive your code using a repository intended to preserve research outputs and make them discoverable via DOIs. These systems are more reliable in the long-term and more integrated into the systems that connect research outputs. Version control and collaboration sites, such as Github, are commercial enterprises without guaranteed longevity - Microsoft could change the rules around Github code sharing or retention at will.
Depositing your code in a repository, such as Zenodo, the Open Science Framework, or Figshare, will keep a final version of your code together with the data it is used to analyze and can also be linked to publications resulting from the project. A permanent DOI will also make the code citable for other users. These repositories will also have you select a license under which your code may be re-used and credited. Note that Creative Commons licenses are not recommended for code - MIT, BSD or Apache 2.0 licenses are suggested instead.