Giter VIP home page Giter VIP logo

erlang-school-final-exam's Introduction

Erlang School Final Exam

For the exam we will use the example of a bank ATM. The ATM supports multiple accounts and maintains a balance.

Step 1: super simple ATM

We will start with a super simple server. It will help everyone get comfortable compiling (and running) code.

It will also show the idea of a server loop, messages and a receive block.

This super-simple ATM will support the following actions. An account is created by depositing money to it.

atm:start() -> started
atm:check_balance(AccountNumber) -> {balance, Amount} | no_such_account | atm_closed
atm:withdraw(AccountNumber, Amount) -> {new_balance, Amount} | overdrawn | no_such_account | atm_closed
atm:deposit(AccountNumber, Amount) -> {new_balance, Amount} | atm_closed
atm:stop() -> stopped | atm_closed

To create an account, deposit money to it. To start we won't bother with PIN numbers.

Step 2: a cluster!

  • Bring up multiple Erlang nodes (node1, node2,...). Connect them with net_adm:ping.
  • Bring an ATM up on each node.
  • Deposit money to account 10000 on node1.
  • Check account balances on various nodes and ensure they all agree.
  • Withdraw money from account 10000 on node2.
  • Check account balances on various nodes, and ensure they all agree.
  • Add a new node to the cluster.
  • Check account balances from new node and ensure they are correct.
  • Disconnect node1 from the cluster.
  • Deposit money to account 10000 on node1.
  • Ensure the deposit is reflected on node1, but not on the other nodes.
  • Deposit money to account 20000 on node2.
  • Ensure the deposit is reflected on node2 and the other connected nodes, but not on node1.
  • Rejoin node1 to the cluster.
  • Ensure the balances for each node all jive.

How to submit your exam

Contribute your solution(s) by adding a folder named {your twitter handle}+{your erlang-vm language} such as:

/bryan_hunter+erlang/step2
/knewter+elixir/step1
/knewter+erlang/step1

Time to play!

erlang-school-final-exam's People

Contributors

bryanhunter avatar calvinb avatar digitalbush avatar

Stargazers

 avatar  avatar  avatar

Watchers

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