Devon M. Simmonds Computer Science Department, CSC592 1 Devon M. Simmonds Computer Science...

19
Devon M. Simmonds Computer Science Department, CSC592 1 Devon M. Simmonds Computer Science Department University of North Carolina, Wilmington [email protected] August 19, 2008 The Directive- Based Transformation Language (DBTL)

Transcript of Devon M. Simmonds Computer Science Department, CSC592 1 Devon M. Simmonds Computer Science...

Page 1: Devon M. Simmonds Computer Science Department, CSC592 1 Devon M. Simmonds Computer Science Department University of North Carolina, Wilmington simmondsd@uncw.edu.

Devon M. Simmonds Computer Science Department, CSC592 1

Devon M. SimmondsComputer Science Department

University of North Carolina, [email protected]

August 19, 2008

The Directive-Based Transformation

Language (DBTL)

Page 2: Devon M. Simmonds Computer Science Department, CSC592 1 Devon M. Simmonds Computer Science Department University of North Carolina, Wilmington simmondsd@uncw.edu.

Devon M. Simmonds Computer Science Department, CSC592 2

Software Development

Simple Tools

Power Tools

Blueprints

International Space Station

International Airport Baggage Handling System

Page 3: Devon M. Simmonds Computer Science Department, CSC592 1 Devon M. Simmonds Computer Science Department University of North Carolina, Wilmington simmondsd@uncw.edu.

Devon M. Simmonds Computer Science Department, CSC592 3

Models in Engineering

• Benefits of models– Help us understand and manage complex systems

– Communicate understanding

– Drive implementation

– Save resources

Need to improve the use of models in software development!

Page 4: Devon M. Simmonds Computer Science Department, CSC592 1 Devon M. Simmonds Computer Science Department University of North Carolina, Wilmington simmondsd@uncw.edu.

Devon M. Simmonds Computer Science Department, CSC592 4

4

Model Model AAModel Model AA

AAAA

BBBBCCCC

Model Model CCModel Model CC

Model Transformation

ModelModel B BModelModel B B

MMMM

AAAA

PPPPKKKK

Transformation

Page 5: Devon M. Simmonds Computer Science Department, CSC592 1 Devon M. Simmonds Computer Science Department University of North Carolina, Wilmington simmondsd@uncw.edu.

Devon M. Simmonds Computer Science Department, CSC592 5

Model-Driven Engineering (MDE)

CodeCodeCodeCode

CreateCreateModelModel

ModelModel of the Program of the ProgramModelModel of the Program of the Program

AAAA

BBBBCCCC

