A collection of object-oriented programming exercises implemented in both Python and Java, developed during my second semester of Computer Science and AI Engineering at Universidad Sergio Arboleda (Fundamentos de Software).
Each exercise includes:
- π A UML class diagram β the design comes before the implementation
- β A Java implementation (statically typed,
extends/implements) - π A Python implementation (
ABCmodule simulating interfaces) - π A short README explaining the concept applied
Sketching the UML diagram before writing any code forces you to define the relationships between classes β inheritance, interface contracts, cardinality β before implementation details get in the way. It also makes it obvious when a language-specific implementation is inconsistent with the original design, which is exactly the kind of thing this repo is meant to demonstrate.
- Abstract classes (the "is-a" relationship β shared state and behavior)
- Interfaces (the "can-do" relationship β a contract every implementer must fulfill, regardless of where it sits in the inheritance tree)
- Polymorphism (treating different concrete classes uniformly through a shared abstract type or interface)
- Encapsulation
See docs/key-concepts.md for a deeper explanation
of how these ideas map between Java and Python.
| # | Domain | Classes |
|---|---|---|
| 01 | Private transportation | Transporte, Conducible, Carro, Moto, Bicicleta |
| 02 | Video game characters | Personaje, Atacante, Guerrero, Mago, Arquero |
| 03 | Streaming content | Contenido, Reproducible, Pelicula, Serie, Documental |
| 04 | Food preparation | Alimento, Preparable, Hamburguesa, Pizza, Ensalada |
| 05 | Animals | Animal, Sonoro, Perro, Gato, Vaca |
| 06 | Bank accounts | CuentaBancaria, Operable, CuentaAhorro, CuentaCorriente |
| 07 | Geometric shapes | Figura, Calculable, Circulo, Rectangulo, Triangulo |
| 08 | Electronic devices | Dispositivo, Controlable, TV, Radio, Celular |
| 09 | Professionals | Persona, Profesional, Medico, Ingeniero, Profesor |
| 10 | Public transportation | TransportePublico, Transportador, Bus, Metro, Taxi |
Each exercise follows the same pattern (abstract class + interface + polymorphism) applied to a different domain, and deliberately implements a different concrete subclass in each language.
docs/theoretical-cases.md contains 10
additional design-only case studies (no code) exploring relationships that
go beyond inheritance and interfaces β aggregation, composition, and
association β across domains like a library system, a payment platform,
and a hospital management system.
oop-exercises/
βββ exercises/
β βββ 01-transporte-privado/
β β βββ diagram.puml
β β βββ Main.java
β β βββ main.py
β β βββ README.md
β βββ 02-personajes-videojuego/
β βββ ...
βββ docs/
βββ key-concepts.md
βββ theoretical-cases.md
- Java (JDK)
- Python 3 (
abcmodule) - PlantUML for diagrams