Defensive programming, unit tests and documentation

Duration3h45 + preparation

Presentation and objectifs

In software development, ensuring the quality, maintainability, and reusability of code is paramount. This course focuses on three critical practices: defensive programming, unit testing, and code documentation. Defensive programming involves writing code that anticipates and handles potential errors gracefully, minimizing bugs and system failures. Unit testing verifies that individual components function as expected, providing a safety net during development and future changes. Lastly, thorough documentation enhances code readability, making it easier for developers to understand, modify, and extend the program over time. Together, these practices form the foundation of robust, reliable, and long-lasting software.

Before the class

Technical requirements

To be able to start working on the activity, you should meet the following requirements:

Important

For this lab, we advise you to deactivate Gihub Copilot and and AI code generation tools.

Prior knowledge acquisition

The programming part of this session addresses a very important notion to help you implement robust and safe programs. Before arriving in class, you should study the following articles:

Now that you have studied the links above, you can verify your understanding of the notions presented there. Here are some resources to help you check if you got everything:

During the class

Practical activity

The class is dedicated to a practical activity. When ready, click on the link below to start:

After the class

Complete the current session

Before the next session, you should:

  • Review the contents of the articles above.
  • Complete the non-optional parts of the practical activity.

Prepare the next session

Also, you should:

  • Check the Before the class section of the next session, and make sure you do everything required to prepare it.