Giter Club home page Giter Club logo

bank-tech-test's Introduction

CircleCI Maintainability Coverage Status

Bank-Tech-Test

Makers Academy Week #10 - Bank Tech Test Challenge

Project Overview

I have set out to create a Bank application as according to the tech test specification. You can withdraw and deposit money to your account and view a list of previous transactions. The application can be executed via command line.

Users Stories

As a bank account holder, So I can know what I can spend, I want to be able to view my account balance.

As a bank account holder, so I can hold cash, I want to be able to make withdrawals from my account.

As a bank account holder, so I can build my savings, I want to be able to make deposits into my account.

As a bank account holder, so I can verify my own spending I want to be able print a detailed statement of my previous transactions and their dates.

Built With

Ruby

Installation

Prerequisites

Alternatively you can use this online ruby environment I have prepared earlier. => (https://repl.it/@AlfieDarko1/Bank-Tech-Test)

Usage

in IRB or PRY (ruby environments)

You can start off running this code in the terminal environment

require './lib/app.rb'

Screen_Shot_2018_04_26_at_20_22_55



or alternatively if you are using the repl.it website

require './main.rb'

then run code below

account = BankAccount.new

Screen_Shot_2018_04_26_at_20_23_15

This will instantiate the BankAccount class and will allow you to run the methods in the next section.

Methods

account.deposit(amount)

'Run this method with an integer as a parameter to deposit funds into your account'


account.withdraw(amount)

'Run this method with an integer as a parameter to withdraw available funds into your account'


account.show_balance

'This method will return your current account balance'


account.print_statement

'This method will print your statement showing the dates and amounts of Many credits and debits relating to this account'

Testing

Tech Used:

  • RSpec (Unit Tests)
  • Simplecov (Coverage)
  • CircleCI
  • CodeClimate

Using the terminal, while in the project folder type and run 'rspec' to run the all the project tests. The class, class methods and scenarios tested will be displayed in the terminal.

To run each class tests individually follow 'rspec' with any of the files in the spec file folder so for eg.

'rspec spec/balance_spec.rb' will only run the specs that test units in the balance class.

Thoughts

This was an interesting project to do as I had to think a lot about encapsulation and DRY principles. I actively tried to keep methods very short and moved all logic to their respective classes and called them from where they were needed.

I used 3 classes. Balance dealt with updating the account holdings. it made calls to the Transaction class to record every time there was balance update. The transaction class held records of any money moves and also had a function to print the statements.The bank account class was the front facing class so our users could interact with the program.

I made small psuedo-code plans before hand but I found that the more I developed it using TDD, the more areas I recognised could be refactored.

I considered making the DateTime format method its own module but I opted to make it a private helper method under the transaction class instead.

TODO

  • I want to move the DateTime format method to its own method

  • I plan to mock the date module somehow as in testing, as the day changes, it renders some of my tests wrong. This oversight was displayed to me when I fell asleep and woke up to a broken build!

  • I plan to create diagrams to illustrate how the classes and methods communicate. This could have been created beforehand as part of a plan but I felt my design choices changed overtime so they wouldn't be an accurate description of what is going on unless done so at the end.
    Perhaps they could be valuable as part of an insight to my process.

  • Use TravisCI over CircleCI as I am having problems displaying the coverage percentage badge with CircleCI.

Authors

Alfie Darko

License

This project is licensed under the MIT License

Contact

email: [email protected]

bank-tech-test's People

Contributors

alfiedarko avatar

Watchers

 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.