Professional Documents
Culture Documents
Objetc Oriented Analytsis-Atm DFD
Objetc Oriented Analytsis-Atm DFD
Software Engineering
Object Oriented Analysis
Object oriented
analysis
The world is made of objects. Just open your eyes
and ears. They are out there. Bank customers,
students, cats, elephants, cars, balls of string,
atoms, molecules, tubs of ice cream, Madonna,
stars, bureaucrats, Robin Hood. The world is built
of objects. Objects are built of smaller objects, and
so ad infinitum. Objects combine to make bigger
objects. We already live in an object-oriented
world.
The first thing an object analyst must do is to remove
the scales from his or her eyes. Object modeling
consists of looking for objects. Of course, there has to
be some boundary. Even sitting at my desk I can see
more objects than I could reasonably list. But that is
where the beauty of object modeling comes in. It uses
observation.
Objects can be described by their attributes and
operations. Attributes are the changeable
characteristics of an object. Cats have color, size,
weight and a preference for either Kit-E-Kat or
Whiskers. Operations are the things an object does
or can have done to it. Cats can catch mice, eat,
miaow, worm up to owners, and be stroked. In our
notation we draw an object such as a cat like this.
The name is shown at the top. The
attributes are listed underneath. The
operations are listed below that.
Actually, strictly speaking, this is the
most very simple class diagram.
In an object model, all data is stored as attributes
of some object. The attributes of an object are
manipulated by the operations. The only way of
getting at the attributes is through an operation.
In an object model, all functionality is defined
by operations. Objects may use each others
operations, but the only legal way one object can
manipulate another object is through an
operation. An operation may inform, say "mass
of ball", or change the state of an object, say
"throw ball".
Object modeling is about finding objects,
their attributes and their operations, and
tying them together in an object model.
Nothing more. Here are some more objects:
Some of these objects may seem jockey, but
they could reasonably be part of a system, be it a
computer game or a multimedia story. Do not be
constrained to be those dull systems that most
software engineers drag out. Object modeling
can be used to design lots of things.
By now you should be getting the idea that
object modeling is, at its simplest level, very
straightforward. The trick comes in knowing
what objects are appropriate, and what their
appropriate attributes and operations are. It is a
question of focus. We will consider some ways
of controlling focus later in the course.
How do objects relate to other concepts in design
methods?
Remember entity-relationship models? SSADM, JSD and so
on have a notion of entity. These are really objects. All we are
doing in object modeling is relabelling entity modeling.
However, we put the emphasis on capturing and grouping
together both functions and data (operations and attributes in
our terminology). That is the elegant simplicity of object
modeling. We will look at object models later which look
remarkably like entity-relationship models (because they are).
We will now look one powerful way of
arranging objects - inheritance hierarchies.
Inheritance
Often we will find that there are objects which have
something in common. It is then useful to create an
abstract object which groups together the common
features, and to use inheritance to define the
original objects.
For example, consider our two fairy story creatures:
Now we can see that they both have the same operations
"arrive" and "meet". We can therefore create an abstract
creature
which has the common operations. We can then draw the original
objects grouped under the abstract object as follows
Inheritance means that all the attributes and operations of an
abstract object are available in the specialized object below.
The triangle in the diagram indicates inheritance. The point of
the triangle indicates where operations and attributes are
inherited from.
Re-use
When new objects are created which are similar to other
objects, they can have many of their attributes and operations
ready defined. Let us suppose we now introduce Grandma into
our fairy story hierarchy.
Here we get a Grandma who already had an appetite,
nose and teeth and who can arrive and meet. Actually
these are not in the normal scope of the fairy story, but
the principle should be clear.
We might be writing a simple geometry program
Now to add circles we simply put in another object under 2D
shape
So the circle object need not define the area and position
attributes or the get area operation
It is now possible to buy or obtain ready-built class hierarchies
written in object-oriented languages which can be extended in
this way to produce a new application.
Designing complex class hierarchies takes time and good
design requires experience. But the basic principles outlined
above, with some intuitive guidelines, are the basis for the
design of good, re-usable designs.
Re-use can be viewed from two directions. Components can
be re-used, which is a sort of bottom-up approach to re-use. Or
designs can be re-used. Both elements are important in the
production of re-usable software.
Relationships
Objects can be related in other ways than by inheritance and
aggregation. Any relationship between real world objects can
be modeled: cats eat canaries, dogs bite postmen, the
woodcutter murders the wolf, cars run over little old ladies,
employees work for organizations, patients visit hospitals,
patients stay in hospitals.
One to one relationships
In a one-to-one relationship, one object is associated with exactly one of its related
objects. This is modelled by a straight line drawn between the objects. If the
relationship is one-way, then an arrow is used to indicate the direction. The line can be
labelled.
Thus a man marries one woman (at a time) and a
woman marries one man (at a time). A cat eats
one canary (before being battered to death by the
little old lady who owned the canary). Canaries
do not (in general) eat cats, so the eats
relationship is one way.
One to many relationships
Sometimes one object can be related to many objects. This is indicated
by different marks at the end of the line.
A player plays for one football team. There are at least 11 players for a
given football team. Football teams do not play for players.
Many to many relationships
A dog may bite zero or more postmen. A postman may be bitten by zero
or more dogs.
A lubricant is recommended for at least one engine. An engine has at
least one lubricant recommended for it.
The OOA Process - I
===> Scenarios
===> complete Object Dictionary
OOA - Object
• generalization of
a set of real-life entities/objects
label • groups a set of attributes (schema)
• can be active (services)
• has memory (states)
label • participates in structures
• label: typically a noun
• specified in the object dictionary
OOA - Object Class & Instance
• A symbol for
an object class and
its object instances.
• a description of one or more
label objects with a uniform set of
attributes and services, and the
actual object instances belonging
to the given class
• “usual way” to model an object
OOA - Whole-Part
• groups objects by combining
whole smaller parts into larger units
(min,max) (min,max) • forms a hierarchy by
– aggregation
– decomposition
(min, (min,
max) max) • cardinalities must be specified
part1 part2 (min , max)
• no inheritance
OOA - Generalization-
Specialization
• groups objects based on similarity
gen
of attributes and services
• forms a class hierarchy by
– generalization
– specialization
• attributes, services, etc. are
spec1 spec2
inherited by the more specialized
from the more general objects
Employee
name Inheritance
address
Manager Programmer
experience list of prg-lang.
courses
OOA - Object Class
• Object Class only
• NO instantiations possible
• a generalization of one or more
objects with a uniform set of
label attributes and services
• can have attributes, services,
states
• used in classification structures
to organize object hierarchies
Employee Student
name Major Multiple
address GPA Inheritance
==>
Inheritance
Lattices
Teaching Assistant
OOA - Association
• provides free mapping between
obj1 objects
• complements the two predefined
(min,max)
structural types
label • forms a network of objects by
using binary relationship types
(min,max)
obj2
• cannot carry attributes
• supports access to partner-object
(via “foreign key”)
Manages which department? Follow association.
Since when? Attribute of ...?
An Example
ACCOUNT
req_withdrw
req_dep
req_balance
req_int_rate
STD_ACCT SAVINGS_ACCT
int_rate
add_on_interest
prov_int_rate
Scenario 1
ACCOUNT
acct #
balance
sec-code TRANS_REC
state
trans_type
withdrw date-time
dep amount
ATM
teller_ID
atm #
req_withdrw
req_dep
acct #
balance
sec-code
state
prov_balance
ATM
req_balance
prov_balance
ACCOUNT
Scenario 3 acct #
sec-code
state
ATM
req_int_rate
SAVINGS_ACCT
prov_int_rate int_rate
prov_int_rate
HOW TO ?
Building an Object Model starts with
identifying Objects and Classes. Candidate
Objects and Classes can usually be found by
looking at the nouns in the problem
statement; they can be physical entities as
well as concepts.
Rules for Identifying Objects
Objects ...
• Are actors. Objects can be viewed as actors that play a role in the system
to be built. For example some of the actors on the stage of the purchasing system
are the vendor, the purchaser, the purchase order and the purchase requisition.
• Are nouns.
nouns Objects often appear as nouns in problem descriptions.
Example: "A purchase order cannot be created until a purchase requisition is
received."
• Have Uniqueness.
Uniqueness Objects can be uniquely defined. That is instances of
one object can be differentiated from another. For example, a person can be male
or female. By contrast money has no distinguishing attributes. It only takes on
importance as an attribute of some object; for example a bank account.
• Have attributes.
attributes Objects can be described by one or more attributes. To
be distinguishable from one another, objects must have attributes. For example,
one automobile is distinguished from another by model, make, colour etc.
• Are data stores.
stores Objects are the data stores in a data flow diagram.
I D E N T I F Y I N G O B JE C T S
JA C O B S O N T H R E E T Y P E S O F O B JE C T S
E N T I T Y O B JE C T S U S E R I N T E R F A C E O B JE C T S C O N T R O L O B JE C T S
Central
Cash Card User Cash Receipt System
Computer
Communication Transaction
Line Log
External cashier
transaction cashier CONSORTIUM BANK
interactor station
BANK central
account customer ATM cash card
COMPUTER computer
account banking
software user cost
data network
communication
line
receipt system
transaction security
cash
log provision
transaction record
access data keeping
in the
works-for association
company has the role employer
and
person has the role employee
3. Use qualified associations
whenever possible