Clean Code: Best Practices in Programming

Clean Code: Best Practices in Programming created by Shaun Geaney, Royal Holloway University of London/National Physical Laboratory

Clean code, in its simplest form, is about creating organised, readable and terse programming code. This is so important because every year, all over the world, be it in labs or software companies, countless hours and days are wasted trawling through long files of code that are riddled with bugs, poorly executed methods and arbitrarily placed variables. Having clean code helps reduce that time significantly.

How will this help you? Well, if you use any kind of text based programming in your research (MatLab, C++, Python, Java, LaTeX etc.) you will find the skills you learn in this module very useful. You can be in either your first or last year of postgraduate study and you will find skills that are helpful to you. These best practices will help you sensibly manage your scripts, allow you to write less code in the future as you will be able to reuse your own modules and functions and also, for collaborative work, allow you to easily understand what it is that somebody else was trying to achieve in their code. Who hasn’t been given old code that a former student or staff member wrote months or even years ago and thought “What on this Earth were they trying to do?!” Having clean code helps to alleviate that problem for people reading your code.

This course will be laid out in an online presentation format. This is so that students can read and study the code and appending information at their own steady pace. The presentation will introduce new best practices and be followed by examples that help illustrate the key skill being presented. Ideally, a student will be able to apply the very general rules and practises to their own code to simplify and streamline their own functions and scripts that they may have already written or plan to write.


For the complete guide see here.