Skip to content

Dinaverse/oop-programming-basics

Repository files navigation

🎓 OOP Programming Basics

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.

🧩 Concepts Demonstrated

1. Classes and Objects

  • classAutoPilot.py: Demonstrates the creation of a class to encapsulate properties and behaviors for an autonomous system.

2. Encapsulation

  • classCompte.py: Showcases encapsulation by managing bank account data and operations within a class structure.

3. Data Modeling & Encapsulation

  • `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.

4. Operator Overloading

  • `TentativeConnexion.py`: Demonstrates operator overloading in Python by implementing `str` for custom string representation and `eq` to define custom equality logic.

5. Inheritance and Polymorphism

  • `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.

6. Abstraction and Abstract Base Classes (ABC)

  • `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.

7. Composition and System Management

  • `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.

About

Fundamental Object-Oriented Programming (OOP) exercises and concepts

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages