Second semester

Introduction to object programming, documentation and testing

Objectives

The aim of the course is to present the approach, know-how and tools needed to develop simple data processing applications. Concepts covered include :

Object-oriented programming (OOP). This is at the heart of modern programming languages, enabling data and data processing to be compartmentalized, and facilitating the modular development of applications. The main objective is to understand the concepts of object programming by designing simple classes, possibly organized hierarchically.

Code structuring. Functionalities are divided into modules and packages according to a logical structure.

Code documentation. This tells developers and users what each implementation does, for example, the descriptions and types of variables expected as input and returned as output. It can also be used to automatically generate package documentation.

Exceptions. These identify possible problems in the code and are raised when a problem is encountered. The call stack can be used to identify which parts of the code have been executed before the exception is raised.

Tests. They are essential to the development of any code to ensure that each module works correctly when isolated from other modules (unit tests) and when interacting correctly with other modules (integration tests), and that the package’s functionalities work correctly (functional tests).

Code style. Code is easier to read and understand when the same style of code is used by all developers.

Implementing these concepts in a programming language. The programming language used in this course is Python.

The UML formalism. It sets out the conventions needed to describe the functionalities expected of a code, to describe the links between data, to describe use cases, etc. It is a powerful language for describing the functionalities expected of a code. It’s a powerful language for communication between developer and prime contractor, as well as for helping the application developer to design its components.

Course outline

Object-oriented programming: class, instance, attribute (public / protected / private) (instance / class), method (public / protected / private) (instance / class), inheritance, abstraction

Code structuring: module, package

Code documentation: docstrings, doctests

Exceptions: call stack, exception types, error messages

Tests: unit tests, integration tests, functional tests, pytest

Code style: PEP8, PEP257

UML diagrams: class and instance diagrams, class relationships

Prerequisites

Algorithms and complexity