from stairway to heaven onto the highway to hell with xtext

32
Karsten Thoms

Upload: karsten-thoms

Post on 12-Apr-2017

204 views

Category:

Engineering


1 download

TRANSCRIPT

Page 1: From Stairway to Heaven onto the Highway to Hell with Xtext

Karsten Thoms

Page 2: From Stairway to Heaven onto the Highway to Hell with Xtext

EASY TO LEARN

FLEXIBLE

GOOD DOCS

HIDES COMPLEXITY

USES XTEND

GOOD SUPPORTFAST PROTOTYPING

GOOD DEFAULTS

MATURE

SOURCE QUALITY

Page 3: From Stairway to Heaven onto the Highway to Hell with Xtext

FLEXIBILITYWho says you can’t play golf with apples?

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

Page 4: From Stairway to Heaven onto the Highway to Hell with Xtext

DESIGN SMELLS

Page 5: From Stairway to Heaven onto the Highway to Hell with Xtext

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

Page 6: From Stairway to Heaven onto the Highway to Hell with Xtext

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

Page 7: From Stairway to Heaven onto the Highway to Hell with Xtext

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

Page 8: From Stairway to Heaven onto the Highway to Hell with Xtext

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

Page 9: From Stairway to Heaven onto the Highway to Hell with Xtext

AMBIGUITY

Page 10: From Stairway to Heaven onto the Highway to Hell with Xtext

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

Page 11: From Stairway to Heaven onto the Highway to Hell with Xtext

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

Page 12: From Stairway to Heaven onto the Highway to Hell with Xtext

COMPLEXITY

Page 13: From Stairway to Heaven onto the Highway to Hell with Xtext

IDENTIFYING THE RIGHT PLACE TO FIX AN ISSUE

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

Page 14: From Stairway to Heaven onto the Highway to Hell with Xtext

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

Use the Source, Luke!

Page 15: From Stairway to Heaven onto the Highway to Hell with Xtext
Page 16: From Stairway to Heaven onto the Highway to Hell with Xtext

Dependency Injection

Page 17: From Stairway to Heaven onto the Highway to Hell with Xtext

CUSTOMIZING

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

UNEXPECTED

Page 18: From Stairway to Heaven onto the Highway to Hell with Xtext

OVER ENGINEERING

Page 19: From Stairway to Heaven onto the Highway to Hell with Xtext

DSL OVERLOAD

Entity DSL

ConfigDSL

FrontendDSL

RuleDSL

Style DSL

BehaviorDSL

RequirementsDSL

CoolDSL

YetAnother

DSLPersonalFavorite

DSL

MyDSL

DatabaseDSL

Sample DSL

The Only Right DSL

Page 20: From Stairway to Heaven onto the Highway to Hell with Xtext

EXPRESSIONS

Page 21: From Stairway to Heaven onto the Highway to Hell with Xtext

DSL != NATURAL LANGUAGE

Page 22: From Stairway to Heaven onto the Highway to Hell with Xtext

NON-TECHIE USERS

Page 23: From Stairway to Heaven onto the Highway to Hell with Xtext

SCALABILITY

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

Page 24: From Stairway to Heaven onto the Highway to Hell with Xtext

CODE WASTE

Page 25: From Stairway to Heaven onto the Highway to Hell with Xtext

PROTOTYPES

Page 26: From Stairway to Heaven onto the Highway to Hell with Xtext

TESTING

Page 27: From Stairway to Heaven onto the Highway to Hell with Xtext

STICK WITH OLD RELEASES

Page 28: From Stairway to Heaven onto the Highway to Hell with Xtext

ADVICE RESISTANCE

Page 29: From Stairway to Heaven onto the Highway to Hell with Xtext

WRONGTOOL

Page 30: From Stairway to Heaven onto the Highway to Hell with Xtext

PROBLEM

SOLUTION

Page 31: From Stairway to Heaven onto the Highway to Hell with Xtext

• 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

Page 32: From Stairway to Heaven onto the Highway to Hell with Xtext

KEEP INFORMED

itemis.com / Blogs / Xtext

@kthoms

@holgerschill

@itemis

@chrdietrich

@franzbecker_io