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

Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Orbitshub
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
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
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...apidays
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfOrbitshub
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Angeliki Cooney
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
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
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 

Recently uploaded (20)

Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
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
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
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
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 

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