Upload
thomasine-briggs
View
213
Download
0
Embed Size (px)
Citation preview
© Trygve Reenskaug 2003 7 November 2003:15:30.OO-NIK 2003 Slide 1
ObjektorienteringObjektorienteringogog
InformasjonssystemerInformasjonssystemerfor det 21. århundrefor det 21. århundre
(Understand – Explore – Master – Control)(Understand – Explore – Master – Control)
Trygve Reenskaug IfI, UiO
[email protected]://www.ifi.uio.no/~trygver
NIK 2003Oslo. 25 november 2003
© Trygve Reenskaug 2003 7 November 2003:15:30.OO-NIK 2003 Slide 3
The Invention ofThe Invention ofObject OrientationObject Orientation
C++
C MultiProcessE-RLispAugmentAlgol-60 Objects
Simula I
Simula 67
Java
Smalltalk-72 -76 -78 -80
RoleModeling
UML 1.x
IS21c-Information Systems for the 21st Century
UML 2.0Squeak
© Trygve Reenskaug 2003 7 November 2003:15:30.OO-NIK 2003 Slide 4
Simula…Simula…A system description languageA system description language
By a system we mean a collection of components which are either
• acting upon other components,
• being acted upon,
• or mutually interacting…"
SIMULA BEGIN:
© Trygve Reenskaug 2003 7 November 2003:15:30.OO-NIK 2003 Slide 5
SIMULA SIMULA BEGINBEGINfig. 1.1.2fig. 1.1.2
SYSTEM LANGUAGE
SYSTEMDESCRIPTION
MODEL
PERSONI
I
I
IA
A
I: Information transferA: Actions
© Trygve Reenskaug 2003 7 November 2003:15:30.OO-NIK 2003 Slide 6
SIMULA SIMULA BEGINBEGIN (1973)(1973)
Example: A Post Office SystemExample: A Post Office System
COUNTER
POST OFFICE
DOORCOUNTERCOUNTERCOUNTER
COUNTER
CLERKQUEUECUSTOMER
CARRY OUTALL TASKS
LIST OFTASKS
CUSTOMER
LIST OFTASKS
CARRY OUTALL TASKS
CUSTOMER
CARRY OUTALL TASKS
LIST OFTASKS
© Trygve Reenskaug 2003 7 November 2003:15:30.OO-NIK 2003 Slide 7
The small, but significant, differenceThe small, but significant, differenceProcedure OrientedProcedure Oriented
PlannerClient
norm_frontload
(…)
activityAduration...
start…end...
activityBweight...duration...
start…end...
activityCweight...duration...
start…end...
activityFduration...
start…end...
crane_frontload
(…)
[ Brad Cox 87]
© Trygve Reenskaug 2003 7 November 2003:15:30.OO-NIK 2003 Slide 8
The small, but significant, differenceThe small, but significant, differenceObject OrientedObject Oriented
PlannerClient
activityAduration...
start…end...
activityBweight...duration...
start…end...
activityCweight...duration...
start…end...
activityFduration...
start…end...
[ Brad Cox 87]
fron
tload
(time)
frontload(…)
frontload(…)
© Trygve Reenskaug 2003 7 November 2003:15:30.OO-NIK 2003 Slide 9
Two ApproachesTwo Approachesto Object Orientationto 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.
© Trygve Reenskaug 2003 7 November 2003:15:30.OO-NIK 2003 Slide 10
TO-CTO-BTO-CtoBtoC
toC
The Clerk metaphorThe Clerk metaphorfor Object Orientationfor Object Orientation
IN
Methods Data
Object A Object B
IN
Methods Data
Port
Messagetriggers method
causes response
Message
StateBehaviorIdentityEncapsulationPolymorphismCommunication (Collaboration)
Inheritance
Data
Object C
IN
Methods
Message
Message
© Trygve Reenskaug 2003 7 November 2003:15:30.OO-NIK 2003 Slide 11
The Idea: Records --> ObjectsThe Idea: Records --> ObjectsSome relevant shipyard objectsSome relevant shipyard objects
Object representinga ship's part
Object representinga construction activity
Object representinga resource
Object representingthe shipyard resources
Object representingthe Shipyard
Object representing a ship’s schedule
© Trygve Reenskaug 2003 7 November 2003:15:30.OO-NIK 2003 Slide 12
SmalltalkSmalltalk
C++
C MultiProcessE-RAlgol-60 Objects
Simula I
Simula 67
Java
RoleModeling
UML 1.x
IS21c-Information Systems for the 21st Century
UML 2.0Squeak
LispAugment
Smalltalk-72 -76 -78 -80
© Trygve Reenskaug 2003 7 November 2003:15:30.OO-NIK 2003 Slide 13
Alan Kay's DynabookAlan Kay's DynabookOwner can view, navigate, edit objectsOwner can view, navigate, edit objects
© Trygve Reenskaug 2003 7 November 2003:15:30.OO-NIK 2003 Slide 14
SmalltalkSmalltalkPersonal Information EnvironmentPersonal Information Environment
© Trygve Reenskaug 2003 7 November 2003:15:30.OO-NIK 2003 Slide 15
Smalltalk-78 in OsloSmalltalk-78 in Oslowith Else Nordhagenwith Else Nordhagen
© Trygve Reenskaug 2003 7 November 2003:15:30.OO-NIK 2003 Slide 16
Objective C, C++ , JavaObjective C, C++ , Java
C++
C MultiProcessE-RAlgol-60 Objects
Simula I
Simula 67
Java
RoleModeling
UML 1.x
IS21c-Information Systems for the 21st Century
UML 2.0Squeak
LispAugment
Smalltalk-72 -76 -78 -80
© Trygve Reenskaug 2003 7 November 2003:15:30.OO-NIK 2003 Slide 17
Role Modeling / Role Modeling / OOramOOramActivity ObjectsActivity Objects
C++
C MultiProcessE-RAlgol-60 Objects
Simula I
Simula 67
Java
RoleModeling
UML 1.x
IS21c-Information Systems for the 21st Century
UML 2.0Squeak
LispAugment
Smalltalk-72 -76 -78 -80
© Trygve Reenskaug 2003 7 November 2003:15:30.OO-NIK 2003 Slide 18
The original 1979 MVCThe original 1979 MVCThe The TOOL AS A COMPOSITETOOL AS A COMPOSITE
ComputerModel
Editor
ToolMentalModel
User
View
Controller
© Trygve Reenskaug 2003 7 November 2003:15:30.OO-NIK 2003 Slide 19
UML 1.xUML 1.x
C++
C MultiProcessE-RAlgol-60 Objects
Simula I
Simula 67
Java
RoleModeling
UML 1.x
IS21c-Information Systems for the 21st Century
UML 2.0Squeak
LispAugment
Smalltalk-72 -76 -78 -80
© Trygve Reenskaug 2003 7 November 2003:15:30.OO-NIK 2003 Slide 20
public class Activity {protected String name;protected int duration;protected int earlyStart;protected int counter = 0;private Activity[] successors;… … …public void frontLoad (int 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);}
}}… … …
}
public class Activity {protected String name;protected int duration;protected int earlyStart = 0;protected int counter = 0;private Activity[] successors;… … …public void frontLoad (int 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);}
}}… … …
}
Java class definition:Java class definition: ActivityActivity
© Trygve Reenskaug 2003 7 November 2003:15:30.OO-NIK 2003 Slide 21
ActivityActivityUML cUML class modellass model
Activityint duration;int earlyStart;int counter;
void frontLoad (int time);int getEarlyFinish();
*
*
successors
© Trygve Reenskaug 2003 7 November 2003:15:30.OO-NIK 2003 Slide 22
ActivityActivityUML UML class hierarchy modelclass hierarchy model
Activityduration: intearlyStart: intcounter: int
frontLoad (int time): voidgetEarlyFinish(): int
0..*successors
0..*
NormalActivityresource: NormalResource
/ getEarlyFinish(): int
CraneActivityresource: CraneResourceload: int
/ getEarlyFinish(): int
© Trygve Reenskaug 2003 7 November 2003:15:30.OO-NIK 2003 Slide 23
* *
The essence of frontloadingThe essence of frontloadingCommunication Communication
Pred Act Succ1: fL(t1) 2: fL(t2)
© Trygve Reenskaug 2003 7 November 2003:15:30.OO-NIK 2003 Slide 24
* *
The essence of frontloadingThe essence of frontloadingCommunication DiagramCommunication Diagram
Pred Act Succ1: fL(t1) 2: fL(t2)
© Trygve Reenskaug 2003 7 November 2003:15:30.OO-NIK 2003 Slide 25
Specialization of CollaborationSpecialization of CollaborationFrontloading with resourcesFrontloading with resources
1: fL(t1) 2: fL(t2)
* *Pred / Activity Succ
1.2: reserv()1.1: alloc()1
*Res
Act
© Trygve Reenskaug 2003 7 November 2003:15:30.OO-NIK 2003 Slide 26
Interfaces in theInterfaces in theBasic scheduling collaborationBasic scheduling collaboration
Pred Act Succ
The interfaces specify minimal requirementsto receiving objects
«Interface»FrontloadIntf
frontLoad(t)
fL(t1) fL(t2)
© Trygve Reenskaug 2003 7 November 2003:15:30.OO-NIK 2003 Slide 27
UML 2.0UML 2.0 (Now being finalized)(Now being finalized)
C++
C MultiProcessE-RAlgol-60 Objects
Simula I
Simula 67
Java
RoleModeling
UML 1.x
IS21c-Information Systems for the 21st Century
UML 2.0Squeak
LispAugment
Smalltalk-72 -76 -78 -80
© Trygve Reenskaug 2003 7 November 2003:15:30.OO-NIK 2003 Slide 28
UML 2.0 Proposal: UML 2.0 Proposal: Components, Parts, Ports, LinksComponents, Parts, Ports, Links
From partners' presentation to OMG Nov 2001 (With permission)
© Trygve Reenskaug 2003 7 November 2003:15:30.OO-NIK 2003 Slide 29
? UML 3.0 ?? UML 3.0 ?An Executing System EnvironmentAn Executing System Environment
C++
C MultiProcessE-RAlgol-60 Objects
Simula I
Simula 67
Java
RoleModeling
UML 1.x
IS21c-Information Systems for the 21st Century
UML 2.0Squeak
LispAugment
Smalltalk-72 -76 -78 -80
© Trygve Reenskaug 2003 7 November 2003:15:30.OO-NIK 2003 Slide 30
#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
We create system modelsWe create system modelsto master our environmentto 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
© Trygve Reenskaug 2003 7 November 2003:15:30.OO-NIK 2003 Slide 35
Thank YouThank You
http://ifi.uio.no/~trygverMore info at
© Trygve Reenskaug 2003 7 November 2003:15:30.OO-NIK 2003 Slide 36
More details ….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.htmlhttp://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 0-393-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