A professional Python-based management system for various types of vehicles (Cars, Motorcycles, Cross-Bikes). The project demonstrates advanced Object-Oriented Programming (OOP) concepts, custom data validation using descriptors, and defensive programming techniques.
- Advanced Data Validation: Uses custom Python Descriptors to manage fuel levels and mileage, ensuring data integrity (e.g., preventing odometer rollback).
- Dynamic Constraints: Fuel tank capacity is dynamically validated based on the specific vehicle model using the
type(self)protocol. - Defensive Logic: Smart methods for
ride,training, andtankingthat prevent invalid operations (like riding without fuel or overfilling the tank). - Clean Architecture: Clear separation of concerns with dedicated modules for descriptors, vehicle types, and error handling.
- Language: Python 3.9+
- Linting: Flake8 (PEP 8 compliance)
- Concepts: Descriptors, Inheritance, Encapsulation, Custom Exceptions.
├── descriptors.py # Custom descriptors (Counter, Tank)
├── vehicle_types.py # Vehicle class hierarchy
├── errors.py # Custom exception classes
├── main.py # Application entry point & simulation
├── requirements.txt # Project dependencies
└── .flake8 # Linter configuration
docker compose up --build- Building an image
docker build -t vehicle-logic-descriptors .- Running program (container)
docker run -v .:/app vehicle-logic-descriptors