Skip to content

Latest commit

 

History

History
113 lines (73 loc) · 7.4 KB

best_practices.md

File metadata and controls

113 lines (73 loc) · 7.4 KB

Best Practices for Software Development

In this chapter we give an overview of the best practices for software development at the Netherlands eScience Center, including a rationale.

Checklists

An easy way to make sure you did not forget anything important is to use a well curated checklist. Great examples can be found via FAIR Software NL. The Turing Way has specific topical checklists at the end of each of their chapters.

Version control

Use a version control tool like git to track changes in your codebase. This allows you to retrace your steps when debugging, keep your repository clean, easily collaborate with others asynchronously and more. More info: The Turing Way chapter on Version Control, RSQkit chapter on Version Control.

At the Netherlands eScience Center: we always use version control and we preferably use GitHub as our online repository and collaboration platform (see the Project Management Protocol on our intranet (only accessible to Netherlands eScience Center employees)).

Testing

Tests are important for two reasons: 1. confirming the expected workings of your code while developing for the first time and 2. making sure your features keep working when later on you or others modify the implementation. The Turing Way gives an overview of the many ways to test code.

Code Reviews

The most effective tool for improving software quality (and sharing knowledge at the same time) is doing code reviews. Have a look at the The Turing Way chapter on Code Reviewing to learn more about ways to do this.

Documentation

Developed programs should be documented at multiple levels, from code comments, through API documentation, to installation and usage documentation. Comments at each level should take into account different target audiences, from experienced developers, to end users with no programming skills. In the Turing Way chapter on Code Documentation you will find a great overview of the how and why of documentation.

Code Quality

Ways to improve code quality are described in the Code quality chapter on the Turing Way.

Explore online tools for software quality improvement. Additionally, check our language guides for language-specific recommendations. RSQKit: Research Software Quality Kit also has many useful guides including software quality. These guides are result of an international collaboration primarily focusing on research software quality.

EditorConfig

The eScience Center provides a shared config file for IDEs and text editors. This file helps standardize coding styles across projects.

Namespaces

If your programming language supports namespaces, use your organization or project-specific namespace.

At the Netherlands eScience Center:, the recommended namespace is nl.esciencecenter, or adapt it to a namespace that aligns with your project's context.

Use standards

Standard files and protocols should always be a primary choice. Using standards improves the interoperability of your software, thereby improving its usefulness. Examples include exchange formats like Unicode, NetCDF, and W3C web standards, and protocols like HTTP, TCP, TLS.

Licensing

Since source code is protected by copyright, to allow people to use your code it needs a license. For more information, see The Turing Way chapter on licensing or the RSQkit Licensing software task.

At the Netherlands eScience Center: our first choice is the Apache v2 license. See the Project Management Protocol on our intranet (only accessible to Netherlands eScience Center employees) for more details on licensing and our intellectual property policies.

Software management plans

The Netherlands eScience Center and NWO have authored the practical guide to software management plans (see also). For our projects we recommend using our Software Sustainability Protocol, which is based on these guidelines. For more information you can also read here.

Releases

Releases are a way to mark or point to a particular milestone in software development. This is useful for users and collaborators, e.g. I found a bug running version x. For publications that refer to software, refering to a specific release enhances the reproducability. See the RSQkit task on Creating code releases for the most essential guidelines. The Turing Way offers many related tips in their chapter on Making Research Objects Citable, like how to make code citable with CITATION.CFF files.

Packaging

A related, but separate topic is packaging, which allows users to conveniently install your released software. Most languages and OS'es have their particular ways of doing this. The Turing Way offers advice on making reproducible environments, in which packaging is an essential component.

Know your tools

In addition to the advice on the best practices above, knowing the tools that are available for software development can really help you getting things done faster.

Learn how to use the command line efficiently

Read the chapter on using Bash.

Use an editor that helps you develop

Commonly used editors and their ecosystem of plugins can really help you write better code faster. Note that for each of the editors and environments listed below, it is important to configure them such that they support the programming languages that you are developing in.

Below is a list of editors that support many programming languages.

Integrated Development Environments (IDEs):

  • Visual Studio Code - modern editor with extensive plugin ecosystem that can make it as powerful as most IDEs
  • JetBrains IDEs - specialized IDEs for Python, C++, Java and web, all using the IntelliJ framework
  • Eclipse - a bit older but still nice

Text editors:

  • vim - classic text editor
  • emacs - classic text editor