Giter Club home page Giter Club logo

futures's Introduction

Activity for Futures

Instructions

In package controllers, each package is an activity. You should implement both methods in each activity The first method should be completed using map and flatMap only The second method should be completed using a for - yield comprehension Both methods should output the same result. The methods to use to get this data are in the connector wrapped in futures. These methods represent calls to an API for data.

Logging

There is a logger in utils that can be used where necessary

Activity 1 - User Details

Complete both methods. The expected result is: "Luke Skywalker - Jedi - 0"

Activity 2 - Stock Price

In this activity you should infer the behaviour of the methods from the unit tests. Remember, both methods should do the same thing using different syntax. The purpose of this activity is to explore error handling for Future.failed

Activity 3 - Pet Shop

You have been asked by a pet shop to make some changes to some of their code which gets the price for some of their pets. You have been told there is an API available through the PetConnector to retrieve information from their database. This API has the functionality to retrieve a pet given an ID and retrieve a price given a Pet. However, this API has an issue: Whenever the shop hosts an event to give away some of their pets, the getPrice call on the API throws a PetNotFoundException. The owners would like it so that whenever this issue occurs, the price is returned as 0, but any other exception should be logged and still be thrown. Furthermore, the pet shop sometimes likes to put a 10% sale on. They have a flag included in their code for the discount. Whenever this is true, the end price should be reduced by 10%.

The method implemented to address this issue should be completed twice. One using maps and flatMaps, the other using for yield syntax.

Running

To run this, just use sbt test

futures's People

Contributors

danewatts avatar

Watchers

James Cloos avatar

Forkers

drewmiley

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.