There’s always more to learn
As with most skills, coding skills need to be maintained. One way to do it is to read other people’s code and have them read yours. If we often ask others to review our emails before we send them, how come we don’t ask them to read our code before presenting its results? If you don’t have people you can go to, you can still review your own code. In both cases, asking the following questions when reading a piece of code will help you improve it:
- What can go wrong in this code?
- Does this code make sense? Can it be simpler? Can it be made more efficient?
- Should this code chunk be a function? Or maybe an external file used as a function input?
- What happens if more observations are added to the data? And if some are removed?
- How many lines of code would I have to update if a research decision changed?
Reading help files and cheat sheets is also a great way to learn more about languages you already use. For example, there may be a faster command to do something that always took you a long time, or a function you were already using may have options you didn’t know about. Cultivate the habit of checking the help file when using a command – you will be positively surprised by what you can learn. Finally, many efficiency gains will come from how you use your IDE, so make sure to learn the shortcuts and workflows for your software of choice.