Trygve Reenskaug University of Oslo The BabyUML Discipline of Programming

advertisement
The BabyUML Discipline of Programming
where A Program =
Communication + Data Structures + Algorithms
App.
App.
DataBase
App.
App.
Trygve Reenskaug
University of Oslo
BabyUML-ECMDA
© Trygve Reenskaug 2005
ECMDA 2005
2016.05.29
Slide 1
Project Planning with
Activity Networks
actA (1-2-3)
actC (3-3-6)
actD (8-2-10)
actB (1-7-8)
ActA
ActB
ActC
ActD
1
BabyUML-ECMDA
2
3
4
5
6
week
© Trygve Reenskaug 2005
7
2016.05.29
8
9
10
Slide 3
The Problem
Undisciplined communication → Spaghetti
User
tools
actA
actC
Project
resources
Project
activities
Class, superclasses, methods
→ Noodles actD
actB
Class
Class
Class
BabyUML-ECMDA
© Trygve Reenskaug 2005
2016.05.29
Slide 4
The BabyComponent
resources
«Component»
resources«Component»
gui
«Component»
gui«Component»
activityNetwork
«Component»
activityNetwork«Component»
BabyUML-ECMDA
© Trygve Reenskaug 2005
2016.05.29
Slide 5
BabyUML Laboratory
Overview
Partition Object Space into
BabyComponents
Encapsulates member objects
• Data Structures
declare Member Objects
defines Universe of Discourse
• Communication
BabyCollaboration
operations as Interacting Roles
• Algorithms
classes, superclasses, methods
BabyUML-ECMDA
© Trygve Reenskaug 2005
2016.05.29
Slide 6
Conventional Activity class
(pseudocode fragment)
Define class Activity subclass of Object
with attributes
name, duration, earlyStart,
Activity [ ] preds, succs
method addSuccessor (anActivity)
add anActivity to succs.
method addPredecessor (anActivity)
add anActivity to preds.
BabyUML-ECMDA
© Trygve Reenskaug 2005
2016.05.29
Slide 7
Code that Declares
the Universe of Discourse
3-schema
architecture
«UML-like schema»
Activity
External
name
earlyStart
earlyFinish
frontLoad: firstWeek preds
resetEarlyStart
Conceptual
Internal
*
succs
BabyUML-ECMDA
*
© Trygve Reenskaug 2005
2016.05.29
Slide 8
Code
Preserves Referential Integrity
Define class Activity subclass of Object
with attributes name, duration, earlyStart
method frontloadFrom (firstWeek)
earlyStart := firstWeek.
babyBase predecessorsOf (self) do:
[:predecessor |
earlyStart := max (earlyStart, predecessor earlyFinish]
BabyUML-ECMDA
© Trygve Reenskaug 2005
2016.05.29
Slide 9
BabyComponent
Provided Interface
«provided interface»
newActivity (name)
addDependent (from, to)
frontloadFrom (firstWeek)
activityNames
xmlActivity (activityName)
«Component»
activityNetwork
BabyUML-ECMDA
© Trygve Reenskaug 2005
2016.05.29
Slide 10
A Projection for each
Provided Operation
activityNetwork
«component»
«UML-like schema»
Activity
frontloadFrom (firstWeek)
name
earlyStart
earlyFinish
frontLoad: firstWeek preds
resetEarlyStart
*
succs
BabyUML-ECMDA
*
© Trygve Reenskaug 2005
2016.05.29
Slide 11
Frontloading Interaction
Communication Code
maestro
frontloadFrom (firstWeek)
activitiesCollab
resetter
resetEarlyStart
«LOOP»
frontCollab
[frontloader exists]
frontloader
frontloadFrom (firstWeek)
example-frontload21
BabyUML-ECMDA
© Trygve Reenskaug 2005
2016.05.29
Slide 12
Fragment: activitiesCollab
Query: Data Structure
maestro
Communication
activitiesCollab
resetter
activitiesCollab «Collaboration»
resetEarlyStart
*
maestro
interact-activitiesCollab-1
resetter
resetEarlyStart
collab- activitiesCollab
Data Structure
activitiesCollab
bindRole resetter
toMembers babyBase.activities.
«UML-like schema»
Query
Activity
name
earlyStart
earlyFinish
frontLoad: firstWeek preds
resetEarlyStart
Conceptual Schema
BabyUML-ECMDA
© Trygve Reenskaug 2005
2016.05.29
*
succs
*
Slide 13
Fragment: activitiesCollab
Algorithm: resetEarlyStart
maestro
External Schema
Communication
activitiesCollab
resetter
activitiesCollab «Collaboration»
resetEarlyStart
maestro
*
interact-activitiesCollab-1
Communication
collab- activitiesCollab
resetter
resetEarlyStart
Data Structure
Algorithm
«UML-like schema»
Activity
resetEarlyStart
earlyStart := nil
name
earlyStart
earlyFinish
frontLoad: firstWeek preds
resetEarlyStart
*
succs
BabyUML-ECMDA
© Trygve Reenskaug 2005
2016.05.29
*
Slide 14
Frontloading Interaction
Sequence Diagram
maestro
frontloadFrom (firstWeek)
activitiesCollab
resetter
resetEarlyStart
«LOOP»
frontCollab
[frontloader exists]
frontloader
frontloadFrom (firstWeek)
example-frontload21
BabyUML-ECMDA
© Trygve Reenskaug 2005
2016.05.29
Slide 15
Fragment: frontCollab
Query: Data Structure
«LOOP»
frontCollab «Collaboration»
frontCollab
[frontloader exists] frontloader
maestro
1
frontloadFrom (firstWeek)
frontloader
frontloadFrom (firstWeek )
1
Communication
collab-frontCollab-0
*
predecessor
Query
Data Structure
earlyStart
collab-frontCollab-1
frontCollab
«UML-like schema»
bindRole frontloader toMember:
Activity
find act from activities such that:
name
(act planned not and all act.predecessors.planned)earlyStart
earlyFinish
bindRole predecessor toMembers:
frontLoad: firstWeek preds
resetEarlyStart
*
babyBase predecessorsOf (frontloader).
succs
BabyUML-ECMDA
© Trygve Reenskaug 2005
2016.05.29
*
Slide 16
Fragment: frontCollab
Algorithm: frontLoadFrom ( )
«LOOP»
frontCollab «Collaboration»
frontCollab
[frontloader exists] frontloader
maestro
1
frontloadFrom (firstWeek)
frontloader
frontloadFrom (firstWeek )
1
collab-frontCollab-0
*
Communication
predecessor
earlyStart
collab-frontCollab-1
Data Structure
«UML-like schema»
Algorithm
Activity
frontloadFrom (firstWeek)
earlyStart := firstWeek .
forAll predecessor do:
[:pred |
earlyStart := max (earlyStart, pred earlyFinish)
BabyUML-ECMDA
© Trygve Reenskaug 2005
name
earlyStart
earlyFinish
frontLoad: firstWeek preds
resetEarlyStart
*
succs
2016.05.29
*
Slide 17
BabyUML Summary: 1 of 4
Stored Program Object Computer
Class
Class
Class
BabyUML Virtual Machine
(Smalltalk/Squeak VM)
BabyUML-ECMDA
© Trygve Reenskaug 2005
2016.05.29
Slide 18
BabyUML Summary: 2 of 4
BabyComponents
resources «Component»
gui «Component»
activityNetwork «Component»
BabyUML Virtual Machine
(Smalltalk/Squeak VM)
BabyUML-ECMDA
© Trygve Reenskaug 2005
2016.05.29
Slide 19
BabyUML Summary: 3 of 4
Anatomy of a Component
activityNetwork «Component»
Member Objects
Port
Maestro
BabyBase
BabyUML Virtual Machine
(Smalltalk/Squeak VM)
BabyUML-ECMDA
© Trygve Reenskaug 2005
2016.05.29
Slide 20
BabyUML Summary: 4 of 4
A Coherent Discipline
activityNetwork «Component»
Member Objects
Port
Maestro
BabyBase
Algorithms
Data Structure
Communication
Component identity
BabyUML-ECMDA
© Trygve Reenskaug 2005
2016.05.29
Slide 21
Finally, A Challenge
Modeling languages
remind us
what should be included in our
Programming Languages
More info at heim.ifi.uio.no/~trygver
BabyUML-ECMDA
© Trygve Reenskaug 2005
2016.05.29
Slide 22
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
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
Unified Modeling Language: Superstructure. Version 2.0.
Object Management Group. Document ptc/04-10-02 or later
http://www.omg.org
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
Erik Arisholm and Dag Sjøberg, A Controlled Experiment with Professionals to Evaluate the Effect of a
Delegated versus Centralized Control Style on the Maintainability of Object-Oriented Software, Simula
Research Laboratory Technical Report 2003-6
http://www.simula.no/publication_one.php?publication_id=601
Richard Pawson and Robert Matthews: Naked Objects. Wiley 2002, ISBN: 0-470-84420-5
BabyUML-ECMDA
© Trygve Reenskaug 2005
2016.05.29
Slide 23
Download