Git Product home page Git Product logo

football-statistics's Introduction

Football Statistics

Coding exercise to show dummy statistics about football teams, players and games

Technologies used

You can view a live version here.

Cloning the project

   git clone https://github.com/JonathanHalpern/football-statistics
   cd ./football-statistics
   yarn or npm i

Available Scripts

In the project directory, you can run:

yarn or npm start

Runs the app in the development mode.
Open http://localhost:3000 to view it in the browser.

The page will reload if you make edits.
You will also see any lint errors in the console.

yarn test or npm test

Launches the test runner in the interactive watch mode.
See the section about running tests for more information.

Architectural decisions

Data

I orginally made a fresh query to the API on each page, followed by a second query to get further information
e.g. to get the data for a particular player, I sent a post with a with a body containing the player's id to

/api/teams/players

This contained a history array of objects which had team_ids rather than team names, so I had to make a second query to the teams api


This mean that there were significant delays each time the user navigated to a new page.

I considered setting up a GraphQL server. This would bring the following benefits:

  • I would only need to make one query each time (avoids under fetching)
  • I would not fetch unneeded data (avoids over fetching)
  • My front end would be built in a more sustainable pattern, not dependent on the shape of the back end
  • I could later add authentication on the 'add a game' endpoint

However, I decided that a more lightweight approach would be to fetch all the data on application load and create my own data store. I felt this was appropriate because the data size was small, it was unlikely to become stale and it would make the UX seameless (after an initial load).

I chose to use Context and React's new 'hooks' feature to share the data.

Having completed the exercise, I feel that I brought too much logic into the front end. This would have been better abstracted to GraphQL.

football-statistics's People

Contributors

jonathanhalpern avatar

Watchers

James Cloos avatar  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.