Cricket Score Board System – Low Level Design Interview Practice
Practise the Cricket Score Board System low level design problem the way an LLD round actually runs. You are asked for requirements first, then a class model, and then to extend the design when a new requirement lands part way through – the follow-up that separates a design that was memorised from one that was understood.
The round checks the things interviewers grade: whether your classes carry single responsibilities, whether you reached for a design pattern or reinvented one, whether the design absorbs a new requirement without rewriting what exists, and whether you can explain a trade-off out loud. Feedback covers class modelling, SOLID principles, use of patterns, extensibility and communication.
What this question is really testing
Event modelling. The scoreboard is derived state; the design question is whether a ball is a first-class event that everything else is computed from.
Requirements to establish first
- Record every delivery with its outcome: runs, extras, wicket, or a combination.
- Handle extras correctly - a wide and a no-ball do not count as balls bowled; a bye does not credit the batter.
- Maintain batting and bowling figures, strike rotation and the current partnership.
- Track overs with the bowler changing each over and no bowler bowling consecutive overs.
- Report the live scorecard and over-by-over commentary.
Core classes
- Ball / Delivery – One legal or illegal delivery with its outcome. The event everything else is derived from.
- Over – Six legal deliveries and one bowler. Illegal deliveries extend it.
- Innings – Overs, the batting order, the fall of wickets.
- Player / BattingCard / BowlingCard – The per-player figures, which are projections of the ball stream, not independently mutated state.
- ScoringStrategy – T20, ODI and Test differ in over limits, powerplays and follow-on rules.
- Scoreboard – An observer of the ball stream that renders the current state.
Design patterns that apply
- Observer – One delivery updates the batting card, the bowling card, the partnership, the run rate and the commentary - none of which the delivery should know about.
- Strategy – Format rules. A no-ball is a free hit in T20 and not in a Test.
- State – Innings state - in progress, between overs, drinks, complete - gates what deliveries are legal.
Follow-up questions to expect
- A no-ball is hit for four with a bye. How many runs, to whom, and does the ball count? Show where that lives.
- Reverse the last delivery after an umpire review. Does your design support it, and what does that imply about derived state?
- A batter retires hurt and returns later. What in your batting card changes?
Where candidates lose marks
- Incrementing score and figures directly from the UI, so the scoreboard and the ball history can disagree.
- Counting every delivery as a ball bowled, which gets every over with a wide wrong.
- Format rules as conditionals scattered through the scoring code rather than in one strategy.