45
How to Build Your Own Product Modeling Environment Tim Geisler webXcerpt Software GmbH [email protected] CWG 2012, Berlin 2012-05-08

How to Build Your Own Product-Modeling Environment?

Embed Size (px)

Citation preview

Page 1: How to Build Your Own Product-Modeling Environment?

How to Build Your OwnProduct Modeling Environment

Tim Geisler

webXcerpt Software GmbH

[email protected]

CWG 2012, Berlin 2012-05-08

Page 2: How to Build Your Own Product-Modeling Environment?

Product Modeling Environments

Page 3: How to Build Your Own Product-Modeling Environment?

Product Modeling Environments:Single Transactions

Page 4: How to Build Your Own Product-Modeling Environment?

Product Modeling Environments:PMEVC

Page 5: How to Build Your Own Product-Modeling Environment?

Product Modeling Environments:Eclipse-based SME

Page 6: How to Build Your Own Product-Modeling Environment?

VClipse

● Eclipse-based textual product modeling environment

● for VC and IPC● based on Xtext / EMF

● Open SourceEclipse Public Licensewww.vclipse.org

Page 7: How to Build Your Own Product-Modeling Environment?

VClipse - VCML

● Textual language for SAP objects

● Embedded languages for dependencies (procedures, conditions, and constraints)

Page 8: How to Build Your Own Product-Modeling Environment?

IDE for VCML

Validation

Content AssistQuickfixes

Cross References

Page 9: How to Build Your Own Product-Modeling Environment?

IDE for VCML

Outline

TemplatesFolding

Renamerefactoring

Where used?

Page 10: How to Build Your Own Product-Modeling Environment?

Interface to SAP ECC (ALE, RFC)

● RFC interface− Create, Read, Update, Delete− Extract recursively: model extraction

● ALE interface− Sending models via IDocs (PDR)

● Delta calculation− Compute and send only changed objects

● „One-click delta deployment“− Send delta via PDR, automatic processing in SAP

Page 11: How to Build Your Own Product-Modeling Environment?

Graphical or TextualProduct Modeling?

Deutsch limit:

You can’t have more than 50 visual primitives on the screen at the same time.

Page 12: How to Build Your Own Product-Modeling Environment?

Focus on Textual Product Models

● Dependencies are written in textual languages● Teamwork support through mature version

control systems● Powerful tools exist and can be used for free:

− Difference tools, search, replace, ...

● Enables offline product modeling● More information is visible on a screen● Text-based product modeling environments are

easy to create with today's frameworks

Page 13: How to Build Your Own Product-Modeling Environment?

Specialized Modeling Environments

Page 14: How to Build Your Own Product-Modeling Environment?

Why Own Specialized PME?

● Product modeling environments from SAPhave to suit all models of all SAP customers

● Customer-specific product modeling is not supported

− Naming conventions− Coding conventions− Variant functions− …

● Customer's notions not used− Not everything is a material, class, or characteristic

Page 15: How to Build Your Own Product-Modeling Environment?

VClipse is Not (Yet) Your Own PME

● not (yet) customer-specific

● Several layers to extend Vclipse:− As a user / modeler− As a (Java) programmer− As a contributor

Page 16: How to Build Your Own Product-Modeling Environment?

Extending VClipse – as ModelerDefine your own templates

E.g., template for determining amount of a material(specific coding convention)

Page 17: How to Build Your Own Product-Modeling Environment?

Extending VClipse – as ProgrammerWrite your own plugins / extend VClipse plugins

Specific validation rules

● e.g. naming conventions

Resulting validation inVCML editor

VcmlJavaValidator.java

Page 18: How to Build Your Own Product-Modeling Environment?

Extending VClipse – as Programmer

Coding conventions / Framework code

● Classes and dependencies are required by the „framework“ for different functionalities

● Validation rules should check

− if a certain procedure or dependency net is present,then certain classes must be present.

− the order of procedures

− …

● Templates (by a modeler)

− The classification and configuration profile could be generated by a template.

Page 19: How to Build Your Own Product-Modeling Environment?

Extending VClipse – as Programmer

● Specific „intelligent“ templates

Implementation:

Page 20: How to Build Your Own Product-Modeling Environment?

Specific Support for Variant Functions

● Implement specific validation● Implement specific code templates

PFunction Z_COPY_DEFAULT_MV (GEN_CSTIC_1_NAME = 'MVCSTIC1'GEN_CSTIC_2_NAME = 'MVCSTIC2'GEN_INSTANCE = 'PARENT'

)

name of multivalued characteristic

one of SELF, PARENT, ROOT

compatible type

Page 21: How to Build Your Own Product-Modeling Environment?

Specifying Variant Functionsimport "cstics.vcml" // contains all cstic definitionsvariantfunction Z_COPY_DEFAULT_MV "Copy default values (MV)" {

GEN_CSTIC_1_NAME : in CharacteristicNameMVGEN_CSTIC_2_NAME : in CharacteristicNameMVGEN_INSTANCE : in CharacteristicValues

}

VCMLValidation

VCMLTemplates

CML integration

Javaimplementation

stub

Documentation

ABAPimplementation

stub

VCMLTooltips

Variantfunctionobject

Generating Artifacts:

Page 22: How to Build Your Own Product-Modeling Environment?

Extending VClipse – as Contributor

Testing language VCMLT for VCML models(contributed to VClipse by Winfried Kung)

See talk byTim Geisler and Christophe Faure

Track 3, 11:15 – 12:00

Page 23: How to Build Your Own Product-Modeling Environment?

Conceptual Gap● SAP VC's concepts

● Implementation

