Skip main navigation

£199.99 £139.99 for one year of Unlimited learning. Offer ends on 28 February 2023 at 23:59 (UTC). T&Cs apply

Find out more

Introduction to Week 1

Writing clean and easy to understand code it is a crucial part of the software development process. Watch Dr. Geert Jan Bex telling you best practices
When writing code, it is quite important to keep in mind the entire life cycle of your project. Typically for scientific software things start out small, it’s just a quick hack to solve a single problem. So, good quality is not that important. But of course, over time your code base will grow. Also, it will get more complex. More importantly, others will start using your code, either just to verify your results or even as the basis for their own research as building blocks.
No doubt, you’ve had the following experience: You open a source file, you stare at it for minutes and you think, “What the heck?” Clearly, the author of that piece of code really failed to convey his intentions to you. Perhaps that can serve as motivation to try and create a clean code that is easy to read.
Perhaps you can think of coding as storytelling. It’s not just about telling a piece of hardware what to do, it’s actually more like writing a novel. So, it should be pleasant to read. We’ll learn best practices to write clean code that’s easy to understand. When you’re using software, documentation is also quite important. Good quality documentation makes using software a lot less problematic and so, having documentation as a part of your release is quite important. Documentation can be written at various levels. For instance, at a level of your functions, classes and methods. For that API documentation you will learn about Doxygen, a tool that really generates beautifully looking documentation.
At the level of the application as a whole you will also require documentation, a manual, if you will. And you’ll learn about MkDocs which will generate that for you. Of course, you’ll also learn about best practices and do’s and dont’s in writing documentation.

Week 1 learning goals

During this week, you’ll learn about:

  • Code style,
  • Best coding practices,
  • Error handling,
  • Writing API documentation,
  • Writing application documentation.
This article is from the free online

Defensive Programming and Debugging

Created by
FutureLearn - Learning For Life

Our purpose is to transform access to education.

We offer a diverse selection of courses from leading universities and cultural institutions from around the world. These are delivered one step at a time, and are accessible on mobile, tablet and desktop, so you can fit learning around your life.

We believe learning should be an enjoyable, social experience, so our courses offer the opportunity to discuss what you’re learning with others as you go, helping you make fresh discoveries and form new ideas.
You can unlock new opportunities with unlimited access to hundreds of online short courses for a year by subscribing to our Unlimited package. Build your knowledge with top universities and organisations.

Learn more about how FutureLearn is transforming access to education