CSE Roadmap

Common tier · about 2 hours · 7 parts

Part 7 of 7 · 2 min read

Exercises

Easy

Easy 1: Name the link (20 minutes)

Name the link for: a car and its engine; a driver and a car; a method that takes a Logger; a Circle and Shape; a team and its players.

Done when: five answers with the test you used.

Hint

Ask whether the part outlives the whole.

Easy 2: Multiplicity (20 minutes)

Write the multiplicity for: a library and its books; a book and its copies; a copy and its current loan; a member and active loans.

Done when: four lines with numbers on both ends.

Hint

A copy has at most one current loan.

Easy 3: Read the code (20 minutes)

Read the Booking code and write a text diagram with the right links.

Done when: a diagram with three links.

Hint

Look at who creates each object.

Medium

Medium 1: Compile and test (30 minutes)

Compile the Booking, Room and TimeSlot code. Make two bookings of one room and check sameRoom.

Done when: a printed true and a printed false.

Hint

Compare references with ==.

Medium 2: Ownership change (30 minutes)

Change TimeSlot to be passed into Booking instead of created inside. Explain how the link and the risks change.

Done when: new code and a short explanation.

Hint

The slot's owner is now outside the booking.

Medium 3: Two-way link (30 minutes)

Make Room hold a list of its bookings. Show how the two sides can fall out of step, and fix it with one method that updates both.

Done when: a bug demonstration and the fix.

Hint

Add a booking to both sides inside one method.

Hard

Hard 1: Draw a design (45 minutes)

Draw the class diagram of a food ordering system with at least six classes and all six link types where they fit.

Done when: a diagram with multiplicity on every link and a one-line reason for each link type.

Hint

Order items are composed in an order, a menu item is only associated.

Hard 2: Two meanings (45 minutes)

Explain how GoF's "aggregation" differs from the modelling-tool terms. Rewrite a GoF sentence about it using composition and aggregation as the tools define them.

Done when: a half-page note with one rewritten sentence.

Hint

GoF has two words and the tools have four.

Hard 3: Cut the arrows (50 minutes)

Take a design with 10 classes and 25 arrows. Remove at least ten arrows by using parameters, interfaces and by dropping two-way links.

Done when: a before and after diagram with the arrow counts.

Hint

Pass a value in when a class needs it only once.