SlideShare a Scribd company logo
1 of 24
Download to read offline
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●

●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●

Am Beispiel des Domain Model Examples

© itemis AG
Agenda

 Xbase
 Anwendungsfälle
 Xbase im Domain Model Example

●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●

 Links

© itemis AG

●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
2
Xbase – Am Beispiel des Domain Model Examples
Was ist Xbase?

“Xbase is a partial programming language implemented in Xtext
and is meant to be embedded and xtended within other programming languages
and domain-specific languages (DSL) written in Xtext.”

●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●

Quelle: Sven Efftinge - Xbase - A new programming language?

© itemis AG

●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
3
Xbase – Am Beispiel des Domain Model Examples
Generelle Bestandteile von Xbase

Expression-Grammatik

•

JVMTypes

•

Extensions (Bibliothek von Funktionen, die für Typen bereitgestellt werden)

•

Xbase Compiler (zu Java Code) / Xbase Interpreter

●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●

•

© itemis AG

●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
4
Xbase – Am Beispiel des Domain Model Examples
Xbase im Detail (1)

•

Xbase.xtext

•

Typen: Arrays, einfache Typ-Referenzen, Funktionstypen (Lambda-Ausdrücke), parametrisierte TypReferenzen, Java-Primitive -> Xbase implementiert Java Typsystem und ist konform zur Java Lang
Spec

•

Expressions (1)
•

Literale: String, Nummer (entspricht Integer), Boolean, Null, Typ (entspricht .class)

•

Operatoren: fest eingebaute boolsche / arithmetische Operatoren sowie with-Operator für Lambda
•

binär: +=, ||, &&, ==, !=, <, >, <=, >=, ->, .., =>, <<, >>, <<<, >>>, <>, ?:, <=>, +, -, *, /, %, **

•

unär: !, -

Zuweisungen (Assignments)

•

Feature Calls (property access, null safe feature Call, static feature call)

•

Constructor Call

•

Lambda Ausdrücke (aka Closures): z.B. myList.findFirst([ e | e.name==null ])

●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●

•

© itemis AG

●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
5
Xbase – Am Beispiel des Domain Model Examples
Xbase im Detail (2)

•

Expressions (ctd.)
•
•

Switch Expression (switch, case)

•

Variable Declarations (nur in Blocks erlaubt)

•

Blocks, entspricht Container für imperative Code-Sequenzen

•

For Loop

•

While Loop

•

Do-While Loop

•

Return Expression

•

Throwing Exceptions

•

try-catch-finally expression

Implizite Variablen 'this‘ und 'it‘: Referenz auf den aktuellen Kontext, it kann auch innerhalb von
Funktionen verwendet werden

●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●

•

If Expression (if, else if, else)

© itemis AG

●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
6
Xbase – Am Beispiel des Domain Model Examples

●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●

Xbase Extensions

© itemis AG

●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
7
Xbase – Am Beispiel des Domain Model Examples
Xbase Compiler

Standard-Generator für Xbase Expressions, der Java-Code generiert

•

wie man Xbase erweitert, und was man alles anpassen muss, ist hier beschrieben: Extending Xbase

•

Expressions können meist beliebig miteinander und beliebig tief kombiniert und verschachtelt sein: ein
Expressions Compiler sollte unabhängig davon in der Lage sein, validen Code zu generieren

●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●

•

© itemis AG

●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
8
Xbase – Am Beispiel des Domain Model Examples
Eigenschaften von Xbase

Runs on the JVM

•

Compiles to Java

•

Statically Typed

•

Full Java Generics

•

No built-in types

•

Closures

•

Type Inference

•

Operator Overloading

•

Simplicity over Syntactical Flexibility

•

Everything is an Expression

●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●

•

© itemis AG

●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
9
Xbase – Am Beispiel des Domain Model Examples
Abstrakte Anwendungsfälle

extends

•

implements

•

invokes

•

maps to

•

model instances/assigments (with type checks)

•

invariants/boolean expressions

•

decisions/switch/cases

•

calculation

●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●

•

© itemis AG

●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
10
Xbase – Am Beispiel des Domain Model Examples
Konkretere Anwendungsfälle

