In our previous post we created some user stories. In this post we are going to work on one of the stories:
- As a user I should be able to view my accounts. (2 pts)
It's a simple process, but we know exactly what we have to do with user stories. It's a different mindset than the traditional requirements. The typical requirement that you are used to seeing is
1.1.1 System shall allow the user to view his/her accounts
It's basically saying the same thing, but the first one the user stories is in plain English and it's a lot easier to comprehend. You can take it to the business user, the web designer, or the web developer and it's easily understood. That's the benefit of Agile development.
First let's take the Iffe out of the account.js file so that it's easier to work with and then we want to make changes to the bankController.js file
Here is how the account.js file should now look like.
Here is the code we change in the bankController.js filefunction Account(balance, type) {this.balance = balance;this.type = type;}Account.prototype.deposit = function (d) {this.balance = this.balance + d;return this.balance;}Account.prototype.withdrawal = function (w) {this.balance = this.balance - w;return this.balance;}function inherits(baseClass, childClass) {childClass.prototype = Object.create(baseClass.prototype);}function Premium(balance, type) {this.balance = balance + (balance * .05);this.type = type;}inherits(Account, Premium);Premium.prototype.transfer = function (from, to, amount) {from.balance -= amount;to.balance += amount;from.rebalance();to.rebalance();}Premium.prototype.deposit = function (d) {this.balance = this.balance + d;this.balance = this.balance + (this.balance * .05);return this.balance;}Premium.prototype.rebalance = function () {this.balance += this.balance * .05;}
(function () {'use strict';angular.module('bankController', []).controller('bankController', ["$scope", function ($scope) {$scope.accounts = [new Account(1000, 'Checking'), new Account(10000, 'Saving'), new Premium(100000, 'Premium Checking')];console.log($scope.accounts);}]);})();