This repository contains fundamental exercises demonstrating Object-Oriented Programming (OOP) concepts in Python. These scripts were developed as part of my initiation into structured programming.
classAutoPilot.py: Demonstrates the creation of a class to encapsulate properties and behaviors for an autonomous system.
classCompte.py: Showcases encapsulation by managing bank account data and operations within a class structure.
- `classArticle.py`: Demonstrates data modeling with encapsulation. Private attributes (
__reference,__nom, etc.) are protected using name mangling and accessed through getter and setter methods. It also implements business logic for managing inventory (approvisionner, vendre) and tax calculations.
- `TentativeConnexion.py`: Demonstrates operator overloading in Python by implementing `str` for custom string representation and `eq` to define custom equality logic.
- `classAlerte.py`: Demonstrates inheritance and polymorphism by overriding `afficher_info()` for specialized alert types.
- `classAppareilReseau.py`: Further demonstrates inheritance where `Serveur` and `Routeur` extend the base `AppareilReseau` class. It showcases polymorphism by overriding `afficher_info()` to include device-specific details (OS/services for servers, interfaces/firmware for routers) while calling the base class method to retain common functionality.
- `Employee.py`: Demonstrates abstraction in Python using the `abc` module. The base `Employee` class is an Abstract Base Class (ABC) with an abstract method `get_salaire()`. This enforces that any subclass (`Ouvrier`, `Cadre`) must implement its own salary calculation logic, ensuring a consistent interface across different employee types.
- `classParcInformatique.py`: Demonstrates Composition, a design principle where a class (`ParcInformatique`) is composed of one or more objects of other classes (`Equipement` and its subclasses). This script shows how to manage a collection of heterogeneous objects (computers, printers, servers) within a single system, coordinating their collective behavior (maintenance, task execution) while leveraging polymorphism.
Learning the foundations of robust software engineering - Dina.