SC_MODULE(producer){sc_outmaster<int> out1;sc_in<bool> start; // kick-startvoid generate_data (){for(int i =0; i <10; i++) {out1 =i ; //to invoke slave;}}SC_CTOR(producer){SC_METHOD(generate_data);sensitive << start;}};SC_MODULE(consumer){sc_inslave<int> in1;int sum; // state variablevoid accumulate (){sum += in1;cout << “Sum = “ << sum << endl;}

CompileCompileModelModel

CompileCompileCodeCode

Binary instructionsBinary instructionsBinary instructionsBinary instructionsSC_MODULE(producer){sc_outmaster<int> out1;sc_in<bool> start; // kick-startvoid generate_data (){for(int i =0; i <10; i++) {out1 =i ; //to invoke slave;}}SC_CTOR(producer){SC_METHOD(generate_data);sensitive << start;}};SC_MODULE(consumer){sc_inslave<int> in1;int sum; // state variablevoid accumulate (){sum += in1;cout << “Sum = “ << sum << endl;}

Code-centric Development

ManuallyManually

Create CodeCreate Code

• Realizing the dream – MDD challenges– Model Specification– Model Transformation

• Model to model• Model to code

– Managing technologies– Model Analysis

Page 6: Devon M. Simmonds Computer Science Department, CSC592 1 Devon M. Simmonds Computer Science Department University of North Carolina, Wilmington simmondsd@uncw.edu.

Devon M. Simmonds Computer Science Department, CSC592 6

6

Transformation Languages

• Needed to support MDE!

ModelModel B BModelModel B B

MMMM

BBBBCCCC

AAAA

PPPPKKKK

Project #4

Page 7: Devon M. Simmonds Computer Science Department, CSC592 1 Devon M. Simmonds Computer Science Department University of North Carolina, Wilmington simmondsd@uncw.edu.

Devon M. Simmonds Computer Science Department, CSC592 7

7

class Department { private:          char name[40]; Student csc[100];public:     void manageStudents(){ csc[i]->register(); csc[i]->grade(); csc[i]->graduate();}}

Generating code from aspect-oriented design models

Project #5

:Student:Department

takeCourse()

takeCourse()

graduate()

Page 8: Devon M. Simmonds Computer Science Department, CSC592 1 Devon M. Simmonds Computer Science Department University of North Carolina, Wilmington simmondsd@uncw.edu.

Devon M. Simmonds Computer Science Department, CSC592 8

8

Model-to-model Transformation Conceptual

Model

Source Pattern

Transformation Schema

Interpreter

Target Pattern

Page 9: Devon M. Simmonds Computer Science Department, CSC592 1 Devon M. Simmonds Computer Science Department University of North Carolina, Wilmington simmondsd@uncw.edu.

Devon M. Simmonds Computer Science Department, CSC592 9

The Directive-Based Transformation Language

• Source pattern– Describes valid input models

• Transformation schema– Describes transformation to change

input model to output model– Transformations are specified using five

directives.

Page 10: Devon M. Simmonds Computer Science Department, CSC592 1 Devon M. Simmonds Computer Science Department University of North Carolina, Wilmington simmondsd@uncw.edu.

Devon M. Simmonds Computer Science Department, CSC592 10

|Participant

|participantOp(|a:|Ptype-1, |b:|Ptype-2)|manageUser

*

|TransactionManager

|clientID:String|serviceID:String

|transOperation(|param1:||Type1, |param2:Type2)

source.|TransactionManager

new |transState:String

redefine |clientID:String{name=Integer}

source.|Participant

new commit()

new abort()

handlesParticipant

0..1*new |getState():Boolean

new commit()

new abort()

*

MoneyTransferService

transID:String

serviceID:String

AccountManager

deposit(a:Account, amt:float)

withdraw(a:Account, amt:float)

handlesParticipant

0..1*

moneyTransfer(a:Account , b:Account, amt:float)

• Source Model

• Source Pattern

• Transformation Schema

Page 11: Devon M. Simmonds Computer Science Department, CSC592 1 Devon M. Simmonds Computer Science Department University of North Carolina, Wilmington simmondsd@uncw.edu.

Devon M. Simmonds Computer Science Department, CSC592 11

A Transformation Schema

Page 12: Devon M. Simmonds Computer Science Department, CSC592 1 Devon M. Simmonds Computer Science Department University of North Carolina, Wilmington simmondsd@uncw.edu.

Devon M. Simmonds Computer Science Department, CSC592 12

Transformation Directives

• The source directive– Copy model elements

• The name directive– Supply platform-specific name

• The redefine directive– Modify copied elements

• The new directive– Create new model elements

• The exclude directive– Eliminate model elements

Page 13: Devon M. Simmonds Computer Science Department, CSC592 1 Devon M. Simmonds Computer Science Department University of North Carolina, Wilmington simmondsd@uncw.edu.

Devon M. Simmonds Computer Science Department, CSC592 13

The source Directive

Page 14: Devon M. Simmonds Computer Science Department, CSC592 1 Devon M. Simmonds Computer Science Department University of North Carolina, Wilmington simmondsd@uncw.edu.

Devon M. Simmonds Computer Science Department, CSC592 14

The rename Directive

Page 15: Devon M. Simmonds Computer Science Department, CSC592 1 Devon M. Simmonds Computer Science Department University of North Carolina, Wilmington simmondsd@uncw.edu.

Devon M. Simmonds Computer Science Department, CSC592 15

The exclude, new & edefine Directives

Page 16: Devon M. Simmonds Computer Science Department, CSC592 1 Devon M. Simmonds Computer Science Department University of North Carolina, Wilmington simmondsd@uncw.edu.

Devon M. Simmonds Computer Science Department, CSC592 16

The source Directive

Page 17: Devon M. Simmonds Computer Science Department, CSC592 1 Devon M. Simmonds Computer Science Department University of North Carolina, Wilmington simmondsd@uncw.edu.

Devon M. Simmonds Computer Science Department, CSC592 17

The source Directive

Page 18: Devon M. Simmonds Computer Science Department, CSC592 1 Devon M. Simmonds Computer Science Department University of North Carolina, Wilmington simmondsd@uncw.edu.

Devon M. Simmonds Computer Science Department, CSC592 18

DBTL Model transformation Process

Page 19: Devon M. Simmonds Computer Science Department, CSC592 1 Devon M. Simmonds Computer Science Department University of North Carolina, Wilmington simmondsd@uncw.edu.

Devon M. Simmonds Computer Science Department, CSC592 19

Q u e s t i o n s ?

The End

Devon M. Simmonds, Computer Science Department, University of North Carolina Wilmington