Integration/Verwebung mit bestehendem Code

•

Model-Checks durch Typsystem(e)

•

durch Typsystem unterstützte Code-Generierung (Expressions an mehreren Stellen)

●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●

•

© itemis AG

●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
11
Xbase – Am Beispiel des Domain Model Examples
Model inferrer & Type inferrer

•

Model inferrer
•

JDT Integration

•

Transparenz Java/DSL

•

Tracing

•

Debugging

•

Type inferrer
Typisierung von in die DSL eingebauten Expression -> Angabe des erwarteten Rückgabetyps

●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●

•

© itemis AG

●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
12
Xbase – Am Beispiel des Domain Model Examples
Model inferrer / Generator / Builder Participant

•

Ableiten von (Teil-)Artefakten, die sich weiterhin mit DSL integrieren sollen -> Model inferrer

•

Reines Erzeugen von Artefakten, die nichts von der DSL wissen müssen -> Generator

•

Ausführungshäufigkeit
•

Generator: Beim Speichern der DSL

•

Model inferrer: Live beim Editieren der DSL-Datei

•

Aufruf-Reihenfolge und Build Abhängigkeiten beachten
•

Unterschiedliches Verhalten vom Builder in der IDE und im automatisierten Build -> im
automatisierten Build müssen unter Umständen erst Stubs erzeugt werden, damit zunächst alle
Referenzen aufgelöst werden können und so trotz wechselseitiger Abhängigkeit alle Artefakte
kompiliert werden können

●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●

•

DSL referenziert auf Java-Elemente, die noch nicht generiert worden sind bzw. zwar schon
generiert wurden aber noch nicht kompiliert worden sind (Java Compiler lief noch nicht)

© itemis AG

●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
13
Xbase – Am Beispiel des Domain Model Examples
Wann sollte man Xbase/JVMTypes verwenden, wann nicht?

•

sich über die Zielgruppe(n) der DSL klar werden

•

sich über die Auswertungsziele der DSL klar werden

•

Generatoren/Interpreter, welche Informationen müssen dazu in den DSLs erfasst werden?

•

sich über die Chancen und Risiken der Entscheidung klar werden
•

Pro
•

•

bekommt vieles Out-Of-The-Box (Standard Editor und Generator/Compiler-Verhalten, Typ-Checks)

Contra
•

eine fachliche DSL wird zu technisch

•

DSL wird mit Informationen überfrachtet

Ziel-Artefakte: Code, Konfiguration, Dokumentation, Testdaten, Tests, Datenbankskripte,
Buildskripte, ...

•

immer dran denken: man kann Xbase auch ohne JVMTypes verwenden, und die Xbase
Expression-Struktur auch ohne den Standard-Xbase-Compiler nutzen

●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●

•

© itemis AG

●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
14
Xbase – Am Beispiel des Domain Model Examples
Änderungen durch Xbase

•

Grammatik-Definition
•

grammar … with org.eclipse.xtext.xbase.Xbase

•

import 'http://www.eclipse.org/xtext/common/JavaVMTypes' as types

•

 die Sprache muss von Xbase erben

 optional

MWE2 Grammar Generator
•

Registrieren der neuen EPackages und GenModels + URI-Mapping

•

fragment = types.TypesGeneratorFragment {}

 für JDT Integration u.a. in Proposals

•

fragment = xbase.XbaseGeneratorFragment {}

 für ModelInferrer

•

public class …ScopeProvider extends XbaseScopeProvider

•

class …JvmModelInferrer extends AbstractModelInferrer  für Mapping auf JvmTypes

•

public class SprayTypeProvider extends XbaseTypeProvider  Typisieren von Expresssions

•

…RuntimeModule: @Override public Class<? extends ITypeProvider> bindITypeProvider() { … }

•

Im Scope-Provider localScope definieren für Expressions (it, this)

●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●

 für Scopen der Expressions

© itemis AG

●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
15
Xbase – Am Beispiel des Domain Model Examples

●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●

Xbase in Spray

© itemis AG

●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
16
Xbase – Am Beispiel des Domain Model Examples

●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●

