Part 7 of 7 · 2 min read
Exercises
Easy
Easy 1: Entity or not (20 minutes)
Classify as entity, value object, attribute or enum: seat, price, ticket, movie, show time, seat status, user email.
Done when: a seven-row table with a reason each.
Hint
Ask whether two of them with the same data are still two things.
Easy 2: Underline (20 minutes)
Read the six room requirements again and list every noun and verb.
Done when: two lists, with each noun sorted as in section 3.
Hint
Keep verbs as method names.
Easy 3: Blocks (20 minutes)
A building has 30 rooms, 10 working hours and 30-minute blocks. Compute blocks per room per day and per building per day.
Done when: two numbers with the working.
Hint
Blocks per room is 10 hours times 2.
Medium
Medium 1: Requirements for a parking lot (30 minutes)
Write ten questions and a numbered list of six requirements for a parking lot, with one out-of-scope line.
Done when: ten questions and a requirement list.
Hint
Cover who parks, what they pay, what sizes exist and what happens when full.
Medium 2: Classes for a parking lot (30 minutes)
From your list, write the classes, mark each as entity, value, enum or service, and point each to a requirement.
Done when: a table with a requirement number for every class.
Hint
Every class needs at least one requirement behind it.
Medium 3: Trim (30 minutes)
Take a class list with ten names for a library system and cut it to seven. Justify each cut.
Done when: seven classes and three cut reasons.
Hint
Look for names that are really fields.
Hard
Hard 1: Conflicting answers (45 minutes)
The interviewer says both "a user can book any room" and "only managers can book the large rooms". Write the question you ask and the two designs that follow from each answer.
Done when: one question and two short designs.
Hint
The answer changes who owns the permission rule.
Hard 2: Value or entity (45 minutes)
Argue both sides for making Address a value object or an entity in a food delivery system. Choose one.
Done when: a short note with a choice and a cost of the choice.
Hint
Ask whether two addresses with the same text are the same thing.
Hard 3: Extension point (50 minutes)
Pick the likeliest extension for the room system. Show which class gets a new interface and what stays the same.
Done when: a class sketch with before and after lists.
Hint
Choose the change that is most likely to be asked next.