How to Build Your Own Product Modeling Environment Tim Geisler webXcerpt Software GmbH

How to Build Your Own
Product Modeling Environment
Tim Geisler
webXcerpt Software GmbH
[email protected]
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 Source
Eclipse Public
License
www.vclipse.org
VClipse - VCML
●
●
Textual language for
SAP objects
Embedded languages
for dependencies
(procedures, conditions,
and constraints)
IDE for VCML
Validation
Cross References
Quickfixes
Content Assist
IDE for VCML
Rename
refactoring
Outline
Folding
Templates
Where used?
Interface to SAP ECC (ALE, RFC)
●
●
RFC interface
−
Create, Read, Update, Delete
−
Extract recursively: model extraction
ALE interface
−
●
Delta calculation
−
●
Sending models via IDocs (PDR)
Compute and send only changed objects
„One-click delta deployment“
−
Send delta via PDR, automatic processing in SAP
Graphical or Textual
Product 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 SAP
have 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 Modeler
Define your own templates
E.g., template for determining amount of a material
(specific coding convention)
Extending VClipse – as Programmer
Write your own plugins / extend VClipse plugins
Specific validation rules
●
e.g. naming conventions
VcmlJavaValidator.java
Resulting validation in
VCML editor
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
name of multivalued characteristic
PFunction Z_COPY_DEFAULT_MV (
GEN_CSTIC_1_NAME = 'MVCSTIC1'
GEN_CSTIC_2_NAME = 'MVCSTIC2'
GEN_INSTANCE = 'PARENT'
)
compatible type
one of SELF, PARENT, ROOT
●
Implement specific validation
●
Implement specific code templates
Specifying Variant Functions
import "cstics.vcml" // contains all cstic definitions
variantfunction Z_COPY_DEFAULT_MV "Copy default values (MV)" {
GEN_CSTIC_1_NAME : in CharacteristicNameMV
GEN_CSTIC_2_NAME : in CharacteristicNameMV
GEN_INSTANCE : in CharacteristicValues
}
Generating Artifacts:
VCML
Validation
Variantfunction
object
VCML
Templates
VCML
Tooltips
ABAP
implementation
stub
Documentation
Java
implementation
stub
CML integration
Extending VClipse – as Contributor
Testing language VCMLT for VCML models
(contributed to VClipse by Winfried Kung)
See talk by
Tim 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 own
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
Example: ConfigModeler @
ConfigModeler
CML
Editor/IDE
Code Generation
VClipse
Editor/IDE
VCML
RFC
ConfigModeler – Initial Idea
Standardized
product
descriptions
CWG 2010 Vienna
CWG 2011 Cologne
CML as
specification and
documentation language
Formalized
product
descriptions
ConfigModeler + VClipse
Eclipse-based IDEs
code generation
ConfigModeler – Languages
CMLUI: User Interface
CML: Product model
CMLT: Test cases
When to Create Own Language and
Product 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
my ConfigModeler
myCML
Editor/IDE
my Code Generation
VClipse
Editor/IDE
VCML
RFC
Grammar
Metamodel
Scoping
Validation
my ConfigModeler
Import from
Legacy
Configurators
myCML
Editor/IDE
Target
Architecture
my Code
Generation
Graphical
Views
Exports /
Reports
VClipse
Adaptions
Code
Generation
Defining your
Modeling-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 your
Modeling-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
Scoping
Visibility of Objects for Cross References
The implementation (really that short!):
Defining your
Target 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 vs
Own 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