Account Management: Quacken

Introduction

Quacken is an account manager with a desktop user interface. (A desktop user interface consists of a desktop window containing internal windows.) Users can use Quacken to create and view bank accounts as well as deposit and withdraw funds from bank accounts.

Demonstration

Here's a screen shot of Quacken:

At this stage two accounts have been created: checking and savings. This was done using the "Accounts/New Account" menu item, which prompts the user for the name of the new account:

The new account is created and added to the account manager. Also, the name of the new account is added as a new menu item to the Accounts menu. Selecting this menu item creates an account view in the desktop. In the screen shot above there are two views of the checking account and one of the savings account. Users can use these views to deposit and withdraw funds from the corresponding account. Note that when the balance of an account changes, the balance field of all views of that accounts are automatically updated.

The File menu allows users to save and load account managers. (See Object Streams section of persistence for hints on how to do this.)

An account manager can be viewed as a table that associates account names with accounts. Using the File menu we can also create a new, empty account manager and quit the application. All of these options: quit, new, and load, prompt the user to save the current file manager if there are unsaved changes to any of the accounts it contains. Account managers are saved in binary files.

The Help menu contains Help and About menu items.

Quacken handles errors with helpful message dialogs. For example:

Requirements Model

The use cases represent user goals that can be accomplished with the application:

The use cases divide into two categories: operations on account managers (save, saveAs, new, and load, newAccount), and operations on accounts (viewAccount, withdraw, deposit).

An account manager can be viewed as a table associating user specified account names to accounts.

Design Model

Quacken instantiates the Model-View-Controller Architecture refined by the Publisher-Subscriber pattern. The model is the account manager. Views are views of the accounts within the account manager. The Controller is the menu listener. (You must implement this design for full credit.)

The design consists of two packages:

The gui package contains the user interface classes, while the model contains the business classes.

Note that the gui package depends on the model package, but not vice-versa. Thus, the user interface can change without changing the model.

Model

The central class in the model package is the AccountManager. It contains a table associating names to accounts:

class AccountManager extends Model {
   private Map<String, Account> accounts;
   // etc.
}

It provides operations for searching and adding entries to this table. It inherits from the Model class the machinery for remembering the file name where it is stored and for remembering if there are any unsaved changes. (See Model.java for some suggestions.)

Every Account is serializable, necessary if account managers are to be serializable, and from the Observer class every account inherits the ability to notify all registered views of any changes to the balance. Of course this is just the Java implementation of the Publisher-Subscriber pattern.

GUI

A desktop may contain many account views. This isn't literally true because Swing distinguishes between frames and their content panes. The desktop is the listener of all menu items.