Objektorientering og Informasjonssystemer for det 21 rhundre Understand
Objektorientering og Informasjonssystemer for det 21. århundre (Understand – Explore – Master – Control) NIK 2003 Oslo. 25 november 2003 Trygve Reenskaug If. I, Ui. O trygve. reenskaug@ifi. uio. no http: //www. ifi. uio. no/~trygver OO-NIK 2003 © Trygve Reenskaug 2003 7 November 2003: 15: 30. 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 UML 1. x Squeak Role Modeling UML 2. 0 IS 21 c-Information Systems for the 21 st Century OO-NIK 2003 © Trygve Reenskaug 2003 7 November 2003: 15: 30. 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. 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. 5
SIMULA BEGIN (1973) Example: A Post Office System POST OFFICE COUNTER DOOR COUNTER QUEUE 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. 6
The small, but significant, difference Procedure Oriented [ Brad Cox 87] Planner Client activity. A duration. . . start… end. . . activity. B norm_ frontload (…) weight. . . duration. . . start… end. . . activity. C weight. . . duration. . . start… end. . . crane_ frontload (…) activity. F duration. . . start… end. . . OO-NIK 2003 © Trygve Reenskaug 2003 7 November 2003: 15: 30. 7
The small, but significant, difference Object Oriented activity. A [ Brad Cox 87] frontload(time) Planner Client duration. . . start… end. . . activity. B frontload (…) weight. . . duration. . . start… end. . . activity. C weight. . . duration. . . start… end. . . frontload (…) activity. F duration. . . start… end. . . OO-NIK 2003 © Trygve Reenskaug 2003 7 November 2003: 15: 30. 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. 9
The Clerk metaphor for Object Orientation Object A Object B Port Message IN Methods TO-B to. C TO-C Data IN Methods TO-C to. C 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 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. 11
Smalltalk C Algol-60 Objects Simula I Augment Lisp E-R Multi Process Simula 67 Smalltalk C++ Java -72 -76 -78 -80 UML 1. x Squeak Role Modeling UML 2. 0 IS 21 c-Information Systems for the 21 st Century OO-NIK 2003 © Trygve Reenskaug 2003 7 November 2003: 15: 30. 12
Alan Kay's Dynabook Owner can view, navigate, edit objects OO-NIK 2003 © Trygve Reenskaug 2003 7 November 2003: 15: 30. 13
Smalltalk Personal Information Environment OO-NIK 2003 © Trygve Reenskaug 2003 7 November 2003: 15: 30. 14
Smalltalk-78 in Oslo with Else Nordhagen OO-NIK 2003 © Trygve Reenskaug 2003 7 November 2003: 15: 30. 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 UML 1. x Squeak Role Modeling UML 2. 0 IS 21 c-Information Systems for the 21 st Century OO-NIK 2003 © Trygve Reenskaug 2003 7 November 2003: 15: 30. 16
Role Modeling / OOram Activity Objects C Algol-60 Objects Simula I Augment Lisp E-R Multi Process Simula 67 Smalltalk C++ Java -72 -76 -78 -80 UML 1. x Squeak Role Modeling UML 2. 0 IS 21 c-Information Systems for the 21 st Century OO-NIK 2003 © Trygve Reenskaug 2003 7 November 2003: 15: 30. 17
The original 1979 MVC The TOOL AS A COMPOSITE Mental Tool Model Computer Model User Controller View Editor OO-NIK 2003 © Trygve Reenskaug 2003 7 November 2003: 15: 30. 18
UML 1. x C Algol-60 Objects Simula I Augment Lisp E-R Multi Process Simula 67 Smalltalk C++ Java -72 -76 -78 -80 UML 1. x Squeak Role Modeling UML 2. 0 IS 21 c-Information Systems for the 21 st Century OO-NIK 2003 © Trygve Reenskaug 2003 7 November 2003: 15: 30. 19
Java class definition: Activity public class Activity { protected String name; protected int duration; protected int early. Start; early. Start = 0; protected int counter = 0; private Activity[] successors; … … … public void front. Load (int time)){{ early. Start = Math. max (early. Start, time); if ((counter += 1) >= predecessors. length) { int fin = get. Early. Finish(); for (int i=0; i<successors. length; i++) { successors[i]. front. Load(fin+1); } } … … … OO-NIK 2003 © Trygve Reenskaug 2003 7 November 2003: 15: 30. 20
Activity UML class model Activity int duration; int early. Start; int counter; successors * void front. Load (int time); int get. Early. Finish(); * OO-NIK 2003 © Trygve Reenskaug 2003 7 November 2003: 15: 30. 21
Activity UML class hierarchy model Activity duration: int early. Start: int counter: int front. Load (int time): void get. Early. Finish(): int 0. . * successors Normal. Activity resource: Normal. Resource / get. Early. Finish(): int Crane. Activity resource: Crane. Resource load: int / get. Early. Finish(): int OO-NIK 2003 © Trygve Reenskaug 2003 7 November 2003: 15: 30. 22
The essence of frontloading Communication Pred 1: f. L(t 1) Act * * OO-NIK 2003 Succ 2: f. L(t 2) © Trygve Reenskaug 2003 7 November 2003: 15: 30. 23
The essence of frontloading Communication Diagram Pred 1: f. L(t 1) Act * * OO-NIK 2003 Succ 2: f. L(t 2) © Trygve Reenskaug 2003 7 November 2003: 15: 30. 24
Specialization of Collaboration Frontloading with resources 2: f. L(t 2) 1: f. L(t 1) Pred * Act / Activity * Succ 1 1. 1: alloc() 1. 2: reserv() * Res OO-NIK 2003 © Trygve Reenskaug 2003 7 November 2003: 15: 30. 25
Interfaces in the Basic scheduling collaboration The interfaces specify minimal requirements to receiving objects Pred f. L(t 1) Act f. L(t 2) Succ «Interface» Frontload. Intf front. Load(t) OO-NIK 2003 © Trygve Reenskaug 2003 7 November 2003: 15: 30. 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 UML 1. x Squeak Role Modeling UML 2. 0 IS 21 c-Information Systems for the 21 st Century OO-NIK 2003 © Trygve Reenskaug 2003 7 November 2003: 15: 30. 27
UML 2. 0 Proposal: Components, Parts, Ports, Links From partners' presentation to OMG Nov 2001 (With permission) OO-NIK 2003 © Trygve Reenskaug 2003 7 November 2003: 15: 30. 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 UML 1. x Squeak Role Modeling UML 2. 0 IS 21 c-Information Systems for the 21 st Century OO-NIK 2003 © Trygve Reenskaug 2003 7 November 2003: 15: 30. 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. 30
OO-NIK 2003 © Trygve Reenskaug 2003 7 November 2003: 15: 30. 31
OO-NIK 2003 © Trygve Reenskaug 2003 7 November 2003: 15: 30. 32
OO-NIK 2003 © Trygve Reenskaug 2003 7 November 2003: 15: 30. 33
OO-NIK 2003 © Trygve Reenskaug 2003 7 November 2003: 15: 30. 34
Thank You More info at http: //ifi. uio. no/~trygver OO-NIK 2003 © Trygve Reenskaug 2003 7 November 2003: 15: 30. 35
More details …. • http: //www. ifi. uio. no/~trygver trygve. reenskaug@ifi. uio. no • Unified Modeling Language (UML). Object Management Group. Version 2. 0, Final Adopted specification http: //www. omg. org/techprocess/meetings/schedule/MOF 2 -UML 2_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/Conceptual. Modeling. OO. 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. 36
- Slides: 35