ATM Case (Week 7,8,9,10)
ATM Case (Week 7,8,9,10)
Project Statement: The given project is to model automatic teller machine in which a customer uses his/her ATM card to draw money from
ATM.
Funtional Requirements: The ATM machine provides facilities like withdraw amount,check balance ,change password,mini-statement and
transfer of amount etc to customers.
Problem Statement-
To develop an ATM System for Bank
1. The Customer has to login into the system using Credit Card or Debit Card number and Pin Number. The system should check for validation.
2. The System queries the customer for the type of account either Savings Account or Current Account. After getting the type of account, the
system shows the amount left.
3. The System then queries the customer for the required amount. The user enters the amount and gets the money.
Model‐View‐Controller (MVC)
View: UI
c) Develop Detailed Sequence Diagrams/ Communication Diagrams for each use case
showing interactions among all three-layer objects
d)Develop detailed design class model (use GRASP patterns for responsibility)
GRASP
● stands for General Responsibility Assignment Software Patterns
● 9 GRASP patterns
Creator Information
Expert Low Coupling
Controller
High Cohesion Indirection
Polymorphism Protected
Variations Pure Fabrication
Responsibility:
● Responsibility can be:
● Decide who can be creator based on the objects association and their interaction.
Example for creator:
Expert
● Given an object o, which responsibilities can be assigned to o?
● Expert principle says – assign those responsibilities to o for which o has the information to fulfill
that responsibility.
● They have all the information needed to perform operations, or in some cases they collaborate with others
to fulfill their responsibilities.
● Low Coupling – How can we reduce the impact of change in depended upon elements on dependant
elements.
● Minimizes the dependency hence making system maintainable, efficient and code reusable
● when a request comes from UI layer object, Controller pattern helps us in determining what is that first object that
receive the message from the UI layer objects.
● This object is called controller object which receives request from UI layer object and then controls/coordinates
with other object of the domain layer to fulfill the request.
● It delegates the work to other class and coordinates the overall activity.
– Controller class also performing many tasks instead of delegating to other class.
Solution – controller class has to delegate things to others.
High Cohesion
● How are the operations of any element are functionally related?
● Benefits
– Easily understandable and maintainable.
– Code reuse
– Low coupling
Example for low cohesion:
Example for High Cohesion:
Polymorphism
● How to handle related but varying elements based on element type?
● Polymorphism guides us in deciding which object is responsible for handling those varying elements.
Pure Fabrication
● Fabricated class/ artificial class – assign set of related responsibilities that doesn't represent any domain object.
Benefits: High cohesion, low coupling and can reuse this class
Indirection
● How can we avoid a direct coupling between two or more elements.
● Indirection introduces an intermediate unit to communicate between the other units, so that the other units are not
directly coupled.
Protected Variation
● How to avoid impact of variations of some elements on the other elements.
● It provides a well defined interface so that the there will be no affect on other units.
The package diagram shows how the various classes are grouped into packages. There are two "top-level" classes - ATMMain and ATMApplet -
which allow the system to be run (respectively) as an application or as an Applet. (Only one of the two would be instantiated in any particular use
of the system.)
Each of these classes, in turn, depends on the package atm which contains the class ATM that represents the system as a whole, and the class
Session that represents one session. ATM depends on Session, and vice versa - since the ATM creates Sessions, and each Session, in turn, uses
the ATM to interact with the customer.
The subpackage transaction contains the classes used to represent individual transactions that a customer initiates. The class Session depends on
the transaction package because it creates individual transaction objects. These, in turn, again depend on the ATM to interact with the customer.
The subpackage physical contains the classes that represent the various physical components of the ATM. For the purposes of this simulation,
these are simulated by a GUI. A real ATM would have quite different classes in this package - classes that actually control its physical
components. The class ATM makes use of these components, and Session and the various kinds of transaction gain access to them through ATM
to actually perform the needed operations.
Finally, the package banking contains classes that represent the banking enterprise itself and the information communicated back and forth
between the ATM and the bank - i.e. classes which might be the same in a totally different implementation of an ATM that interacts with the
same bank.
This is, of course, a simulation. However, most of the code that is specific to the simulation resides in the package physical, plus the two top-
level classes. Presumably, the other classes and packages might be similar in a real system.
THREE LAYER PACKAGE DIAGRAM FOR Online Banking System: