Code review in academia

ba.pngBy Becky Arnold, University of Sheffield 

Coding is now the backbone of much of scientific research. Despite this in many cases the coding education of researchers is nonexistent, or doesn’t extend far beyond how to use a for loop. As a result we largely learn tips, tricks and best practice the hard way, and in small fragments. The solution- teach each other! If everyone knows a little then put together we know a lot.

The approach of the Sheffield astrophysics group

Since May 2017 we have held lunchtime code review and collaboration meetings every two weeks. These meetings are very informal to encourage discussion, and as well as reviewing one anothers code we use these sessions to exchange information. If you spent the week figuring something out, read an interesting article, or picked up a new trick here is the place to tell others about it. People can also opt to give short tutorials if they wish, for example we’ve had ones on version control, wrapping one language with another, and best practice.

These sessions have had numerous benefits:

1. Save time and frustration

Researchers have a vast array of administrative and research responsibilities which leave little time to spare. But how many days of that valuable time have you spent knocking your head against coding issues, scouring stack overflow, and crying into coffee cups at 2 am about the code that just won’t work. An hour every week or two dedicated to improving programming skills pays for itself many times over in the long term.

2. Avoid duplication of effort

Simple maths, if one person spends an hour figuring something out then spends 10 minutes explaining it then that is better than 10 people spending an hour figuring it out independently.

3. Improve soft skills

These meetings provide an excellent opportunity for particularly early career researchers to improve their presentation skills in a relatively safe environment, amongst people they know who can give constructive feedback. Additionally, giving short tutorials allows early career researchers to gain experience with teaching, which is a valuable skill in many career paths.

4. Collaboration and mental health

Good coding practice is relevant to people from very disparate research areas, and as such these meetings can provide an opportunity to foster relationships between those that would not otherwise meet, potentially leading to collaborations. Further, spending time in an informal, somewhat social environment provides a welcome relief in the sometimes isolating world of research, particularly for PhD students.

Top tips

Here some of the things we’ve found to be beneficial in our meetings:

Keep it informal. Less confident or less experienced programmers are much more likely to ask questions and to contribute in an informal environment, allowing them to get more from these sessions and to give more to them. In addition to this useful things often spring up from casual discussion.

Have at least one person scheduled to speak each session. If no one has prepared anything to share there is a danger of people walking away without having heard anything useful, and they’re much less likely to come back.

Food is always good. If it can be wrangled from a budget biscuits are a powerful motivator.

Mix it up. Make sure it’s not always the same few people talking/contributing, it gets old fast so try to draw quieter people into the discussion.

Think carefully about language. Depending on your members you may all have a common coding language. If not try to keep sessions largely language independent, e.g. anyone can benefit from an explanation of the role of units tests but there’s no point lecturing a lifelong FORTRAN programmer about the differences between python 2 and 3.

Make it fun. For example one tutorial session we ran was to give us practise using github collaboratively. The project we worked on was writing a program to make bingo sheets of common complaints or mishaps at the astrogroup’s weekly meeting.  


 

Posted by s.aragon on 18 May 2018 - 9:45am