What is Analysis and Designthe problem and requirements rather than how a solution is defined solution that system fulfils the requirements rather than its implementation Hoa Sen Uni
Trang 1Object-Oriented Analysis and
Design
with Patterns, Process, and the UML
Introduction
Trang 2 Welcome!
Introduction
– Course leader: Dr Trần Vũ Bình– Participants:
Prerequisites: Object-Oriented Programming
Logistics
Trang 3Overview and Objectives
Learn how to “think in objects”
Requirements and analysis of the problem domain
Trang 5Team Project – Online Enrolment
Your client:
– Hoa Sen University
Your goal:
– Design a system to allow users to select
appropriate course, arrange schedule as
available
curriculum.
Trang 6Project Task
Assignment 1
– Prepare requirement document
– Write use cases
– Develop Domain Model
Assignment 2
– Write Design Document
– Implement the system (desktop version)
– System Demo
Trang 8What is OOAD?
Lecture 1
Trang 9Today’s lecture topic
Object oriented concepts revisited
What’s OOAD?
Functional decomposition and its problem
What’s UML?
Software Development Process
Trang 11What is Analysis and Design
the problem and requirements rather
than how a solution is defined
solution that system fulfils the
requirements rather than its
implementation
Hoa Sen University 11
Trang 12What 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)
describing the objects – or concepts- in
the problem domain
software objects (things, concepts, or
entities) that have attributes and methods
Trang 13Object vs Function Oriented Analysis
Hoa Sen University 13
Library Information System
Trang 14Functional 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
Trang 15Functional 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
Trang 16How 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.
Trang 17A “software like” option
– 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
– 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
Trang 18A “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
Trang 19 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
Hoa Sen University 19
Trang 20Dealing with changing
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
Trang 21Dealing with changing
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
Trang 22Key Steps in OOAD [1]
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.
Trang 23Key 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
Trang 24Key steps in OOAD [3]
Interaction Diagram: shows the flow of messages
between software objects (method invocation)
:DiceGame play()
Trang 25Key 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()
Trang 26Iterative and Evolutionary
Development
Iterative development
– Development is organized into a series of
short, fixed-length mini-projects called
iterations.
– the outcome of each is a tested, integrated,
and executable partial system.
– Known as iterative and incremental
development
Trang 27Iterative and evolutionary
Test & Integration
& More Design
Final Integration
& System Test
Requirements Design
3 weeks (for example)
The system grows incrementally.
Feedback from iteration N leads to refinement and adaptation of the requirements and design in iteration N+1.
Iterations are fixed in
length, or timeboxed.
Time
Implementation &
Test & Integration
& More Design Final Integration
& System Test
Trang 28Handle change on iterative project
Early iterations are farther from the "true
path" of the system Via feedback and
adaptation, the system converges towards
the most appropriate requirements and
design
In late iterations, a significant change in requirements is rare, but can occur Such late changes may give an organization a competitive business advantage
one iteration of design, implement, integrate, and test
Trang 29How long should an iteration be?
Most iterative methods recommend an
iteration length between two and six weeks.
Iteration are timeboxed, or fixed in length
Date slippage is illegal
If it seems difficult to meet the deadline, the
recommended response is to de-scope –
remove tasks or requirements from the
iteration, and include them in a future
iteration
Hoa Sen University 29
Trang 30How to do Iterative and Evolutionary
Analysis and Design?
Iteration 1 Iteration 2 Iteration 3 Iteration 4 Iteration 5
design, UML
start coding &
testing
a 3-week iteration
de-scope iteration goals if too much
final check -in and code- freeze for the iteration
demo and 2-day requirements workshop
next iteration planning meeting;
Trang 31Agile Methods and attitudes
Agile development methods usually apply
timeboxed iterative and evolutionary
development, employ adaptive planning,
promote incremental delivery and include
other values and practices that encourage
agility – rapid, and flexible response to
Trang 32Agile Modelling
Adopting an agile method does not mean
avoiding any modelling
The purpose of modelling and models is
primarily to support understanding and
communication, not documentation
Don’t model or apply the UML to all or
most of the software design
Use the simplest tool possible
Trang 33Agile modelling (cont)
Don’t model alone
Create models in parallel
Use “good enough” simple notation while
sketching with a pen on paper
Developers themselves should do the OO
design modelling, for themselves, not to
create diagrams that are given to other
programmers to implement.
Hoa Sen University 33
Trang 34Layers and textbook case study
primary focus
of case studies explore how to design objects
secondary focus
Trang 35Case study strategy
Hoa Sen University 35
Introduces just those
analysis and design skills
related to iteration one
Additional analysis and design skills introduced
Trang 36 Case one: The NextGen POS
system
– A POS system is a computerized
application used (in part) to record
sales and handle payments
– Hardware: computer, bar code
scanner
– Software
– Interfaces to service applications:
tax calculator, inventory control
Case Two: The Monopoly Game
System