35
Meng Tian [email protected] Extension in Domain Specific Code Generation with Ontology Based Aspect Weaving Supervisor: Julian Rathke [email protected]

Meng Tian [email protected]

  • Upload
    lowri

  • View
    49

  • Download
    0

Embed Size (px)

DESCRIPTION

Extension in Domain Specific Code Generation with Ontology Based Aspect Weaving. Meng Tian [email protected]. Supervisor: Julian Rathke [email protected]. Domain Specific Code Generation. Domain Specific Code Generation (DSCG) Model Driven Engineering (MDE) - PowerPoint PPT Presentation

Citation preview

Page 1: Meng Tian mt5e09@ecs.soton.ac.uk

Meng [email protected]

Extension in Domain Specific Code Generation with Ontology Based

Aspect Weaving

Supervisor: Julian [email protected]

Page 2: Meng Tian mt5e09@ecs.soton.ac.uk

Domain Specific Code Generation

Domain Specific Code Generation (DSCG)•Model Driven Engineering (MDE)•Raised abstraction level, highly automated•Increased productivity and reliability

Page 3: Meng Tian mt5e09@ecs.soton.ac.uk

Domain Specific Code Generation

Domain Specific Code Generation (DSCG)•Model Driven Engineering (MDE)•Raised abstraction level, highly automated•Increased productivity and reliability

Page 4: Meng Tian mt5e09@ecs.soton.ac.uk

Domain Specific Code Generation

Domain Specific Code Generation (DSCG)•Model Driven Engineering (MDE)•Raised abstraction level, highly automated•Increased productivity and reliability

However, in practice…

Page 5: Meng Tian mt5e09@ecs.soton.ac.uk

Extensions Required

e.g. to add logging facilities in the generated code.

Page 6: Meng Tian mt5e09@ecs.soton.ac.uk

Extensions Required

e.g. to add logging facilities in the generated code.

MDE orthodoxy

“model change

-> code re-generation”

Page 7: Meng Tian mt5e09@ecs.soton.ac.uk

Extensions Required

e.g. to add logging facilities in the generated code.

MDE orthodoxy

“model change

-> code re-generation”

Round-trip engineering

“code change

-> model reverse generation”

Page 8: Meng Tian mt5e09@ecs.soton.ac.uk

Extensions Required

e.g. to add logging facilities in the generated code.

MDE orthodoxy

“model change

-> code re-generation”

Round-trip engineering

“code change

-> model reverse generation”

What if change not expressible?

Page 9: Meng Tian mt5e09@ecs.soton.ac.uk

Extensions Required

e.g. to add logging facilities in the generated code.

MDE orthodoxy

“model change

-> code re-generation”

Round-trip engineering

“code change

-> model reverse generation”

What if change not expressible? Or even worse,

meta-model change is required

Page 10: Meng Tian mt5e09@ecs.soton.ac.uk

Evolving model-based software

Is meta-model change a good

thing?

Yes. Now my modelling language is more

expressive and powerful.

1. Is that still abstraction?

2. Is that cost effective?3. Compatible

problems?

Page 11: Meng Tian mt5e09@ecs.soton.ac.uk

Evolving model-based software

Is meta-model change a good

thing?

Yes. Now my modelling language is more

expressive and powerful.

1. Is that still abstraction?

2. Is that cost effective?3. Compatible

problems?

Page 12: Meng Tian mt5e09@ecs.soton.ac.uk

Extensions Required

e.g. to add logging facilities in the generated code.

MDE orthodoxy

“model change

-> code re-generation”

Round-trip engineering

“code change

-> model reverse generation”

What if M’=M

Page 13: Meng Tian mt5e09@ecs.soton.ac.uk

Modification CANNOT be reflected in the model.

Where is the problem?

Page 14: Meng Tian mt5e09@ecs.soton.ac.uk

Modification CANNOT be reflected in the model.

Where is the problem?

Causes:• Model and code are both

maintained explicitly as core products.

• Forceful synchronization of artefacts of two different abstraction level is unnecessary and may break abstraction levels.

Page 15: Meng Tian mt5e09@ecs.soton.ac.uk

Modification CANNOT be reflected in the model.

Where is the problem?

