domain-specific profiles for your uml tool

24
Dr. Darius Silingas | No Magic, Inc. Domain-Specific Profiles for Your UML Tool Building DSL Environments with MagicDraw UML

Upload: faunus

Post on 24-Jan-2016

56 views

Category:

Documents


2 download

DESCRIPTION

Domain-Specific Profiles for Your UML Tool. Building DSL Environments with MagicDraw UML. Contents. UML Extension Mechanisms MagicDraw DSL Customization Engine Workflow for Creating DSL Environment A Case Study: DSL for Modeling Organization Structure. UML ( Unified Modeling Language ). - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Domain-Specific Profiles for Your UML Tool

Dr. Darius Silingas | No Magic, Inc.

Domain-Specific Profilesfor Your UML ToolBuilding DSL Environments with MagicDraw UML

Page 2: Domain-Specific Profiles for Your UML Tool

Dr. Darius Silingas | No Magic, Inc.

Contents

• UML Extension Mechanisms• MagicDraw DSL Customization Engine• Workflow for Creating DSL Environment• A Case Study: DSL for Modeling Organization

Structure

Page 3: Domain-Specific Profiles for Your UML Tool

Dr. Darius Silingas | No Magic, Inc.

UML (Unified Modeling Language)

• De facto standard software modeling language– Standardized for 10 years already– Very popular but still not used by everyone– UML extension mechanisms are not anything new!– UML tools are starting to develop features for DSL

Page 4: Domain-Specific Profiles for Your UML Tool

Dr. Darius Silingas | No Magic, Inc.

UML Universal Modeling Language

Page 5: Domain-Specific Profiles for Your UML Tool

Dr. Darius Silingas | No Magic, Inc.

OMG 4 Layer Metamodel

MOF

UML metamodel

User model (UML)

Real world

corresponds to

corresponds to

corresponds to

UML diagramsbased on

is modeled using

M3

M2

M1

M0

Page 6: Domain-Specific Profiles for Your UML Tool

Dr. Darius Silingas | No Magic, Inc.

UML Extension Elements

• Profile is a reusable set of UML extensions• Stereotype extends semantics of standard UML

metaclass(es) and may also define additional properties and custom appearance icon– Tag Definition specifies additional property that is not

available in the extended metaclass(es)

• Constraint is a rule for domain-specific model correctness or completeness

• Also: Data Type, Enumeration, …

Page 7: Domain-Specific Profiles for Your UML Tool

Dr. Darius Silingas | No Magic, Inc.

Stereotype Definition and Application

<<Employee>>Darius Silingas

{e-mail = "[email protected]" , first name = "Darius" , last name = "Šilingas" , phone = "+37068612748" }

<<Employee>>Darius Silingas

<<Employee>>

e-mail = "[email protected]"first name = "Darius"last name = "Šilingas"phone = "+37068612748"

<<metaclass>>Class

<<stereotype>>Employee

first name : Stringlast name : Stringe-mail : Stringphone : String

Page 8: Domain-Specific Profiles for Your UML Tool

Dr. Darius Silingas | No Magic, Inc.

Contents

• UML Extension Mechanisms• MagicDraw DSL Customization Engine• Workflow for Creating DSL Environment• A Case Study: DSL for Modeling Organization

Structure

Page 9: Domain-Specific Profiles for Your UML Tool

Dr. Darius Silingas | No Magic, Inc.

Problems of UML Profiles

• UML modeling environment is too complex

• Applying stereotype doesn’t hide the UML properties, terminology, etc.

• Difficult to restrict usage of standard UML elements and ensure model correctness

Page 10: Domain-Specific Profiles for Your UML Tool

Dr. Darius Silingas | No Magic, Inc.

MagicDraw UML DSL Engine

Custom Diagram Wizard– Custom diagram for DSL profile with custom toolbar

elements, symbol styles, smart manipulators

DSL Customization– DSL stereotype appearance as first-class element– Custom specification editors– Custom context menus– Additional rules for model initialization and restrictions

Enhanced UML Profiling– Tag grouping, hiding stereotypes and tags,

customizing paths, etc.

Page 11: Domain-Specific Profiles for Your UML Tool

Dr. Darius Silingas | No Magic, Inc.

Contents

• UML Extension Mechanisms• MagicDraw DSL Customization Engine• Workflow for Creating DSL Environment• A Case Study: DSL for Modeling Organization

Structure

Page 12: Domain-Specific Profiles for Your UML Tool

Dr. Darius Silingas | No Magic, Inc.

Workflow for Creating DSL Environment

1. Define DSL metamodel

2. Map DSL metamodel to UML profile

3. Create DSL sample

4. Define customizations for stereotypes

5. Define validation rules

6. Create custom DSL diagram

7. Test the created DSL environment

Page 13: Domain-Specific Profiles for Your UML Tool

Dr. Darius Silingas | No Magic, Inc.

Contents

• UML Extension Mechanisms• MagicDraw DSL Customization Engine• Workflow for Creating DSL Environment• A Case Study: DSL for Modeling Organization

Structure

Page 14: Domain-Specific Profiles for Your UML Tool

Dr. Darius Silingas | No Magic, Inc.

1. Define DSL Metamodel

ProjectRole

Organization

OrganizationRole

Project

OrganizationUnit

Skill

Role

Employee

has

1..*

0..*

plays0..*0..*

work on

0..*

1..*

defines1

1..*has 10..*

contains

1..*

1

contains

0..*

1

requires

1..*

0..*

specifies

1..*

1supervises

0..*0..1

works in

1

1..*

Page 15: Domain-Specific Profiles for Your UML Tool

Dr. Darius Silingas | No Magic, Inc.

2. Map DSL Metamodel to UML Profile

<<stereotype>>Organization

[Package]

id : IntegerVAT code : Integertype : OrgType

<<stereotype>>Project

[Package]

start : dateend : datedescription : String

<<stereotype>>OrganizationRole

[Actor]

<<stereotype>>ProjectRole

[Actor]

<<stereotype>>Employee

[Class]

first name : Stringlast name : Stringe-mail : Stringphone : String

<<stereotype>>Supervise

[Dependency]

start : dateend : date

<<stereotype>>OrganizationUnit

[Package]

title : Stringaddress : Stringdescription : String

<<stereotype>>Skill

[Class]

description : String

<<stereotype>>RoleAssignment

[Dependency]

start : dateend : dateworkload : float

<<stereotype>>Role

[Actor]

instructions : String

department1

-requiredSkills

1..*

team

1..*

prerequisites

0..*

clients

1..*

skills

1..*

project

1suppliers

1..*

manager 1

Page 16: Domain-Specific Profiles for Your UML Tool

Dr. Darius Silingas | No Magic, Inc.

3. Create DSL Sample

• Should represent all major aspects of DSL!

<<OrganizationUnit>>

Training

<<Employee>>Darius Šilingas

<<Employee>>

e-mail = "[email protected]"phone = "+37068612748"skills =       English       UML 2       MDA       DSL

<<OrganizationRole>>Principal Trainer

<<Employee>>Ruslnas Vitiutinas

<<Skill>>openArchitectureWare

<<Skill>>Java Programming

<<Skill>>DSL

<<Skill>>English

<<Skill>>MDA

<<Skill>>UML 2

<<Supervise>><<RoleAssignment>>

Page 17: Domain-Specific Profiles for Your UML Tool

Dr. Darius Silingas | No Magic, Inc.

4. Create Customizations for Stereotypes

• Customizations are model elements, part of profile!

<<Customization>>EmployeeCustomization

<<Customization>>

allowedRelationships =       RoleAssignment       SupervisecustomizationTarget = EmployeehideMetatype = truepossibleOwners = OrganizationUnit

Page 18: Domain-Specific Profiles for Your UML Tool

Dr. Darius Silingas | No Magic, Inc.

5. Define Validation Rules

• Employees can be placed only in organization units

• Validation rules are constraints, part of profile!• Possibility to validate the user model against the rule!!

<<stereotype>>Employee

{owner.oclIsKindOf(OrganizationUnit)}

first name : Stringlast name : Stringe-mail : Stringphone : String

Page 19: Domain-Specific Profiles for Your UML Tool

Dr. Darius Silingas | No Magic, Inc.

6. Create Custom DSL Diagram

• Custom diagrams can be exported to XML descriptors and imported in other machines!

Page 20: Domain-Specific Profiles for Your UML Tool

Dr. Darius Silingas | No Magic, Inc.

7. Test the Created DSL Environment

• Demonstration in MagicDraw UML

Page 21: Domain-Specific Profiles for Your UML Tool

Dr. Darius Silingas | No Magic, Inc.

Enabling the Full Power of DSL

Create DSL-specific transformations– Model reports– DSL-specific patterns– Model 2 Model transformations– Model 2 Code transformations

Create guidance for DSL modeling– Project templates– Samples and tutorials– Modeling wizards– Reusable model libraries

Page 22: Domain-Specific Profiles for Your UML Tool

Dr. Darius Silingas | No Magic, Inc.

Why UML Profiles?

• Reuse of modeling environment features– Single modeling environment for different roles

• Possibility to use the extensions in standard UML diagrams– e.g., assign project role to activity swimlane

• Standardized model data storage and ability to interchange data between tools– MDA tools can be used for code generation

Page 23: Domain-Specific Profiles for Your UML Tool

Dr. Darius Silingas | No Magic, Inc.

References

• OMG. Unified Modeling Language: Superstructure– Formal Specification, version 2.1.2, 2007

• Bran Selic. A Systematic Approach to Domain-Specific Language Design Using UML

• Darius Silingas et. al. A Method for Creating Domain-Specific Modeling Environment Based on UML Profiles– Coming out this summer, check www.magicdraw.com

Page 24: Domain-Specific Profiles for Your UML Tool

Dr. Darius Silingas | No Magic, Inc.

Questions

???Let’s Keep in Touch!

– E-mail: [email protected]– Skype: darius.silingas