Xbase in Spray

© itemis AG

●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
17
Xbase – Am Beispiel des Domain Model Examples

●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●

●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
© itemis AG

18
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●

© itemis AG

19
Xbase – Am Beispiel des Domain Model Examples
Erweiterungen für das Domain Model Example

•

DSL definieren, um das Mapping zwischen Fachmodell und Persistenz-Modell zu definieren
•
•

Zuweisungen können auch durch Verknüpfungen erfolgen, z.B. Name = Vorname + ” “ + Nachname

•

•

dabei müssen durch das Typsystem invalide Zuweisungen erkannt werden bzw. erst gar nicht angeboten
werden

Zuweisungen können Guards enthalten, z.B. Anrede = if(gender == ‘female’) “Frau” else “Herr”

Analog zu Jnario eine Test-Beschreibungs-Sprache definieren, um
•
•

Erwartungen auszudrücken: Wenn Eingabe diese Belegung Dann Ausgabe diese Belegung

Abfrage-Sprache definieren

●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●

•

Test-Datensätze auszudrücken, also defacto Instanzieren des Domänen-Modells

© itemis AG

●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
20
Xbase – Am Beispiel des Domain Model Examples
Links: Dokumentation & Blogs

Xbase - A new programming language?

•

Xbase Language Reference

•

Xtext and Java

•

Xbase - Implementing domainspecific languages for Java

•

Xtext 2.1: using Xbase variables

•

The JvmModelInferrer, the debugger and Xbase in Xtext 2.3

•

Extending Xbase

•

Pragmatic DSL Design with Xtext, Xbase and Xtend 2

•

Five simple steps to your JVM language

•

Using JVM Types in Xtext 2.1 and the ImportManager

•

Xtext casts: Debug-support, Number literals, 7 languages, Jnario

•

XREPL

●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●

•

© itemis AG

●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
21
Xbase – Am Beispiel des Domain Model Examples
Links: Xbase Source Code

Xbase.xtext

•

JvmModelGenerator.xtend

•

XbaseCompiler.java

•

XbaseCompiler2.java (benutzt das neue Typsystem)

•

AbstractXbaseCompiler.java

•

XbaseInterpreter.java

•

JvmModelAssociator.java

•

JvmTypesBuilder.java

•

TypeConvertingCompiler.java

●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●

•

© itemis AG

●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
22
Xbase – Am Beispiel des Domain Model Examples
Links: Xbase nutzende Projekte

Xtend (see Xtend.xtext)

•

Sigasi - VHDL editor (closed source)

•

openHAB (see Rules.xtext, Script.xtext)

•

Spray (see Spray.xtext, Shape.xtext, Style.xtext)

•

Jnario (see Spec.xtext)

•

Tocea - Architecture-Designer (see QueryDsl.xtext)

•

Xsemantics (see Documentation, see Xsemantics.xtext)

•

EMF-IncQuery (see PatternLanguage.xtext)

•

JST (see Jst.xtext)

•

eLang (see EL.xtext)

•

MQL (see ModelQueryLanguage.xtext)

•

Demonstratoren: Fowlers statemachine with expressions (see MyDsl.xtext), LorenzoBettini - Xtext2
experiments, Meinte Boersma - Xtext2-DSLs

●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●

•

© itemis AG

●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
23
Xbase – Am Beispiel des Domain Model Examples
Links: Domain Model Example

•

Example auf dem aktuellen Juno Stand: File -> New -> Other -> Examples/Xtext Examples/Xtext
Domain Model Example

•

Example auf dem Indigo-Stand

•

Language Workbench Competetion 2011 – Xtext
•
•

Doownload-Sektion mit Screencasts und den Projekt-Stände nach jedem Kapitel

XbaseIntegrationTest.java

●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●

•

Schritt für Schritt Anleitung (pdf)

© itemis AG

●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
24

More Related Content

More from joergreichert

OKLab Leipzig - 2023 Update
OKLab Leipzig - 2023 UpdateOKLab Leipzig - 2023 Update
OKLab Leipzig - 2023 Updatejoergreichert
 
