ATM Machine Group Project

oatmealbrothersSoftware and s/w Development

Nov 18, 2013 (4 years and 1 month ago)

106 views

CIS 3309

Component
-
Based Software Design

The Suggestion Box


Suggestions on the Design of Your ATM Project

FALL

Semester 2013


Introduction
:

This is a hard project for a number of reasons.

1.

Many

of you probably have not worked on a system as large and complex as this one (and this is
still very small by comparison). Almost all of you have never had to use object
-
oriented design

(OOD) or programming (OOP) techniques

in designing and implementin
g a system starting with
nothing.

2.

You are learning a new language with an extensive library, the FCL.

3.

You are learning the ropes of a new Integrated Development Environment (IDE).

4.

You have to design several forms.

5.

You have to gain considerable mastery
in t
he practice of OOD and OOP
, most of the material in
the first 12 chapters of your book, and some additional material as well.

If you
are feeling a bit overwhelmed you are advised to read what follows very carefully.

PLEASE NOTE: There are many good approac
hes to this project. At best
,

this might just be one of them.
COME T
O CLASS WITH QUESTIONS
!!

Project Goals
: The goals for this project are pretty well summarized in the Introduction section (above).



Learning the basics of object
-
oriented design and prog
ramming



Understanding how to analyze a problem statement (a specification) and

-

Map out the behavior of a software system that meets the needs specified system using a
UML
-
like behavior diagram

-

Provide

a detailed description of the classes you will use as
the basic building blocks of your
software system, including

descriptions of

a) the responsibility or purpose of each class,

b)
the fields and properties (aka attributes or data stores) required for each class
,

c
)

the methods required

for a class, including the name and purpose of each method, the
return values (for functions), and the arguments needed
,
and

CIS 3309


ATM Suggestion Box
7/15/2013

1:41 PM

Page
2


d) the
exceptions that must be handled

by the class in order to keep your system from
crashing



Putting into practice the basic id
eas underlying MVC by carefully constructing 1)
M
odels of the
key data structures required for your project, 2) the
V
iews of what you want the user to see
(and where appropriate, the data structures behind these views) , and 3) the user interactive
C
ontrol
lers).



Practicing

incremental design and implementation,
s
tarting with the core part of your project
and expanding outward, adding and testing new features in an incremental and patient fashion.



Learning to program in Visual Basic .NET



Learning a lot of n
ew terminology



Learning how to design windows forms that meet the needs of your project and make sense to
the user



Learning the fundamentals of more complex algorithm design as well as event
-
driven
programming.



Learning to navigate the Visual Studio IDE



Le
arning about software testing. There is a lot of
software testing to be done. Although this is
not a primary focus of the course,
it deserves
consi
derable attention
.



Learning to work effectively in groups

Project Fundamentals
:

Three aspects of this proj
ect
should be developed

in parallel, and by now, in great detail.

A.


A detailed map of the behavior of
your ATM

system (a Behavior Diagram) is needed.

B.


A model (class) is needed for every entity that requires processing in the development of the
behavior dia
gram.

Each field and property
of the class
should be

described, along with each
method (and

its return values a
nd arguments)
. The exceptions handled should also be
documented. I have provided some
hints as to how I would like to see this done. If not

for your
own benefit, just for mine (I expect to read what you have done)
your documentation should be
clearly organized with the fields, properties, methods, and exceptions described in separate
sections for each class. The method descriptions, return v
alues, and arguments should also be
described in separate sections for each method.

For example:


Class x



statement of responsibility or purpose


Fields



(list of fields and description of each
)


Properties



(list of properties and descriptions)


Me
thods





Method1


description

(purpose or responsibility)




Return Value





Arguments


(list and description of each)



Method2


etc
.



Exceptions to be
H
andled



(list and description of each exception you handled)

CIS 3309


ATM Suggestion Box
7/15/2013

1:41 PM

Page
3



C.

A reasonable set of forms
should be developed and the flow among must be clear from the
behavior diagram.


The Project Itself
:

I.

You should

do a detailed behavior diagram with the use of each of your forms and data objects
clearly spelled out. I expect a neat, uncluttered, and deta
iled diagram

at the time the project is
due
.

II.

This is a multi
-
form project. To keep your sanity, I strongly urge you to limit the number of forms to
4 or 5.

A.

I suggest you
declare and instantiate the f
our classes and
objects you need as public data
acces
sible to the rest of your system.
You may want to try to do this in your program.cs file.
This will simplify life a bit. I prefer to use
the program
in this way


as
a
driver
component
for the entire system
, and as the component in which data that is gl
obal to an entire system
is typed and instantiated.



In our case, once

you have the
declarations of the
objects we
need to have accessible our system,

all
we

need to do is create an instance of your first form
in the module

(I chose a splash screen form)
.

This will cause the form to appear
dynamically, during the execution of your program.


I used four forms. The first is the Splash Screen, which in our case is best thought of as our …

B.

UserAccountEntry Form


