Online course in Tech & Coding

Defensive Programming and Debugging

Find out how to write clean and robust code as a programmer. Explore techniques to minimise the number of bugs during development.

  • Duration 5 weeks
  • Weekly study 4 hours
  • Learn Free
  • Extra benefits From $84 Find out more

Learn how to identify and solve software bugs in your code

Want to improve your ability to identify and fix bugs in code?

On this course, you’ll discover how to reduce bugs during software development. You’ll learn with examples in both C and Fortran programming languages and understand how to catch bugs early using compiler features and writing tests for your code.

You’ll learn to find the bugs in your code using the best tools available including debuggers and code analysers. You’ll also look at parallel programs and explore tools for debugging parallel code at scale.

By the end of the course, you’ll feel confident writing high-quality and clean code.

Download video: standard or HD

Skip to 0 minutes and 9 secondswhat can you tell us about bugs? Okay, so there's the story. In 1947 a group of technicians at Harvard University were running their electromechanical computer and they noticed a lot of errors. So they opened up the computer and they found a moth. They found an actual bug! So they dropped the logbook, took the moth, pasted it in and wrote the following

Skip to 0 minutes and 38 secondswords: "first actual case of a bug being found". And from that day onward we've been using the word bug to refer to glitches and flaws in any system. So why are bugs bad? Seriously? Besides making your life as a programmer miserable, they can have really dramatic consequences. In 1996 the launch of an Ariane 5 rocket failed due to a bug in the inertial reference system. 40 seconds after launch the rocket exploded ... Just like with real bugs you want to prevent an infestation. So, it's crucial that you adopt a defensive programming style to reduce the number of bugs in your code. In this MOOC will discuss professional tools and advanced techniques for debugging serial and parallel programs.

Skip to 1 minute and 30 secondsSo, you'll minimize the time and frustration spent on finding and fixing them.

Skip to 1 minute and 35 secondsWelcome to our MOOC: "Defensive programming and debugging"

What topics will you cover?

  • Defensive programming: the use of good coding style, documentation strategies and good code testing
  • Preventing bugs: how to use compiler flags and static code checkers to identify bugs in an early stage
  • Finding bugs: debugging concepts and technics
  • Using the debugging tools GDB and Valgrind to fix serial programs
  • Debugging parallel code: using Intel Inspector and ITAC

When would you like to start?

Most FutureLearn courses run multiple times. Every run of a course has a set start date but you can join it and work through it after it starts. Find out more

  • Available now
    This course started 29 April 2019

What will you achieve?

By the end of the course, you'll be able to...

  • Develop good writen software codes
  • Produce clear and useful software documentation
  • Identify software bugs
  • Solve sofware bugs

Who is the course for?

This is an intermediate level course aimed at people with some programming experience. Although examples will be given in C and Fortran, the principles (and most of the tools) are transferable to other programming languages.

Who will you learn with?

Geert Jan Bex

HPC analist/consultant at Hasselt University and University of Leuven.

Mag Selwa

During my physics studies I got interested in research in computational physics/astrophysics. After several postdoctoral positions I joined VSC and I stay close to science by supporting our HPC users.

Ingrid Barcena

I have been for more than 20 years helping users to take the most of the HPC systems. Since 2013 I work at the HPC User Support Team at KU Leuven.

Who developed the course?

The Partnership for Advanced Computing in Europe (PRACE) is an international non-profit association with its seat in Brussels.

Join this course

Start this course for free, upgrade for extra benefits, or buy Unlimited to access this course and hundreds of other short courses for a year.


Join free and you will get:

  • Access to this course for 7 weeks


Upgrade this course and you will get:

  • Access to this course for as long as it’s on FutureLearn
  • Access to this course’s tests as well as a print and digital Certificate of Achievement once you’re eligible

Unlimited (New!)
$269 for one year

Buy Unlimited and you will get:

  • Access to this course, and hundreds of other FutureLearn short courses and tests for a year
  • A printable digital Certificate of Achievement on all short courses once you’re eligible
  • The freedom to keep access to any course you've achieved a digital Certificate of Achievement on, for as long as the course exists on FutureLearn
  • The flexibility to complete your choice of short courses in your own time within the year
Find out more about upgrades or Unlimited.