The Carpentries; Software Sustainability Institute
30 August 2023
My ideal job:
writing code that helps people to do their research
This has a name:
Research Software Engineering
If you develop software 1 to support your own research or that of others, you are doing Research Software Engineering!
You may like to describe yourself as a Research Software Engineer (RSE)
You’re welcome in RSE events and spaces, such as the yearly UK RSE Conference
Sustainability means that the software you use today will be available - and continue to be improved and supported - in the future. 1
Sustainable software is software which: 2
Would you use and trust the results of a microscope or telescope that hadn’t been built by qualified engineers or tested? 1
Software is the most prevalent of all the instruments used in modern science
The consequences of not following best practices can be serious
Two students collaborate to model telescope observations of a specific type of astronomical event.
The C++ tool FABBER processes functional magnetic resonance imaging to recognise blood flow patterns in the brain and measure brain activity.
Post questions in Slido Q&A tab
Coming next: How Do I Improve the Sustainability of my Software?
Heavily inspired by 9 steps for quality research software by Laurence Billingham, Steven Lamerton, Nick Rees, Mike Croucher, Richard Domander, and Carl Wilson
You don’t need to do all of them right now
You don’t need to follow them in order
Pick one that resonates with you, and focus on that
In the long run:
Strive to make a small improvement every time you write a new piece of code
Hello, I am Eli, and I’ve written terrible software.
It’s ok to not write perfect code
It’s ok to write very imperfect code
Just don’t deny that your code could be better out of pride or shame
Version control:
Invest a couple of days in learning, then practice, practice, practice
Put your code on a platform like GitLab or Bitbucket while you’re at it. Now you have a backup!
Ideally, make this open-source
How often do you hit save in your word processor or code editor?
Is it almost reflexive?
Do the same with committing to version control!
You will build up a richer, more searchable, more undo-able history of changes (and it means more practice)
It’s ok to commit something broken, then fix it in a later commit
Now that your code is hosted openly online, anyone can download it to any other machine - so make sure it will run there!
Try to compile, build, and run your code on a machine that’s not yours
Document these alongside your code:
If your research isn’t reproducible, it isn’t reliable.
Save time by using tools that can automate the process
An hour invested now will save you many in the future
Popular choices for C++ are make
and cmake
You (hopefully) already test your code by putting in a known input and making sure it gives you the output you expect.
When you’ve confirmed it works, you delete the test.
Instead, wire that test up permanently using a testing framework, and run it whenever you make a change to ensure you didn’t break anything.
Do this every time you write a new piece of code, and suddenly you have a test suite!
Break your code down into simple chunks or units that do one thing each, and turn them into functions (e.g. loading a file, checking inputs are within valid ranges, plotting a chart)
Now your software is built from many simple interacting components.
It’s much simpler to verify that each function works correctly with individual ‘unit tests.’
You’ve written a function to solve a particular problem, and now your colleague has the same problem
Get them using the same code!
Now you have another set of eyes making sure your code works - and if either of you find a bug, you can fix it for both of you
In the same way, use and improve functions that your colleagues/friends/enemies have written
Research is better when we help each other
This one can be scary! But it will make your code better
You (hopefully) ask people to review your grant proposals and papers, even if you’ve been writing for years. Why not your code?
In return, offer to review your colleagues’ code too - and be nice
You will learn about functions, packages, and techniques you wouldn’t know about otherwise
Use continuous integration services to automatically build and test your code every time you make changes (e.g. Travis CI, GitHub Actions)
Test multiple OSs, compilers, and environments simultaneously with minimal setup
Many tools are free for open-source/academic projects!
But be warned: this is not a substitute for code review by a human
A community of practice is a group of people who share a concern or a passion for something they do and learn how to do it better as they interact regularly
cmake
, and HEP toolsPost questions in the Slido Q&A tab, or contact me:
Find these slides at https://github.com/elichad/talks