Ooad PPT Notes
Ooad PPT Notes
COURSE OBJECTIVES:
➢ To Understand the fundamentals of Object-Oriented System Development
➢ To understand the object-oriented methodologies.
➢ To use UML in requirements elicitation and designing.
➢ To understand concepts of relationships and aggregations.
➢ To test the software against its requirements specification
UNIT I - INTRODUCTION
Overview of object-oriented language systems development – Object basics hierarchy – Object and identity –
Static and dynamic binding – Object oriented SDLC.
COURSE OUTCOMES
CO1 - Understand the basics object model for System development.
CO2 - Understand the object-Oriented Methodologies
CO3 - Express software design with UML diagrams
CO4 - Understand the concept of Relationships
CO5 - Design software applications using OO concepts.
CO6 -Understand the various testing methodologies for OO software
2
UNIT – I
INTRODUCTION
3
1.3 Why an object orientation?
o To create sets of objects that work together with to produce software the problem.
o The systems are easier to adapt to changing requirements, easier to maintain,
more robust and promote greater design and code reuse.
o Object oriented development allows us to create modules of functionality.
o Once objects are defined, they will perform their desired functions.
o Here are some reasons,
▪ Higher level of abstraction
▪ Seamless transition among different phases of software development.
▪ Encouragement of good programming techniques
▪ Promotion of reusability
o Higher level of abstraction
▪ The top-down approach supports abstraction at the function level
▪ The object-oriented approach supports abstraction at the object level.Since
“objects encapsulate both data and functions they work at a higher
level of abstraction.”
o Seamless transition among different phases of software development.
▪ The object-oriented approach essentially uses the same language to talk
about analysis, design, programming, database design.
▪ This seamless approach reduces the level of complexity and redundancy
and makes for clear, more robust system development.
o Encouragement of good programming techniques
▪ Object oriented languages produce more modular and reusable code via the
concepts of class and inheritance.
▪ The object-oriented languages are C++, Smalltalk or Java.
o Promotion of reusability
▪ Objects are reusable because they are modelled directly out of a real-world
problem domain.
▪ The object orientation adds inheritance which is a powerful technique that
allows classes to be built from each other.
4
1. Identify the users/actors
2. Develop a simple business process model
3. Develop the use case
4. Interaction diagrams
5. Classification
6. Apply design axioms to design classes
7. Design the access layer
8. Design the view layer
9. Iterate and refine the design/analysis.
2. Object basics
- Object: It is a real-world entity that has properties and methods.
o E.g., Car.
- Properties (or Attributes): It describes the state (or data) of an object, refer Fig.1
o E.g., Color, manufacturer, cost, model and owner etc.
- Methods (or Procedures): It defines its behavior (or operations), refer Fig.2
o E.g., Go, stop, turn left, turn right and etc.…
5
- When developing an object-oriented application, two basic questions always arise,
o What objects does the application needs?
o What functionality should those objects have?
2.1 Object-Oriented Philosophy
o Object oriented programming is that it allows the base concepts of the language
to be extended to include ideas and terms closer to those of its applications.
o The traditional development methodologies are either algorithm centric or data
centric
1. Algorithm-centric methodology: An algorithm that can accomplish the
task, and then build data structures for that algorithm to use.
2. Data-centric methodology: To structure the data, and then build the
algorithm around that structure.
o Object-oriented methodology is the algorithm and the data structures are
packaged together as an object, which has a set of attributes or properties.
2.2 Objects are grouped into classes
o Classes are used to distinguish one type of objects from another
o A class is a set of objects that share a common structure and a common behavior
o Each object is an instance of a class, refer Fig. 3 and 4
o A class is a specification of,
1. Structure (instance variable)
2. Behaviour (methods)
3. Inheritance for objects
Fig. 1.3. Ada, Riche, James and Writh are Fig. 1.4. Employee class
objectsof the class Employee
6
2.3 Attributes or properties
o It represented by data type.
o It describe the state of an object
o Eg. Car attributes, see Fig. 5.
7
3. Send a Compute payroll message to Employee object
8
3. Class Hierarchy
- An object-oriented system organized classes into a “Subclass-Super class hierarchy”.
At the top of the hierarchy are the most general (base) classes and at the bottom are the
most specific classes (sub-classes).
- The parent class also is known as the bases class or super class.
A subclass inherits all of the properties and methods (procedures) defined in its super
class, refer Fig. 9 and 10.
3.1 Inheritance
o Inheritance is a relationship between classes where one class is the parent class of
another (derived) class, refer Fig. 11.
o Inheritance allows classes to share and reuse behaviours and attributes.
o The real advantage of inheritance is that we can build and reuse what we already
have.
9
Fig. 1.11. Inheritance allows reusability
o Dynamic Inheritance
1. It allows objects to change and evolve over time.
2. Dynamic inheritance refers to the ability to add, delete or change parents
from objects at run time.
3.2 Multiple Inheritance
o Object oriented systems permit a class to inherit its state (attributes) and behaviors
from more than one super class. This kind of inheritance is referred to as “Multiple
Inheritance”. Refer Fig. 12.
Fig. 1.12. Utility vehicle inherits from both the car and truck class
10
3.3 Polymorphism
o Poly means “Many” and morph means “Form”
o Polymorphism means that the same operation may behave differently on different
classes. Refer Fig. 13 and 14
11
3.4 Object relationship and Association
o The concept of association represents relationships between objects and class.
o Associations are bidirectional by which they can be traversed in both directions
o E.g., A pilot can fly planes, refer Fig.15.
12
- The identity does not depend on the objects name, or its key or its location.
In an object system, object identity often is implemented through some kind of “OBJECT
IDENTIFIER” (OID) or “UNIQUE IDENTIFIER” (UID). An OID is dispersed by a part
of object-oriented programming system that is responsible for guaranteeing the uniqueness
of every identifier.
- OID’s are never reused.
E.g., The car may have an owner property, which refer the class person. A person has an
owns property that contains a reference to the car instance. The relationship between the
car and person can be implemented and maintained by a reference, refer Fig. 18.
Fig. 1.18. The owner property of the car contains the reference to the personinstance named Hal
13
5. Object Oriented – SDLC
- The essence of the software development process that consists of
• Analysis
• Design
• Implementation
• Testing
• Refinement
- To transform users’ needs into a software solution that satisfies those needs.
Fig. 1.19. Software process reflecting transformation from needs to a software product that
satisfiesthose needs.
14
o Transformation 1 (Analysis): Translates the users’ needs into system
requirementsand responsibilities.
o Transformation 2 (Design): Begins with a problem statement and ends with
adetailed design that can be transformed into an operational system.
o Transformation 3 (Implementation): Refines the detailed design into the
systemdeployment that will satisfy the user’s needs.
“An Example (see Fig. 20) of the software development process is Waterfall
approach”
15
3. Correctness: It measures the consistency of the product requirements
withrespect to the design specification
4. Verification: It is the exercise of determining correctness
o Verification: Am, I building the product, right?
o Validation: Am, I building the right product?
Validation begins as soon as the project starts, but verification can begin only after a
specification has been accepted. Validation & verification are independent of each other.
16
Fig. 1.22. The object-oriented system development approach
a) The goal of OOD is to design the classes identified during the analysis phase
b) OOA and OOD are distinct disciplines, but they can be interconnected.
c) In OOD, design classes, define attributes and methods then build object and
dynamic model.
d) First build the object model based on objects and their relationship then iterate
and refine the model
a. Design and refine classes
b. Design and refine attributes
c. Design and refine the methods
d. Design and refine the structures
e. Design and refine the associations
e) Guidelines to use in your OOD
a. Reuse rather than build a new class know the existing classes
b. Design a large number of simple classes, rather than a small number of
complex classes
c. Design methods
d. A detailed analysis, what you have proposed. If possible, go-back and
refine the classes.
3) Prototyping
a) A prototype is a version of a software product developed in the early stages of the
products life cycle for specific, experimental purposes.
b) Prototyping can further define the use-cases, and actually makes use-case
modelling much easier.
c) Prototyping provides the developer a means to test and refine the user interface
and increase the usability of the system.
d) Prototypes have been categorized in various ways
a. Horizontal prototype:
a. It’s a simulation of the interface but contains no functionality.
b. An advantage is quick to implement.
b. Vertical prototype:
a. It is a subset of the system features with complete functionality.
b. An advantage is that the few implemented functions can be tested
in great depth.
c. Analysis prototype:
a. It is an aid for exploring the problem domain.
b. The final product will use the concepts exposed by the prototype,
not its code.
d. Domain prototype:
18
a. It is an aid for the incremental development of the
ultimate software solution.
b. It demonstrates the feasibility of the implementation.
4) Implementation: Component Based Development
o Component Based Development (CBD) is an industrial approach to
software development.
o Software components are functional units, or building blocks
offering a collectionof reusable services.
o A CBD developer can assemble components to construct a complete
software system.
o A component-based development is concerned with the
implementation and system integration aspects of software
development.
o CASE: Computer Aided Software Engineering Tools allow their
users to rapidly develop information systems.
o Goal: The main goal of CASE technology is the automation of the
entire systems development life cycle process using a set of
integrated software tools, such as modelling, methodology and
automatic code generation.
o RAD: Rapid Application Development
o RAD is to build a version of an application rapidly to see whether we
actually understood the problem.
o It builds the application quickly through tools such as Delphi, Visual
Age, Visual Basic.
5) Incremental Testing
o To test an application for bugs and performance.
o After development of applications are finally given to Quality
Assurance group for testing the process.
19
UNIT II
INTRODUCTION
Object-oriented methodology is a set of methods, models, and rules for developing
systems.
Modelling is the process of describing an existing or proposed system. It can be used
during any phase of the software life cycle.
3
Fig. 2.1. OMT object model of a bank system
Boxes- represents classes, Filled Triangle – represents Specialization, Association between
account and transaction represents one to many, Filled Circle – represents many (zero or more).
Association between Client and Account represents one to one.
Fig. 2. 2. State transition diagram for the bank application user interface. The roundboxes
represent states and the arrows represent transitions.
4
THE OMT FUNCTIONAL MODEL
The OMT data flow diagram (DFD) shows the flow of data between different
processes in a business.
1. - The process is any function being performed; for example, verify Password
or PIN in the ATM system (see Fig .3).
2. - The data flow shows the direction of data element movement; for example,
PIN code.
3. - The data store is a location where data are stored; for example, account is a
data store in the ATM example.
4. - An external entity is a source or destination of a data element; for example, the
ATM card reader.
5
2.2BOOCH METHODOLOGY
▪ The Booch methodology is a widely used object-oriented method that helps you
design your system using the object paradigm.
▪ The Booch method consists of the following diagrams:
o Class diagrams
o Object diagrams
o State transition diagrams
o Module diagrams
o Process diagrams
o Interaction diagrams
▪ The Booch methodology prescribes a macro development process and a micro
development process.
THE MACRO DEVELOPMENT PROCESS
• The macro process serves as a controlling framework for the micro process.
• The primary concern of the macro process is technical management of the system.
5. Maintenance. Make localized changes to the system to add new requirements and
eliminate bugs.
6
Fig. 2.4. Object modeling using Booch notation
The arrows represent specialization; for example, the class Taurus is subclass ofthe class
Ford.
Fig. 2.5. An alarm class state transition diagram with Booch notation.
This diagram can capture the state of a class based on a stimulus. For example, a stimulus
causes the class to perform some processing, followed by a transition to anotherstate. In this
case, the alarm silenced state can be changed to alarm sounding state and vice versa.
7
2.3THE JACOBSON METHODOLOGIES
USE CASES
• Use cases are scenarios for understanding system requirements.
• A use case is an interaction between users and a system.
• The use-case model captures
- the goal of the user and
- the responsibility of the system to its users
8
• How and when the use case will need data stored in the system or will store data in
the system.
Exceptions to the flow of events.
• How and when concepts of the problem domain are handled.
Fig. 2.7. The use case model is considered in every model and phase.
2.4PATTERNS
Definition:
A pattern is [an] instructive information that captures the essential structure and
insight of a successful family of proven solutions to a recurring problem that arises
within a certain context and system of forces.
A pattern involves a general description of a solution to a recurring problem bundle
with various goals and constraints.
proto-pattern.
• A "pattern in waiting," which is not yet known to recur, sometimes is called a proto-
pattern.
10
• Nongenerative patterns are static and passive:
- They describe how to reproduce them.
Patterns Template
Every pattern must be expressed "in the form of a rule [template] which establishes a
relationship between a context and a configuration
ANTIPATTERNS
A pattern represents a "best practice," whereas an antipattern represents "worst
practice" or a "lesson learned."
Anti-patterns come in two varieties:
• Those describing a bad solution to a problem that resulted in a bad situation.
• Those describing how to get out of a bad situation and how to proceed from there toa
good solution.
Anti-patterns are valuable because often it is just as important to see and understand badsolutions
as to see and understand good ones.
Capturing Patterns
• Writing good patterns is very difficult
A pattern should help its users comprehend existing systems, customize systems tofit
user needs, and construct new systems.
The process of looking for patterns to document is called pattern mining (or
sometimes reverse architecting).
11
2.5. FRAMEWORKS
A framework is a way of presenting a generic solution to a problem that can be
applied to all levels in a development.
A definition of an object-oriented software framework is given by Gamma:
- A framework is a set of cooperating classes that make up a reusable
design for a specific class of software.
- A framework provides architectural guidance by partitioning the design
into abstract classes and defining their responsibilities and
collaborations.
- A developer customizes a framework to a particular application by
subclassing and composing instances of framework classes.
- The framework captures the design decisions that are common to its
application domain.
- A single framework typically encompasses several design patterns.
In fact, a framework can be viewed as the implementation of a system of designpatterns.
12
3. Repository for object-oriented system development patterns and frameworks.
4. Component based development.
OBJECT-ORIENTED ANALYSIS
- Analysis is the process of extracting the needs of a system and what the system must do
to satisfy the users' requirements.
- The goal of object-oriented analysis is to first understand the domain of the problem and
the system's responsibilities by understanding how the users use or will use the system.
- This is accomplished by constructing several models of the system.
- These models concentrate on describing what the system does rather than how it doesit.
Separating the behavior of a system from the way it is implemented requires viewingthe
system from the user's perspective rather than that of the machine.
13
OBJECT-ORIENTED DESIGN
OOD Process consists of:
• Designing classes, their attributes, methods, associations, structures and protocols,
apply design axioms
• Design the Access Layer
• Design and prototype User interface
• User Satisfaction and Usability Tests based on the Usage/Use Cases
• Iterate and refine the design
16
WHY MODELING?
Building a model for a software system prior to its construction is as essential as having
a blueprint for building a large building. Good models are essential forcommunication among
project teams. As the complexity of systems increases, so does the importance of good
modeling techniques. Many other factors add to a project's success, but having a rigorous
modeling language is essential. A modeling language must include Model elements-
fundamental modeling concepts and semantics.
Is
• A way to describe your software
17
• more precise than English
• less detailed than code
UML DIAGRAMS
The UML defines nine graphical diagrams:
1. Class diagram (static)
2. Use-case diagram
3. Behavior diagrams (dynamic):
– 3.1. Interaction diagram:
• 3.1.1. Sequence diagram
• 3.1.2. Collaboration diagram
– 3.2. State chart diagram
4. Implementation diagram:
4.1. Component diagram
4.2. Deployment diagram
18
UML CLASS DIAGRAM
The UML class diagram, also referred to as object modelling, is the main static
analysis diagram. These diagrams show the static structure of the model.
A class diagram is a collection of static modeling elements, such as classes and their
relationships, connected as a graph to each other and to their contents; for example, the things
that exist (such as classes), their internal structures, and their relationships to other classes.
Class diagrams do not show temporal information, which is required in dynamic
modeling.
□ A class diagram describes the types of objects in the system and the various
kinds of static relationships that exist among them.
□ A graphical representation of a static view on declarative static elements.
□ A central modelling technique that runs through nearly all object-oriented
methods.
□ The richest notation in UML.
□ A class diagram shows the existence of classes and their relationships in the logical
view of a system
Attributes
– Classes have attributes that describe the characteristics of their objects.
– Attributes are atomic entities with no responsibilities.
– Attribute syntax (partial):
o [visibility] name [: type] [ = default Value]
– Class scope attributes are underlined
Visibility
• Visibility describes whether an attribute or operation is visible and can be referenced
from classes other than the one in which they are defined.
• Language dependent
o Means different things in different languages
• UML provides four visibility abbreviations: + (public) – (private) # (protected)
~(package)
Object Diagram
A static object diagram is an instance of a class diagram. It shows a snapshot of the
detailed state of the system at a point in time. Notation is the same for an object diagram
and a class diagram. Class diagrams can contain objects, so a class diagram with objects and
no classes is an object diagram.
Class interface notation is used to describe the externally visible behavior of a class;
for example, an operation with public visibility. Identifying class interfaces is a design activity
of object-oriented system development.
The UML notation for an interface is a small circle with the name of the interface
20
connected to the class. A class that requires the operations in the interface may be attachedto
the circle by a dashed arrow. The dependent class is not required to actually use all of the
operations.
For example, a Person object may need to interact with the BankAccount object to get
the Balance; this relationship is depicted in Fig13. with UML class interface notation.
Association Role
A simple association- binary association-is drawn as a solid line connecting two class
symbols. The end of an association, where it connects to a class, shows the association role.
The role is part of the association, not part of the class. Each association has two or more roles
to which it is connected.
In above Fig14. the association worksfor connects two roles, employee and employer.
A Person is an employee of a Company and a Company is an employer of a Person.
The UML uses the term association navigation or navigability to specify a roleaffiliated
with each end of an association relationship. An arrow may be attached to the end of the path
21
to indicate that navigation is supported in the direction of the class pointed to. An arrow may
be attached to neither, one, or both ends of the path. In particular, arrows could be shown
whenever navigation is supported in a given direction.
In the UML, association is represented by an open arrow, as represented in Fig.15.
Navigability is visually distinguished from inheritance, which is denoted by an unfilled
arrowhead symbol near the superclass.
Qualifier
22
A qualifier is shown as a small rectangle attached to the end of an association path,
between the final path segment and the symbol of the class to which it connects. The qualifier
rectangle is part of the association path, not part of the class. The qualifier rectangle usually
is smaller than the attached class rectangle (see above Fig).
Multiplicity
Multiplicity specifies the range of allowable associated classes. It is given for roles
within associations, parts within compositions, repetitions, and other purposes. A multiplicity
specification is shown as a text string comprising a period-separated sequence of integer
intervals, where an interval represents a range of integers in this format (see Fig 17):
lower bound. upper bound.
The terms lower bound and upper bound are integer values, specifying the range of
integers including the lower bound to the upper bound. The star character (*) may be used for
the upper bound, denoting an unlimited upper bound. If a single integer value is specified,
then the integer range contains the single values.
OR Association
An OR association indicates a situation in which only one of several potential
associations may be instantiated at one time for any single object. This is shown as a dashed
line connecting two or more associations, all of which must have a class in common,with the
constraint string {or} labeling the dashed line (see Fig 18). In other words, any instance of the
class may participate in, at most, one of the associations at one time.
23
Fig. 2.18. An OR association notation. A car may associate with a person or a company.
Association Class
An association class is an association that also has class properties. An association
class is shown as a class symbol attached by a dashed line to an association path. The name in
the class symbol and the name string attached to the association pathare the same (see Fig
19). The name can be shown on the path or the class symbol or both.If an ssociation class has
attributes but no operations or other associations, then the name may be displayed on the
association path and omitted from the association class to emphasize its "association nature."
If it has operations and attributes, then the name may beomitted from the path and placed in
the class rectangle to emphasize its "class nature."
24
N-Ary Association
An n-ary association is an association among more than two classes. Since n-ary
association is more difficult to understand, it is better to convert an n-ary association to
binary association.
An n-ary association is shown as a large diamond with a path from the diamond to
each participant class. The name of the association (if any) is shown near the diamond. The
role attachment may appear on each path as with a binary association. Multiplicity may be
indicated; however, qualifiers and aggregation are not permitted. An association class symbol
may be attached to the diamond by a dashed line, indicating an n-ary association that has
attributes, operation, or associations. The example depicted in Fig 20 shows the grade book
of a class in each semester.
Fig. 2.20. An n-ary (ternary) association that shows association among class, year, and
student classes. The association class GradeBook which contains the attributes of the
associations such as grade, exam, and lab.
25
Fig. 2.21. Association Path
26
Generalization
Generalization is the relationship between a more general class and a more specific
class. Generalization is displayed as a directed line with a closed, hollow arrowheadat the
superclass end (see Fig 23 ). The UML allows a discriminator label to be attached toa
generalization of the superclass.
27
Fig. 2.24. Ellipses(...) indicate that additional classes exist and are not shown.
USE-CASE DIAGRAM
The use-case concept was introduced by Ivar Jacobson in the object-oriented software
engineering (OOSE) method. The functionality of a system is described in anumber of
different use cases, each of which represents a specific flow of events in the system.
A use case corresponds to a sequence of transactions, in which each transaction is
invoked from outside the system (actors) and engages internal objects to interact with
one another and with the system's surroundings.
The description of a use case defines what happens in the system when the use case
is performed. In essence, the use-case model defines the outside (actors) and inside(use case)
of the system's behavior. Use cases represent specific flows of events in the system. The use
cases are initiated by actors and describe the flow of events that these actors set off. An actor
is anything that interacts with a use case: It could be a human user, external hardware, or
another system. An actor represents a category of user rather
28
than a physical user. Several physical users can play the same role. For example, in termsof
a member actor, many people can be members of a library, which can be represented by one
actor called Member.
A use-case diagram is a graph of actors, a set of use cases enclosed by a system
boundary, communication (participation) associations between the actors and the use cases,
and generalization among the use cases.
Fig. 2. 25. Use-case diagram shows the relationship among actors and use cases
within a system.
Fig 25. diagrams use cases for a Help Desk. A use-case diagram shows the relationship
among the actors and use cases within a system. A client makes a call that is taken by an
operator, who determines the nature of the problem. Some calls can beanswered immediately;
other calls require research and a return call.
A use case is shown as an ellipse containing the name of the use case. The name ofthe
use case can be placed below or inside the ellipse. Actors' names and use case names should
follow the capitalization and punctuation guidelines of the model.
29
An actor is shown as a class rectangle with the label < <actor> >, or the label and astick
fig, or just the stick fig with the name of the actor below the fig (see Fig 26).
Booch explains that describing a systematic event in a static medium such as on asheet of
paper is difficult, but the problem confronts almost every discipline.
The Dynamic semantics of a problem with the following diagrams:
Behavior diagrams (Dynamic)
□ Interaction Diagrams:
□ Sequence diagrams □
□ Collaboration diagrams
State Chart diagrams
□ Activity diagrams
Each class may have an associated activity diagram that indicates the behavior of the
class's instance (its object). In conjunction with the use-case model, we may provide a scripts
or an interaction diagram to show the time or event ordering of messages as they are evaluated
.
30
UML Sequence Diagram: Sequence diagrams are an easy and intuitive way of describing
the behavior of a system by viewing the interaction between the system and its environment.A
sequence diagram shows an interaction arranged in a time sequence. It shows the objects
participating in the interaction by their lifelines and the messages they exchange, arrangedin
a time sequence.
A sequence diagram has two dimensions: the vertical dimension represents time,
the horizontal dimension represents different objects. The vertical line is called the object's
lifeline. The lifeline represents the object's existence during the interaction. This form was first
popularized by Jacobson. An object is shown as a box at the top of a dashed vertical line (see
Fig 27). A role is a slot for an object within a collaboration that describes the type ofobject that
may play the role and its relationships to other roles. a sequence diagram does not show the
relationships among the roles or the association among the objects. An object role is shown as
a vertical dashed line, the lifeline.
Each message is represented by an arrow between the lifelines of two objects. The order
in which these messages occur is shown top to bottom on the page. Each message is labeled
with the message name. The label also can include the argument and some control information
and show self-delegation, a message that an object sends to itself, by sending the message
arrow back to the same lifeline. The horizontal ordering of the lifelines is arbitrary. Often, call
arrows are arranged to proceed in one direction across the page, but this is not always possible
and the order conveys no information.
The sequence diagram is very simple and has immediate visual appeal-this is its great
strength. A sequence diagram is an alternative way to understand the overall flow of the control
of a program. Instead of looking at the code and trying to find out the overall sequence of
behavior, you can use the sequence diagram to quickly understand thatsequence.
31
UML Collaboration Diagram: Another type of interaction diagram is the collaboration
diagram. A collaboration diagram represents a collaboration, which is a set of objects related
in a particular context, and interaction, which is a set of messages exchanged among the
objects within the collaboration to achieve a desired outcome. In a collaboration diagram,
objects are shown as figs. As in a sequence diagram, arrows indicate the messagesent within
the given use case. In a collaboration diagram, the sequence is indicated by numbering the
messages.
A collaboration diagram provides several numbering schemes. The simplest is
illustrated in Fig 28.
Fowler and Scott argue that the main advantage of interaction diagrams (both
collaboration and sequence) is simplicity. You easily can see the message by looking atthe
diagram. The disadvantage of interaction diagrams is that they are great only for representing
a single sequential process; they begin to break down when you want to represent conditional
looping behavior.
Conditional behavior can be represented in sequence or collaboration diagrams through
two methods.
*. The preferred method is to use separate diagrams for each scenario. *. Another way
is to use conditions on messages to indicate the
behavior.
34
Fig. 2. 31. An activity diagram for processing mortgage requests
(Loan: ProcessingMortgage Request).
An activity model is similar to a state chart diagram, where a token (shown by a black
dot) represents an operation. An activity is shown as a round box, containing the name of
the operation. When an operation symbol appears within an activity diagram or other state
diagram, it indicates the execution of the operation.
Executing a particular step within the diagram represents a state within the execution
of the overall method. The same operation name may appear more than once in a state diagram,
indicating the invocation of the same operation in different phases.
An outgoing solid arrow attached to an activity symbol indicates a transition triggered
by the completion of the activity. The name of this implicit event need not be written, but the
conditions that depend on the result of the activity or other values may be included (Fig. 31).
Several transitions with different conditions imply a branching off of control. If
conditions are not disjoint, then the branch is nondeterministic. The concurrent control is
represented by multiple arrows leaving a synchronization bar, which is represented by a short
thick bar with incoming and outgoing arrows. Joining concurrent control is expressedby
multiple arrows entering the synchronization bar.
35
Fig. 2.32. A decision.
An activity diagram is used mostly to show the internal state of an object, but external
events may appear in them. An external event appears when the object is in a "waitstate," a
state during which there is no internal activity by the object and the object is waitingfor some
external event to occur as the result of an activity by another object (such as a user input or
some other signal). The two states are wait state and activity state. More than one possible
event might take the object out of the wait state; the first one that occurs triggers the transition.
A wait state is the "normal" state.
Activity and state diagrams express a decision when conditions (the UML calls them
guard conditions) are used to indicate different possible transitions that depend on Boolean
conditions of container object. The fig 2.32 provided for a decision is the traditional diamond
shape, with one or more incoming arrows and two or more outgoing arrows, each labeled by a
distinct guard condition. All possible outcomes should appear on one
of the outgoing transitions (see Fig 2.32).
Actions may be organized into swimlanes, each separated from neighboring swimlanes
by vertical solid lines on both sides. Each swimlane represents responsibility for part of the
overall activity and may be implemented by one or more objects. The relative ordering of the
swimlanes has no semantic significance but might indicate some affinity. Each action is
assigned to one swimlane. A transition may cross lanes; there is no significance to the routing
of the transition path (see Fig 2.33 ).
Component Diagram:
Component diagrams model the physical components (such as source code,
executable program, user interface) in a design. These high-level physical components mayor
may not be equivalent to the many smaller components you use in the creation of your
application. For example, a user interface may contain many other off-the-shelf components
purchased to put together a graphical user interface.
Another way of looking at components is the concept of packages. A package is used
to show how you can group together classes, which in essence are smaller scale components.
A package usually will be used to group logical components of the application, such as classes,
and not necessarily physical components. However, the package could be a first approximation
of what eventually will turn into physical grouping. In that case, the package will become a
component.
A component diagram is a graph of the design's components connected by dependency
relationships. A component is represented by the boxed fig shown in Fig 34 Dependency is
shown as a dashed arrow.
37
Deployment Diagram
Deployment diagrams show the configuration of run-time processing elements and
the software components, processes, and objects that live in them. Software component
instances represent run-time manifestations of code units. In most cases, component diagrams
are used in conjunction with deployment diagrams to show how physical modules of code are
distributed on various hardware platforms. In many cases, component and deployment
diagrams can be combined.
A deployment diagram is a graph of nodes connected by communication association. Nodes
may contain component instances, which mean that the component lives or runs at that node.
Components may contain objects; this indicates that the object is part of the component.
Components are connected to other components by dashed arrow dependencies, usually
through interfaces, which indicate one component uses the services of another. Each node or
processing element in the system is represented by a three- dimensional box. Connections
between the nodes (or platforms) themselves are shown by solid lines (see Fig 35).
38
MODEL MANAGEMENT: PACKAGES AND MODEL ORGANIZATION
39
A real model would have many more classes in each package. The contents might be
shown if they are small, or they might be suppressed from higher levels. The entire system is
a package. Fig 37 also shows the hierarchical structure, with one packagedependent on other
packages. For example, the Customer depends on the package Business Model, meaning that
one or more elements within Customer depend on one or more elements within the other
packages. The package Business Model is shown partially expanded. In this case, we see that
the package Business Model owns the classes Bank, Checking, and Savings as well as the
packages Clients and Bank. Ownership may be shown by a graphic nesting of the figs or by
the expansion of a package in a separate drawing. Packages can be used to designate not
logical and physical groupings but also use-case groups. A use-case group, as the name
only
suggests, is a package of use cases.
Model dependency represents a situation in which a change to the target element may
require a change to the source element in the dependency, thus indicating the relationship
between two or more model elements. It relates the model elements themselvesand does not
require a set of instances for its meaning. A dependency is shown as a dashed arrow from
40
one model element to another on which the first element is dependent (see Fig 38).
Fig. 2.38. An example of constraints. A person is a manager of people who work for the
accounting department.
UML EXTENSIBILITY
1. Model Constraints and comments
41
2. Note
A Note is a graphic symbol containing textual information; it also could contain
embedded images. It is attached to the diagram rather than to a model element. A note is
shown as a rectangle with “Bent Corner” in the upper right corner. It can contain any length
text. (ref. Fig 39).
3. Stereotype
Stereotype represent a built-in extensibility mechanism of the UML. User-defined
extensions of the UML are enabled through the use of stereotypes and constraints. A stereotype
is a new class of modeling element introduced during modeling, It represents a subclass of an
existing modeling element with the same form (attributed and relationships) but a different
intent. UML stereotype extend and tailor the UML for a specific domain or process.
The general presentation of a stereotype is to use a figure for the base element but place
a keyword string above the name of the element (if used, the keyword string is the name of a
stereotype within matched guillemets,
“<<”,”>>”, such as <<flow>.. Note that a guillemet looks like a angle-bracket, but it is a single
character in most fonts.
42
<< Flow >> copy
Number of Copy
MakeCopy
Copy
Number of Copy
MakeCopy
3. UML Meta-model
The UML defined notations as well as a meta model. UML graphic
notations can be used not only to describe the system’s components but also to describe a
model itself. This is known as a meta-model.
In other words, a meta-model is a model of modeling elements. The purpose of the
UML meta-model is to provide a single, common, and definitive statement of the syntax and
semantics of the elements of the UML.
43
The meta model provides us a means to comment different UML diagrams. The
connection between the different diagrams is very important, and the UML attempts to make
these coupling more explicit through defining the underlying model while imposing no
methodology.
The presence of this meta model has made it possible for its developers to agree on
semantics and how those semantics would be best rendered. This is an important step forward,
since it can assure consistency among diagrams. The meta-model also can serve as a means to
exchange data between different case tools. The fig 41 is an example for the UML meta-model
that describes relationship with association and generalization; association is depicted as a
composition of association roles.
Fig. 2.41. The UML meta-model describing the relationship between association and
generalization.
44
UNIT – III
OBJECT ORIENTED ANALYSIS: USE-CASE DRIVEN
Analysis is the process of extracting the needs of a system and what the system must do to
satisfy the users' requirement. The goal of object-oriented analysis is to understand the
domain of tile problem and the system's responsibilities by understanding how the users
use or will use the system. The first step in finding an appropriate solution to a given
problem is to understand the problem and its domain.
The main objective of the analysis is to capture a complete, unambiguous, and
consistent picture of the requirements of the system and what the system must do to satisfy
the users' requirements and needs. This is accomplished by constructing several models of
the system that concentrate on describing what the system does rather than how it does it.
Separating the behavior of a system from the way that behavior is implemented requires
viewing the system from the perspective of the user rather than that of the machine.
Analysis is the process of transforming a problem definition from a fuzzy set of facts and
myths into a coherent statement of a system's requirements.
1. Fuzzy descriptions - such as "fast response time" or "very easy and very secure
updating mechanisms." A requirement such as fast response time is open to interpretation,
which might lead to user dissatisfaction if the user's interpretation of a fast response is
different from the systems analyst's interpretation
2. Incomplete requirements - mean that certain requirements necessary for successful
system development are not included for a variety of reasons. These reasons could include
the users' forgetting to identify them, high cost, politics within the business,or oversight by
the system developer. However, because of the iterative nature of object- oriented analysis
and the unified approach most of the incomplete requirements can be identified in
subsequent tries.
3. Unnecessary features - When addressing features of the system, keep in mind that
every additional feature could affect the performance, complexity, stability, maintenance,
and support costs of an application. Features implemented by a small extension to the
application code do not necessarily have a proportionally small effect on a user interface.
3
3.2 BUSINESS OB.JECT ANALYSIS: UNDERSTANDING THE
BUSINESS LAYER
Business object analysis is a process of understanding the system's requirements
and establishing the goals of an application. The main intent of this activity is to understand
users' requirements. The outcome of the business object analysis is to identify classes that
make up the business layer and the relationships that play a role in achieving system goals.
Fig 3.1. Object Oriented analysis process in the Unified Approach (UA)
4
3.4 BUSINESS PROCESS MODELING
This may include modeling as-is processes and the applications that support them
and any number of phased, would-be models of reengineered processes or implementation
of the system. These activities would be enhanced and supported by using an activity
diagram. Business process modeling can be very time consuming, so the main idea should
be to geta basic model without spending too much time on the process.
The advantage of developing a business process model is that it makes you more
familiar with the system and therefore the user requirements and also aids in developing
use cases. For example, let us define the steps or activities involved in using your school
library. These activities can be represented with an activity diagram. (See Fig- 3.2)
Developing an activity diagram of the business process can give us a better understanding
of what sort of activities are performed in a library by a library member.
Fig. 3.2. This activity diagram shows some activities that can be performed by a
library member.
5
3.5 USE-CASE MODEL
Use cases are scenarios for understanding system requirements.
• A use-case model can be instrumental in project development, planning, and
documentation of systems requirements.
• A use case is an interaction between users and a system; it captures the goal of
the users and the responsibility of the system to its users). For example, take a car;
typical uses of a car include "take you different places" or "haul your stuff" or a
user may wantto use it "off the road."
• The use-case model describes the uses of the system and shows the courses of
eventsthat can be performed.
• A use-case model also can discover classes and the relationships among subsystems
ofthe systems.
• Use-case model can be developed by talking to typical users and discussing
thevarious things they might want to do with the application being prepared.
• Each use or scenario represents what the user wants to do.
• Each use case must have a name and short textual description, no more than a
fewparagraphs.
• Since the use-case model provides an external view of a system or application, it
is directed primarily toward the users or the "actors" of the systems, not its
implementers(see Figure 3.3).
• The use-case model expresses what the business or application will do and not
how;that is the responsibility of the UML class diagram
6
The UML class diagram, also called an object model, represents the static
relationships between objects, inheritance, association, and the like. The object model
represents an internal view of the system, as opposed to the use- case model, which
represents the external view of the system. The object model shows how the business is
run. Jacobson, Ericsson, and Jacobson call the use-case model a "what model," in contrast
to the object model, whichis a "how model.".
Use cases represent the things that the user is doing with the system, which can be different
from the users' goals.
Definition of use case by Jacobson "A Use Case is a sequence of transactions in a system
whose task is to yield results of measurable value to an individual actor of the system."
• Use case - Use case is a special flow of events through the system. By definition,
many courses of events are possible and many of these are very similar.
• Actors - An actor is a user playing a role with respect to the system. When dealing
withactors, it is important to think about roles rather than just people and their job
titles.
• Ina system -. This simply means that the actors communicate with the system's use
case.
• A measurable value- A use case must help the actor to perform a task that has
some identifiable value.
• Transaction. - A transaction is an atomic set of activities that are performed either
fully or not at all. A transaction is triggered by a stimulus from an actor to the system
or by a point in time being reached in the system.
The following are some examples of use cases for the library (see Figure 3.4).
7
Fig. 3.4. A member, a circulation clerk, and a supplier.
1. Use-case name: Borrow books. A member takes books from the library to read at
home, registering them at the checkout desk so the library can keep track of its
books. Depending on the member's record, different courses of events will follow.
2. Use-case name: Get an interlibrary loan. A member requests a book that the
library does not have. The book is located at another library and ordered through an
interlibrary loan.
3. Use-case name: Return books. A member brings borrowed books back to the library.
4. Use-case name: Check library card. A member submits his or her library card to
the clerk, who checks the borrower's record.
5. Use-case name: Do research. A member comes to the library to do research. The
member can search in a variety of ways (such as through books, journals, CDROM,
WWW) to find information on the subjects of that research.
6. Use-case name: Read books, newspaper. A member comes to the library for
aquiet place to study or read a newspaper, journal, or book.
7. Use-case name: Purchase supplies. The supplier provides the books, journals, and
newspapers purchased by the library.
8
A way to simplify the description is to take advantage of extends and uses
associations. The extends association is used when you have one use case that is similar to another
use case but does a bit more or is more specialized; in essence, it is like a subclass.
The uses association occurs when you are describing your use cases and notice that
some of them have sub flows in common. To avoid describing a sub flow more than once
in several use cases, you can extract the common sub flow and make it a use case of its
own. This new use case then can be used by other use cases. The relationships among the
other use cases and this new extracted use case are called a uses association. The uses
association helps us avoid redundancy by allowing a use case to be shared. For example,
checking a library card is common among the borrow books, return books, and interlibrary
loan use cases (see Figure 3.4).
The similarity between extends and uses associations is that both can be viewed as
a kind of inheritance. When you want to share common sequences in several use cases,
utilize the uses association by extracting common sequences into a new, shared use case.
The extends association is found when you add a bit more specialized, new use case that
extends some of the use cases that you have.
Use cases could be viewed as concrete or abstract. An abstract use case is not
complete and has no initiation actors but is used by a concrete use case, which does interact
with actors. This inheritance could be used at several levels. Abstract use cases also are the
use cases that have uses or extends associations.
Fowler and Scott provide us excellent (guidelines for addressing variations in use
case modeling : .
1. Capture the simple and normal use case first.
2. For every step in that use case, ask
*. What could go wrong here?
*. How might this work out differently?
3. Extract common sequences into a new, shared use case with the uses association. If
you are adding more specialized or exceptional uses cases, take advantage of usecases
you already have with the extends association.
9
You have to identify the actors and understand how they will use and interact
with the system. In a thought-provoking book on requirement analysis, Gause and
Weinberg , explain what is known as the railroad paradox:
When trying to find all users, we need to beware of the Railroad Paradox. When
railroads were asked to establish new stops on the schedule, they "studied the
requirements," by sending someone to the station at the designated time to see if anyone
was waiting for a train. Of course, nobody was there because no stop was scheduled, so
the railroad turned down the request because there was no demand.
Gause and Weinberg concluded that the railroad paradox appears everywhere thereare
products and goes like this (which should be avoided):
1. The product is not satisfying the users.
2. Since the product is not satisfactory, potential users will not use it.
3. Potential users ask for a better product.
4. Because the potential users do not use the product, the request is denied.
Therefore, since the product does not meet the needs of some users, they are not identified
as potential users of a better product. They are not consulted and the product stays bad. The
railroad paradox suggests that a new product actually can create users where none existed
before Candidates for actors can be found through the answers to thefollowing questions:
• Who is using the system? Or, who is affected by the system? Or, which groups
need help from the system to perform a task?
• Who affects the system? Or, which user groups are needed by the system to
perform itsfunctions? These functions can be both main functions and secondary
functions, suchas administration.
• Which external hardware or other systems (if any) use the system to perform tasks?
• What problems does this application solve (that is, for whom)? And, finally,
howdo users use the system (use case)? What are they doing with the system?
When requirements for new applications are modeled and designed by a group
that excludes the targeted users, not only will the application not meet the users' needs,
but potential users will feel no involvement in the process and not be committed to giving
the application a good try. Always remember Veblen's principle: 'There's no change, no
matter how awful, that won't benefit some people; and no change, no matter how good, that
won't hurt some.”,
Another issue worth mentioning is that actors need not be human, although
actors are represented as stick figures within a use case diagram. An actor alsocan be an
external system. For example, an accounting system that needs information from a system
to update its accounts is an actor in that system.
10
Fig. 3.5. The difference between users and actors
Once you have identified the use-cases candidates, it may not be apparent that all
of these use cases need to be described separately; some may be modeled as variants of
others. Consider what the actors want to do.
It is important to separate actors from users. The actors each represent a role that
one or several users can play. Therefore, it is not necessary to model different actors that
can perform the same use case in the same way. The approach should allow different users
to be different actors and play one role when performing a particular actor's use case. Thus,
each use case has only one main actor. To achieve this, you have to
• Isolate users from actors.
• Isolate actors from other actors (separate the responsibilities of each actor).
• Isolate use cases that have different initiating actors and slightly different
behavior (If the actor had been the same, this would be modeled by a use-case
alternativebehavior).
11
5. How Detailed Must a Use Case Be? When to Stop Decomposing and When to
Continue
A use case, as already explained, describes the courses of events that will be carried
out by the system. Jacobson et al. believe that, in most cases, too much detail maynot be
very useful.
During analysis of a business system, you can develop one use-case diagram asthe
system use case and draw packages on this use case to represent the various business
domains of the system. For each package, you may create a child usecase diagram. On each
child use-case diagram, you can draw all of the use cases of the domain, with actions and
interactions. You can further refine the way the use cases are categorized.The extends and
uses relationships can be used to eliminate redundant modeling of scenarios.
When should use cases be employed? Use cases are an essential tool in capturing
requirements and planning and controlling any software development project.
Capturing use cases is a primary task of the analysis phase. Although most use cases
are captured at the beginning of the project, you will uncover more as you proceed.
The UML specification recommends that at least one scenario be prepared for each
significantly different kind of use case instance
12
.
Fig. 3.6. A library system can be divided into many packages, each of whichencompasses
multiple use cases.
Documenting your project helps reveal issues and gaps in the analysis and design.
A document can serve as a communication vehicle among the project's team members, or
it can serve as an initial understanding of the requirements. Blum concludes that
management has responsibility for resources such as software, hardware, and operational
expenses.
In many projects, documentation can be an important factor in making a decision
about committing resources. Application software is expected to provide a solution to a
problem. It is very difficult, if not impossible, to document a poorly understood problem.
The main issue in documentation during the analysis phase is to determine what the system
must do. Decisions about how the system works are delayed to the design phase. Blum
raises the following questions for determining the importance of documentation: How will
a document be used? (If it will not be used, it is not necessary.) What is the objective of the
document? What is the management view of the document? Who are the readers of the
document?
13
1. Organization Conventions for Documentation
Bell and Evans provide us the following guidelines for making documents fit theneeds
and expectations of your audience:
1. 1.Common cover. All documents should share a common cover sheet that
identifiesthe document, the current version, and the individual responsible for
the content. As thedocument proceeds through the life cycle phases, the
responsible individual may change. That change must be reflected in the cover
sheet.
2. 2.80-20 rule. As for many applications, the 80-20 rule generally applies for
documentation: 80 percent of the work can be done with 20 percent of the
documentation. The trick is to make sure that the 20 percent is easily accessible and
the rest (80 percent) is available to those (few) who need to know.
3. Familiar vocabulary. The formality of a document will depend on how it is used
and who will read it. When developing a documentation use a vocabulary that your
readers understand and are comfortable with. The main objective here is to
communicate with readers and not impress them with buzz words.
4. Make the document as short as possible. Assume that you are developing a
manual. The key in developing an effective manual is to eliminate all repetition;
present summaries, reviews, organization chapters in less than three s; and make
chapter headings task oriented so that the table of contents also could serve as an
index.
5. Organize the document. Use the rules of good organization (such as the
organization’s standards, college handbooks, Strunk and White's Elements of Style
or the University of Chicago Manual of Style) within each section. Appendix A
provides a template for developing documentation for a project. Most CASE tools
provide documentation capability by providing customizable reports. The purpose
of these guidelines is to assist you in creating an effective documentation.
14
(Document Name)
For
(Product)
(Version no)
Responsible individual
Name:
Title:
Fig. 3.7. Cover Sheet template.
3.7 Case Study: ANALYSING THE VIANET BANK ATM – THE USE CASE
DRIVEN PROCESS
The Following section provides the description of the vianet bank atm system’s
requirement.
• The Bank client must be able to deposit an amount to and withdraw an amount
from his or her accounts using the touch screen at the vianet bank atm. Each
transaction must be recorded, and the client must be able to review all transactions
performed against the given account. Recorded transactions must include the date,
time, Transaction type,amount and account balance after the transactions.
• A ViaNet bank client can have two types of accounts: a checking account and
savings account. For each checking account, one related savings account can
• exist.
Access to the ViaNet bank accounts is Provided by a PIN code consisting of four
• integerdigits between 0 and 9.
• One PIN code allows access to all accounts held by a bankclient.
• No receipts will be provided for any account transactions.
• The bank application operates for a single banking institution only.
Neither a checking nor a savings account can have a negative balance. The system
should automatically withdraw money from a related savings account if the
requested withdrawal amount on the checking account is more than its current
balance. If the balance on a savings account is less than the withdrawal amount
requested, the transaction will stop and the bank client will be notified.
i) Identifying Actors and Use Cases for the ViaNet Bank ATM System
The bank application will be used by one category of users: bank clients. Notice
that identifying the actors of the system is an iterative process and can be modified as you
learn more about the system. The actor of the bank system is the bank client. The bank
client must be able to deposit an amount to and withdraw an amount from his or her
accounts using the bank application. The following scenarios show use-case interactions
between the actor (bank client) and the bank. In real life application these use cases are
15
created by system requirements, examination of existing system documentation,
interviews, questionnaire, observation, etc.
• Use-case name: Bank ATM transaction. The bank clients interact with the
bank system by going through the approval process. After the approval process, the bank
clientcan perform the transaction. Here are the steps in the ATM transaction use case:
1. Insert ATM card.
2. Perform the approval process.
3. Ask type of transaction.
4. Enter type of transaction.
5. Perform transaction.
6. Eject card.
7. Request take card.
8. Take card.
These steps are shown in the Figure activity diagram. .
• Use-case name: Approval process. The client enters a PIN code that consists of
4digits.Activities involved in an ATM transaction.
1. Request password.
2. Enter password.
3. Verify password.
16
• Usecase name: Invalid PIN. If the PIN code is not valid, an appropriate message
is displayed to the client. This use case extends the approval process. (See Figure.)
• Usecase name: Deposit amount. The bank clients interact with the bank system after
the approval process by requesting to deposit money to an account. The client selects
the
account for which a deposit is going to be made and enters an amount in dollar currency.
The system creates a record of the transaction. (See Figure) This usecase extends the bank
ATM transaction
1. Request use case.
account type.Here are the steps:
2. Request deposit amount.
3. Enter deposit amount.
4. Put the check or cash in the envelope and insert it into ATM.
• Usecase name: Deposit savings. The client selects the savings account for
which a deposit is going to be made. All other steps are similar to the deposit amount
use case. The system creates a record of the transaction. This use case extends the
deposit amount use case. (See Figure 6-11.)
17
• Usecase name: Withdraw checking. The client tries to withdraw an amount from his or
her checking account. If the amount is more than the checking account's balance, the
insufficient amount is withdrawn from the related savings account. The system creates a
record of the transaction and the withdrawal is successful. This use case extends the
withdraw checking use case and uses the withdraw savings use case. (See Figure)
• Usecase name: Withdraw savings. The client tries to withdraw an amount from a
savings account. The amount is less than or equal to the balance and the transaction is
performed on the savings account. The system creates a record of the transaction since
the withdrawal is successful. This use case extends the withdraw amount use case.
• Usecase name: Withdraw savings denied. The client withdraws an amount from a
savings account. If the amount is more than the balance, the transaction is halted and
a
message is displayed. The savings account use-cases package. This use case extends the
bank transaction use case. (See Figure 3.10))
• Usecase name: Savings transaction history. The bank client requests a history of
transactions for a savings account. The system displays the transaction history for the
savings account. This use case extends the bank transaction use case. (See Figure)
The use-case list contains at least one scenario of each significantly different kind of use-
case instance. Each scenario shows a different sequence of interactions between actors and
the system, with all decisions definite. If the scenario consists of an if statement, for each
condition create one scenario.
18
OBJECT ANALYSIS: CLASSIFICATION
Classes are an important mechanism for classifying objects. The chief role of
class is to define the attributes, methods, and applicability of its instances. The class car,
for example, defines the property color. Each individual car (formally, each instance of the
class car) will have a value for this property, such as maroon, yellow, or white. It is early
natural to partition the world into objects that have properties (attributes)and methods
(behaviors). It is common and useful partitioning or classification, but we also routinely
divide the world along a second dimension: We distinguish classes from instances.
A class is a specification of structure, behavior, and the description of an
object. Classification is concerned more with identifying the class of an object than the
individual objects within a system.
The problem of classification may be regarded as one of discriminating things,not
between the individual objects but between classes, via the search for features or invariant
attributes or behaviors among members of a class.
Classification can be defined as the categorization of input data (things) into
identifiable classes via the extraction of significant features of attributes of the data from
a background of irrelevant detail.
Another issue in relationships among classes is studied.
19
3.9 APPROACHES FOR IDENTIFYING CLASSES
The first two approaches have been included to increase your understanding of the
subject; the unified approach uses the use-case driven approach for identifying classes and
understanding the behavior of objects. However, you always can combine these approaches
to identify classes for a given problem.
Another approach that can be used for identifying classes is Classes,
Responsibilities, and Collaborators (CRC) developed by Cunningham, Wilkerson, and
Beck.
Classes, responsibilities, and Collaborators, more technique than method, is used
for identifying classes responsibilities and therefore their attributes and methods.
Fig. 3.11. Using the noun phrase strategy, candidate classes can be divided into 3categories.
20
• All classes must make sense in the application domain; avoid computer
implementation classes-defer them to the design stage.
• Carefully choose and define class names.
The following guidelines help in selecting candidate classes from the relevant and
fuzzy categories of classes in the problem domain.
• Redundant classes. Do not keep two classes that express the same information. If
more than one word is being used to describe the same idea, select the one thatis
the most meaningful in the context of the system. This is part of building a common
vocabulary for the system as a whole. Choose your vocabulary carefully; use the
word that is being used by the user of the system.
• Adjectives classes. Adjectives can be used in many ways. An adjective can suggest
a different kind of object, different use of the same object, or it could be utterly
irrelevant. Does the object represented by the noun behave differently when the
adjective is applied to it? If the use of the adjective signals that the behavior of the
object is different, then make a new class”. For example, Adult Members behave
differently than Youth Members, so, the two should be classified as different
classes.
• Attribute classes. Tentative objects that are used only as values should be defined
or restated as attributes and not as a class. For example, Client Status and
Demographic of Client are not classes but attributes of the Client class.
• Irrelevant classes. Each class must have a purpose and every class should be
clearly defined and necessary. You must formulate a statement of purpose for each
candidate class. If you cannot come up with a statement of purpose, simply
eliminate the candidate class.
21
Fig. 3.12. The process of eliminating the redundant classes and refining the remaining classes
is not sequential. You can move back and forth among these steps as often as you like.
Example: The ViaNet Bank ATM System: Identifying Classes by Using Noun
Phrase Approach
To better understand the noun phrase method, we will go through a case and apply
the noun phrase strategy for identifying the classes.
Initial List of Noun Phrases: Candidate Classes
The initial study of the use cases of the bank system produces the following
noun phrases (candidate classes-maybe).
Account Balance
AmountApproval
Process ATM
Card
ATM Machine
Bank
Bank Client
Card
Cash
Check
Checking
Checking Account
Client
Client's Account
Currency Dollar
Envelope
Four Digits
Fund
22
Invalid PIN
Message
Money
Password
PIN
PIN Code
Record
Savings
Savings Account
Step.
System Transaction
History
It is safe to eliminate the irrelevant classes. The candidate classes must be selected
from relevant and fuzzy classes. The following irrelevant classes can be eliminated
because they do not belong to the problem statement: Envelope, Four Digits, and Step.
Strikeouts indicate eliminated classes.
Account Balance
AmountApproval
Process ATM
Card
ATM Machine
Bank
BankClient
Card
Cash
Check
Checking
Checking Account
Client
Client's Account
Currency Dollar
Envelope
Four Digits
Fund
Invalid PIN
Message
Money,
Password
PIN
PIN Code
Record
Savings
Savings Account
23
Step
System Transaction
- Transaction
History
We need to review the candidate list to see which classes are redundant. Ifdifferent
words are being used to describe the same idea, we must select the one that isthe most
meaningful the context of the system and eliminate the others. The following are the
different class names that are being used to refer to the same concept:
24
PIN Code
Record
Savings
Savings Account
Step
System
Transaction
Transaction History
We again review the remaining list, now with an eye on classes with adjectives.
The main question is this: Does the object represented by the noun behave differently when
the adjective is applied to it? If an adjective suggests a different kind of class or the class
represented by the noun behaves differently when the adjective is applied to it, then we
need to make a new class. However (it is a different use of the same object or the classis
irrelevant, we must eliminate it) In this example, we have no classes containingadjectives
that we can eliminate.
The next review focuses on identifying the noun phrases that are attributes, not classes.
The noun phrases used only as values should be restated as attributes. This process also
will help us identify the attributes of the classes in the system.
Amount: a value, not a class.
Account Balance: An attribute of the Account class.
Invalid PIN: It is only a value, not a class.
Password: An attribute, possibly of the BankClient class.
Transaction History: An attribute, possibly of the Transaction class.
PIN: An attribute, possibly of the BankClientclass.
Here is the revised list of candidate classes. Notice that the eliminated classes are
strikeouts (they have a line through them).
Account Account
Balance Amount
Approval Process
ATM Card
Bank
BankClient
Cash
Card
Check
Checking
Checking Account
Currency
Dollar
25
Envelope
Fund digits
Fund
Message
MaBey
PIN
PIN Code
Record
Savings Account
System
stepTransa
ction
Transaction History
Identifying the classes that play a role in achieving system goals and requirements
is a major activity of object-oriented analysis) Each class must have a purpose. Every class
should be clearly defined and necessary in the context of achieving the system's goals. If
you cannot formulate a statement of purpose for a class, simply eliminate it. The classes
that add no purpose to the system have been deleted from the list. The candidate classes
are these:
• ATM Machine class: Provides an interface to the ViaNet bank.
ATMCard class: Provides a client with a key to an account.
• BankClient class: A client is an individual that has a checking account and,possibly,
a savings account.
• Bank class: Bank clients belong to the Bank. It is a repository of accounts and
processes the accounts' transactions.
• Account class: An Account class is a formal (or abstract) class, it defines the
common behaviors that can be inherited by more specific classes such as
CheckingAccount and SavingsAccount.
• CheckingAccount class: It models a client's checking account and provides more
specialized withdrawal service.
• savingsAccount class: It models a client's savings account.
• Transaction class: Keeps track of transaction, time, date, type, amount, and
'balance.
The second method for identifying classes is using common class patterns, which is
based on a knowledge base of the common classes that have been proposed by various
researchers, such as Shlaer and Mellor [10], Ross[8], and Coad and Yourdon [3].
They have compiled and listed the following patterns for finding the candidate class and
object :
26
• Name.Concept class
• Name.Events class
Context: Events classes are points in time that must be recorded. Things
happen, usually to something else at a given date and time or as a step in an ordered
sequence. Associated with things remembered are attributes (after all, the things to
remember are objects) such as who, what, when, where, how, or why.
Example. Landing, interrupt, request, and order are possible events.
• Name. People class (also known as person, roles, and roles played class)
Context. The people class represents the different roles users play in interacting
with the application. People carry out some function. What roles does a personplay in the
system? Coad and Yourdon [3] explain that a class which is represented by a person can be
divided into two types: those representing users of the system, such as an operator or clerk
who interacts with the system; and those representing people who donot use the system but
about whom information is kept by the system.
Example. Employee, client, teacher, and manager are examples of people.
Context. Places are physical locations that the system must keep information about.
Example. Buildings, stores, sites, and offices are examples of places.
Context. This class includes physical objects or groups of objects that are tangible
and devices with which the application interacts.
27
Example. Cars are an example of tangible things, and pressure sensors are an
example of devices.
i) Implementation Of Scenarios
The UML specification recommends that at least one scenario be prepared for each
significantly different use-case instance. Each scenario shows a different sequenceof
interaction between actors and the system, with all decisions definite. In essence, this
process helps us to understand the behavior of the system's objects.
When you have arrived at the lowest use-case level, you may create a child
sequence diagram or accompanying collaboration diagram for the use case. With the
sequence and collaboration diagrams, you can model the implementation of the scenario.
Like use-case diagrams, sequence diagrams are used to model scenarios in the
systems. Whereas use cases and the steps or textual descriptions that define them offer a
high-level view of a system, the sequence diagram enables you to model a more specific
analysis and also assists in the design of the system by modeling the interactions between
objects in the system.
As explained in a sequence diagram, the objects involved are drawn on thediagram
as a vertical dashed line, with the name of the objects at the top. Horizontal lines
corresponding to the events that occur between objects are drawn between the vertical
object lines. The event lines are drawn in sequential order, from the top of the diagram to
the bottom. They do not necessarily correspond to the steps defined for a usecase scenario.
28
CASE STUDY: THE VIANET BANK ATM SYSTEM: DECOMPOSING
You can draw sequence diagrams to model each scenario that exists when a
BankClient withdraws, deposits, or needs information on an account. By walking through
the steps, you can determine what objects are necessary for those steps to take place.
Therefore, the process of creating sequence or collaboration diagrams can assist you in
Identifying Classes or objects of the system. This approach can be combined with noun
phrase and class categorization for the best results. We identified the use cases for the bank
system. The following are the low level (executable) use cases:
Deposit Checking
Deposit Savings
Invalid PIN
Withdraw Checking
Withdraw More fromChecking
Withdraw Savings
Withdraw Savings Denied
Checking Transaction History
Savings Transaction History
29
Sequence/collaboration diagrams are associated with a use case. For example, to model
the sequence/collaboration diagrams in SA/Object, you must first select a use case, such as the
Invalid PIN use case, then associate a sequence or collaboration child process.
To create a sequence, you must think about the classes that probably will be
involved in a use-case scenario. Keep in mind that use case refers to a process, not a
class. However, a use case can contain many classes, and the same class can occur in many
different use cases. Point of caution: you should defer the interfaces classes to the design
phase and concentrate on the identifying business classes here. Consider how we would
prepare a sequence diagram for the Invalid PIN use case. Here, we need to think about the
sequence of activities that the actor BankClient performs:
• Insert ATM Card.
• Enter PIN number.
• Remove the ATM Card.
Based on these activities, the system should either grant the access right to the
account or reject the card. Next, we need to more explicitly define the system. With what
are we interacting? We are interacting with an ATMMachine and the BankClient. So, the
other objects of this use case are ATMMachine and BankClient.
Now that we have identified the objects involved in the use case, we need to list
them in a line along the top of a and drop dotted lines beneath each object (see Figure 3.13).
The client in this case is whoever tries to access an account through the ATM, and may or
may not have an account. The BankClient on the other hand has an account.
Fig. 3.13. The sequence diagram for the INVALID PIN use case
30
The dotted lines are the lifelines. The line on the right represents an actor, in this
case the BankClient, or an event that is outside the system boundary. An event arrow
connects objects. In effect, the event arrow suggests that a message is moving between
those two objects. An example of an event message is the request for a PIN. An event
line can pass over an object without stopping at that object. Each event must ha"\'e'a
descriptive name. In some cases, several objects are active simultaneously, even if they are
only waiting for another object to return information to them. In other cases, an object
becomes active when it receives a message and then becomes inactive as soon as it
responds. Similarly, we can develop sequence diagrams for other use cases (as in Figures
3.14 and 3.16). Collaboration diagrams are just another view of the sequence diagrams and
therefore can be created automatically; most UML modeling tools automatically create
them (see Figures 3.15)
The following classes have been identified by modeling the UML sequence /
collaboration diagrams: Bank, BankClient, ATMMachine, Account, Checking Account,
and Savings Account. Similarly other classes can be identified by developing the remaining
sequence/ collaboration diagrams.
Fig. 3.14. Sequence Diagram for the Withdraw Checking use case
31
31
3.13 CLASSES, RESPONSIBILITIES, AND COLLABORATORS
(CRC) APPROACH
32
i) Classes, Responsibilities, And Collaborators Process
Classes are identified and grouped by common attributes, which also provides
candidates for super classes. The class names then are written onto Classes,
Responsibilities, and Collaborators cards. The card also notes sub- and super classes to
show the class structure. The application's requirements then are examined for actions and
information associated with each class to find the responsibilities of each class.
Next, the responsibilities are distributed; they should be as general as possible and
placed as high as possible in the inheritance hierarchy. The idea in locating collaborators
is to identify how classes interact. Classes (cards) that have a close collaboration are
grouped together physically.
CASE STUDY: The ViaNet Bank ATM System: Identifying Classes by Using
Classes, Responsibilities, and Collaborators
We already identified the initial classes of the bank system. The objective of this
example is to identify objects' responsibilities such as attributes and methods in that system.
Account and Transaction provide the banking model. Note that Transaction assumes an
active role while money is being dispensed and a passive role thereafter. The class Account
is responsible mostly to the BankClient class and it collaborates with several objects to
fulfill its responsibilities. Among the responsibilities of the Account class to the BankClient
class is to keep track of the BankClient balance, account number, and other data that need
to be remembered. These are the attributes of the Account class. Furthermore, the Account
class provides certain services or methods, such as means for
33
BankClient to deposit or withdraw an amount and display the account's Balance (see
Figure 3.18).
Fig. 3.19. Classes, Responsibilities and Collaborators for the Account Object.
• By the convention, the class name must begin with an upper-case letter.
• For compound words, capitalize the first letter of each word - for example,
Loan Window.
34
IDENTIFYING OBJECT, RELATIONSHIPS, ATTRIBUTES, &
METHODS
35
i) Identifying Associations
Answering these questions helps us identify association. The approach you should
take to identify association is flexibility. First, extract all candidates' associations from
the problem statement and get them down on paper.
The Following are general guidelines for identifying the tentative associations:
• A dependency between two or more classes may be an association. Association
often corresponds to a verb or prepositional phrase, such as part of, next to, works
for, or contained in.
• A reference from one class to another is an association. Some associations are
implicit or taken from general knowledge.
The common association patterns are based on some of the common associations
defined by researchers and practioners: Rumbaugh et al. Coad and Yourdon, and others.
These include.Location association - -next to, part of, contained in. For example,
consider a soup object, cheddar cheese is a-part-of soup. The a-part-of relation is a special
type of association.
Communication association –talk to, order to. For example, a customer places an
order (communication association) with an operator person (see Figure 3.20).
custome
r
36
operator person.
These association patterns and similar ones can be stored in the repository and
added to as more patterns are discovered.
Fig. 3.22. Grandparent of Ken can be defined in terms of the parent association.
Fig. 3.23. One way of achieving the benefits of multiple inheritance from the most
appropriate class.
38
3.17 A PART OF RELATIONSHIPS-AGGREGATION
Fig. 3.24. A-part-of composition. A carburetor is a part of an engine and an engine and a
radio are parts of a car.
39
Fig. 3.24. A house is a container
To identify a-part-of structures, Coad and Yourdon provide the following guidelines:
• Assembly. An assembly is constructed from its parts and an assembly- part
situation physically exists; for example, a French onion soup is an assembly of onion,
butter, flour, wine, French bread, cheddar cheese, and so on.
• One class diagram for the system, which shows the identity and definition of
classes in the system, their interrelationships, and various packages containing
groupings of classes.
Fig 3.26. UML class diagram for the ViaNet bank ATM system. Some CASE tools such as the SA/Object Architect can automatically
define classes and draw them from use cases or collaboration/ sequence diagrams. However, presently, it cannot identifyall the classes.
For this example, S/A Object was able to identify only the BankClient class.
41
Fig. 3.27. Defining the BankClient-Account association multiplicity. One Client can have
one or more Accounts (checking and savings accounts).
The first obvious relation is that each account belongs to a bank client since each
BankClient has an account. Therefore, there is an association between the BankClient and
Account classes. We need to establish cardinality among these classes.
By default, in most CASE tools such as SNObject Architect, all associations are
considered one to one (one client can have only one account and vice versa). However,
since each BankClient can have one or two accounts we need to change the cardinality of
the association (see Figure 3.27). Other associations and their cardinalities are defined in
Table 8-1 and demonstrated in Figure 3.28.
Table 8.1
Fig. 3.28. Associations among the ViaNet bank ATM system classes.
42
4) Defining Super-Sub Relationships
43
Fig 8.30. Association, generalization, and aggregation among the ViaNet bank classes. Notice that the super-sub arrows
for CheckingAccount and SavingsAccount have merged. The relationship between BankClient and ATMMachine is an
interface.
Identifying attributes and methods is like finding Classes, still a difficult activity and an
iterative process.
Responsibilities identify problems to be solved.
Attributes are things an object must remember such as color, cost and manufacturer.
Identifying attributes of a system’s classes starts with understanding the system’ s
responsibilities.
The following questions help in identifying the responsibilities of classes and deciding
what data elements to keep track of:
# What information about an object should we keep track of?
# What services must a class provide?
44
3.19CLASS RESPONSIBILITY: DEFING ATTRIBUTES BY ANALYZING USE
CASES AND OTHER UML DIAGRAMS
Attributes can be derived from scenario testing; therefore, by analyzing the use
cases and sequence/collaboration, activity and state diagrams, you can begin to understand
classes responsibilities and how they must interact to perform their tasks.
The main goal is to understand what the class is responsible for knowledge.
Responsibility is the issue.
What kind of questions what kind of question would you like ask;
• How am I going to be used?
• How am I going to collaborate with other classes?
• How am I described in the context of this system’s responsibility?
Objects not only describe abstract data but also must provide some services.
Methods and messages are the workhorses of object-oriented systems.
In an object-oriented environment, every piece of data or object is surrounded by a
rich set of routines called methods.
These methods do everything from printing the object to initializing its variables.
Every class is responsible for storing certain information from the domain
knowledge. It also is logical to assign the responsibility for performing any operation
necessary on that information.
Operations (methods or Behavior) in the o-o-system usually correspond to queries
about attributes.
Methods are responsible for managing the value of attributes such as query,
updating, reading and writing;
45
CASE STUDY : DEFINING ATTRIBUTES FOR VIANET BANK OBJETCTS.
Similarly, what information does the system need to know about an account? Based on
the ATM Usecase diagram, Sequence/Collaboration diagram and activity diagram,
BankClient can interact with its account by entering the account number and they could
deposit money, get an account history, or get the balance. Therefore, we have defined
the following attributes for the Account Class: number, balance.
We know that, in a sequence diagram, the objects involved are drawn on the
diagram as vertical dashed lines. Furthermore, the events that occur between objects are
drawn between the vertical object lines. An Event is considered tobe an action that
transmits information.
For example, to define methods for the Account class, we look at sequencediagrams
for the following use cases.
Deposit Checking
Deposit Savings
Withdraw Checking
Withdraw More from
Checking Withdraw Savings
Withdraw Savings Denied
Checking Transaction History
Savings Transaction History
46
CASE STUDY: DEFINING METHODS BY BANK OBJECTS
Operations (methods or behavior) in the object-oriented system usually correspond
to events or actions that transmit information in the sequence diagram or queries about
attributes of the objects. In other words, methods are responsible for managing the value
for attributes such as query, updating, reading and writing.
The services added to the Account class are those that apply to all subclasses of
Account; namely, CheckingAccount and SavingsAccount. The subclass will either inherit
these generic services without charge or enhance them to suit their own needs.
47
UNIT IV
OBJECT ORIENTED DESIGN
4.1 OO Design Process
3
Design Axioms
• Axiom 1 deals with relationships between system components (such as classes,
requirements, software components).
• Axiom 2 deals with the complexity of design.
Axioms
Axiom 1. The independence axiom. Maintain the independence of components.
Axiom 2. The information axiom. Minimize the information content of the design.
Occam's Razor
The best theory explains the known facts with a minimum amount of complexity and maximum
simplicity and straightforwardness.
Corollaries
• Corollary 1. Uncoupled design with less information content.
• Corollary 2. Single purpose. Each class must have single, clearly defined purpose. Corollary 3.
• Large number of simple classes. Keeping the classes simple allows reusability. Corollary 4.
• Strong mapping. There must be a strong association between the analysis's object and design's
object.
• Corollary 5. Standardization. Promote standardization by designing
interchangeable components and reusing existing classes or components.
• Corollary 6. Design with inheritance. Common behavior (methods) must be moved to super
classes.
• The superclass-subclass structure must make logical sense.
4
Designing With Inheritance
Fig 4.3. The single inheritance design modified to allow licensing food trucks.
5
Avoid Inheriting Inappropriate Behaviors
You should ask the following questions:
I. Is the subclass fundamentally similar to its superclass? or,
II. Is it entirely a new thing that simply wants to borrow some expertise from its superclass?
Classes
In analysis modeling only the following needs to be shown:
Class name;
key attributes;
key operations
stereotypes (if they have any business significance)
Name compartment
• Class name is in UpperCamelcase
• Special symbols such as punctuation marks, dashes, underscores,
ampersands, hashes, and slashes are always avoided and can lead to unexpected consequences
when code or Html/Xml documentation is generated from the model.
• Avoid abbreviations at all costs
• Domain specific acronyms can be used (e.g. CRM-Customer
Relationship Management)
Attribute Component
Attributes are named in lowerCamelCase-Starting with a lowercase letter and then mixed upper-and
lowercase.
visibilityname:type[multiplicity]=initialValue
Visibility
Visibility controls access to the features of a class.
+ ->Public visibility
- ->Private visibility
# ->protected visibility
~ -> package visibility
6
Object Construction and destruction
• Constructors are a design consideration and are generally not shown on analysis models.
Destructors
• Destructors are special operations that “clean up” when objects are destroyed.
• Different languages follow different algorithms for clean-up.
• In java “Garbage Collection”
Class Visibility
• In designing methods or attributes for classes, you are confronted with two issues.
o One is the protocol, or interface to the class operations and its visibility;
o and how it should be implemented.
• Public protocols define the functionality and external messages of an object, while private
protocols define the implementation of an object.
Sub class
Fig 4.5. Class Visibility
Access Layer
Introduction
A database management system (DBMS) is a collection of related data and associated programs that
access, manipulate, protect and manage data.
Persistence (review)
Persistence is defined as objects that outlive the programs which created them.
• Persistent object stores do not support query or interactive user interface facilities, as found
in a fully supported DBMS or OODBMS.
8
Object Storage and Persistence
Atkinson et al. describe six broad categories for the lifetime of data:
1. Transient results to the evaluation of expressions.
2. Variables involved in procedure activation (parameters and variables with a localized scope).
3. Global variables and variables that are dynamically allocated.
4. Data that exist between the executions of a program.
5. Data that exist between the versions of a program.
6. Data that outlive a program.
Database Models
A database model is a collection of logical constructs used to represent the data structure and data
relationships within the database.
• Hierarchical Model
• Network Model
• Relational Model
Hierarchical model
The hierarchical model represents data as a single-rooted tree
Network model
A network database model is similar to a hierarchical database, with one distinction.
Unlike the hierarchical model, a network model's record can have more than one parent.
9
Relational Model
Of all the database models, the relational model has the simplest, most uniform
structure and is the most commercially widespread.
Shareability
• Data in the database often needs to be accessed and shared by different applications.
• The database then must detect and mediate the conflicts and promote the greatest amount of
sharing possible without sacrificing the integrity of data.
Transaction
• A transaction is a unit of change, in which either all changes to objects within a transaction
will be applied or not at all.
• A transaction is said to commit if all changes can be successfully made to the database and to
abort if all changes cannot be successfully made to the database.
10
Concurrency Control
• Programs will attempt to read and write the same pieces of information simultaneously and,
in doing so, create a contention for data.
• The concurrency control mechanism is thus established to mediate these conflicts.
• It does so by making policies that dictate how read and write conflicts will be handled.
• The most conservative way is to allow a user to lock all records or objects when they are
accessed and to release the locks only after a transaction commits.
• By distinguishing between reading the data, and writing it (which is achieved by qualifying
the type of lock placed in the data-read lock or write lock) somewhat greater concurrency can
be achieved.
• This policy allows many readers of a record or an objective, but only one writer.
Distributed Databases
In distributed databases portions of the database reside on different nodes (computers) in the network.
Client/Server Computing
Client/server computing allows objects to be executed in different memory spaces or even different
machines. The calling module becomes the "client" (which requests a service), and the called module
becomes the "server" (which provides the service).
A Two-Tier Architecture
• A two-tier architecture is one where a client talks directly to a server, with no intervening server.
• This type of architecture is typically used in small environments with less than 50 users.
11
A Three-Tier Architecture
• A three-tier architecture introduces another server (or an "agent") between the client and the
server.
• The role of the agent is many fold.
• It can provide translation services as in adapting a legacy application on a mainframe to a
client/server environment.
Distributed Processing
• Distributed processing implies that processing will occur on more than one processor in order for
a transaction to be completed.
12
For example, in processing an order from our client, the client information may process at one
machine and the account information will then be processed next on a different machine.
Cooperative processing
Cooperative processing is a form of distributed computing where two or more distinct processes are
required to complete a single business transaction.
Client/Server Components
1. User Interface Layer: This is one of the major components of the client/server application. It
interacts with users, screens, Windows, Window management, keyboard, and mouse handling.
2. Business Processing Layer: This is a part of the application that uses the user interface data to
perform business tasks.
3. Database Processing Layer: This is a part of the application code that manipulates data within
the application.
13
First, the rules that make it an object-oriented system are as follows:
1. The system must support complex objects.
2. Object identity must be supported.
3. Objects must be encapsulated.
4. The system must support types or classes.
5. The system must support inheritance.
6. The system must avoid premature binding.
7. The system must be computationally complete.
8. The system must be extensible.
Second, these rules make it a DBMS:
9. It must be persistent, able to remember an object state.
10. It must be able to manage very large databases.
11. It must accept concurrent users.
12. It must be able to recover from hardware and software failures.
13. Data query must be simple.
Table-Class Mapping
• Each row in the table represents an object instance and each column in the table
corresponds to an object attribute.
Multidatabase System
A different approach for integrating object-oriented applications with relational data environments is
multidatabase systems, or heterogeneous database systems, which facilitate the integration of
heterogeneous databases and other information sources.
MDBS
A multidatabase system (MDBS) is a database system that resides on top of, say existing relational
and object databases and file systems (called local database systems) and presents a single database
illusion to its users.
Characteristics of MDBS
• Automatic generation of a unified global database schema from local databases.
• Provision of cross-database functionality (global queries, updates, and transactions) by using
unified schemata.
• Integration of a heterogeneous database system with multiple databases.
• Integration of data types other than relational data through the use of such tools as driver
generators.
• Provision of a uniform but diverse set of interfaces (e.g., a SQL-style interface, browsing tools,
and C++) to access and manipulate data stored in local databases.
Process
The access layer design process consists of these following activities:
If a class interacts with a nonhuman actor, such as another system, database or the web
1. For every business class identified, mirror the business class package.
2. Define relationships. The same rule as applies among business class objects also applies
among access classes.
3. Simplify classes and relationships. The main goal here is to eliminate redundant or
unnecessary classes or structures.
3.1. Redundant classes. If you have more than one class that provides similar services,
simply select one and eliminate the other(s).
3.2. Method classes. Revisit the classes that consist of only one or two methods to see if
they can be eliminated or combined with existing classes.
4. Iterate and refine.
Another approach is to let the methods be stored in a program (ex: A compiled c++ program
stored on a file)
1. For every business class identified, determine if the class has persistent data.
2. Mirror the business class package.
3. Define relationships. The same rule as applies among business class objects also applies
among access classes.
4. Simplify classes and relationships. The main goal here is to eliminate redundant or
unnecessary classes or structures.
4.1. Redundant classes. If you have more than one class that provides similar services,
simply select one and eliminate the other(s).
4.2. Method classes. Revisit the classes that consist of only one or two methods to see if
they can be eliminated or combined with existing classes.
5. Iterate and refine
UI Design Rules
• Rule 1- Making the Interface Simple
• Rule 2- Making the Interface Transparent and Natural
• Rule 3- Allowing Users to Be in Control of the Software
UI Design Rule 1
• Making the interface simple: application of corollary 2.
• Keep It Simple.
• Simplicity is different from being simplistic.
• Making something simple requires a good deal of work and code.
• Every additional feature potentially affects performance, complexity, stability, maintenance,
and support costs of an application.
• A design problem is harder to fix after the release of a product because users may adapt, or
even become dependent on, a peculiarity in the design.
UI Design Rule 2
• Making the interface transparent and Natural: application of corollary 4.
• Corollary 4 implies that there should be strong mapping between the user's view of doing
things and UI classes.
17
Making The Interface Natural
• The user interface should be intuitive so users can anticipate what to do next by applying their
previous knowledge of doing tasks without a computer.
Using Metaphors
• Metaphore, relates two unrelated things by using one to denote the other
• Metaphors can assist the users to transfer their previous knowledge from their work
environment to your application interface.
• For example, question mark to label a Help button.
UI Design Rule 3
• Allowing users to be in control of the software: application of corollary 1.
• Users should always feel in control of the software, rather than feeling controlled by the
software.
Allowing Users Control of the Software
• Some of the ways to put users in control are:
– Making the interface forgiving.
– Making the interface visual.
– Providing immediate feedback.
– Making the interface consistent.
Making the Interface Forgiving
• Users should be able to back up or undo their previous action.
• They should be able to explore without fear of causing an irreversible mistake.
18
Fig 4.13. Designing Data Entry Windows
• Orient the controls in the dialog box in the direction people read.
• Usually left to right, top to bottom.
• Required information should be put toward the top and left side of the form, entering
optional or seldom entered information toward the bottom.
19
Guidelines for the Command Buttons Layout
• Arrange the command buttons either along the upper-right border of the form or dialog box
or lined up across the bottom.
• Positioning buttons on the left or centre is popular in Web interfaces.
20
Guidelines For Using Fonts
• Use commonly installed fonts, not specialized fonts that users might not have on their
machines.
• Use bold for control labels so they will remain legible when the object is dimmed.
• Use fonts consistently within each form and among all forms in your application.
• For example, the fonts for check box controls should be the same throughout.
• Consistency is reassuring to users, and psychologically makes users feel in control.
• Using too many font styles, sizes and colors can be visually distracting and should be avoided.
21
OBJECT ORIENTED ANALYSIS AND DESIGN
COURSE OBJECTIVES:
➢ To Understand the fundamentals of Object-Oriented System Development
➢ To understand the object-oriented methodologies.
➢ To use UML in requirements elicitation and designing.
➢ To understand concepts of relationships and aggregations.
➢ To test the software against its requirements specification
UNIT I - INTRODUCTION
Overview of object-oriented language systems development – Object basics hierarchy – Object and
identity –Static and dynamic binding – Object oriented SDLC.
COURSE OUTCOMES
CO1 - Understand the basics object model for System development.
CO2 - Understand the object-Oriented Methodologies
CO3 - Express software design with UML diagrams
CO4 - Understand the concept of Relationships
CO5 - Design software applications using OO concepts.
CO6 -Understand the various testing methodologies for OO software
2
UNIT V
SOFTWARE QUALITY
Software quality assurance – Testing strategies – Test cases – Test plan – Myers debugging principle
– System usability and measuring user satisfaction.
3
down testing, and bottom-up testing. However, no strategy or combination of strategies truly can
prove the correctness of a system; it can establish only its "acceptability."
4
Top-Down Testing
Top-down testing assumes that the main logic or object interactions and systems messages of
the application need more testing than an individual object's methods or supporting logic. A top-down
strategy can detect the serious design flaws early in the implementation.
Bottom-Up Testing
Bottom-up testing starts with the details of the system and proceeds to higher levels by a
progressive aggregation of details until they collectively fit the requirements for the system. This
approach is more appropriate for testing the individual objects in a system. Here, you test each object,
then combine them and test their interaction and the messages passed among objects by utilizing the
top-down approach.
In bottom-up testing, you start with the methods and classes that call or rely on no others. You
test them thoroughly. Then you progress to the next level up: those methods and classes that use only
the bottom level ones already tested. Next, you test combinations of the bottom two layers. Proceed
until you are testing the entire program. This strategy makes sense because you are checking the
behavior of a piece of code before it is used by another. Bottom-up testing leads to integration testing,
which leads to systems testing.
6
satisfaction, or quality assurance tests. It should state the test objectives and how to meet them. The
test plan need not be very large; in fact, devoting too much time to the plan can be counterproductive.
All passed tests should be repeated with the revised program, called regression testing, which
can discover errors introduced during the debugging process. When sufficient testing is believed to
have been conducted, this fact should be reported, and testing for this specific product is complete.
According to Tamara Thomas, the test planner at Microsoft, a good test plan is one of the
strongest tools you might have. It gives you the chance to be clear with other groups or departments
about what will be tested, how it will be tested, and the intended schedule. Thomas explains that,
with a good, clear test plan, you can assign testing features to other people in an efficient manner.
You then can use the plan to track what has been tested, who did the testing, and how the testing was
done. You also can use your plan as a checklist, to make sure that you do not forget to test any
features.
Who should do the testing? For a small application, the designer or the design team usually will
develop the test plan and test cases and, in some situations, actually will perform the tests. However,
many organizations have a separate team, such as a quality assurance group, that works closely with
the design team and is responsible for these activities (such as developing the test plans and actually
performing the tests). Most software companies also use beta testing, a popular, inexpensive, and
effective way to test software on a select group of the actual users of the system. This is in contrast
to alpha testing, where testing is done by inhouse testers, such as programmers, software engineers,
and internal users. If you are going to perform beta testing, make sure to include it in your plan, since
it needs to be communicated to your users well in advance of the availability of your application in a
beta version.
The following guidelines have been developed by Thomas for writing test plans :
• You may have requirements that dictate a specific appearance or format for your test plan.
These requirements may be generated by the users. Whatever the appearance of your test plan,
try to include as much detail as possible about the tests. The test plan should contain a
schedule and a list of required resources. List how many people will be needed, when the
testing will be done, and what equipment will be required.
• After you have detained what types of testing are necessary (such as black box, white box,
top-down, or bottom-up testing), you need to document specifically what you are going to do.
Document every type of test you plan to complete.
• The level of detail in your plan may be driven by several factors, such as the following: How
much test time do you have?
7
• Will you use the test plan as a training tool for newer team members?
• A configuration control system provides a way of tracking the changes to the code. At a
minimum, every time the code changes, a record should be kept that tracks which module has
been changed, who changed it, and when it was altered, with a comment about why the change
was made. Without configuration control, you may have difficulty keeping the testing in line
with the changes, since frequent changes may occur without being communicated to the
testers.
A well-thought-out design tends to produce better code and result in more, complete testing, so it
is a good idea to try to keep the plan up to date. Generally, the older a plan gets, the less useful it
becomes. If a test plan is so old that it has become part of the fossil record, it is not terribly useful.
As you approach the end of a project, you will have less time to create plans. If you do not take the
time to document the work that needs to be done, you risk forgetting something in the mad dash to
the finish line. Try to develop a habit of routinely bringing the test plan in sync with the product or
product specification. At the end of each month or as you reach each milestone, take time to complete
routine updates. This will help you avoid being overwhelmed by being so out of- date that you need
to rewrite the whole plan. Keep configuration information on your plan, too. Notes about who made
which updates and when can be very helpful down the road
CASE STUDY: DEVELOPING TEST CASES FOR THE VIANET BANK ATM SYSTEM
We identified the scenarios or use cases for the ViaNet bank ATM system. The ViaNet bank ATM
system has scenarios involving Checking Account, Savings Account, and general Bank Transaction
(see Figures. Here again is a list of the use cases that drive many object-oriented activities, including
the usability testing:. Bank Transaction (see Figure). Checking Transaction History (see Figure ).
.Deposit Checking (see Figure).
.Deposit Savings (see Figure ). .Savings Transaction History (see Figure ). .Withdraw Checking (see
Figure ). .Withdraw Savings (see Figure ). .Valid/Invalid PIN (see Figure).
The activity diagrams and sequence/collaboration diagrams created for these use cases are
used to develop the usability test cases. For example, you can draw activity and sequence diagrams
to model each scenario that exists when a bank client withdraws, deposits, or needs information on
an account. Walking through the steps can assist you in developing a usage test case.
Let us develop a test case for the activities involved in the ATM transaction based on the use
cases identified so far. (See the activity diagram in Figure and the sequence diagram of Figure to
refresh your memory.)
USABILITY TESTING
The International Organization for Standardization (ISO) defines usability as the
effectiveness, efficiency; and satisfaction with which a specified set others can achieve a specified
set of tasks in particular environments. The ISO definition requires. Defining tasks. What are the
tasks? Defining users. Who are the users? A means for measuring effectiveness, efficiency, and
satisfaction. How do we measure usability?
The phrase two sides of the same coin is helpful for describing the relationship between the
usability and functionality of a system. Both are essential for the development of high-quality
software. Usability testing measures the ease of use as well as the degree of comfort and satisfaction
users have with the software. Products with poor usability can be difficult to learn, complicated to
operate, and misused or not used at all. Therefore, low product usability leads to high costs for users
and a bad reputation for the developers. Usability is one of the most crucial factors in the design and
development of a product, especially the user interface. Therefore, usability testing must be a key
part of the UI design process.
Usability testing should begin in the early stages of product development; for example, it can
be used to gather information about how users do their work and find out their tasks, which can
complement use cases. You can incorporate your findings into the usability test plan and test cases.
As the design progresses, usability testing continues to provide valuable input for analyzing initial
design concepts and, in the later stages of product development, can be used to test specific product
tasks, especially the ill.
Usability test cases begin with the identification of use cases that can specify the target
audience, tasks, and test goals. When designing a test, focus on use cases or tasks, not features. Even
if your goal is testing specific features, remember that your users will use them within the context of
particular tasks. It also is a good idea to run a pilot test to work the bugs out of the tasks to be tested
and make certain the task scenarios, prototype, and test equipment work smoothly. Test cases must
include all use cases identified so far. Recall from Previous chapter that the use case can be used
through most activities of software development.
Furthermore, by following Jacobson's life cycle model, you can produce designs that are
traceable across requirements, analysis, design, implementation, and testing. The main advantage is
that all design traces directly back to the user requirements. Use cases and usage scenarios can
become test scenarios; and therefore, the use case will drive the usability, user satisfaction, and
quality assurance test cases (see Figure).
9
Fig. 5.4. Usability Testing
The use cases identified during analysis can be used in testing the design. Once the design is
complete, walk users through the steps of the scenarios to determine if the design enables the
scenarios to occur as planned.
10
the techniques and search patterns users employ when attempting to work through a difficulty and
the number and type of hints you have to provide them.
Ask subjects to think aloud as they work, so you can hear what assumptions and inferences
they are making. As the participants work, record the time they take to perform a task as well as any
problems they encounter. You may want to follow up the session with the user satisfaction test (more
on this in the next section) and a questionnaire that asks the participants to evaluate the product or
tasks they performed.
Record the test results using a portable tape recorder or, better, a video camera. Since even
the best observer can miss details, reviewing the data later will prove invaluable. Recorded data also
allows more direct comparison among multiple participants. It usually is risky to base conclusions
on observing a single subject. Recorded data allows the design team to review and evaluate the
results.
Whenever possible, involve all members of the design team in observing the test and
reviewing the results. This ensures a common reference point and better design solutions as team
members apply their own insights to what they observe. If direct observation is not possible, make
the recorded results available to the entire team. To ensure user satisfaction and therefore high-quality
software, measure user satisfaction along the way as the design takes form. In the next section, we
look at the user satisfaction test, which can be an invaluable tool in developing highquality software.
User 1 2 3 4 5 6 7 8 9
Ease of use 4 7
Functionality 5 4
Cost 1 6
Realiablity 3 4
Periodical plotting can reveal shifts in user satisfaction, which can pinpoint a problem -
Plotting the high and low responses indicates where to go for maximum information (Gause and
Weinberg) finding out what attributes are important or unimportant. An interesting side effect of
developing a user satisfaction test is that you benefit from it even if the test is never administered to
anyone; it still provides useful information. However, performing the test regularly helps to keep the
user involved in the system. It also helps you focus on user wishes. Here is the user satisfaction cycle
that has been suggested by Gause and Weinberg:
12
1. Create a user satisfaction test for your own project. Create a custom form that fits the project's
needs and the culture of your organization. Use cases are a great source of information; however,
make sure to involve the user in creation of the test.
2. Conduct the test regularly and frequently.
3. Read the comments very carefully, especially if they express a strong feeling.
4. Never forget that feelings are facts, the most important facts you have about the users of the
system.
5. Use the information from user satisfaction test, usability test, reactions to prototypes, interviews
recorded, and other comments to improve the product.
Another benefit of the user satisfaction test is that you can continue using it even after the
product is delivered. The results then become a measure of how well users are learning to use the
product and how well it is being maintained. They also provide a starting point for initiating follow-
up projects.
CASE STUDY: DEVELOPING USABILITY TEST PLANS AND TEST CASES FOR THE
VIANET BANK ATM SYSTEM
In previous chapter, we learned that test plans need not be very large; in fact, devoting too
much time to the plans can be counterproductive. Having this in mind let us develop a usability test
plan for the ViaNet ATM kiosk by going through the following steps.
Next, we need to select a small number of test participants (6 to 10) who have never before used the
kiosk and ask them to perform the following scenarios based on the use case:
1. Deposit $1056.65 to your checking account.
2. Withdraw $40 from your checking account.
3. Deposit $200 to your savings account.
4. Withdraw $55 from savings account.
5. Get your savings account transaction history.
6. Get your checking account transaction history.
13
Start by explaining the testing process and equipment to the participants to ease the pressure.
Remember to make participants feel comfortable by emphasizing that you are testing the software,
not them. If they become confused or frustrated, it is no reflection on them but the poor usability of
the system. Make sure to ask them to think aloud as they work, so you can hear what assumptions
and inferences they are making. After all, if they cannot perform these tasks with ease, then the system
is not useful. As the participants work, record the time they take to perform a task as well as any
problems they encounter. In this case, we used the kiosk video...camera to record the test results
along with a tape recorder. This allowed the design team to review and evaluate how the participants
interacted with the user interface, like those developed in Previous chapter. For example, look for
things such as whether they are finding the appropriate buttons easily and the buttons are the right
size. Once the test subjects complete their tasks, conduct a user satisfaction test to measure their level
of satisfaction with the kiosk.
14