# Score Board Library (simple) Live Football World Cup Score Board that shows matches and scores ## Content This module includes: - API for the library - Generic implementation - Reference implementation ## Description The board supports the following operations: 1. Start a game. When a game starts, it should capture (being initial score 0 – 0): a. Home team b. Away team 2. Finish game. It will remove a match from the scoreboard. 3. Update score. Receiving the pair score; home team score and away team score updates a game score. 4. Get a summary of games by total score. Those games with the same total score will be returned ordered by the most recently added to our system. As an example, being the current data in the system: ``` a. Mexico - Canada: 0 - 5 b. Spain - Brazil: 10 – 2 c. Germany - France: 2 – 2 d. Uruguay - Italy: 6 – 6 e. Argentina - Australia: 3 - 1 ``` The summary would provide with the following information: ``` Uruguay 6 - Italy 6 Spain 10 - Brazil 2 Mexico 0 - Canada 5 Argentina 3 - Australia 1 Germany 2 - France 2 ``` ###Some notes on edge cases In an exercise where simplicity is requested and edge cases as well, it's virtually impossible to match expectations. This makes this exercise great. My approach for not dealing with nulls, but still dealing with nulls, in a simple project like this, was this: * There is no reference to nulls in the method javadocs, so they are not expected and therefore the behaviour is undetermined * In an application using this library, as it was before the commit where these notes got added, the cases where nulls would be passed are extreme and arguably not something that should be dealt with at this level in an app * Although I didn't add a test for it, I made sure that an NPE would be the exception being thrown * Adding it properly to where it's needed is time-consuming. I have limited time to do these challenges so the compromise was to make sure the correct exceptions were thrown with the code I delivered I tend to think and code for edge cases that stem from user error, not programmer error. NPEs, as any Runtime Exception, are to be avoided and functionality made to fail gracefully. They most often result from programmer error or hardware faults so... got to pick battles.. ####An edge case I got wrong Trying to finish a match that is no longer held by the library, or never was, seems like something a user would do by mistake and is definitely something that one such library should trigger an exception for, in general. However, I did everything but add the javadoc throws tag for it. :) Added it now. Trying to start a match with teams that are already in a game is another example. Or the same team as away and home. However, in these I added everything but the unit tests for them. Adding isInOngoingMatch(ITeam) and isOngoingMatch(IMatch) would also be nice helper methods to have. But..simple library.