Giter VIP home page Giter VIP logo

sportradar's Introduction

sportradar

Sportradar demo app

Author: Felipe Monteiro de Carvalho

Building and running test in the command line

./gradlew build

Assumptions

  1. Implemented the simplest solution which is that the ScoreBoard constains a list of games. The most common operation probably will be reading, if we want the list to be pre-sorted so that reading it is O(1) we could use SortedSet/TreeSet, but this will only work if we support only 1 kind of sorting. Java apps are typically servers, so optimizing here might be pointless, since caching the final response would anyway be much better and would include the transformation to JSON.

  2. Didn't use spring since this is a "library", to prevent locking the user into it

  3. Used Domain Driven Development instead of classic OO design (like Qt, Cocoa, etc)

  4. There was no requirement to support writing and reading concurrently, but it could be implemented by using a "Flip/Flop" mechanism, in which during writes you populate the entire data in the unused version, and then simply switches which version is used by using an AtomicInteger increase. getGames() would select to return Flip or Flop based on this counter.

  5. Assumed users of the library won't pass null anywhere

  6. Assumed we prefer no-op to exceptions in some corner cases like removing the same game twice

Time complexities

  1. startGame - List.add is O(1), worse case O(n) due to array enlargement

  2. finishGame - O(n) for remove() in a List

  3. updateScore - O(n) due to remove+add

  4. getGamesSummary - O(n * log(n)) for sorting

For reference, see: https://www.baeldung.com/java-collections-complexity

sportradar's People

Contributors

felipemdc avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.