Causes:• Model and code are both

maintained explicitly as core products.

• Forceful synchronization of artefacts of two different abstraction level is unnecessary and may break abstraction levels.

Page 16: Meng Tian mt5e09@ecs.soton.ac.uk

What makes the magic mapping?

The code generator!

Page 17: Meng Tian mt5e09@ecs.soton.ac.uk

What makes the magic mapping?

The code generator!

Page 18: Meng Tian mt5e09@ecs.soton.ac.uk

What makes the magic mapping?

The code generator!

Page 19: Meng Tian mt5e09@ecs.soton.ac.uk

Our approach

• No “model-code” synchronization.

• An intermediate layer – aspect, between model and code, in which modification can be expressed flexibly.

• As the aspect languages are built based on the domain ontology, we call them Ontology Based Aspect languages (OBALs)

Page 20: Meng Tian mt5e09@ecs.soton.ac.uk

Our approach

Page 21: Meng Tian mt5e09@ecs.soton.ac.uk

Test with ANTLR Parser Generator

Production rule in ANTLR grammar

Extension for program synthesis functionalities in ANTLR grammar can be difficult, sometimes even impractical.

Page 22: Meng Tian mt5e09@ecs.soton.ac.uk

Test with ANTLR Parser Generator

Production rule in ANTLR grammar

Extension for program synthesis functionalities in ANTLR grammar can be difficult, sometimes even impractical.

Page 23: Meng Tian mt5e09@ecs.soton.ac.uk

Test with ANTLR Parser Generator

Production rule in ANTLR grammar

Extension for program synthesis functionalities in ANTLR grammar can be difficult, sometimes even impractical.

Page 24: Meng Tian mt5e09@ecs.soton.ac.uk

Test with ANTLR Parser Generator

Page 25: Meng Tian mt5e09@ecs.soton.ac.uk

Test with ANTLR Parser Generator

Count how many if-only statements in a Java program, and how many equality check involved.

Page 26: Meng Tian mt5e09@ecs.soton.ac.uk
Page 27: Meng Tian mt5e09@ecs.soton.ac.uk

3 “if” statements without “else”.

Page 28: Meng Tian mt5e09@ecs.soton.ac.uk

Test with ANTLR Parser GeneratorBegin_Parse_Rule_statement_Alternative_1();

End_Parse_Rule_statement_Alternative_1();

Begin_Match_Token_ELSE();

End_Match_Token_ELSE();

Page 29: Meng Tian mt5e09@ecs.soton.ac.uk

Test with ANTLR Parser GeneratorBegin_Parse_Rule_statement_Alternative_1();

End_Parse_Rule_statement_Alternative_1();

Begin_Match_Token_ELSE();

End_Match_Token_ELSE();

Page 30: Meng Tian mt5e09@ecs.soton.ac.uk

Test with ANTLR Parser GeneratorBegin_Parse_Rule_statement_Alternative_1();

End_Parse_Rule_statement_Alternative_1();

Begin_Match_Token_ELSE();

End_Match_Token_ELSE();

Page 31: Meng Tian mt5e09@ecs.soton.ac.uk

Test with ANTLR Parser Generator

Page 32: Meng Tian mt5e09@ecs.soton.ac.uk

Evaluation

Benefits

•It solves the “model non-reflectable” extension problem.

•It makes the generator extensible, instead of simply extending it.

•There is no model compatible problem.

•It allows modification to be described in a flexible way.

•The aspect based extension process can be fully automated.

Limitations

•Knowledge of the code generator is required.

•Maintenance of ontology tracing information

Page 33: Meng Tian mt5e09@ecs.soton.ac.uk

Conclusions

• We introduced a new approach for extending the generated code in model-based software development, i.e. via ontology-based aspect.

• Under certain assumptions, our approach can generate the aspect language over the ontology model, and produce the corresponding weaver provided ontology tracing information.

Page 34: Meng Tian mt5e09@ecs.soton.ac.uk

Future Work

• Standardize the ontology definition schema, i.e. meta meta

model.

• Supporting restrictions in domain ontology. E.g., access

control, conflict prevention. E.g., OCL based solution.

Page 35: Meng Tian mt5e09@ecs.soton.ac.uk

Any Question?