# Best practices in scientific software development

**URL:** <https://fortran-lang.discourse.group/t/best-practices-in-scientific-software-development/7402>\
**Category:** Uncategorized\
**Created:** [February 13, 2024, 1:54pm UTC](https://fortran-lang.discourse.group/t/best-practices-in-scientific-software-development/7402 "2024-02-13T13:54:05Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Beliavsky](https://avatars.discourse-cdn.com/v4/letter/b/ba8739/32.png) [@Beliavsky](https://fortran-lang.discourse.group/u/Beliavsky)\
**Post date:** [February 13, 2024, 1:54pm UTC](https://fortran-lang.discourse.group/t/best-practices-in-scientific-software-development/7402/1 "2024-02-13T13:54:05Z")

</div>

I found the analogies between C++ and Fortran especially interesting. Geert Jan Bex co-authored a [Fortran MOOC](https://www.futurelearn.com/courses/fortran-for-scientific-computing) and the funny [video](https://www.youtube.com/watch?v=l6pEaUttWo8) where Fortran devours a Python. A Fortran-specific version of this material could be created. For example, Jan Bex recommends CMake for builds, but a Fortran course would highlight FPM.

* * *

[Material](https://gjbex.github.io/Best-practices-in-programming/) [by Geert Jan Bex] for a training on best practices for programming and software development.

## Programming languages

Although this training aims to be programming language-agnostic, the repository also list a number of tools that are programming language-specific. Obviously, this can not be exhaustive, so feel free to suggest additional tools if you are aware of any.

Programming languages covered:

- C
- C++
- Fortran
- Python
- R

## Table of contents

1. [Syntax versus semantics](https://gjbex.github.io/Best-practices-in-programming/syntax_vs_semantics/)
2. [Code style and conventions](https://gjbex.github.io/Best-practices-in-programming/code_style/)
3. [Version control & collaboration](https://gjbex.github.io/Best-practices-in-programming/version_control/)
4. [Code documentation](https://gjbex.github.io/Best-practices-in-programming/documentation/)
5. Testing

- [Testing as experiments](https://gjbex.github.io/Best-practices-in-programming/testing/testing_as_experiments/)
- [Unit testing](https://gjbex.github.io/Best-practices-in-programming/testing/unit_testing/)
- [Functional testing](https://gjbex.github.io/Best-practices-in-programming/testing/functional_testing/)
- [Code coverage](https://gjbex.github.io/Best-practices-in-programming/testing/code_coverage/)

1. [Deployment](https://gjbex.github.io/Best-practices-in-programming/deployment/)
2. [Continuous integration](https://gjbex.github.io/Best-practices-in-programming/continuous_integration/)
3. [References](https://gjbex.github.io/Best-practices-in-programming/references/)

---

<div class="post-metadata">

**Author:** ![hkvzjal](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/hkvzjal/32/3055_2.png) [@hkvzjal](https://fortran-lang.discourse.group/u/hkvzjal)\
**Post date:** [February 13, 2024, 2:11pm UTC](https://fortran-lang.discourse.group/t/best-practices-in-scientific-software-development/7402/2 "2024-02-13T14:11:13Z")

</div>

There is an ongoing initiative in this direction centered around Fortran here: [Course Curriculum Outline · carpentries-incubator/intro-to-modern-fortran · Discussion #6 · GitHub](https://github.com/carpentries-incubator/intro-to-modern-fortran/discussions/6#discussioncomment-8334018)

The program you outlined is of course way more general! they are quite complementary I think 🙂

---

<div class="post-metadata">

**Author:** ![nbehrnd](https://avatars.discourse-cdn.com/v4/letter/n/e0b2c6/32.png) [@nbehrnd](https://fortran-lang.discourse.group/u/nbehrnd)\
**Post date:** [February 14, 2024, 3:56pm UTC](https://fortran-lang.discourse.group/t/best-practices-in-scientific-software-development/7402/3 "2024-02-14T15:56:21Z")

</div>

Let’s invite Geert Jan Bex with @gjbex to join the thread.

---

<div class="post-metadata">

**Author:** ![gjbex](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/gjbex/32/860_2.png) [@gjbex](https://fortran-lang.discourse.group/u/gjbex)\
**Post date:** [February 14, 2024, 4:21pm UTC](https://fortran-lang.discourse.group/t/best-practices-in-scientific-software-development/7402/4 "2024-02-14T16:21:41Z")

</div>

To put this into context: I was asked to provide a 3-hour best practices training that would be high-level and programming language-agnostic. That training is tomorrow, and I created this website to allow the participants to revisit the topics later.

Many software engineering concerns are indeed not specific to a particular programming language, but tools and many aspects of code style are.

Some of the material was taken from an MOOC on defensive programming and debugging that I produced a couple of years ago and that unfortunately is no longer online. Other material ties in with many of the programming language-specific training sessions I do.

My intention for now is to add to this repository/website when I come across interesting tools or material. We’ll see where it goes.

---

<div class="post-metadata">

**Author:** ![nbehrnd](https://avatars.discourse-cdn.com/v4/letter/n/e0b2c6/32.png) [@nbehrnd](https://fortran-lang.discourse.group/u/nbehrnd)\
**Post date:** [February 14, 2024, 4:30pm UTC](https://fortran-lang.discourse.group/t/best-practices-in-scientific-software-development/7402/5 "2024-02-14T16:30:28Z")

</div>

> [@gjbex](#):
>
> Some of the material was taken from an MOOC on defensive programming and debugging that I produced a couple of years ago and that unfortunately is no longer online.

I guess it is the one ([once] equally) on futurelearn [here](https://www.futurelearn.com/courses/defensive-programming-and-debugging) with a companion page still accessible [here](https://gjbex.github.io/Defensive_programming_and_debugging/).

---

<div class="post-metadata">

**Author:** ![nbehrnd](https://avatars.discourse-cdn.com/v4/letter/n/e0b2c6/32.png) [@nbehrnd](https://fortran-lang.discourse.group/u/nbehrnd)\
**Post date:** [February 14, 2024, 9:38pm UTC](https://fortran-lang.discourse.group/t/best-practices-in-scientific-software-development/7402/6 "2024-02-14T21:38:12Z")

</div>

Three resources I’m aware of which seem to resonate with this thread are

- the [BCI Research Software Engineering Guide](https://bristolcompositesinstitute.github.io/RSE-Guide/) by the Bristol Composites Institute, University of Bristol (last edit by 2022)
- a compilation by West Virginia University about [scientific programming](https://docs.hpc.wvu.edu/text/500.ScientificProgramming.html), sub sections straddle Fortran, C, C++; Python; R; Julia; Matlab; Perl; OpenMP, MPI, OpenAcc, Cuda (last edit by 2023)
- the presentation [Best Practices for Programming GPUs using Fortran, OpenACC, and CUDA](https://www.nvidia.com/en-us/on-demand/session/gtcspring23-S51857/) by David Appelhans (Senior DevTech @NVIDIA, March 2023) – though frankly (because I don’t use GPUs) this is a resource I only know from the outside/by name thanks to an exchange around [r/scientificcomputing](https://www.reddit.com/r/ScientificComputing/).