● Standard languages

● Transactions

● VClipse

● Your concepts

● Specification

● Your languages

● Your ownmodeling environment

Page 24: How to Build Your Own Product-Modeling Environment?

Your Own Modeling Language

● Why?− Tailored to your concepts and needs− Means for specifying the product model− Means for communication with the domain expert− Formal specification language

● Overcome the gap by generating VCML code

Page 25: How to Build Your Own Product-Modeling Environment?

Example: ConfigModeler @

RFC

Editor/IDE

Editor/IDE

ConfigModeler

VClipse

CML

VCML

Code Generation

Page 26: How to Build Your Own Product-Modeling Environment?

ConfigModeler – Initial Idea

StandardizedStandardizedproductproductdescriptionsdescriptions

FormalizedFormalizedproductproductdescriptionsdescriptions ConfigModeler + VClipse

Eclipse-based IDEscode generation

CML asspecification and

documentation language

CWG 2010 ViennaCWG 2011 Cologne

Page 27: How to Build Your Own Product-Modeling Environment?

ConfigModeler – Languages

CMLUI: User Interface

CML: Product model

CMLT: Test cases

Page 28: How to Build Your Own Product-Modeling Environment?

When to Create Own Language andProduct Modeling Environment?

● Schematic product specifications● Similarly structured products● Schematic translation● Schematic implementation● Model migration from legacy to SAP

− intermediate language with manipulation possibilities (refactoring, commented code, …)

● …

Page 29: How to Build Your Own Product-Modeling Environment?

My Own Product-Modeling Environment

RFC

Editor/IDE

Editor/IDE

my ConfigModeler

VClipse

myCML

VCML

my Code Generation

Page 30: How to Build Your Own Product-Modeling Environment?
Page 31: How to Build Your Own Product-Modeling Environment?

Editor/IDE

my ConfigModeler

myCML

my Code Generation

GrammarMetamodel Scoping

Validation

Target Architecture

Code Generation

VClipse Adaptions

Exports / Reports

Graphical Views

Import from Legacy

Configurators

Page 32: How to Build Your Own Product-Modeling Environment?

Defining yourModeling-Language Grammar

● using the Xtext grammar language

● from this grammar, the following is derived:− metamodel (Ecore + Java classes)− parser− editor with syntax highlighting, cross references,

content assist, outline, folding, ...

Page 33: How to Build Your Own Product-Modeling Environment?

Defining yourModeling-Language Metamodel

Represents all product models in the domain(like a schema)● EMF Ecore Meta Model● Generated from grammar or defined separately● Source of transformation

Page 34: How to Build Your Own Product-Modeling Environment?

ScopingVisibility of Objects for Cross References

The implementation (really that short!):

Page 35: How to Build Your Own Product-Modeling Environment?

Defining yourTarget Architecture

Clear: SAP Variant Configuration

Open aspects:− Naming conventions− Which objects should be modeled?− Constraints / conditions on values?− BOM calculation− Use of variant tables− Use of certain variant functions− …

Might be very company-specific!

Page 36: How to Build Your Own Product-Modeling Environment?

Code Generation

Task: map myCML models (instances of your metamodel) to VCML models● Respect your target architecture● Either generate VCML as text

− Model to text transformation languages− e.g. templating languages or frameworks

● or generate VCML as data structure− Model to model transformation languages− e.g. Java, Eclipse Xtend

Page 37: How to Build Your Own Product-Modeling Environment?

IDE Adaptions

● Xtext-based editors are highly extensible and configurable through dependency injection using Google Guice without modifying framework code.

− Implement your desired behaviour by subclassing standard implementations.

− Bind your defined subclass using dependency injection.

● Nearly each part of system can be adapted and replaced.

Page 38: How to Build Your Own Product-Modeling Environment?

Effort

Page 39: How to Build Your Own Product-Modeling Environment?

Effort

● Prototype for small language can be build in about a week

Page 40: How to Build Your Own Product-Modeling Environment?

Is This a New Idea?

No, in software engineering this idea is called

Model-Driven Software Development● Huge number of frameworks, tools,

knowledgeable people, … exist.● Current trend is to go from general UML models

− to Domain-Specific Modeling− using Domain-Specific Languages

Page 41: How to Build Your Own Product-Modeling Environment?

Extending VClipse vsOwn Modeling Language

● With VClipse, you can start small.− Need to learn only the required parts of the

technology stack to implement− Usable with minimal training effort

● Possible improvements are bigger with own modeling language approach.

Page 42: How to Build Your Own Product-Modeling Environment?

Experiences at NSN

● Own modeling language (CML) used for 2/3 of all live product models

● Fully integrated side languages (UI, help texts, testing)

● Semi-automatic migration from legacy configurators

● VClipse mainly used as a backend to ConfigModeler

● Manual VCML editing mainly used for prototyping

● NSN-specific extensions to VCML just recently implemented

● Modelers even implemented a third level(they generate CML for certain classes of products)

Page 43: How to Build Your Own Product-Modeling Environment?

Summary

● Eclipse-based external textual modeling environments

● Various possibilites to extend VClipse● Build own textual modeling language on top● MDSD approach applied to product modeling● Modern frameworks like Xtext allow quick

implementation● Approach successfully in production at NSN

Page 44: How to Build Your Own Product-Modeling Environment?

VClipse - Try It Out

● Ready-to-run from memory stick● Eclipse 3.7.2 (Indigo) for Windows 32bit / 64 bit● VClipse installed● configured for CWG sandbox use● VClipse sources – ready to change● Sample workspace

Page 45: How to Build Your Own Product-Modeling Environment?