Upload
tim-geisler
View
1.369
Download
3
Tags:
Embed Size (px)
Citation preview
How to Build Your OwnProduct Modeling Environment
Tim Geisler
webXcerpt Software GmbH
CWG 2012, Berlin 2012-05-08
Product Modeling Environments
Product Modeling Environments:Single Transactions
Product Modeling Environments:PMEVC
Product Modeling Environments:Eclipse-based SME
VClipse
● Eclipse-based textual product modeling environment
● for VC and IPC● based on Xtext / EMF
● Open SourceEclipse Public Licensewww.vclipse.org
VClipse - VCML
● Textual language for SAP objects
● Embedded languages for dependencies (procedures, conditions, and constraints)
IDE for VCML
Validation
Content AssistQuickfixes
Cross References
IDE for VCML
Outline
TemplatesFolding
Renamerefactoring
Where used?
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
Graphical or TextualProduct Modeling?
Deutsch limit:
You can’t have more than 50 visual primitives on the screen at the same time.
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
Specialized Modeling Environments
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
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
Extending VClipse – as ModelerDefine your own templates
E.g., template for determining amount of a material(specific coding convention)
Extending VClipse – as ProgrammerWrite your own plugins / extend VClipse plugins
Specific validation rules
● e.g. naming conventions
Resulting validation inVCML editor
VcmlJavaValidator.java
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.
Extending VClipse – as Programmer
● Specific „intelligent“ templates
Implementation:
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
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:
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
Conceptual Gap● SAP VC's concepts
● Implementation
● Standard languages
● Transactions
● VClipse
● Your concepts
● Specification
● Your languages
● Your ownmodeling 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
Example: ConfigModeler @
RFC
Editor/IDE
Editor/IDE
ConfigModeler
VClipse
CML
VCML
Code Generation
ConfigModeler – Initial Idea
StandardizedStandardizedproductproductdescriptionsdescriptions
FormalizedFormalizedproductproductdescriptionsdescriptions ConfigModeler + VClipse
Eclipse-based IDEscode generation
CML asspecification and
documentation language
CWG 2010 ViennaCWG 2011 Cologne
ConfigModeler – Languages
CMLUI: User Interface
CML: Product model
CMLT: Test cases
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, …)
● …
My Own Product-Modeling Environment
RFC
Editor/IDE
Editor/IDE
my ConfigModeler
VClipse
myCML
VCML
my Code Generation
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
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, ...
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
ScopingVisibility of Objects for Cross References
The implementation (really that short!):
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!
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
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.
Effort
Effort
● Prototype for small language can be build in about a week
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
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.
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)
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
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