From Stairway to Heaven onto the Highway to Hell with Xtext

Post on 12-Apr-2017

202 views 1 download

Transcript of From Stairway to Heaven onto the Highway to Hell with Xtext

Karsten Thoms

EASY TO LEARN

FLEXIBLE

GOOD DOCS

HIDES COMPLEXITY

USES XTEND

GOOD SUPPORTFAST PROTOTYPING

GOOD DEFAULTS

MATURE

SOURCE QUALITY

FLEXIBILITYWho says you can’t play golf with apples?

https://pixabay.com/de/apple-natur-green-garten-947674/

DESIGN SMELLS

GRAMMAR• Assign ‚name=ID‘ attribute for non-referable elements

• Tweaking grammar to optimize non syntax related stuff

• generated meta model structure

• content assist (e.g. whitespace in combined keywords)

• scoping

DESIGN SMELLS

GRAMMAR• Too few / too much keywords

• Trying to solve too much with terminal rules

• Unordered groups for multivalued assignments

• Using Xcore for small metamodels

• Enable backtracking to „solve“ a grammar ambiguity issues

DESIGN SMELLS

GRAMMAR• Too few / too much keywords

• Trying to solve too much with terminal rules

• Unordered groups for multivalued assignments

• Using Xcore for small metamodels

• Enable backtracking to „solve“ a grammar ambiguity issues

DESIGN SMELLS

GRAMMAR• Too few / too much keywords

• Trying to solve too much with terminal rules

• Unordered groups for multivalued assignments

• Using Xcore for small metamodels

• Enable backtracking to „solve“ grammar ambiguity issues

DESIGN SMELLS

AMBIGUITY

SCOPING• Use declarative scope provider

• Navigate cross-references while computing scope

• Compute stuff in scope provider which could be put into IEObjectDescription’s user data

• „Optimize“ scope to tweak content assist

• Check for proxies, resolve proxies

• Instantiate unnecessary objects

• Access node model and assume that it is complete

DESIGN SMELLS

VALIDATION• Don’t use semantic validation at all

• Use @Check without CheckType => Default is CheckType.FAST

• Provide check methods for child-elements which traverse sibling elements (e.g. uniqueness check)

• Many fine grained check methods

• Loading the world again

DESIGN SMELLS

COMPLEXITY

IDENTIFYING THE RIGHT PLACE TO FIX AN ISSUE

https://pixabay.com/de/nadel-im-heuhaufen-nadel-heuhaufen-1752846/

https://pixabay.com/de/yoda-dunkel-die-dunkle-seite-des-1726764/

Use the Source, Luke!

Dependency Injection

CUSTOMIZING

http://de.freeimages.com/photo/chef-s-swiss-knife-1239195

UNEXPECTED

OVER ENGINEERING

DSL OVERLOAD

Entity DSL

ConfigDSL

FrontendDSL

RuleDSL

Style DSL

BehaviorDSL

RequirementsDSL

CoolDSL

YetAnother

DSLPersonalFavorite

DSL

MyDSL

DatabaseDSL

Sample DSL

The Only Right DSL

EXPRESSIONS

DSL != NATURAL LANGUAGE

NON-TECHIE USERS

SCALABILITY

http://de.freeimages.com/photo/constructing-tower-1207408

CODE WASTE

PROTOTYPES

TESTING

STICK WITH OLD RELEASES

ADVICE RESISTANCE

WRONGTOOL

PROBLEM

SOLUTION

• Evaluate if Xtext is the right tool to solve a problem [ it

often is :-) ]

• Get experts on board when starting ambitious projects

• Learn underlying technologies (EMF, ANTLR, …)

• Continuously develop DSL projects

• Write extensive tests

• Invest into user experience

AVOIDING TROUBLE

KEEP INFORMED

itemis.com / Blogs / Xtext

@kthoms

@holgerschill

@itemis

@chrdietrich

@franzbecker_io