CSE Roadmap

Core tier · about 2 hours · 7 parts

Part 6 of 7 · 1 min read

How much to draw

Enough to guide the talk, no more.

How much to draw

A made-up budget for a 45-minute round: 5 minutes on one class diagram, 3 minutes on one sequence diagram. That leaves most of the time for code.

Habits that help: - Start with boxes and lines only. Add fields and methods when the talk needs them. - Use the same names as the code. A box called Booking and a class called Reservation confuse everyone. - Do not chase the notation. Interviewers rarely check whether the arrowhead is hollow or filled. They check that the idea is clear. - Redraw when the design changes. A stale diagram is worse than none.

Common mistake

Drawing a full diagram with every field and every method, then running out of time before any code.

Interview angle

Answer in your head first, then open it.

Which diagram do you draw first?

A class diagram, then a sequence diagram for the main flow.

What is the difference between aggregation and composition?

In composition the whole owns the part, and the part ends with it.

How do you check a design?

Walk one request through the sequence diagram and see whether each call has a method.

Check yourself: 1. Why use the same names as the code? 2. How many minutes would you give to diagrams in a 45-minute round? 3. What do you do when the design changes?

Words you will meet

Word Meaning
Class diagram Boxes for classes with lines for the links between them
Sequence diagram The calls between objects for one scenario, in order
Association One object holds or knows another
Aggregation A whole with parts that can live on their own
Composition A whole that owns parts which end with it
Multiplicity How many objects sit at each end of a link