Skip to content

wleng0808/RubyBank

Repository files navigation

Build Status

Bank

A tech test set during Week 10 at Makers Academy written in Ruby and tested with Rspec.

Extracted User Stories

As a user,
so that I can keep my money safe,
I want to be able to keep it in a bank account.
As a user, 
so that I can add money to my account,
I want to be able to make a deposit.
As a user, 
so that I can spend my money,
I want to be able to make a withdrawal.
As a user,
so that I can keep track of my money,
I want to be able to print a statement.

Functionality

[1] pry(main)> require './lib/account.rb'
=> true
[2] pry(main)> require './lib/atm.rb'
=> true
[3] pry(main)> require './lib/transaction.rb'
=> true
[4] pry(main)> require './lib/statement.rb'
=> true
[5] pry(main)> require './lib/history.rb'
=> true
[6] pry(main)> atm = ATM.new(Account.new(0, Transaction, History.new), Statement)
=> #<ATM:0x007f801fb58eb0
 @account=
  #<Account:0x007f801fb59040
   @balance=0,
   @history=#<History:0x007f801fb591a8 @transactions=[]>,
   @transaction=Transaction>,
 @statement=Statement>
[7] pry(main)> atm.deposit(500)
=> 500
[8] pry(main)> atm.withdraw(400)
=> 100
[9] pry(main)> atm.show_statement
date || credit || debit || balance
28/11/2017 || || 500.00 || 500.00
28/11/2017 || 400.00 || || 100.00

My Approach

I began with extracting the user stories from the requirements provided in the challenge. From this I diagrammed using CRC cards and so had a mental model of the classes I wanted to create. I implemented the code using TDD and tight refactoring loops and was intential from the start about ensuring I was delegating appropriately and injecting dependancies when and were neccessary. This ensured my code was obeying SOLID principles as much as possible.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages