UML 2 in Together 2006 An Introduction to Model Driven Development and new capabilities of UML 2.

51
UML 2 in Together 2006 An Introduction to Model Driven Development and new capabilities of UML 2

Transcript of UML 2 in Together 2006 An Introduction to Model Driven Development and new capabilities of UML 2.

Page 1: UML 2 in Together 2006 An Introduction to Model Driven Development and new capabilities of UML 2.

UML 2 in Together 2006

An Introduction to Model Driven Development

and new capabilities of UML 2

Page 2: UML 2 in Together 2006 An Introduction to Model Driven Development and new capabilities of UML 2.

Scope:

UML 2 adds new modeling capabilities. These fall into two categories:

Advances in modelling static structures such as components Strengthening the ability to model dynamic behavior

Interactions expand on Sequence Diagrams Activities and Actions expand on the old Activity Diagram Statemachines expand the former Statechart Diagram

We cannot show it all in one hour We don't want to limit the audience to modeling experts

So we will work with just two kinds of diagram We will illustrate the work as we go, using Together 2006

Page 3: UML 2 in Together 2006 An Introduction to Model Driven Development and new capabilities of UML 2.

Overall Goal:

Construct a unified model using new UML 2 capabilities Class diagram as extended for encapsulated behaviored classes Behavior Model, using the activity diagram, likewise extended Unify the two thru the new common behavior model of UML2

Behaviored Classifier owns behaviors and behavioral features. Encapsulated Classifier controls communications by using ports Behaviors are “specified” by behavioral features Classifiers can own behaviors that execute on instantiation.

Three steps: Class diagram for static structural view. Activity diagram for dynamic behavior view. Set the SW_DevProject class as the context for its behavior:

Assign a Behavior as the essential behavior of the object class

Page 4: UML 2 in Together 2006 An Introduction to Model Driven Development and new capabilities of UML 2.

Intermediate Goal: Make this class diagram.

RoleOfPerson

RoleOfArtifact

SW_DevProject

ManagedWork

PersonKind

kindCodekindDescription:String

ProjectKind

kindCodekindDescription:String

Person

Store

<<enumeration>>ProjectStatus

greenyellowredcancelled

StoreKind

kindCodekindDescription:String

Artifact

ArtifactKind

kindCodekindDescription:String

enact

Location

assignedKind 1..1

kind

0..*

status

0..*content

1..1

kind

0..*

worker

asPlanned

ownedProjectLog

0..1

asExecuted

1..1

kind

allocations1..*

workspace

0..*0..* workthing

1..1

kind

0..*repository

And understand what it means New UML 2 features: ports and associations

Page 5: UML 2 in Together 2006 An Introduction to Model Driven Development and new capabilities of UML 2.

The Diagram Shows Classes for:

Software Development Projects: SW_DevProject A behaviored classifier, with a port and an Inner Class

An enumeration type for project status values. A class for cataloging standard kinds of project (blue) A class for the storage resources available to Project. Persons to participate in Projects (color modeling green) An association class for the locating Artifacts in Stores. An Artifact class for documents, files, and executables. An ArtifactRole class for different ways artifacts relate:

Some are resources used by the project Others are workproducts created by the project And so on…

Page 6: UML 2 in Together 2006 An Introduction to Model Driven Development and new capabilities of UML 2.

Methodology

In line with the SDO Theme of DevCon, we will Take Software Development Projects as our subject, Resulting in a self-referential project for the problem domain of

software development projects.

MODEL DRIVEN DEVELOPMENT (not MDA but MDD) Start with a model of the problem domain. Feel free to go beyond the view of projects found in current

tools. Emphasis on what SW Projects really involve, move to SDO.

At the end, we want a model of software development to use as the context for later development of support tools.

Page 7: UML 2 in Together 2006 An Introduction to Model Driven Development and new capabilities of UML 2.

Create a new project.

Remember, it will be a project that will model what a project is. Self referential stuff happening.

Page 8: UML 2 in Together 2006 An Introduction to Model Driven Development and new capabilities of UML 2.

File | New | Project | Wizard List

Page 9: UML 2 in Together 2006 An Introduction to Model Driven Development and new capabilities of UML 2.

New Project has top-level diagram.

Page 10: UML 2 in Together 2006 An Introduction to Model Driven Development and new capabilities of UML 2.

Unfold the Project node.

Page 11: UML 2 in Together 2006 An Introduction to Model Driven Development and new capabilities of UML 2.

UML organizes by Package

We choose to model from two points of view: Static Structure, using a Class Diagram Dynamic Behavior, in this case, Activity Diagram

This is a good approach, but not the only one. We will create a modeling package for each view:

Our first package will be named

staticProjectStructure The intent is to represent the “real-world” items that

make up a software development project. Package will hold a class from which to instantiate:

SW development projects

Page 12: UML 2 in Together 2006 An Introduction to Model Driven Development and new capabilities of UML 2.

Create package to organize the model.

Page 13: UML 2 in Together 2006 An Introduction to Model Driven Development and new capabilities of UML 2.

Use any of three views to rename package.

Page 14: UML 2 in Together 2006 An Introduction to Model Driven Development and new capabilities of UML 2.

New package gets its own package diagram.

Page 15: UML 2 in Together 2006 An Introduction to Model Driven Development and new capabilities of UML 2.

Create a class to represent Software Projects.

Page 16: UML 2 in Together 2006 An Introduction to Model Driven Development and new capabilities of UML 2.

Make it pretty.

Page 17: UML 2 in Together 2006 An Introduction to Model Driven Development and new capabilities of UML 2.

Add behavioral features. AKA operations.

Page 18: UML 2 in Together 2006 An Introduction to Model Driven Development and new capabilities of UML 2.

Specify the operations with signatures.

Page 19: UML 2 in Together 2006 An Introduction to Model Driven Development and new capabilities of UML 2.

OOPs! Undo

We need to see how to add operations to Classes But this is old UML 1 stuff Let's represent the behavior of SW projects UML 2 style

Page 20: UML 2 in Together 2006 An Introduction to Model Driven Development and new capabilities of UML 2.

Behavior

Operation

Parameter

Constraint

BehavioralFeature

BehavioredClassifier

context

ownedBehavior

classifierBehavior

{ordered}

ownedMember

precondition

postconditionspecification

Part of the extended UML 2 Metamodel

Page 21: UML 2 in Together 2006 An Introduction to Model Driven Development and new capabilities of UML 2.

Central domain entity has dynamic behavior

SW_DevProject

Page 22: UML 2 in Together 2006 An Introduction to Model Driven Development and new capabilities of UML 2.

Elaborate the static model.

Store

Artifact

SW_DevProject

:

ArtifactKind

kindCodekindDescription:String

ProjectKind

kindCodekindDescription:String

StoreKind

kindCodekindDescription:String

1..*

output

1..*

input

1..*

workspace

1..1

1..1

1..1

Page 23: UML 2 in Together 2006 An Introduction to Model Driven Development and new capabilities of UML 2.

Apply the color pattern where appropriate.

MomentInterval

dateOrTimeInterval

ThingRole

roleName:String

listRoles

Thing

serialNumber:String

+listThings

ThingDescription

type

listDescriptions

o..*0..*1..10..* 1..10..*

Simplified view of the Domain Neutral Component

Page 24: UML 2 in Together 2006 An Introduction to Model Driven Development and new capabilities of UML 2.

PlaceRole

roleName: StringroleSpecificAttribute

listRoles

Place

serialNumber: StringparticularDescription

+listThings

PartyRole1

roleName: StringroleSpecificAttribute

listRoles

PartyDescription

typereusableDescription

listDescriptions

Party

serialNumber: StringparticularDescription

+listThings

ThingRole

roleName: StringroleSpecificAttribute

listRoles

Thing

serialNumber: StringparticularDescription

+listThings

ThingDescription

typereusableDescription

listDescriptions

MomentI ntervalDetail

dateOrTimeI nterval

calcTotal

MomentI nterval

status

generateNextgenerateMI DetailcalcTotalAcrossMI DetailsassessWRTnextassessWRTactuallistMI DetailslistMI s

PlaceDescription

typereusableDescription

listDescriptions

1..10..*1..10..*

1..*

planactual

o..*0..*

1..10..* 1..10..*

1..10..*0..*1..1

0..*1..1

next

0..1

1..10..*

More detailed view of the color pattern DNC.

The Domain Neutral Component in more detail.

Page 25: UML 2 in Together 2006 An Introduction to Model Driven Development and new capabilities of UML 2.

Apply the Domain Neutral Component

PersonRoleOfPerson

Store

RoleOfArtifact

StoreKind

kindCodekindDescription:String

PersonKind

kindCodekindDescription:String

SW_DevProject

ArtifactKind

kindCodekindDescription:String

ProjectKind

kindCodekindDescription:String

<<enumeration>>ProjectStatus

greenyellowredcancelled

Artifact

location

resource

assignedKind

1..1

kind

0..*

1..1

kind

0..*

worker

asPlanned

0..1

asExecuted

1..1

kindallocatedWorkspaces 1..*

workspace

0..*0..*

workthing

1..1

kind

status

Page 26: UML 2 in Together 2006 An Introduction to Model Driven Development and new capabilities of UML 2.

Upgrade the location relationship to first-class UML 2 has stronger support for Association Classes Allows adding ends to model n-tuples No rolename for association because it is not an end.

Page 27: UML 2 in Together 2006 An Introduction to Model Driven Development and new capabilities of UML 2.

The Behaviored Classifier

And Structured Classifier Stronger ability to model component structures

Using Together to peek at the metamodel.

Page 28: UML 2 in Together 2006 An Introduction to Model Driven Development and new capabilities of UML 2.

Structured Classifier Notation with Interfaces

Interface1

EncapsulatedClassifier B

OtherPart[1]

OtherPart2[1]

Port

Port

EncapsulatedClassifier A

-Part1[1]

Part[1]Port

PortInterface2

Interface3

Required

Provided

Page 29: UML 2 in Together 2006 An Introduction to Model Driven Development and new capabilities of UML 2.

Adding a behavior port.

change isBehavior isService

Page 30: UML 2 in Together 2006 An Introduction to Model Driven Development and new capabilities of UML 2.

Together automatically maintains Package Diagram.

Page 31: UML 2 in Together 2006 An Introduction to Model Driven Development and new capabilities of UML 2.

Adding an Inner Class

A project involves work that produces the deliverables.

Create class for ManagedWork in the diagram for package.

Drag and drop it into the SW_DevProject class.

Page 32: UML 2 in Together 2006 An Introduction to Model Driven Development and new capabilities of UML 2.

View of the resulting diagram

RoleOfPerson

RoleOfArtifact

SW_DevProject

ManagedWork

PersonKind

kindCodekindDescription:String

ProjectKind

kindCodekindDescription:String

Person

Store

<<enumeration>>ProjectStatus

greenyellowredcancelled

StoreKind

kindCodekindDescription:String

Artifact

ArtifactKind

kindCodekindDescription:String

enact

Location

assignedKind 1..1

kind

0..*

status

0..*content

1..1

kind

0..*

worker

asPlanned

ownedProjectLog

0..1

asExecuted

1..1

kind

allocations1..*

workspace

0..*0..* workthing

1..1

kind

0..*repository

Page 33: UML 2 in Together 2006 An Introduction to Model Driven Development and new capabilities of UML 2.

Close and reopen.

Page 34: UML 2 in Together 2006 An Introduction to Model Driven Development and new capabilities of UML 2.

Goal 2: Make an Activity diagram.

PhaseActivity

Produce Workproducts

realizations

Review Workproducts

valuations

<<datastore>>PhaseRepository

TimeBoxLimit

Define Workproducts

Define Schedule

specifications

schedule

workproduct output

We may choose to do a new diagram in class. But it will be similar to this and for the same domain. Then connect the Activity to the SW_DevProject Class

Page 35: UML 2 in Together 2006 An Introduction to Model Driven Development and new capabilities of UML 2.

Add second package for dynamic view.

Page 36: UML 2 in Together 2006 An Introduction to Model Driven Development and new capabilities of UML 2.

As with all things, work graphically if you wish.

Page 37: UML 2 in Together 2006 An Introduction to Model Driven Development and new capabilities of UML 2.

Package “dynamicProjectBehavior”

An empty package with an empty diagram.

Page 38: UML 2 in Together 2006 An Introduction to Model Driven Development and new capabilities of UML 2.

We need to model a behavior in this package.

A StateMachine or Interaction model could be used. We choose to model project behavior as Activity

Behavior Parameter

Constraint

BehavioralFeature

BehavioredClassifier

Operation Activity StateMachine I nteraction

context

ownedBehavior

classifierBehavior

{ordered}

ownedMember

precondition

postcondition

specification

precondition

postcondition

ownedMember

Page 39: UML 2 in Together 2006 An Introduction to Model Driven Development and new capabilities of UML 2.

Activity is one specialization of Behavior.

Using Together to peek at the metamodel.

To make them able to matchOperations (aka Functions)the UML 2 Behaviors have Parameter Sets.

Page 40: UML 2 in Together 2006 An Introduction to Model Driven Development and new capabilities of UML 2.

So create an Activity in an ActivityDiagram

WorkAccordingToScrum

Page 41: UML 2 in Together 2006 An Introduction to Model Driven Development and new capabilities of UML 2.

Activities can represent Control Flows.

ActivityWithFlows

Action

Action

Action

Action

Action

[true]

[false]

Page 42: UML 2 in Together 2006 An Introduction to Model Driven Development and new capabilities of UML 2.

Control Flow Nodes

Control Flows with Guard Expressions Initial Final Ends the Entire Activity Process

FlowFinal is a useful new capability for local "thread" death

Decision branch merge

Fork Join

Although they use the same graphic, the syntax of Fork and Join are different, likewise wrt Branch and Merge.

Page 43: UML 2 in Together 2006 An Introduction to Model Driven Development and new capabilities of UML 2.

Only one path can be taken in executing this.

Need x-or guard conditions

Nonsense Random Waving Activity

High-Five Boris's Right

High-Five Boris's Left

High-Five Karl's Left

High-Five Karl's Right

MergeNode

DecisionNode

Page 44: UML 2 in Together 2006 An Introduction to Model Driven Development and new capabilities of UML 2.

Non-Sequential, Maybe Concurrent/ParallelDouble-High-Five Activity

High-Five Boris's Right

High-Five Boris's Left

High-Five Karl's Left

High-Five Karl's Right

Missing Concept: do all 4 actions occur at same TIME?

Page 45: UML 2 in Together 2006 An Introduction to Model Driven Development and new capabilities of UML 2.

Compare with an alternative notation

TerminateEvent

Event1 Event2 Event3 Event4

Event1 Event4Event2 Event3

Event1 Event2 Event3 Event4

Event1 Event2 Event3 Event4

Called "swimlanes" or "partitions". Difference is that Lanes are labelled by responsible party

Page 46: UML 2 in Together 2006 An Introduction to Model Driven Development and new capabilities of UML 2.

Semantic-Aware Tools For Activities

Data Flow Arrows are different From Control Flow Input and Output Pins can be Typed for ObjectFlows

Control Flow Elements

Data Flow Elements

Page 47: UML 2 in Together 2006 An Introduction to Model Driven Development and new capabilities of UML 2.

Make this process the “classifier behavior”.

Set the context for this Activity to be ManagedWork

Page 48: UML 2 in Together 2006 An Introduction to Model Driven Development and new capabilities of UML 2.

Three Behaviors Modeled In Together

Top-Level Project Behavior Generic Phase of a Project – not methodology specific Development Work by Scrum

Page 49: UML 2 in Together 2006 An Introduction to Model Driven Development and new capabilities of UML 2.

Project

projectExecutionProcess

ProjectReport<<datastore>>ProjectStore

DeliverOutcomeInvokeManagedWork

cancellationSignal

ProjectTimeExceeded

ReleaseResourcesAcquireResources

ReviewProject

outputinput

start review

[nextPhase=yes]

[nextPhase=no]

artifacts used

artifacts delivered

Page 50: UML 2 in Together 2006 An Introduction to Model Driven Development and new capabilities of UML 2.

Phase

PhaseActivity

Produce Workproducts

realizations

Review Workproducts

valuations

<<datastore>>PhaseRepository

TimeBoxLimit

Define Workproducts

Define Schedule

specifications

schedule

workproduct output

Page 51: UML 2 in Together 2006 An Introduction to Model Driven Development and new capabilities of UML 2.

ScrumWorkAccordingToScrum

aBackLogItem

<<datastore>>ProductBacklo

g

PrioritizeBacklogAdd To BacklogNew Item

sprintPlanningSessioinStart

SelectItemsForSprintBacklog

<<centralBuffer>>SprintBacklog

RealizeItemsFromSprintBacklog

<<datastore>>ProjectWorkproducts

DemonstrateScrumRealizations

aWorkingExecutable

aBackLogItem

MergeNode20

AnotherSprint?

SprintEndSignal

[developer available = true]

[anotherSprint = true]

Final

FlowFinal