Professional Documents
Culture Documents
Martin Fowler: What We Will Cover
Martin Fowler: What We Will Cover
Martin Fowler
fowler@acm.org
http://ourworld.compuserve.com/homepages/Martin_Fowler
http://ourworld.compuserve.com/homepages/Martin_Fowler
Page 2 © Martin Fowler 8/13/98
1
OO Methods
Coad
Coad
Wirfs-Brock
Wirfs-Brock/ /
Late 80’s RDD
RDD
early 90’s Shlaer
Odell
Odell/ /OOIE
OOIE Shlaer/ /
Mellor
Mellor
Rumbaugh Jacobson
Jacobson/ /
Booch Rumbaugh/ /
Booch OMT Objectory
Objectory
OMT
2
Unified Modeling Language
(UML)
q Developed by the three amigos: Booch,
Jacobson and Rumbaugh at Rational
â Many contributions through OMG process
q Notation and semantics, not process
q Organizations preparing processes
â Rational: Objectory (Unified Process)
â HP: Fusion
www.rational.com/uml
UML Books
3
Use-cases
http://members.aol.com/acockburn
Incremental Development
Development
Exploration
1 2 ...
Finishing Finishing
4
Development
Exploration
q Gather use-cases
â One or two paragraphs
q Outline conceptual model
â Find key abstractions in conceptual problem
q Baseline technical architecture
â Try out key pieces of technology and how they fit
together
â Determine key packages and interfaces
q About 1/5 of project length
5
Dividing Use Cases
q Capture basic order information
â Customer, date received
â Line items: quantity and product
q Price order
â Rules vary with products, different price thresholds
and options.
â May be combination rules
q Discount plans
â Customers may be members of various discount
plans.
â Plans apply various discounts to orders
â A particularly involved discount plan is the “bonnie
prince” plan
Take Order
Price Order
Take Order
Customer Discounts
Bonnie Prince
Discount Plan
Combination Pricing
Rules
6
The «extends» Notion
Take Order
«extends» «extends»
«extends»
«extends»
Use-case Diagram
Use Case
Actor
Set Limits
«uses»
Trading Manager
Analyze Risk
«uses» Valuation
7
Cockburn’s Style
http://members.aol.com/acockburn
Abuse Cases
q Decomposition
â Temptation to drive design
â Takes time (for little value)
q Abstraction
â Loses users
â Less value in testing
q GUI prototypes
â False sign of progress
â Encourages scope growth
q Denying choice
â System v user use cases
8
Class Diagrams
Corporate Personal
Customer Customer
] Contact Name Credit card #
Attributes Credit Rating
Order Line
Credit Limit
product Remind
quantity
price Class
Operations
Modeling Perspectives
q Conceptual
â Describes people’s perception of the world
â Independent of software
q Specification
â Interfaces of classes (types)
q Implementation
â Internal features of a class
9
Association
An employee must have a single department
1 [ [
Department Employee Skill
[
notation
for cardinalities
Generalization
A nurse is a kind of a person
Person
Doctor Nurse
10
Dangers of Class Diagrams
Class, Responsibility,
Collaboration: CRC
Order
Check Items are in Stock Order Line
Determine the price Order Line
Check for valid payment Customer
Dispatch to delivery
address
11
Interaction (Sequence)
an Order Entry
Diagrams
an Order an Order Line a Stock Item
window
prepare()
* prepare()
hasStock :=
Message check() Condition
Object
Iteration [hasStock]
remove()
needsReorder :=
needsToReorder()
self
delegation
return
[needsReorder] new
a Reorder
Item
[hasStock] new
a Delivery
Item
deletion
creation
Interaction (Collaboration)
Diagrams
:Order Entry Window Object
1:prepare()
message
:Order self sequence
1.1*[for all order 1.1.1: hasStock := check ()
delegation number
lines]: prepare () 1.1.2:[hasStock] remove ()
talisker line : Order Line talisker stock : Stock Item 1.1.2.1: needsReorder :=
needToReorder ( )
12
Key Books for Base
Techniques
q Implementation focus: Booch, G. Object-
oriented Analysis and Design With
Applications, (Second Edition), Benjamin /
Cummings, Redwood City, CA, 1993.
q Conceptual Focus: Martin, J. And Odell, J.
Object Oriented Methods: a Foundation, (UML
Edition) Prentice Hall, Englewood Cliffs, NJ,
1998).
q For Responsibilities: Wirfs-brock R, Wilkerson
B and Wiener L (1990) Designing Object-
oriented Software, Prentice Hall, Englewood
Cliffs NJ.
Patterns
…projects fail despite the latest
technology for lack of ordinary
solutions.
http://www.hillside.net/patterns
13
Design Pattern: Proxy
Subject
request()
realSubject.request()
Real Subject Proxy
request() 1 request()
Analysis Patterns
Scenario Timepoint
[ 1
1
[
1 Scenario [
Instrument Money
[ Element 1
14
Packages
Stocks
Pricer UI Portfolio UI Martin, R.C. Designing
Object-Oriented C++
Applications Using the
GUI Library Booch Method, Prentice
Stocks
Hall, Englewood Cliffs,
Portfolio
Pricer Application
NJ, 1995.
Dependency
Package
Stocks Scenario
Positions
Database Manager
Harel Statechart
H Wait Open
close safe
candle removed [door closed] door opened key turned [candle in]
Active
Lock
catch released / reveal lock
Catch exit / hide lock
Final
15
Simple Activity Diagram
H
Assign Goods to
Order
Authorize [failed]
Cancel Order
Payment
[suceeded]
Dispatch Order
Decision Notation
H
Assign Goods to
Order
[payment rejected]
Cancel Order
[payment authorized]
Dispatch Order
16
Introducing Parallel Behavior
Receive Order
[suceeded]
Dispatch Order
q Sequence is independent
Adding Iteration
H
Receive Order
Assign Goods to
Item
Authorize [failed]
Cancel Order
[need to reorder] Payment
[suceeded]
Reorder Goods
[stock assigned to all items and payment authorized]
Dispatch Order
17
Multiple Diagrams (1)
H
Receive Order
[in stock]
Assign Goods to
Item
Authorize [failed]
Cancel Order
[need to reorder] Payment
[suceeded]
Reorder Goods
[stock assigned to all items and payment authorized]
Dispatch Order
Receive
Incoming Goods
Choose
outstanding
order items
Assign Goods to
Item
Add Remainder
Dispatch Order
to Stock
18
Combining Diagrams
H
H
Receive
Incoming Goods Receive Order
Add Remainder
to Stock
Dispatch Order
Design by Contract
Square Root
q Inputs
â x : Real Number
q Output
â result : Real Number
q Pre-condition
â x 0 o Also uses class
q Post-condition invariants
â result * result == x
q Exceptions
â none
Meyer, B. Object-Oriented Software Construction,
Prentice-Hall, New York, 1996
Meyer, B. “Applying “Design by Contract”,” IEEE
Computer, 25,10, (1992), pp. 40–51.
www.eiffel.com
Page 38 © Martin Fowler 8/13/98
19
CASE Tools
q Design Document
â Drawing facilities
â Repository reports
â Uses right set of UML for you?
â Selectivity
q Code Generation
â Can you work with the code?
â Updated code fed back into model?
Translation
Capture
specifics of Domain Analysis
domain
Model Compiler Final System
Rules for your Archetypes
platform
q Advocated by Shlaer/Mellor
â Basic idea also used by ObjectTime
4 Easy regeneration of system to different
platforms
4 Can reuse the archetypes
8 Does it work in practice?
20
Why use these techniques?
21