Architectural Design of Distributed Systems
Download
Report
Transcript Architectural Design of Distributed Systems
Objektorientering
og
Informasjonssystemer
for det 21. århundre
(Understand – Explore – Master – Control)
NIK 2003
Oslo. 25 november 2003
Trygve Reenskaug
IfI, UiO
[email protected]
http://www.ifi.uio.no/~trygver
OO-NIK 2003
© Trygve Reenskaug 2003
7 November 2003:15:30.
Slide 1
The Invention of
Object Orientation
C
Algol-60
Objects
Simula I
Augment
Lisp
E-R
Multi
Process
Simula 67
Smalltalk
C++
Java
-72 -76 -78 -80
Role
Modeling
UML 1.x
Squeak
UML 2.0
IS21c-Information Systems for the 21st Century
OO-NIK 2003
© Trygve Reenskaug 2003
7 November 2003:15:30.
Slide 3
Simula…
A system description language
SIMULA
BEGIN:
By a system we mean
a collection of components which are either
• acting upon other components,
• being acted upon,
• or mutually interacting…"
OO-NIK 2003
© Trygve Reenskaug 2003
7 November 2003:15:30.
Slide 4
SIMULA BEGIN
fig. 1.1.2
MODEL
A
I
SYSTEM
I
A
I: Information transfer
A: Actions
OO-NIK 2003
I
PERSON
LANGUAGE
I
SYSTEM
DESCRIPTION
© Trygve Reenskaug 2003
7 November 2003:15:30.
Slide 5
SIMULA BEGIN (1973)
Example: A Post Office System
POST OFFICE
COUNTER
COUNTER
COUNTER
COUNTER
DOOR
COUNTER
QUEUE
CUSTOMER
CLERK
CUSTOMER
LIST OF
TASKS
OO-NIK 2003
CARRY OUT
ALL TASKS
© Trygve Reenskaug 2003
LIST OF
TASKS
CARRY OUT
ALL TASKS
7 November 2003:15:30.
Slide 6
The small, but significant, difference
Procedure Oriented
[ Brad Cox 87]
activityA
duration...
start…
end...
activityB
Planner
Client
norm_
frontload
(…)
weight...duration...
start…
end...
activityC
weight...duration...
start…
end...
crane_
frontload
(…)
activityF
duration...
start…
end...
OO-NIK 2003
© Trygve Reenskaug 2003
7 November 2003:15:30.
Slide 7
The small, but significant, difference
Object Oriented
activityA
[ Brad Cox 87]
frontload(time)
Planner
Client
duration...
start…
end...
frontload
(…)
activityB
weight...duration...
start…
end...
activityC
weight...duration...
start…
end...
frontload
(…)
activityF
duration...
start…
end...
OO-NIK 2003
© Trygve Reenskaug 2003
7 November 2003:15:30.
Slide 8
Two Approaches
to Object Orientation
• "East Coast Approach":
Object orientation is a smart programming
artifact.
An object is an instance of a class.
• "West Coast Approach":
Object Orientation is a powerful tool for
thinking.
An object is an entity with a well-defined
boundary and identity that encapsulates state
and behavior without revealing its interior
construction.
OO-NIK 2003
© Trygve Reenskaug 2003
7 November 2003:15:30.
Slide 9
The Clerk metaphor
for Object Orientation
Object A
Object B
Port Message
IN
Methods
TO-B
toB
toC
TO-C
Data
IN
Methods
TO-C
toC
Message
Object C
Data
IN
Message
State
Behavior
Message
Identity
Methods
triggers method
Encapsulation
Polymorphism
causes response
Communication (Collaboration)
Inheritance
OO-NIK 2003
© Trygve Reenskaug 2003
7 November 2003:15:30.
Data
Slide 10
The Idea: Records --> Objects
Some relevant shipyard objects
Object representing
the Shipyard
Object representing
a ship’s schedule
Object representing
the shipyard resources
Object representing
a construction activity
Object representing
a resource
Object representing
a ship's part
OO-NIK 2003
© Trygve Reenskaug 2003
7 November 2003:15:30.
Slide 11
Smalltalk
C
Algol-60
Objects
Simula I
Augment
Lisp
E-R
Multi
Process
Simula 67
Smalltalk
C++
Java
-72 -76 -78 -80
Role
Modeling
UML 1.x
Squeak
UML 2.0
IS21c-Information Systems for the 21st Century
OO-NIK 2003
© Trygve Reenskaug 2003
7 November 2003:15:30.
Slide 12
Alan Kay's Dynabook
Owner can view, navigate, edit objects
OO-NIK 2003
© Trygve Reenskaug 2003
7 November 2003:15:30.
Slide 13
Smalltalk
Personal Information Environment
OO-NIK 2003
© Trygve Reenskaug 2003
7 November 2003:15:30.
Slide 14
Smalltalk-78 in Oslo
with Else Nordhagen
OO-NIK 2003
© Trygve Reenskaug 2003
7 November 2003:15:30.
Slide 15
Objective C, C++ , Java
C
Algol-60
Objects
Simula I
Augment
Lisp
E-R
Multi
Process
Simula 67
Smalltalk
C++
Java
-72 -76 -78 -80
Role
Modeling
UML 1.x
Squeak
UML 2.0
IS21c-Information Systems for the 21st Century
OO-NIK 2003
© Trygve Reenskaug 2003
7 November 2003:15:30.
Slide 16
Role Modeling / OOram
Activity Objects
C
Algol-60
Objects
Simula I
Augment
Lisp
E-R
Multi
Process
Simula 67
Role
Modeling
Smalltalk
C++
Java
-72 -76 -78 -80
UML 1.x
Squeak
UML 2.0
IS21c-Information Systems for the 21st Century
OO-NIK 2003
© Trygve Reenskaug 2003
7 November 2003:15:30.
Slide 17
The original 1979 MVC
The TOOL AS A COMPOSITE
Mental
Tool
Computer
Model
Model
User
Controller
View
Editor
OO-NIK 2003
© Trygve Reenskaug 2003
7 November 2003:15:30.
Slide 18
UML 1.x
C
Algol-60
Objects
Simula I
Augment
Lisp
E-R
Multi
Process
Simula 67
Role
Modeling
Smalltalk
C++
Java
-72 -76 -78 -80
UML 1.x
Squeak
UML 2.0
IS21c-Information Systems for the 21st Century
OO-NIK 2003
© Trygve Reenskaug 2003
7 November 2003:15:30.
Slide 19
Java class definition:
Activity
public class Activity {
protected String name;
protected int duration;
protected int earlyStart;
earlyStart = 0;
protected int counter = 0;
private Activity[] successors;
… … …
public void frontLoad (int time
time)){{
earlyStart = Math.max (earlyStart, time);
if ((counter += 1) >= predecessors.length) {
int fin = getEarlyFinish();
for (int i=0; i<successors.length; i++) {
successors[i].frontLoad(fin+1);
}
}
}
… … …
}
OO-NIK 2003
© Trygve Reenskaug 2003
7 November 2003:15:30.
Slide 20
Activity
UML class model
Activity
int duration;
int earlyStart;
int counter;
successors
*
void frontLoad (int time);
int getEarlyFinish();
*
OO-NIK 2003
© Trygve Reenskaug 2003
7 November 2003:15:30.
Slide 21
Activity
UML class hierarchy model
Activity
duration: int
earlyStart: int
counter: int
frontLoad (int time): void
getEarlyFinish(): int
0..
*
0..
*
successors
NormalActivity
resource: NormalResource
/ getEarlyFinish(): int
CraneActivity
resource: CraneResource
load: int
/ getEarlyFinish(): int
OO-NIK 2003
© Trygve Reenskaug 2003
7 November 2003:15:30.
Slide 22
The essence of frontloading
Communication
Pred
1: fL(t1)
Act
*
*
OO-NIK 2003
Succ
2: fL(t2)
© Trygve Reenskaug 2003
7 November 2003:15:30.
Slide 23
The essence of frontloading
Communication Diagram
Pred
1: fL(t1)
Act
*
*
OO-NIK 2003
Succ
2: fL(t2)
© Trygve Reenskaug 2003
7 November 2003:15:30.
Slide 24
Specialization of Collaboration
Frontloading with resources
1: fL(t1)
Pred
*
2: fL(t2)
Act
/ Activity
*
Succ
1
1.1: alloc()
1.2: reserv()
*
Res
OO-NIK 2003
© Trygve Reenskaug 2003
7 November 2003:15:30.
Slide 25
Interfaces in the
Basic scheduling collaboration
The interfaces specify minimal requirements
to receiving objects
Pred
fL(t1)
Act
fL(t2)
Succ
«Interface»
FrontloadIntf
frontLoad(t)
OO-NIK 2003
© Trygve Reenskaug 2003
7 November 2003:15:30.
Slide 26
UML 2.0
(Now being finalized)
C
Algol-60
Objects
Simula I
Augment
Lisp
E-R
Multi
Process
Simula 67
Smalltalk
C++
Java
-72 -76 -78 -80
Role
Modeling
UML 1.x
Squeak
UML 2.0
IS21c-Information Systems for the 21st Century
OO-NIK 2003
© Trygve Reenskaug 2003
7 November 2003:15:30.
Slide 27
UML 2.0 Proposal:
Components, Parts, Ports, Links
OO-NIK 2003
From partners' presentation to OMG Nov 2001 (With permission)
© Trygve Reenskaug 2003
7 November 2003:15:30.
Slide 28
? UML 3.0 ?
An Executing System Environment
C
Algol-60
Objects
Simula I
Augment
Lisp
E-R
Multi
Process
Simula 67
Smalltalk
C++
Java
-72 -76 -78 -80
Role
Modeling
UML 1.x
Squeak
UML 2.0
IS21c-Information Systems for the 21st Century
OO-NIK 2003
© Trygve Reenskaug 2003
7 November 2003:15:30.
Slide 29
We create system models
to master our environment
# User's model of the application
• utility - cause and effect
# Architect's model of the running system
• objects - containment - roles - responsibilities
• behavior - interactions - state machines - actions
# Coder's model of the code
• classes - features - inheritance - packages - deployment
OO-NIK 2003
© Trygve Reenskaug 2003
7 November 2003:15:30.
Slide 30
OO-NIK 2003
© Trygve Reenskaug 2003
7 November 2003:15:30.
Slide 31
OO-NIK 2003
© Trygve Reenskaug 2003
7 November 2003:15:30.
Slide 32
OO-NIK 2003
© Trygve Reenskaug 2003
7 November 2003:15:30.
Slide 33
OO-NIK 2003
© Trygve Reenskaug 2003
7 November 2003:15:30.
Slide 34
Thank You
More info at
http://ifi.uio.no/~trygver
OO-NIK 2003
© Trygve Reenskaug 2003
7 November 2003:15:30.
Slide 35
More details ….
• http://www.ifi.uio.no/~trygver
[email protected]
• Unified Modeling Language (UML). Object Management Group.
Version 2.0, Final Adopted specification
http://www.omg.org/techprocess/meetings/schedule/MOF2-UML2_Infrastructure_FTF.html
http://www.omg.org/techprocess/meetings/schedule/UML_2.0_Superstructure_FTF.html
• Roles and artifacts in cognitive psychology:
Steven Pinker: How the Mind Works. Norton, New York 1997. ISBN 0393-04535-8
• The reference work on role modeling:
Reenskaug, Wold, Lehne: Working With Objects.
This book is out of print. A .pdf version kan be downloaded free from
http://www.ifi.uio.no/~trygver
• The theory of role modeling: Egil P. Andersen: Conceptual Modeling of
Objects. A Role Modeling Approach. Dr Scient thesis. Dept. of
Informatics, University of Oslo. 4 November 1997.
ftp://ftp.nr.no/pub/egil/ConceptualModelingOO.ps.gz
• Richard Pawson and Robert Matthews: Naked Objects.
See http://www.nakedobjects.org
OO-NIK 2003
© Trygve Reenskaug 2003
7 November 2003:15:30.
Slide 36