Introduction to object programming, documentation and testing
- Teacher(s)
- Ludovic DENEUVILLE, Johann FAOUZI, Antoine GUENNEC, Louis GUICHARD, Kevin LEROY, Thierry MATHE
- Course type
- COMPUTER SCIENCE
- Correspondant
- Johann FAOUZI
- Unit
-
Module 1-08-M-E-S: Programming with Python
- Number of ECTS
- 2.5
- Course code
- 1AINF06
- Distribution of courses
-
Heures de cours : 7.3
Heures de TP : 21
- Language of teaching
- French
- Evaluation methods
- 1 devoir maison (40%) et 1 devoir sur table de 2h (60%)
Objectives
Discover object-oriented programming. It is at the heart of modern programming languages, it allows compartmentalization of data and its processing and it facilitates the modular development of applications. The main objective is to understand the concepts of object-oriented programming by designing simple classes, possibly organized hierarchically. ; Learn to structure your code. Functions must be distributed into modules, sub-packages and packages following a logical structure. ; Develop the habit of documenting your code. Code documentation allows you to indicate to developers and users what each functionality does. It includes a description of the expected input arguments as well as the variables returned as output. It can also be used to automatically generate documentation for a package. ; Learn to throw exceptions. Exceptions allow you to identify potential problems in the code and are thrown when a problem is encountered. The call stack allows you to identify which parts of the code were executed before the exception was thrown. Develop the habit of writing and running tests. Tests are essential to the development of any code to ensure that each module works correctly when isolated from other modules (unit tests) and when it interacts with other modules (integration tests), and that the package’s features work correctly (functional tests). ; Respect a code style. It is easier to read, and therefore understand, code when the same code style is used by all developers. It is therefore important to develop good habits regarding the style of written code. ; Implement the concepts mentioned above in a programming language. The programming language used in this course is Python. ; Learn the UML formalism. This sets the conventions necessary for describing the expected functionalities of a code, describing the link between data, describing use cases, etc. It is a powerful language to enable communication between developer and project manager, but also to help the developer of an application to design its components.
Course outline
Object-oriented programming: class, instance, attribute (public, protected, private) of instance and class, method (public, protected, private) of instance, class and static, inheritance, abstraction. ; Code structuring: packages, subpackages, modules. ; Code documentation: docstrings, doctests. ; Exceptions: call stack, exception types, error messages. ; Tests: unit tests, integration tests, functional tests. ; Code style: PEP8, PEP257, Ruff, Noir. ; UML diagrams: class diagrams, instance diagrams.
Prerequisites
Algorithms: data structures (variables), control structures (sequences, loops). Python programming: variables, functions, native types (integers, floating-point numbers, strings, lists, tuples, sets, dictionaries), loops (for, if, elif, else, while).