Welcomes the user and asks for the user’s a
ccount number. I
used the code behind this form to verify that the account was properly structured (a five
digit integer) and then to search the input file to find the record for this account.
(Note that
the search required reading one record at a time f
rom the currentDataFile and if this record
is not the one we are looking for, writing it out to the updatedDataFile. (All records will
eventually have to be read and written, but at most one is modified (perhaps more than
once).
If the account is not fou
nd you can either quit or rewind the file, tell the user the bad
news, and allow them to reenter the account number and start all over again.
Once the
record was found a turned control over to the …

C.

UserNameAndPin Form


Use

this form to ask the user
(the

customer)
to enter
his/her

name
and
pin number. Check

the user name and pin against the

record for the account. Give

the
user three chances to get the name and pin correct before telling them to see the bank
manager and ending the program (and closing a
ll the files). Once a match
ing name and pin
was entered, you can
turned control over to the …

D.

TransactionEntry Form


This was the mo
st complicated of the forms. You might want to
consider
display
ing

its co
ntrols in three stages. For example, start by
p
ut
ting

eight large
-
ish

buttons on this form ((1) Savings Deposit, (2) Savings W/D, (3) Checking Deposit, (4)
Checking W/D, (5) Savings to Checking Transfer, (6) Checking to Savings Transfer, (7) Savings
Balance, (8) Checking Balance. Six of these transact
ions require the user to enter an amount
(and press OK).

CIS 3309


ATM Suggestion Box
7/15/2013

1:41 PM

Page
4



The controls for entering the amount and pressing OK
could be

made visible only after a
transaction button was selected.

Once OK

was pr
e
ssed,
you can make more controls visible

for the purpose of

asking

the user if this was the desired transaction

and to giving the user
Yes and

No button
s
.


If No

is selected,
reset the form controls
and ask

the user to reenter
the transaction information (button and amount). If Y
es is selected, go
on to process
the
transaction,
wri
te out the updated record, and then turned control over to the …

E.

TransactionCompleteForm


Used to display the balances on both accounts and ask the user
if he or she wants another trans
action (back to the Transaction
Entry form) or not.

If not (if
the user is done), copy

all the remaining records on the currentDataFile to the
updatedDateFile
, d
isplay

the total number of records processed
, close

the files, and then
close
the forms.


Control flows from one form to the next with a loop
going back to the TransactionEntry form
in case
there are multiple transactions for the same user.


If you read the above
information
carefully, you will have a pretty g
ood idea of the large
-
grained

behavior of the system. You will also note that, as i
s the case with almost all such system, the ATM
project is layered. That is, the

code behind these four forms

involves the manipulation of four key
entities or objects, the Bank Object itself, a customer object, a
nd two objects that are really

collection
s

of customer objects, the currentDataFile (input) and the updatedDataFile (output). The
classes that model these objects make up the layer of code between the forms and the CLR.
Virtually every line of code you write as the code behind these form will in
volve access to the
methods and properties of these four classes
. This is the way it is supposed to be.



III.

The Underlying Layer of Classes



As summarized below, these classes must contain every piece of
data and every method required to make your system w
ork properly. The only way to figure out
what goes in these classes is to maintain a list of fields, properties, and methods that are needed
based on the details of your behavior diagram. I will map out
an outline

of what is
required

here
.
Y
ou
will need

to do the rest, including completing the descriptions of the fields, properties, and
methods I have listed here (or
those
that you used).


A.

The ATMBank Class


This is a pretty simple class.

I probably should have declared the file
objects here too, sinc
e the file
s

belong to the bank. But I got a little lazy and declared all four
class objects
listed here as public objects in

the module, so as to make them all accessible
everywhere.

Fields


I try to prefix the names of fields that have related propertie
s with
the word
hidden

Account length (I fixed this at 5 characters all digits)
hiddenAccountLength


Max number of user tries (3) to enter information before being referred to the manager


Maximum allowed daily withdrawal amount ($300)

Properties


(You

do not need properties. But without them you need additional methods)


One for each field


accountLength

for example

CIS 3309


ATM Suggestion Box
7/15/2013

1:41 PM

Page
5


Methods


I treated the collections of customers (the current and updated files) as
belonging

to the bank (along with the fields and ass
ociated properties)


findCustomer



calls customer.cust
o
merMatch

to read records and look for an account
as entered by a user


copyRemainingRecords

B.

The Customer Class


Fields



a

list
of

customer
s



A linear data structure of items of type customer

used to
store all the elements of a customer record (
the string split method is
used to split
out the five components of the records,
which once split
into the array can be

stored in the fields

indicated below. We will not know how big this list will nee
d to
be until the program is actually running so using as array here is not practical.




s
tring

recordAccountNumber

string

recordName

string

recordPin

decimal

recordChkBalance

decimal

recordSavBalance

Properties (none)

Methods


customerMatch



given a customer account (entered by the customer) and a customer
record (read from the currentFile) checks to see if the account

matches the record
account (
the first field of the record)
. Returns True or False.

verifyNameAndPin



given the name and p
in entered by the customer,
checks to see if
the
y match
the account number
entered earlier. Returns True or False.


modifyCustomerRecord



modifies customer record based on requested transaction and
returns the modified record. Given a t
ransaction code
(1
-
8
,

or an element of an

enumeration) and the amount involved (an amount of 0 if a balance is requested)

getCheckBalance



simply returns the current state of the customer’s checking account
balance

getSavings
Balance

-

simply returns the current state of the customer’s savings account
balance



C.

The currentFile Class


Fields




s
tring

currentFilePath


file path


System.IO.StreamReader
currentFileSR



stream reader object




integer

recordReadCount


tracks number of records read

Properties


(
none)

Methods



(constructor)


sets count of records read to 0 and opens the current file

getNextRecord


gets and returns the next record from the current file (also returns a
Boolean flag indicating if the
end of file was encountered)

CIS 3309


ATM Suggestion Box
7/15/2013

1:41 PM

Page
6


getRecordsReadCount


returns number of records read

closeFile


closes the file

rewindFile


(not yet written)


The updatedFile Class




(very similar to the currentFile class)