SDGs und wo sind die Daten?
SDGs und wo sind die Daten?SDGs und wo sind die Daten?
SDGs und wo sind die Daten?joergreichert
 
Gieß a bit more the Bäume
Gieß a bit more the BäumeGieß a bit more the Bäume
Gieß a bit more the Bäumejoergreichert
 
Leipzig Giesst (Dezember 2020)
Leipzig Giesst (Dezember 2020)Leipzig Giesst (Dezember 2020)
Leipzig Giesst (Dezember 2020)joergreichert
 
OKLab Leipzig - Schwerpunkt Mobilität
OKLab Leipzig - Schwerpunkt MobilitätOKLab Leipzig - Schwerpunkt Mobilität
OKLab Leipzig - Schwerpunkt Mobilitätjoergreichert
 
Die Stadt als Schule der Demokratie
Die Stadt als Schule der DemokratieDie Stadt als Schule der Demokratie
Die Stadt als Schule der Demokratiejoergreichert
 
OKLab Leipzig (2019 Update)
OKLab Leipzig (2019 Update)OKLab Leipzig (2019 Update)
OKLab Leipzig (2019 Update)joergreichert
 
A Pattern Language - Patterns for Javascript
A Pattern Language - Patterns for JavascriptA Pattern Language - Patterns for Javascript
A Pattern Language - Patterns for Javascriptjoergreichert
 
Unit testing mit Javascript
Unit testing mit JavascriptUnit testing mit Javascript
Unit testing mit Javascriptjoergreichert
 
OkLab Leipzig (2018 Update)
OkLab Leipzig (2018 Update)OkLab Leipzig (2018 Update)
OkLab Leipzig (2018 Update)joergreichert
 
Modell-getriebene Softwareentwicklung für Lego Mindstorms NXT
Modell-getriebene Softwareentwicklung für Lego Mindstorms NXTModell-getriebene Softwareentwicklung für Lego Mindstorms NXT
Modell-getriebene Softwareentwicklung für Lego Mindstorms NXTjoergreichert
 
Spray Democamp Dresden 2011-11-08
Spray Democamp Dresden 2011-11-08Spray Democamp Dresden 2011-11-08
Spray Democamp Dresden 2011-11-08joergreichert
 

More from joergreichert (18)

OKLab Leipzig - 2023 Update
OKLab Leipzig - 2023 UpdateOKLab Leipzig - 2023 Update
OKLab Leipzig - 2023 Update
 
SDGs und wo sind die Daten?
SDGs und wo sind die Daten?SDGs und wo sind die Daten?
SDGs und wo sind die Daten?
 
Gieß a bit more the Bäume
Gieß a bit more the BäumeGieß a bit more the Bäume
Gieß a bit more the Bäume
 
OKLab Leipzig 2022
OKLab Leipzig 2022OKLab Leipzig 2022
OKLab Leipzig 2022
 
FAIRe Sensordaten
FAIRe SensordatenFAIRe Sensordaten
FAIRe Sensordaten
 
OKLab Leipzig 2021
OKLab Leipzig 2021OKLab Leipzig 2021
OKLab Leipzig 2021
 
Leipzig Giesst (Dezember 2020)
Leipzig Giesst (Dezember 2020)Leipzig Giesst (Dezember 2020)
Leipzig Giesst (Dezember 2020)
 
Road to mauAR
Road to mauARRoad to mauAR
Road to mauAR
 
OKLab Leipzig - Schwerpunkt Mobilität
OKLab Leipzig - Schwerpunkt MobilitätOKLab Leipzig - Schwerpunkt Mobilität
OKLab Leipzig - Schwerpunkt Mobilität
 
Die Stadt als Schule der Demokratie
Die Stadt als Schule der DemokratieDie Stadt als Schule der Demokratie
Die Stadt als Schule der Demokratie
 
OKLab Leipzig (2019 Update)
OKLab Leipzig (2019 Update)OKLab Leipzig (2019 Update)
OKLab Leipzig (2019 Update)
 
A Pattern Language - Patterns for Javascript
A Pattern Language - Patterns for JavascriptA Pattern Language - Patterns for Javascript
A Pattern Language - Patterns for Javascript
 
