CricBuzz Cricket App – Home Screen Design

Difficulty: MEDIUMCategory: LLDFrequency: 1Asked On 2023-12-04

Problem Statement

Design the Home Screen of a cricket app (like CricBuzz) that shows live scores, upcoming matches, recent results, and player/team highlights. The focus is on object-oriented design, modularity, and real-time updates for the user interface.


Functional Requirements


1.Live Matches Section
•Display ongoing matches with real-time score updates.
•Show teams, current score, overs, wickets, and match status (e.g., live, rain delay).
2.Upcoming Matches Section
•Display scheduled matches with date, time, and venue.
•Optionally, allow users to set reminders/notifications.
3.Recent Results Section
•Display recently completed matches with scores and outcomes.
4.Player/Team Highlights
•Show top performers, player stats, and team rankings.
5.User Interaction
•Tap on a match → navigate to match details screen.
•Tap on a team/player → navigate to profile/statistics.
6.Real-Time Updates
•Push score updates via a streaming system or polling mechanism.


Non-Functional Requirements


•Scalability: Support millions of concurrent users viewing live scores.
•Performance: Home screen should load quickly (<2 seconds).
•Extensibility: Easy to add new widgets (e.g., news, videos).
•Thread Safety: Ensure real-time updates don’t conflict with UI rendering.


Edge Cases & Constraints


•Network latency → show cached data until real-time data arrives.
•Matches may get canceled/postponed → reflect updates dynamically.
•No live match → handle empty states gracefully.
•Multiple live matches → prioritize or paginate display.


Design Hints


•Key Classes / Interfaces:
•HomeScreen → main screen container.
•MatchWidget → shows live/upcoming/recent match info.
•Team → team details (name, players, stats).
•Player → player details and statistics.
•ScoreUpdateListener → interface to receive live updates.
•NotificationManager → handles reminders or score alerts.
•Design Patterns:
•Observer Pattern → live score updates push changes to UI components.
•Composite Pattern → HomeScreen contains multiple widgets (MatchWidget, HighlightsWidget).
•Strategy Pattern → different display strategies for live, upcoming, and recent matches.


Example Flow


1.User opens the Home Screen.
2.HomeScreen fetches:
•Live matches → MatchWidget renders scores in real-time.
•Upcoming matches → MatchWidget renders scheduled matches.
•Recent results → MatchWidget renders completed matches.
3.Scores update dynamically via ScoreUpdateListener.
4.User taps a match → MatchDetailScreen opens with ball-by-ball updates.


Evaluation Areas


•Class hierarchy & modularity for different widgets.
•Efficient handling of real-time updates.
•Use of OOP principles (abstraction, encapsulation, inheritance).
•Handling edge cases and empty states.
•Extensibility for future widgets/features.


Solution

Comments