Also wanted to share some thoughts, on how this design can be further extended:
For each ball we can add BallEvent enum.. which tells any event that has happened for that particular Ball. Example - DOT, SIX, FOUR, CATCH, RUNOUT etc
Instead of creating a List we can have an array of fixed Ball size[6]
Instead of an Integer score, we can keep an object Score (which has both runs and wicket info - like 110/8 instead of just 110)
We can add a commentary String object for each Ball
Hi Ashish,
I feel createScorecard method should be synchronised. To avoid scenario where scorecardId from one match is not assigned to a different match? We already seem to use AtomicInteger and ConcurrentHashMap https://github.com/ashishps1/awesome-low-level-design/blob/main/solutions/java/src/cricinfo/ScorecardService.java
Also wanted to share some thoughts, on how this design can be further extended:
Thanks, Ajay