Java程序辅导

C C++ Java Python Processing编程在线培训 程序编写 软件开发 视频讲解

客服在线QQ:2653320439 微信:ittutor Email:itutor@qq.com
wx: cjtutor
QQ: 2653320439
1Introduction
Course Overview
Lecture 1
Monday July 28, 2008
COMP5028 Object-Oriented Analysis and Design (S2 2008)
Dr. Ying Zhou, School of IT, The University of Sydney 
2
Agenda
„ Administrative
„ Course objective and outline
„ Course Glossary
„ OOAD
„ UML
„ Methodology: Iterative Development
„ Pattern
COMP5028 Object-Oriented Analysis and Design (S2 2008)
Dr. Ying Zhou, School of IT, The University of Sydney 
3
Administrative
„ Instructor
„ Dr. Ying ZHOU (zhouy@it.usyd.edu.au)
„ Office: SIT 437
„ Lectures
„ Monday 6-8 pm Architecture Lecture Theatre 1
„ Labs
„ Monday 8-9 pm SIT 114/115 (start from week 2)
„ Course Website:
„ http://www.cs.usyd.edu.au/~comp5028
„ Also, check the WebCT site of this course
COMP5028 Object-Oriented Analysis and Design (S2 2008)
Dr. Ying Zhou, School of IT, The University of Sydney 
4
Communication Channels
„ Consultation
„Monday 4-5 pm, SIT 437
„ Email: zhouy@it.usyd.edu.au
„ WebCT discussion board
„ All news, notices will be published there
COMP5028 Object-Oriented Analysis and Design (S2 2008)
Dr. Ying Zhou, School of IT, The University of Sydney 
5
Objectives
„ Learn O-O A&D methodology
„ Learn UML (Unified Modeling Language)
„ Learn O-O design patterns/principles
„ Design something that illustrates the 
concepts
And the ultimate goal is…
To write good software
COMP5028 Object-Oriented Analysis and Design (S2 2008)
Dr. Ying Zhou, School of IT, The University of Sydney 
6
Expectations
„ Assumed Knowledge
„ Some experience in Java or other similar OO language
„ Java is the teaching language in this course
„ BEFORE each lecture
„ Download and printout the lecture slides 
„ Read the related chapter (s) and lectures notes
„ Read the tutorial instruction
„ Make sure you keep up with the progress
„ Consult course staff EARLY enough for difficulties and 
problems!
COMP5028 Object-Oriented Analysis and Design (S2 2008)
Dr. Ying Zhou, School of IT, The University of Sydney 
7
Course Outline
„ Two Major parts of the content
„ OOA (4 weeks)
„ Use Case Model, Domain Modeling
„ OOD (7 weeks)
„ Design principles and patterns
„ We will miss one lecture on labour day 
(Monday, 6th of Oct)
COMP5028 Object-Oriented Analysis and Design (S2 2008)
Dr. Ying Zhou, School of IT, The University of Sydney 
8
Assessment Components
„ Four Quizzes (online & in lab) (50%)
„Week 4 (online quiz: 15%)
„Week 6 (lab quiz: 10%)
„Week 9 (online quiz: 15%)
„Week 12 (lab quiz: 10%)
„ Results will be published on webCT two weeks after the due 
date, please check WebCT to make sure that your results are 
correctly recorded. Any discrepancies should be resolved 
within one week after the result being published!
„ Final Exam (50%)
„ Open book, 2 hours
COMP5028 Object-Oriented Analysis and Design (S2 2008)
Dr. Ying Zhou, School of IT, The University of Sydney 
9
Our Textbook
„ Craig Larman, Applying UML 
and Patterns: An Introduction 
to Object-Oriented Analysis 
and Design and Iterative 
Development, 3rd edition, 
Prentice Hall PTR, 2005
„ Detailed Intro to Object-
Oriented Analysis & Design
„ Unified Modeling 
Language (UML)
„ Design Patterns
COMP5028 Object-Oriented Analysis and Design (S2 2008)
Dr. Ying Zhou, School of IT, The University of Sydney 
10
Reference Books
„ Martin Fowler, UML Distilled, 3rd edition, Addison-
Wesley, 2004 
„ Robert C. Martin, Agile Software Development: 
Principles, Patterns and Practices, Prentice Hall, 
2003 
„ Erich Gamma, Richard Helm, Ralph Johnson, John 
Vlissides, Design Patterns, Addison-Wesley, 1995 
„ Allan Shalloway ,James R. Trott Design patterns 
explained: A new perspective on Object-Oriented 
Design, 2nd edition, Addison-Wesley, 2005.
„ Eric Freeman, Elisabeth Freeman, Kathy Sierra and 
Bert Bates, Head First Design Patterns, O'Reilly, 
2004 
COMP5028 Object-Oriented Analysis and Design (S2 2008)
Dr. Ying Zhou, School of IT, The University of Sydney 
11
Software
„ Microsoft Visio 
„ Licensed software
„ Installed on the lab PCs
„ Used for drawing diagrams
„ J2SE 1.5 or above
„ Free download from java.sun.com
„ Used for running sample code
COMP5028 Object-Oriented Analysis and Design (S2 2008)
Dr. Ying Zhou, School of IT, The University of Sydney 
12
Rule of Conducts
„ Okay to discuss ideas and problem approaches
„ All work must be your own creation
„ Plagiarism will not be tolerated under any 
circumstance!
„ What is plagiarism
„ Copying all or part of another student’s work 
(with or without their knowledge)
„ Using another person’s ideas without 
acknowledgement
„ Obtaining material (code or other) from the 
web or a book and passing it off as your own 
13
Questions?
COMP5028 Object-Oriented Analysis and Design (S2 2008)
Dr. Ying Zhou, School of IT, The University of Sydney 
14
What is good software?
„ End Users:
„ Managers:
„ Developers:
COMP5028 Object-Oriented Analysis and Design (S2 2008)
Dr. Ying Zhou, School of IT, The University of Sydney 
15
Today’s lecture topic
„ What is OOAD?
„ Basic OOAD methodology: Iterative 
Development
„ What is UML?
„ What is PATTERN
COMP5028 Object-Oriented Analysis and Design (S2 2008)
Dr. Ying Zhou, School of IT, The University of Sydney 
16
What is Analysis and Design
„ Analysis emphasizes an investigation of the 
problem rather than how a solution is defined
„ Design emphasizes a logical solution, how 
the system fulfills the requirements
COMP5028 Object-Oriented Analysis and Design (S2 2008)
Dr. Ying Zhou, School of IT, The University of Sydney 
17
Analysis and Design (cont)
„ Division between A & D is fuzzy
„ A & D activities exist on a continuum
„ Some practitioners can classify an activity as 
analysis while others put it into design category
More analysis oriented More design oriented
-what
-requirements
-investigation of domain
-understanding of problem
-how
-logical solution
-understanding and  
description of solution
COMP5028 Object-Oriented Analysis and Design (S2 2008)
Dr. Ying Zhou, School of IT, The University of Sydney 
18
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
COMP5028 Object-Oriented Analysis and Design (S2 2008)
Dr. Ying Zhou, School of IT, The University of Sydney 
19
Object vs. Function Oriented Analysis
Library Info 
System
O-O A&D
Decompose by objects and concepts
Structured A&D
Decompose by functions and processes
Catalog Librarian
Book Library
System
Record Loans Add Resource Report Fines
COMP5028 Object-Oriented Analysis and Design (S2 2008)
Dr. Ying Zhou, School of IT, The University of Sydney 
20
Object vs. Function Oriented Analysis
„ Object has good 
encapsulation
„ Every object has a 
public interface and 
private implementation
„ Easy to modify the 
detailed 
implementation
„ Easy to plug in / switch 
component
COMP5028 Object-Oriented Analysis and Design (S2 2008)
Dr. Ying Zhou, School of IT, The University of Sydney 
21
Unified Modeling Language
„ “A language for specifying, visualizing and 
constructing the artifacts of software system”
[Booch, Jacobson, Rumbaugh]
„ It is a notational system aimed at modeling 
systems using O-O concepts
„ Define " boxes", "lines " with specific 
meanings
COMP5028 Object-Oriented Analysis and Design (S2 2008)
Dr. Ying Zhou, School of IT, The University of Sydney 
22
UML diagrams
„ Use case diagram
„ Class diagram
„ Behavior diagrams:
„ statechart diagram
„ activity diagram
„ interaction diagrams:
„ Sequence diagram
„ Collaboration diagram
„ Implementation diagrams:
„ component diagram
„ deployment diagram
COMP5028 Object-Oriented Analysis and Design (S2 2008)
Dr. Ying Zhou, School of IT, The University of Sydney 
23
What is legal UML?
„ Legal UML is what is defined as well formed in the 
specification
„ Prescriptive rules
„ A language with prescriptive rules is controlled by an 
official body that states what is or isn’t legal in the 
language and what meaning you give to utterances in 
that language
„ Descriptive rules
„ A language with descriptive rules is one which you 
understand its rules by looking at how people use the 
language in practice
COMP5028 Object-Oriented Analysis and Design (S2 2008)
Dr. Ying Zhou, School of IT, The University of Sydney 
24
OOA/D Methodology
„ What does methodology mean?
„ Basic steps
„ An overall plan of organizing those steps
„ Rationale and philosophy
COMP5028 Object-Oriented Analysis and Design (S2 2008)
Dr. Ying Zhou, School of IT, The University of Sydney 
25
Key Steps in OOAD – Use Cases
Use Case: a textual description or “story” describing the system
Example:
Play A Dice Game: “A player picks up and rolls the dice.
If the dice face values total seven, they win; otherwise, they lose.”
Define domain
model
Define interaction
diagrams
Define design
class diagramsDefine use cases
COMP5028 Object-Oriented Analysis and Design (S2 2008)
Dr. Ying Zhou, School of IT, The University of Sydney 
26
Key steps in OOAD– Domain Model
Domain Model: diagram(s) showing domain concepts, attributes,
and associations
Example: Player
name
DiceGame
Die
faceValue
Rolls
Plays
Includes
2
2
1
1
1
1
Define domain
model
Define interaction
diagrams
Define design
class diagramsDefine use cases
[Larman05] Figure 1.3, page 9
COMP5028 Object-Oriented Analysis and Design (S2 2008)
Dr. Ying Zhou, School of IT, The University of Sydney 
27
Key steps in OOAD – Interaction diagrams
Interaction Diagram: shows the flow of messages between software
objects (method invocation)
Define domain
model
Define interaction
diagrams
Define design
class diagramsDefine use cases
:DiceGame
play()
die1 : Die
fv1 := getFaceValue()
die2 : Die
roll()
roll()
fv2 := getFaceValue()
Example:
[Larman02] Figure 1.4, page 9
COMP5028 Object-Oriented Analysis and Design (S2 2008)
Dr. Ying Zhou, School of IT, The University of Sydney 
28
Key steps in OOAD-- class diagram
Define domain
model
Define interaction
diagrams
Define design
class diagramsDefine use cases
Class Model: shows attributes, methods and associations
for software (solution) objects (not domain objects!)
2
Die
faceValue : int
getFaceValue() : int
roll()
DiceGame
die1 : Die
die2 : Die
play()
1
Example:
[Larman05] Figure 1.5, page 10
COMP5028 Object-Oriented Analysis and Design (S2 2008)
Dr. Ying Zhou, School of IT, The University of Sydney 
29
Key steps in OOAD– Design Class Diagrams
Define domain
model
Define interaction
diagrams
Define design
class diagramsDefine use cases
Class Model: shows attributes, methods and associations
for software (solution) objects (not domain objects!)
2
Die
faceValue : int
getFaceValue() : int
roll()
DiceGame
die1 : Die
die2 : Die
play()
1
Example:
[Larman05] Figure 1.5, page 10
COMP5028 Object-Oriented Analysis and Design (S2 2008)
Dr. Ying Zhou, School of IT, The University of Sydney 
30
Iterative 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
COMP5028 Object-Oriented Analysis and Design (S2 2008)
Dr. Ying Zhou, School of IT, The University of Sydney 
31
Iterative and evolutionary 
development
Requirements
Design
Implementation &
Test & Integration
& More Design
Final Integration
& System Test
Requirements
Design
4 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
[Larman05] Figure 2.1, page 20
COMP5028 Object-Oriented Analysis and Design (S2 2008)
Dr. Ying Zhou, School of IT, The University of Sydney 
32
Handle 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
[Larman05] Figure 2.2, page 22
COMP5028 Object-Oriented Analysis and Design (S2 2008)
Dr. Ying Zhou, School of IT, The University of Sydney 
33
How 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
COMP5028 Object-Oriented Analysis and Design (S2 2008)
Dr. Ying Zhou, School of IT, The University of Sydney 
34
The oldest waterfall lifecycle
„ Attempt to define all or most of the requirements 
before programming. To create a thorough design 
before programming
„ Strongly associated with high rates of failure, lower 
productivity, and higher defect rates.
„ 45% of the features in waterfall requirements are 
never used, early waterfall schedules and estimates 
vary up to 400% from the final actuals.
COMP5028 Object-Oriented Analysis and Design (S2 2008)
Dr. Ying Zhou, School of IT, The University of Sydney 
35
Mini workshop
„ Which one of the following is true iterative 
development
„ I’ve done five iterations on requirement collection and 
the client finally satisfied and signed off the 
requirement document.
„ We take iterative method to achieve good database 
design. After the first interview with the client, we make 
an initial design of the database and brought this to the 
client. We got valuable feedback from them and made 
according changes, we repeat this process for four 
times and now have our final version of the database 
design
COMP5028 Object-Oriented Analysis and Design (S2 2008)
Dr. Ying Zhou, School of IT, The University of Sydney 
36
How to do iterative and evolutionary 
analysis and design
[Larman05] Figure 2.4, page 28
COMP5028 Object-Oriented Analysis and Design (S2 2008)
Dr. Ying Zhou, School of IT, The University of Sydney 
37
Unified Process (UP) -- Methodology
[Larman05] Figure 2.6, page 34
COMP5028 Object-Oriented Analysis and Design (S2 2008)
Dr. Ying Zhou, School of IT, The University of Sydney 
38
UP Phases
„ Inception – Approximate vision, business case, 
scope, vague estimates
„ Elaboration – refined vision, iterative implementation 
of the core architecture, resolution of high risks, 
identification of most requirements and scope, more 
realistic estimates
„ Construction – iterative implementation of the 
remaining lower risk and easier elements, and 
preparation for deployment
„ Transition – beta tests, deployment
COMP5028 Object-Oriented Analysis and Design (S2 2008)
Dr. Ying Zhou, School of IT, The University of Sydney 
39
Patterns
„ Solution path to recurring problems in 
software development project
„ Design patterns
„ Analysis patterns
COMP5028 Object-Oriented Analysis and Design (S2 2008)
Dr. Ying Zhou, School of IT, The University of Sydney 
40
An overall picture
„ A development task
„ A blue print of steps to achieve the task 
(methodology, example: UP)
„ A few tricks or shortcuts in each step 
(principles and patterns)
„ An efficient way to communicate the job/result 
of each step (UML diagram)
COMP5028 Object-Oriented Analysis and Design (S2 2008)
Dr. Ying Zhou, School of IT, The University of Sydney 
41
Layers and texbook case study
User Interface
Sale Payment
Logging ... Database Access ...
application 
logic layer
other layers or 
components
minor focus
explore how to connect to 
other layers
primary focus 
of case studies
explore how to 
design objects
secondary 
focus
[Larman05] Figure 3.1, page 42
COMP5028 Object-Oriented Analysis and Design (S2 2008)
Dr. Ying Zhou, School of IT, The University of Sydney 
42
Cases
„ 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