New Discipline of Programming rOOts 2005 Towards a Trygve Reenskaug

advertisement
Towards a
New Discipline of Programming
with the BabyUML Language Laboratory
rOOts 2005
Trygve Reenskaug
University of Oslo
http://heim.ifi.uio.no/~trygver
trygver@ifi.uioi.no
BabyUML-rOOts
© Trygve Reenskaug 2005
2016.05.29
Slide 1 of xx
”Nusse”
Stored program, binary computer
”Nusse”
(1953-59)
• Stored Program
• Binary (512 words a 32 bits)
• An innocuous change in one corner
broke program in opposite corner
BabyUML-rOOts
© Trygve Reenskaug 2005
2016.05.29
Slide 3 of xx
Smalltalk:
Stored Program, Object Computer
(1973---)
• Stored Program
• 300.000 objects
• An innocuous change in one corner
breaks program in opposite corner
BabyUML-rOOts
© Trygve Reenskaug 2005
2016.05.29
Slide 4 of xx
Testing is of limited utility
Dijkstra - 1:
Exhaustive testing of
a
(32 bits)
*b
(32 bits)
at one million tests per second.
Exhaustive test takes nearly 600.000 years !!
"Program testing can be used to show
the presence of bugs,
but never to show their absence!"
http://en.wikiquote.org/wiki/Edsger_Wybe_Dijkstra
BabyUML-rOOts
© Trygve Reenskaug 2005
2016.05.29
Slide 5 of xx
Limiting factor is human brain
Dijkstra - 2:
As a slow-witted human
being I have a very small
head and I had better learn
to live with it and to respect
my limitations…
http://www.cs.utexas.edu/users/EWD/ewd02xx/EWD249.PDF
BabyUML-rOOts
© Trygve Reenskaug 2005
2016.05.29
Slide 6 of xx
Deal With
Comprehensible Programs
All Programs
All Meaningful Programs
All Comprehensible Programs
Two ways of constructing asoftware design (C.A.R. Hoare)
Make it
1) so simple that there are obviously no deficiencies
2) so complicated that there are no obvious deficiencies.
BabyUML-rOOts
© Trygve Reenskaug 2005
2016.05.29
Slide 7 of xx
1973
The Last Comfortable Program
Program:
•
•
•
•
~ 3000 FORTRAN statements
Unit test: ~ One error/400 LOC
System Test: No errors
Use: No errors
Process:
• Specification
• Database schema
• For each subroutine:
–Design, Write, Peer review, Test
• System test
• Use
BabyUML-rOOts
© Trygve Reenskaug 2005
2016.05.29
Slide 8 of xx
New Challenges After 1973
• Open Systems
– Distributed components,
– No closed boundaries
• Evolution:
– Requirements change during development
– and forever after
• Multi Process
• Ownership
– Computer Literate users
– Demand better control
BabyUML-rOOts
© Trygve Reenskaug 2005
2016.05.29
Slide 9 of xx
Objects
Implicit in Class Browser
Smalltalk Object Space (Image))
Object
Object
Object
Object
Object
Smalltalk
Virtual Machine (VM)
BabyUML-rOOts
© Trygve Reenskaug 2005
2016.05.29
Slide 10 of xx
Projections
BabyUML-rOOts
© Trygve Reenskaug 2005
2016.05.29
Slide 11 of xx
A BabyUML Component
encapsulates other objects
«Port»
ProductionControl
«Component»
Tool2
MaterialsManagement
«Port»
«Component» sampleNet
actA(2)
actC(3)
actD (2)
<2203>
actB(7)
«Port»
«Port»
Tool 1
Manufacturing
«Port»
BabyUML-rOOts
© Trygve Reenskaug 2005
2016.05.29
Slide 12 of xx
Link by matching
required / provided interfaces
required
(client)
provided
(server)
Desmond D’Souza: Objects, Components, and Frameworks with UML (Catalysis)
BabyUML-rOOts
© Trygve Reenskaug 2005
2016.05.29
Slide 13 of xx
Five Projections – 1
Encapsulated Object
«interface»
+name
+ frontload (firstWeek: Integer)
+descriptor (name: String) : Dictionary
objectID= <2203>
Black box: Encapsulated
BabyUML-rOOts
© Trygve Reenskaug 2005
2016.05.29
Slide 14 of xx
Five Projections - 2
Collaboration
<2200>
<2272>
(2)
(3)
actA
actC
<2203>
actD
(2)
<2261>
actB
(7)
BabyUML-rOOts
© Trygve Reenskaug 2005
2016.05.29
Slide 15 of xx
Five Projections - 3
Interaction
<0321>
<2200>
<2261>
<2272>
<2203>
port
actA
actB
actC
actD
(3)
(2)
(2)
frontload: 1
(7)
frontload: 1
frontload: 3
frontload: 6
frontload: 1
frontload: 8
BabyUML-rOOts
© Trygve Reenskaug 2005
2016.05.29
Slide 16 of xx
Five Projections – 4
Conceptual Object
objectID = <2203>
activityName
'actD '
=
3
duration =
earlyStart
earlyFinish
16
=
predecessors =
{act B. actC .}
name : String =
= method
frontload (firstWeek : Integer)
= method
descriptor : Dictionary
= method
White box: Conceptual
BabyUML-rOOts
attributes
14
=
methodDict
firstWeek
: Integer) =
© Trygve Reenskaug 2005
2016.05.29
Slide 17 of xx
Five Projections – 5
The Object Descriptor
objectID = <0002>
superclass
methodDict = {inspect ...
format = 2
superclass = nil
attributes= {}
className = #Object
... = method
...= method
objectID = <0148>
objectID = <2203>
instance
activityName=
duration =
earlyStart =
earlyFinish =
predecessors =
'actD'
2
8
9
{actB. actC.}
class
class
«instanceOf»
name : String =
method
frontload (firstWeek: : Integer) = method
descriptor : Dictionary =
method
BabyUML-rOOts
© Trygve Reenskaug 2005
superclass
«subclassOf»
... = method
methodDict = {frontLoad:...
format = ...
superclass= Object
className= #Activity
attributes= {activityName…
#new =method
#compile: =method
...= method
2016.05.29
Slide 18 of xx
Component Merge
superclass
«merge»
merged
«merge»
class
receiving
merged
instance
receiving
Smalltalk -merge1
superclass
class
<0002> Object
<0148> Activity
<2203> actD
methodDict = {frontLoad:...
format = ...
superclass= Object
className = #Activity
attributes= {activityName...
methodDict = {inspect ...
format = 2
superclass = nil
attributes= {}
className = #Object
'actD'
3
14
16
{'actB'. 'actC'.}
#new = method
#compile: = method
xxx= method
xxx= method
Smalltalk -merge2
merged
BabyUML-rOOts
instance
receiving
© Trygve Reenskaug 2005
merged
2016.05.29
receiving
Slide 19 of xx
The Simple Component
«Component»
<2203>
«port» < 0321 >
newActivity (name : String, duration : Integer)
addDependency (from, to : String)
frontload (firstWeek : Integer)
activityNames () : String [] {sorted}
activityDescriptor (name: String) : Dictionary
frontload (1)
actD
members
name = ' actD'
duration = 2
earlyStart = 8
earlyFinish = 9
predecessors = {
actB . ' actC .}
successors { }
frontload ( firstWeek : Integer)
example- white5
<0321> port
sampleNet
<2200> actA
<2261> actB
<2272> actC
<2203> actD
(2)
(7)
(3)
(2)
frontload (1)
frontload (3)
frontload (6)
frontload (1)
BabyUML-rOOts
firstWeek
: Integer)
frontload (8)
© Trygve Reenskaug 2005
2016.05.29
Slide 20 of xx
The Mastered Component
Conceptual
«Component» sampleNet
«provided interface»
<0321>
port
newActivity: aString duration:anInteger
addDependencyFrom: predName to: succName
frontload: firstWeek
activityNames
activityDescriptor: actName
<4002>
maestro
<2203> actD
name = 'actD'
duration = 2
earlyStart = 8
earlyFinish = 9
predecessors = { actB. 'actC.}
successors { }
frontload (firstWeek : Integer)
BabyUML-rOOts
© Trygve Reenskaug 2005
2016.05.29
Slide 21 of xx
The Mastered Component
Interaction
<4002>
maestro
frontload (1)
<2200>
actA
(2)
<2261>actB
(7)
<2272>actC
<2203>actD
(3)
(2)
resetFrontload ()
resetFrontload
self earlyStart: nil.
resetFrontload ()
resetFrontload ()
resetFrontload ()
frontload (1)
frontload (1)
frontload: start
self earlyStart: start.
self predecessors do:
[ :pred |
self earlyStart: (self earlyStart max: pred earlyFinish + 1)
].
frontload (1)
earlyFinish ()
frontload: firstWeek
| frontActs |
frontload (1)
activities do: [:act | act resetFrontload].
[(frontActs := activities select:
[:act |
act earlyStart isNil
and: [act predecessors allSatisfy: [:pred | pred earlyStart notNil]]]
) notEmpty]
whileTrue:
[frontActs do: [:act | act frontload: firstWeek] ] © Trygve Reenskaug 2005
BabyUML-rOOts
2016.05.29
earlyFinish ()
earlyFinish ()
Slide 22 of xx
The Declarative Component
Conceptual
«port»
<0321>
<4002> maestro
«Component»sampleNet
«database» <0983>
«schema»Network
Activity
preds
name: string
duration: integer
earlyStart
: integer
/earlyFinish: integer
*
*
BabyUML-rOOts
succs
© Trygve Reenskaug 2005
<2203> : Activity
name =actD'
'
duration = 2
earlyStart= 8
earlyFinish= 9
frontload: firstWeek
2016.05.29
Slide 23 of xx
The Declarative Component
Layered
«Component» sampleNet <0321>
newActivityNamed: aString duration: anInteger
addDependentFrom: actName1 to: actName2
frontloadFrom: firstWeekNo
activityNames
activityDescriptorFor: actName
LayeredComponent
BabyUML-rOOts
© Trygve Reenskaug 2005
2016.05.29
Slide 24 of xx
The Declarative Component
frontloading sequence diagram
frontload: firstWeek
maestro
activitiesContext
allActs
resetEarlyStart
resetEarlyStart
self earlyStart: nil.
frontContext [frontAct notNil]
define query frontAct as
frontAct
frontPreds
«schema» select act
frontload:
: firstWeek
from activities
Activity where act.earlyStart.isNil
pred
name:
and
duration:
( select succ frontload: firstWeek
*
earlyStart
self earlyStart: firstWeek.
from
dependencies
self frontPreds do:
/earlyFinish
|
where succ = act[:pred
succ
self earlyStart: (self earlyStartmax: (pred earlyFinish+ 1))].
*
and pred.earlyStart.isNil)
BabyUML-rOOts
© Trygve Reenskaug 2005
) isEmpty
2016.05.29
Slide 25 of xx
Network
Summary-1:
Divide and Conquer with Components
«Port»
«Component»
ProductionControl
Tool2
MaterialsManagement
«Port»
«Component» sampleNet
actA(2)
actC(3)
actD (2)
<2203>
actB(7)
«Port»
«Port»
Tool 1
Manufacturing
«Port»
BabyUML-rOOts
© Trygve Reenskaug 2005
2016.05.29
Slide 26 of xx
Summary-2:
Four Projections
<0321>
port
<2272> actC
(3)
<2200> actA
(2)
frontload: 1
<2203> actD
(2)
<2261> actB
(7)
<2200>
<2261>
<2272>
<2203>
actA
actB
actC
actD
(2)
(7)
(3)
(2)
frontload: 1
frontload: 3
frontload: 6
frontload: 1
frontload: 8
Interaction
Collaboration
objectID = <2203>
activityName =
duration =
earlyStart =
earlyFinish =
predecessors =
«interface»
name
frontload (firstWeek : Integer)
descriptor (name: String) : Dictionary
objectID = <2203>
Black box: Encapsulated
BabyUML-rOOts
'actD'
3
14
16
{actB. actC.}
attributes
name : String =
method
frontload (firstWeek: : Integer) = method
methodDict
descriptor : Dictionary =
method
White box: Conceptual
© Trygve Reenskaug 2005
2016.05.29
Slide 27 of xx
Input
Output
Input Output
Input
Central
Processing
Unit
Memory
Central
Processing
Unit
Output
Tape
Tape
Memory
CPU-Centered
Tape
Central
Processing
Unit
Disk
Memory
Disk
Storage-Centered
Conceptual
schema (classes)
Databases
[1GL]Binary
[4GL] Schema
Language
External
schema
(roles)
Methods
[2GL] Assembly
(NIAM)
Internal
schema
(descriptors)
[3GL]FORTRAN, Algol
Procedures
BabyUML-rOOts
Communication Bus
A Discipline of Programming
Combining Three Architectures
© Trygve Reenskaug 2005
CommunicationCentered
Components
HTTP
/ HTML
Interactions
[3GL++]
C++, Java, C #
2016.05.29
Slide 28 of xx
New Challenges After 1973
• Evolution:
– Requirements change during development
– and forever after
• Open Systems
– Distributed components,
– No closed boundaries
• Multi Process
• Ownership
– Computer Literate users
– Demand better control
BabyUML-rOOts
© Trygve Reenskaug 2005
2016.05.29
Slide 29 of xx
BabyUML Goals
• Master Complexity
–
Divide and conquer
• Scale
–
inner -> global
• Safe and Secure
–
protect component boundaries
• Controlled system evolution
–
stored program
• Support reuse & interchange
– persistent components
BabyUML-rOOts
© Trygve Reenskaug 2005
2016.05.29
Slide 30 of xx
Thank You
More info at
heim.ifi.uio.no/~trygver
BabyUML-rOOts
© Trygve Reenskaug 2005
2016.05.29
Slide 31 of xx
More details ….
http://www.ifi.uio.no/~trygver
mailto: trygver ‘at’ ifi.uio.no
Trygve Reenskaug:
Towards a New Discipline of Programming with the BabyUML Language Laboratory.
http://heim.ifi.uio.no/~trygver/2005/babyuml/BabyUML.book.pdf
[UML] Unified Modeling Language: Superstructure. Version 2.0.
Object Management Group. Document ptc/04-10-02 or later
http://www.omg.org
Edsger Dijkstra: A Discipline of Programming, 1976
Trygve Reenskaug: Empowering People with BabyUML:
A sixth GenerationProgramming Language. Opening talk, ECOOP 2004, Oslo.
http://heim.ifi.uio.no/~trygver/2004/ECOOP-04/EcoopHandout.pdf
Model Driven Architecture
See: http://www.omg.org/mda/
Cattell, Barry: The Object Data Standard: ODMG 3.0. Academic Press,
London, 2000. ISBN 1-55860-647-4
BabyUML-rOOts
© Trygve Reenskaug 2005
2016.05.29
Slide 32 of xx
END END END END END END END
BabyUML-rOOts
© Trygve Reenskaug 2005
2016.05.29
Slide 33 of xx
Early UML Layered architecture
Core/MOF
M3
Class
«instanceOf»
«instanceOf»
UML
M2
Attribute
Class
«instanceOf»
«instanceOf»
Design
Person
M1
age: Integer
«instanceOf»
Application
M0
Mike: Person
age = 11
BabyUML-rOOts
© Trygve Reenskaug 2005
2016.05.29
Slide 34 of xx
Instatiation contra Inheritance
M3
BMetaMetaclass
«instance of»
M2
«instance of»
ProtoObject
(Squeak)
BMetaSimpleclass
«instance of»
M1
BActivity
«instance of»
M0
BBehavior
BBObject
BObject
BBehavior
actA
actB
BActivity
actC
BMetaMetaclass
BMetaSimpleclass
Inheritance5.sdr
BabyUML-rOOts
© Trygve Reenskaug 2005
2016.05.29
Slide 35 of xx
BabyUML
Initial instantiation structure
M3
BMetaMetaclass
«instance of»
«instance of»
M2
BMetaSimpleclass
«instance of»
M1
BActivity
«instance of»
M0
BabyUML-rOOts
BBehavior
BObject
actA
actB
actC
© Trygve Reenskaug 2005
2016.05.29
Slide 36 of xx
BabyUML
Class Inheritance Structure
ProtoObject
(Squeak)
BBObject
BBehavior
BMetaMetaclass
BActivity
BMetaSimpleclass
Inheritance5.sdr
BabyUML-rOOts
© Trygve Reenskaug 2005
2016.05.29
Slide 37 of xx
frontActivities query
define query frontActivities as
select act
from activities
where act.earlyStart.isNil
and
( select succ
from dependencies
where succ = act
and pred.earlyStart.isNil)
) isEmpty
BabyUML-rOOts
© Trygve Reenskaug 2005
2016.05.29
Slide 38 of xx
Stored Program, Object Computer
Smalltalk Object Space (Image))
SmalltalkObject
Object
Object
Object
Object
Object
Object
Smalltalk
Virtual Machine (VM)
BabyUML-rOOts
© Trygve Reenskaug 2005
2016.05.29
Slide 39 of xx
Stored Program, Object Computer
Smalltalk Object Space (Image))
Object
Object
Object
Object
Challenge:
Comprehend
300.000
objects
Object
Smalltalk
Virtual Machine (VM)
BabyUML-rOOts
© Trygve Reenskaug 2005
2016.05.29
Slide 40 of xx
UML Superstructure
Top Level Packages
Common
Behaviors
Classes
Profiles
Auxiliary
Constructs
Use
Cases
State
Machines
Interactions
Composite
Structures
Components
Activities
Deployments
Actions
Behavior
BabyUML-rOOts
Structural
© Trygve Reenskaug 2005
2016.05.29
Slide 41 of xx
COMBINE
Development Process Overview
Business Model
Requirements Model
Goal Model (Not UML)
Business process model
(Activity model. Manual-man/machine-automatic
Architecture & Design
activities)
Business information model
Stakeholders (Use case model)
Main Use Case Model
ModelSubsystem Use Case Models
Detailed Use Case Models
Platform Specific Model
Generated Code
& Deployment files
Business Application
Manual
Hierarchical Component
Models
Component Information
Models
Interface Models
Component Class Models
GUI Design
Sequence Diagrams
www.opengroup.org/combine/
BabyUML-rOOts
© Trygve Reenskaug 2005
2016.05.29
Slide 42 of xx
New tools needed for
communication-centered architectures
Burj Dubai – 800 m
BabyUML-rOOts
© Trygve Reenskaug 2005
2016.05.29
Slide 43 of xx
A BabyUML Component
encapsulates other objects
«Port»
Object
«Component»
Object
Object
«Port»
«Component» sampleNet
actA(2)
«Port»
actB(7)
«Port»
actC(3)
actD (2)
<2203>
«Port»
Object
Object
Object
BabyUML-rOOts
© Trygve Reenskaug 2005
2016.05.29
Slide 44 of xx
Summary-1:
Divide and Conquer with Components
BabyUML-rOOts
© Trygve Reenskaug 2005
2016.05.29
Slide 45 of xx
Download