Publisher / Subscriber• Patterns: Observer, Strategy
Cricbuzz
Medium
Problem Summary
Design Cricbuzz/Cricinfo to display live cricket match scorecards, player statistics, and run notifications.
Functional Scope
- Provide real-time updates of overs, runs, wickets, and run rates.
- Push scoreboard modifications immediately to observers (web dashboard, SMS notifier).
- Compute statistics (Strike rate, economy, target runs) dynamically.
Entity-Relationship (ER) Schema
Match [1] <---> [2] Innings Match [1] <---> [*] Observer Innings [1] <---> [*] PlayerStats
Design Approach
Use the Observer pattern to decouple Match engine updates from dashboard rendering layouts. Compute statistics on the fly inside the Scorecard model.
Core Classes & Models
Match (Matches state and statistics)Innings (Overs, wickets tracking)Observer (Interface for scorecard, notification listener)
Code Blueprint
public interface Observer {
void update(Scorecard score);
}