Coder Social home page Coder Social logo

ftechassignment's Introduction

Running the BarberShop Application (with make)

I have added a Makefile to automate the process of building, running, and testing the application. Kindly see the instructions below :

  • make build builds a binary called barbershop in the root directory.
  • make run builds the binary as explained above and runs it.
  • make run is intended to run unit test (though there are none because it's difficult testing concurrent code).

Running the BarberShop Application (with Docker)

Please follow the instructions below to run the app using docker :

  • run docker build -t barbershop:v1
  • run docker run -d --name barbershop barbershop:v1
  • run docker logs barbershop to view logs from the app

When the application starts, it loads some environment variables to tweak how it works. However, in the absence of explicit definitions of these values, certain default values are used.

To modify the behaviour of this applications, set the following env vars :

  • SEAT_CAPACITY : (defaults to 10) sets number of seats in the waiting area.
  • ARRIVAL_RATE_IN_SEC : (defaults to 100) determines the interval within which we simulate the arrival of new customers to the shop.
  • CUT_DURATION_IN_MSEC : (defaults to 1000) determines how long it hypothetically takes a barber to finish one job.
  • OPENED_UNTIL_IN_SEC : (defaults to 10) determines how long the shop is opened for a day.
  • ENVIRONMENT : (defaults to development) determines the environment within which the app is running. This modifies how the logger writes messages. The format of the production logger could be used in a centralized logging system such as Graylogs.

Architecture diagram for System Design question

The image below is the architectural diagram of how I would design a solution for the system explained in Question 2 of the assignment.

Drag Racing

What I could improve

  • I could have added tests the content of what is printed in the logs for certain scenarios in the barbershop application. However, it's not straight-forward to test concurrent code sometimes.
  • In the architecture of the system described in Question 2, I could have a variation where the Designers Dashboard and Manufacturers Dashboard are merged into one application. However, in real-life situation, there is an advantage to separating them to avoid a single source of failure. Also, different development teams can be assigned to focus on specific dashboards.
  • In the same architectural diagram, I could have a variation where the Designers Dashboard and Manufacturers Dashboard authenticate directly on Firebase Auth without going through the Auth Controller. This way, the token received after a successful authentication on Firebase could be used for API authentication. However, this approach would let us miss out on being able to implement custom business rules during authentication.

ftechassignment's People

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.