Unit testing mit Javascript
Unit testing mit JavascriptUnit testing mit Javascript
Unit testing mit Javascript
 
damals.in/leipzig
damals.in/leipzigdamals.in/leipzig
damals.in/leipzig
 
OkLab Leipzig (2018 Update)
OkLab Leipzig (2018 Update)OkLab Leipzig (2018 Update)
OkLab Leipzig (2018 Update)
 
Map technologies
Map technologiesMap technologies
Map technologies
 
Modell-getriebene Softwareentwicklung für Lego Mindstorms NXT
Modell-getriebene Softwareentwicklung für Lego Mindstorms NXTModell-getriebene Softwareentwicklung für Lego Mindstorms NXT
Modell-getriebene Softwareentwicklung für Lego Mindstorms NXT
 
Spray Democamp Dresden 2011-11-08
Spray Democamp Dresden 2011-11-08Spray Democamp Dresden 2011-11-08
Spray Democamp Dresden 2011-11-08
 

Recently uploaded

Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfhans926745
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 

Recently uploaded (20)

Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 

Xbase Am Beispiel des Domain Model Examples

  • 2. Agenda  Xbase  Anwendungsfälle  Xbase im Domain Model Example ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ●  Links © itemis AG ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● 2
  • 3. Xbase – Am Beispiel des Domain Model Examples Was ist Xbase? “Xbase is a partial programming language implemented in Xtext and is meant to be embedded and xtended within other programming languages and domain-specific languages (DSL) written in Xtext.” ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● Quelle: Sven Efftinge - Xbase - A new programming language? © itemis AG ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● 3
  • 4. Xbase – Am Beispiel des Domain Model Examples Generelle Bestandteile von Xbase Expression-Grammatik • JVMTypes • Extensions (Bibliothek von Funktionen, die für Typen bereitgestellt werden) • Xbase Compiler (zu Java Code) / Xbase Interpreter ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● • © itemis AG ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● 4
  • 5. Xbase – Am Beispiel des Domain Model Examples Xbase im Detail (1) • Xbase.xtext • Typen: Arrays, einfache Typ-Referenzen, Funktionstypen (Lambda-Ausdrücke), parametrisierte TypReferenzen, Java-Primitive -> Xbase implementiert Java Typsystem und ist konform zur Java Lang Spec • Expressions (1) • Literale: String, Nummer (entspricht Integer), Boolean, Null, Typ (entspricht .class) • Operatoren: fest eingebaute boolsche / arithmetische Operatoren sowie with-Operator für Lambda • binär: +=, ||, &&, ==, !=, <, >, <=, >=, ->, .., =>, <<, >>, <<<, >>>, <>, ?:, <=>, +, -, *, /, %, ** • unär: !, - Zuweisungen (Assignments) • Feature Calls (property access, null safe feature Call, static feature call) • Constructor Call • Lambda Ausdrücke (aka Closures): z.B. myList.findFirst([ e | e.name==null ]) ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● • © itemis AG ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● 5
  • 6. Xbase – Am Beispiel des Domain Model Examples Xbase im Detail (2) • Expressions (ctd.) • • Switch Expression (switch, case) • Variable Declarations (nur in Blocks erlaubt) • Blocks, entspricht Container für imperative Code-Sequenzen • For Loop • While Loop • Do-While Loop • Return Expression • Throwing Exceptions • try-catch-finally expression Implizite Variablen 'this‘ und 'it‘: Referenz auf den aktuellen Kontext, it kann auch innerhalb von Funktionen verwendet werden ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● • If Expression (if, else if, else) © itemis AG ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● 6
  • 7. Xbase – Am Beispiel des Domain Model Examples ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● Xbase Extensions © itemis AG ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● 7
  • 8. Xbase – Am Beispiel des Domain Model Examples Xbase Compiler Standard-Generator für Xbase Expressions, der Java-Code generiert • wie man Xbase erweitert, und was man alles anpassen muss, ist hier beschrieben: Extending Xbase • Expressions können meist beliebig miteinander und beliebig tief kombiniert und verschachtelt sein: ein Expressions Compiler sollte unabhängig davon in der Lage sein, validen Code zu generieren ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● • © itemis AG ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● 8
  • 9. Xbase – Am Beispiel des Domain Model Examples Eigenschaften von Xbase Runs on the JVM • Compiles to Java • Statically Typed • Full Java Generics • No built-in types • Closures • Type Inference • Operator Overloading • Simplicity over Syntactical Flexibility • Everything is an Expression ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● • © itemis AG ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● 9
  • 10. Xbase – Am Beispiel des Domain Model Examples Abstrakte Anwendungsfälle extends • implements • invokes • maps to • model instances/assigments (with type checks) • invariants/boolean expressions • decisions/switch/cases • calculation ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● • © itemis AG ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● 10
  • 11. Xbase – Am Beispiel des Domain Model Examples Konkretere Anwendungsfälle Integration/Verwebung mit bestehendem Code • Model-Checks durch Typsystem(e) • durch Typsystem unterstützte Code-Generierung (Expressions an mehreren Stellen) ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● • © itemis AG ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● 11
  • 12. Xbase – Am Beispiel des Domain Model Examples Model inferrer & Type inferrer • Model inferrer • JDT Integration • Transparenz Java/DSL • Tracing • Debugging • Type inferrer Typisierung von in die DSL eingebauten Expression -> Angabe des erwarteten Rückgabetyps ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● • © itemis AG ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● 12
  • 13. Xbase – Am Beispiel des Domain Model Examples Model inferrer / Generator / Builder Participant • Ableiten von (Teil-)Artefakten, die sich weiterhin mit DSL integrieren sollen -> Model inferrer • Reines Erzeugen von Artefakten, die nichts von der DSL wissen müssen -> Generator • Ausführungshäufigkeit • Generator: Beim Speichern der DSL • Model inferrer: Live beim Editieren der DSL-Datei • Aufruf-Reihenfolge und Build Abhängigkeiten beachten • Unterschiedliches Verhalten vom Builder in der IDE und im automatisierten Build -> im automatisierten Build müssen unter Umständen erst Stubs erzeugt werden, damit zunächst alle Referenzen aufgelöst werden können und so trotz wechselseitiger Abhängigkeit alle Artefakte kompiliert werden können ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● • DSL referenziert auf Java-Elemente, die noch nicht generiert worden sind bzw. zwar schon generiert wurden aber noch nicht kompiliert worden sind (Java Compiler lief noch nicht) © itemis AG ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● 13
  • 14. Xbase – Am Beispiel des Domain Model Examples Wann sollte man Xbase/JVMTypes verwenden, wann nicht? • sich über die Zielgruppe(n) der DSL klar werden • sich über die Auswertungsziele der DSL klar werden • Generatoren/Interpreter, welche Informationen müssen dazu in den DSLs erfasst werden? • sich über die Chancen und Risiken der Entscheidung klar werden • Pro • • bekommt vieles Out-Of-The-Box (Standard Editor und Generator/Compiler-Verhalten, Typ-Checks) Contra • eine fachliche DSL wird zu technisch • DSL wird mit Informationen überfrachtet Ziel-Artefakte: Code, Konfiguration, Dokumentation, Testdaten, Tests, Datenbankskripte, Buildskripte, ... • immer dran denken: man kann Xbase auch ohne JVMTypes verwenden, und die Xbase Expression-Struktur auch ohne den Standard-Xbase-Compiler nutzen ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● • © itemis AG ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● 14
  • 15. Xbase – Am Beispiel des Domain Model Examples Änderungen durch Xbase • Grammatik-Definition • grammar … with org.eclipse.xtext.xbase.Xbase • import 'http://www.eclipse.org/xtext/common/JavaVMTypes' as types •  die Sprache muss von Xbase erben  optional MWE2 Grammar Generator • Registrieren der neuen EPackages und GenModels + URI-Mapping • fragment = types.TypesGeneratorFragment {}  für JDT Integration u.a. in Proposals • fragment = xbase.XbaseGeneratorFragment {}  für ModelInferrer • public class …ScopeProvider extends XbaseScopeProvider • class …JvmModelInferrer extends AbstractModelInferrer  für Mapping auf JvmTypes • public class SprayTypeProvider extends XbaseTypeProvider  Typisieren von Expresssions • …RuntimeModule: @Override public Class<? extends ITypeProvider> bindITypeProvider() { … } • Im Scope-Provider localScope definieren für Expressions (it, this) ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ●  für Scopen der Expressions © itemis AG ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● 15
  • 16. Xbase – Am Beispiel des Domain Model Examples ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● Xbase in Spray © itemis AG ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● 16
  • 17. Xbase – Am Beispiel des Domain Model Examples ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● Xbase in Spray © itemis AG ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● 17
  • 18. Xbase – Am Beispiel des Domain Model Examples ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● © itemis AG 18
  • 20. Xbase – Am Beispiel des Domain Model Examples Erweiterungen für das Domain Model Example • DSL definieren, um das Mapping zwischen Fachmodell und Persistenz-Modell zu definieren • • Zuweisungen können auch durch Verknüpfungen erfolgen, z.B. Name = Vorname + ” “ + Nachname • • dabei müssen durch das Typsystem invalide Zuweisungen erkannt werden bzw. erst gar nicht angeboten werden Zuweisungen können Guards enthalten, z.B. Anrede = if(gender == ‘female’) “Frau” else “Herr” Analog zu Jnario eine Test-Beschreibungs-Sprache definieren, um • • Erwartungen auszudrücken: Wenn Eingabe diese Belegung Dann Ausgabe diese Belegung Abfrage-Sprache definieren ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● • Test-Datensätze auszudrücken, also defacto Instanzieren des Domänen-Modells © itemis AG ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● 20
  • 21. Xbase – Am Beispiel des Domain Model Examples Links: Dokumentation & Blogs Xbase - A new programming language? • Xbase Language Reference • Xtext and Java • Xbase - Implementing domainspecific languages for Java • Xtext 2.1: using Xbase variables • The JvmModelInferrer, the debugger and Xbase in Xtext 2.3 • Extending Xbase • Pragmatic DSL Design with Xtext, Xbase and Xtend 2 • Five simple steps to your JVM language • Using JVM Types in Xtext 2.1 and the ImportManager • Xtext casts: Debug-support, Number literals, 7 languages, Jnario • XREPL ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● • © itemis AG ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● 21
  • 22. Xbase – Am Beispiel des Domain Model Examples Links: Xbase Source Code Xbase.xtext • JvmModelGenerator.xtend • XbaseCompiler.java • XbaseCompiler2.java (benutzt das neue Typsystem) • AbstractXbaseCompiler.java • XbaseInterpreter.java • JvmModelAssociator.java • JvmTypesBuilder.java • TypeConvertingCompiler.java ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● • © itemis AG ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● 22
  • 23. Xbase – Am Beispiel des Domain Model Examples Links: Xbase nutzende Projekte Xtend (see Xtend.xtext) • Sigasi - VHDL editor (closed source) • openHAB (see Rules.xtext, Script.xtext) • Spray (see Spray.xtext, Shape.xtext, Style.xtext) • Jnario (see Spec.xtext) • Tocea - Architecture-Designer (see QueryDsl.xtext) • Xsemantics (see Documentation, see Xsemantics.xtext) • EMF-IncQuery (see PatternLanguage.xtext) • JST (see Jst.xtext) • eLang (see EL.xtext) • MQL (see ModelQueryLanguage.xtext) • Demonstratoren: Fowlers statemachine with expressions (see MyDsl.xtext), LorenzoBettini - Xtext2 experiments, Meinte Boersma - Xtext2-DSLs ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● • © itemis AG ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● 23
  • 24. Xbase – Am Beispiel des Domain Model Examples Links: Domain Model Example • Example auf dem aktuellen Juno Stand: File -> New -> Other -> Examples/Xtext Examples/Xtext Domain Model Example • Example auf dem Indigo-Stand • Language Workbench Competetion 2011 – Xtext • • Doownload-Sektion mit Screencasts und den Projekt-Stände nach jedem Kapitel XbaseIntegrationTest.java ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● • Schritt für Schritt Anleitung (pdf) © itemis AG ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● 24