Skip to content

Instantly share code, notes, and snippets.

@naganowl
Last active August 29, 2015 13:56
Show Gist options
  • Save naganowl/9221445 to your computer and use it in GitHub Desktop.
Save naganowl/9221445 to your computer and use it in GitHub Desktop.
An interview question I came up with that's practical and tests MVC concepts

How would you go about designing a system to coordinate trains departing from different stations on multiple lines purely clientside?

Starting inputs are:

  1. Total number of trains
  2. Total number of stations and the lines they are on. 3. Assume stations are equally spaced apart.
  3. Schedule of when train needs to start/end and their 'base' 3. Assume trains start and end at the same location.

Given that, how would your design answer the following:

  • Where is a given train at any given time?

  • How would you coordinate service advisories to all trains from the CC about outages or major delays?

  • How do you deliver messages to only trains on a given line? (For example, if an elevator is out of service on Line 1 say you only want to inform trains on that line).

  • How do you find out how many trains are currently in service? In a given line?

  • How and when do you decide to deploy an additional train? Who would know the limit for number of trains on a line?

  • What modifications would be made if there was a backend/server involved?

For a practical example, think of BART as the train system.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment