Debrief of SORTEE Code Club: Hacky Hour - Tuesday March 19

By Natalie van Dis | April 4, 2024

 

The Member Engagement Committee runs Code Club every third Tuesday of the month. Time can vary depending on the host and will be announced at least two weeks in advance on SORTEE’s Slack.

In this month’s Hacky Hour, 9 participants shared their code mistakes, starting up the SORTEE library of code mistakes! The goal is twofold: the normalization of coding errors and building a resource of (common) code mistakes that you can use during code review.

 

SORTEE Code Club: Hacky Hour

 

Sharing code mistakes, problems, tips & tricks

The Hacky Hour revolved around the 4 R’s of Code review - Reported, Run, Reliable, and Reproducible - that we learnt about in the previous Code Club meeting. Participants shared their code mistakes, problems, tips and tricks in a collaborative document, practising with (Markdown language)[https://www.markdownguide.org/basic-syntax/] at the same time.

We learnt how to say ‘computer’ in 8 different languages as an icebreaker, followed by the opportunity to request a code review. We then discussed the best way to report software versions (Reported), how to use Quarto (Reported) and easy ways to keep track of memory and CPU usage in R (Run). You can read back what we discussed in this HackMD document.

 

Sharing code mistakes: watch out with the mean() function in R!

One of the coding mistakes shared among peers was about using the mean() function in R. This base function takes a vector of numbers (e.g. c(2,4)) and calculates the mean. But if one forgets to put the numbers in a vector, only the first number will be used to calculate the mean! Without giving any warning. The other numbers will be interpreted as arguments changing the function’s usage, which probably is often not the intended behavior by the coder…

> mean(2, 4)
[1] 2

> mean(c(2, 4))
[1] 3

 

What’s next?

The next Code Club meeting will be a Training session on Tuesday April 16 at 8-9h UTC +00:00 (zoom link will be posted on SORTEE’s Slack). We will discuss the development of a code review checklist for Ecology and Evolution.

Stefan Vriend, Joey Burant and Freddy Hillemann have turned the 4 R’s into a code review checklist for Ecology and Evolution. They will host a workshop where we will use this checklist to code review published papers, followed by a discussion on how it can be improved.

You can check the Code Club schedule here for upcoming meetings.