LLD of Cricbuzz (Match scheduling, Performance tracking, Score counting)
Difficulty: MEDIUMCategory: LLDFrequency: 1Asked On 2024-08-15
Problem Statement
Design the core backend system for a cricket application like Cricbuzz focusing on match scheduling, live score tracking, and player performance statistics. Emphasize class design, modularity, and data updates rather than UI.
Functional Requirements
1.Match Scheduling
•Schedule matches between teams with date, time, venue.
•Maintain status of matches: upcoming, live, completed.
•Support tournament fixtures (group stage, playoffs, finals).
2.Score Tracking
•Track runs, wickets, overs, balls for each match.
•Maintain player-level stats (runs scored, balls faced, wickets, overs bowled).
•Update live scores in real-time.
3.Player & Team Management
•Store team details: name, players, coach.
•Store player details: name, role (batsman, bowler, all-rounder, wicketkeeper).
4.Performance Statistics
•Calculate averages, strike rates, economy rates, etc.
•Track historical performance across multiple matches/tournaments.
5.Notifications / Updates
•Notify users for match start, innings updates, milestones (50/100 runs, 5-wicket haul).
Non-Functional Requirements
•Real-time updates: Efficient score and stats updates for live matches.
•Scalability: Support multiple simultaneous matches.
•Extensibility: Easy to add new sports, leagues, or detailed analytics.
Edge Cases & Constraints
•Match postponed/cancelled → update match status.
•Player substitution → update live score and stats accurately.
•Concurrent updates → handle thread-safety if multiple data feeds are used.
Design Hints
•Key Classes / Interfaces
•Match → stores match ID, teams, start time, venue, status, innings info.
•Team → stores team name, list of players.
•Player → stores player info, role, cumulative stats.
•ScoreBoard → tracks runs, wickets, overs, and balls for each innings.
•Innings → tracks batting/bowling order, ball-by-ball events.
•PerformanceTracker → calculates player stats and averages.
•CricbuzzApp → main orchestrator managing matches, score updates, and notifications.
•Data Structures
•HashMap / Dictionary → playerId → Player object, matchId → Match object.
•Queue / List → ball-by-ball events, notifications.
•Nested Objects → Match → Innings → ScoreBoard → PlayerStats.
•Design Patterns
•Observer Pattern → notify users or UI components about live updates.
•Strategy Pattern → optional, different scoring or calculation strategies.
•Singleton → optional, for global CricbuzzApp instance.
Example Flow
1.Admin schedules a match → Match object created with Team objects.
2.Live match starts → Innings and ScoreBoard initialized.
3.Ball-by-ball update → ScoreBoard and PlayerStats updated.
4.Notifications sent to users → Observer pattern used.
5.Match ends → final scores and performance stats stored.
Evaluation Areas
•Accurate OOP modeling of matches, teams, players, and scores.
•Efficient live update handling for scores and player stats.
•Proper class relationships: Match → Innings → ScoreBoard → PlayerStats.
•Extensibility for new features like analytics, AI predictions, or multi-sport support.