Data Structures & Algorithms

Object-Oriented Modelling and Events

4:03

Plays from YouTube. Watch on YouTube

How can Python model a delivery service without turning into one enormous class?

Meet object-oriented modelling, representation invariants and discrete-event simulation.

We start by separating customers, restaurants, couriers and orders into coherent entities, then assign responsibility for shared state.

From there, we represent events on a timeline and process them using a priority queue, accounting for cancellations and equal-time ordering.

Finally, we verify transitions with invariant-based tests.

The big idea: reliable simulations model state changes and their ordering explicitly.

Software design explained visually, one concept at a time.