Object-Oriented Analysis and
Object-Oriented Analysis and
Design
Design
with Patterns, Process, and the UML
with Patterns, Process, and the UML
Introduction
Introduction
Introduction
Introduction
Welcome!
Introduction
–
Course leader: Dr. Trần Vũ Bình
–
Participants:
Hồ Thuỵ Hương Thuỷ (Tutor)
Prerequisites: Object-Oriented
Programming
Logistics
Overview and Objectives
Overview and Objectives
Learn how to “think in objects”
Requirements and analysis of the problem
domain
Design of a solution
–
Assign responsibilities to objects
–
Design patterns
–
Architectural issues
–
Java, C# and/or C++ issues
Unified Process
UML
Practice!
Team work
Team work
Software development is a team-oriented
activity…
Two assignments will work around the
same project
You need to work in the same team for
both assignments
Preferred team size: 3-5 students
You can do it by yourself
Form your team as early as possible
Hoa Sen University 4
Team Project – Online Enrolment
Team Project – Online Enrolment
Your client:
–
Hoa Sen University
Your goal:
–
Design a system to allow users to select
appropriate course, arrange schedule as
available
Manage studied/failed courses according to
curriculum.
Manage tuition set per course
Display marks, GPA and report
Taking the system online for student enrolment
Hoa Sen University 5
Project Task
Project Task
Assignment 1
–
Prepare requirement document
–
Write use cases
–
Develop Domain Model
Assignment 2
–
Write Design Document
–
Implement the system (desktop version)
–
System Demo
Hoa Sen University 6
Software
Software
Visual Paradigm 6.3
Rational Rose
–
Installed on the lab PC
Microsoft Visio
Hoa Sen University 7
What is OOAD?
What is OOAD?
Lecture 1
Lecture 1
Hoa Sen University 8
Today’s lecture topic
Today’s lecture topic
Object oriented concepts revisited
What’s OOAD?
Functional decomposition and its problem
What’s UML?
Software Development Process
Hoa Sen University 9
What is Object-Oriented?
What is Object-Oriented?
What is object?
What is class?
What is instance?
What is abstraction?
What is inheritance?
What is polymorphism?
What is encapsulation?
Hoa Sen University 10
What is Analysis and Design
What is Analysis and Design
Analysis emphasizes an investigation of
the problem and requirements rather
than how a solution is defined
Design emphasizes a conceptual
solution that system fulfils the
requirements rather than its
implementation
Hoa Sen University 11
What is O-O A&D?
What is O-O A&D?
The essence of O-O A&D is to consider a
problem domain and logical solution from
the perspective of objects (things,
concepts, or entities)
O-O Analysis emphasizes finding and
describing the objects – or concepts- in
the problem domain
O-O Design emphasizes defining logical
software objects (things, concepts, or
entities) that have attributes and methods
Hoa Sen University 12
Object vs. Function Oriented Analysis
Object vs. Function Oriented Analysis
Hoa Sen University 13
Library
Information
System
Structured A&D
Decompose by functions and processes
OOA&D
Decompose by objects and concepts
Catalogue Librarian
Book Library
Functional Decomposition
Functional Decomposition
A very simple development case
–
You are asked to write code to access a list of
shapes that were stored in a database then
display them
What steps we need to achieve this?
1.Locate the list of shapes in the database
2.Open up the list of shapes
3.Sort the list according to some order
4.Display the individual shapes on the monitor
Hoa Sen University 14
Functional Decomposition
Functional Decomposition
We might breakdown some step further
–
Identify the type of shapes
–
Get the location of the shape
–
Call the appropriate function that will display
the shape, giving it the shape’s location
This is called functional decomposition
because the analyst breaks down
(decomposes) the problem into the
functional steps that compose it.
Hoa Sen University 15
How do people do things
How do people do things
Case:
–
You are an instructor at a seminar. People in
your seminar have another class to attend
following yours, but don’t know where it is
located. One of your responsibilities is to
make sure everyone knows how to get to the
next class.
Hoa Sen University 16
A “software like” option
A “software like” option
Steps:
–
Get list of people in the class
–
For each person on this list,
do the following:
Find the next class he or she
is taking
Find the location of that class
Find the way to get from your
classroom to the persona’s
next class
Tell the person how to get to
his or her next class
Procedures needed:
–
A way of getting the list of
people in the class
–
A way of getting the schedule
for each person in the class
–
A program that gives
someone directions from
your classroom to any other
classroom
–
A control program that works
for each person in the class
and does the required steps
for each person
Hoa Sen University 17
A “human like” option
A “human like” option
What’s the alternatives?
–
Post a directions to go from this classroom to
the other classrooms and tell everyone in the
class
“ I have posted the locations of the other classes
following this in the back of the room, as well as
the locations of the other classrooms. Please use
them to go to your next classroom. ”
–
Assume everyone knows what his or her next
class is
Hoa Sen University 18
Difference?
Difference?
Option 1: giving explicit directions to
everyone – pay attention to lots of details.
You are responsible for everything
Option 2: giving general instructions and then
expect each person will figure out how to do
the task individually
–
Two kinds of objects
Instructor: responsible for posting the instruction
Students: knowing their own next classes, able to follow
the instruction
Key point: Shift of responsibility!
Hoa Sen University 19
Dealing with changing
Dealing with changing
requirements
requirements
Impact
–
What if you need to distinguish postgraduate
students from undergraduate students?
–
Option 1: change the control program a lot
–
Option 2: add an additional routine for
graduate students to follow
The second case can minimize changes
Hoa Sen University 20
Dealing with changing
Dealing with changing
requirements
requirements
What makes it happen?
–
The people are responsible for their own
behaviour
–
The control program can talk to different types
of people as if they were exactly the same
–
The control program does not need to know
about any special steps that students might
need to take when moving from class to class
Hoa Sen University 21
Key Steps in OOAD [1]
Key Steps in OOAD [1]
Hoa Sen University 22
Use Case: a textual description or “story”
describing the system
Play a Dice Game: Player requests to roll
the dice. System presents results: If the
dice face value totals seven, player wins;
otherwise, player loses.
Key steps in OOAD [2]
Key steps in OOAD [2]
a domain model that shows the noteworthy
domain concepts or objects, attributes, and
associations
Hoa Sen University 23
Player
name
DiceGame
Die
faceValue
Rolls
Plays
Includes
2
2
1
1
1
1
Key steps in OOAD [3]
Key steps in OOAD [3]
Interaction Diagram: shows the flow of
messages between software objects (method
invocation)
Hoa Sen University 24
:DiceGame
play()
die1 : Die
fv1 := getFaceValue()
die2 : Die
roll()
roll()
fv2 := getFaceValue()
Key steps in OOAD [4]
Key steps in OOAD [4]
Class Model: shows attributes, methods and
associations for software (solution) objects (not
domain objects!)
Hoa Sen University 25
2
Die
faceValue : int
getFaceValue() : int
roll()
DiceGame
die1 : Die
die2 : Die
play()
1