Recall & Review
beginner
What is the Parking Strategy Pattern?
It is a design approach that helps decide how to park vehicles in a parking lot using different strategies, like parking nearest to the entrance or in the largest free space.
Click to reveal answer
intermediate
Why use the Strategy Pattern in parking systems?
It allows changing parking rules easily without changing the main system. For example, switching from first-come-first-served to reserved parking without big code changes.
Click to reveal answer
beginner
Name two common parking strategies.
1. Nearest Spot First: Park the vehicle in the closest available spot to the entrance.<br>2. Largest Spot First: Park the vehicle in the largest available spot to fit bigger vehicles.
Click to reveal answer
intermediate
How does the Parking Strategy Pattern improve scalability?
By separating parking logic into strategies, the system can add new parking rules without affecting existing code, making it easier to grow and maintain.
Click to reveal answer
intermediate
What role does the Context play in the Parking Strategy Pattern?
The Context is the parking lot system that uses a chosen strategy to decide where to park vehicles. It delegates the decision to the strategy object.
Click to reveal answer
What does the Parking Strategy Pattern help with?
✗ Incorrect
The pattern focuses on how to decide parking spots using different strategies.
Which of these is NOT a benefit of using the Parking Strategy Pattern?
✗ Incorrect
Cleaning the parking lot is unrelated to the strategy pattern.
In the Parking Strategy Pattern, what is the 'Context'?
✗ Incorrect
The Context is the system that applies the chosen parking strategy.
Which strategy might park a vehicle in the closest spot to the entrance?
✗ Incorrect
Nearest Spot First chooses the closest available spot.
How does the Parking Strategy Pattern help when parking rules change?
✗ Incorrect
The pattern allows swapping strategies easily to adapt to new rules.
Explain the Parking Strategy Pattern and how it helps manage parking decisions.
Think about how different parking rules can be swapped easily.
You got /3 concepts.
Describe the roles of Context and Strategy in the Parking Strategy Pattern with an example.
Imagine the system choosing where to park based on a rule.
You got /3 concepts.
