Code Monkey home page Code Monkey logo

taxis's Introduction

Taxi akka app.

Please note: class names in double quotes:
A "GPSActor" waits for messages and uses the "GPSService" to acquire the "Location" of a "Taxi". The "TaxiActor" has a "GPSActor" child which is
used to figure out the GPS location of the "Taxi".

The "ManagementCenterActor" accepts "NewTaxi" registration requests. It then creates a "TaxiActor" child and schedules it's report each second.

This implementation uses sbt to manage dependencies and run tests & the application.

To run the app
---------------------------------------------------------

sbt run
(it will run a simulation with 4 taxis for 10 seconds. Each taxi reports its gps location once per second)

to run the tests
---------------------------------------------------------

sbt test
(please note, 1 test is ignored because it fails, in ManagementCenterActorOpsSuite. Due to a mockito problem expecting anyObject() for a by-name =>Unit parameter,
more inside the test itself. I am not sure if there is currently a solution but I couldn't find anything on the internet. Maybe a missing
feature? Anyway I left this as is due to time constraints.)


Some generic notes about the code
---------------------------------------------------------

- actor dependencies are passed on via constructor arguments. The call

context.actorOf(Props(new GPSActor(gpsService)))

is safe for non-remote actors. (For a real system we probably want to investigate DI)

- Some tests use fixture context objects, http://www.scalatest.org/user_guide/sharing_fixtures

- Using a service layer helps us minimize the code inside actors, making the actors simpler and more testable. Also
	breaking up the functionality of the actors into multiple classes help us simplify the code and ease testing.

- Actor classes have private constructors and a companion object to control instance creation and help extending
	the code later on (if it was actually required).

- Ideally an end to end test should exist for the TaxiActor (and maybe one for the GPSActor) but due to time
	constraints, I've implemented the most important: ManagementCenterEndToEndSuite . This tests end to end
	the whole system.

taxis's People

Contributors

kostaskougios avatar

Watchers

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