Online course

Defensive Programming and Debugging

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

Learn how to keep your code clean and bug-free

Identifying and fixing bugs in code often proves difficult.

On this course, you’ll discover tools and techniques to minimise the number of bugs during software development.

You’ll learn how to catch bugs early using compiler features and writing tests for your code.

You’ll find out how to pinpoint bugs in your code using the best tools available including debuggers, code analysers and more.

You’ll 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 code that is clean, robust and easy to maintain.

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?

  • Available now
    This course started 5 November 2018

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.

Learners collage mobile
Join this course


  • Access to this course for 7 weeks
  • Includes any articles, videos, peer reviews and quizzes


  • Unlimited access to this course
  • Includes any articles, videos, peer reviews and quizzes
  • Tests to validate your learning
  • Certificate of Achievement to prove your success when you're eligible
  • Download and print your Certificate of Achievement anytime