Learning pathsA
Design exercises

Design a parking lot

Separate allocation, payment, and occupancy.

Understand the problem

Define Vehicle, Spot, Ticket, AllocationPolicy, and PricingPolicy. Parking atomically claims a compatible spot and creates a ticket. Leaving settles a ticket before releasing occupancy under explicit rules.

Make it concrete

A motorcycle may use a small spot; a large vehicle requires a compatible capacity class.

Trade-offs and pitfalls

A global allocation lock is simple but can bottleneck large facilities.

Check your understanding

Describe how concurrent entry gates avoid allocating the same spot.

Practice this topic

Your study notes