Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
DSL Design - Best Practices (XtextCON 2015)
Search
Sven Efftinge
May 20, 2015
Technology
0
1.1k
DSL Design - Best Practices (XtextCON 2015)
Sven Efftinge
May 20, 2015
Tweet
Share
More Decks by Sven Efftinge
See All by Sven Efftinge
Life of a Resource (XtextCON 2015)
svenefftinge
0
320
Future of Xtext (with Sebastian Zarnekow)
svenefftinge
0
19k
Other Decks in Technology
See All in Technology
君はジョシュアツリーを知っているか?名前をつけて事象を正しく認識しよう / Do you know Joshua Tree?
ykanoh
4
120
形式手法特論:SMT ソルバで解く認可ポリシの静的解析 #kernelvm / Kernel VM Study Tsukuba No3
ytaka23
1
790
「捨てる」を設計する
kubell_hr
0
240
Blue/Green Deployment を用いた PostgreSQL のメジャーバージョンアップ
kkato1
0
120
AI時代のIssue駆動開発のススメ
moongift
PRO
0
210
QA組織のAI戦略とAIテスト設計システムAITASの実践
sansantech
PRO
1
140
夢の無限スパゲッティ製造機 #phperkaigi
o0h
PRO
0
360
新規事業×QAの挑戦:不確実性を乗りこなす!フェーズごとに求められるQAの役割変革
hacomono
PRO
0
180
Astro Islandsの 内部実装を 「日本で一番わかりやすく」 ざっくり解説!
knj
1
270
Phase06_ClaudeCode実践
overflowinc
0
1.9k
MCPで決済に楽にする
mu7889yoon
0
100
ThetaOS - A Mythical Machine comes Alive
aslander
0
170
Featured
See All Featured
Agile Leadership in an Agile Organization
kimpetersen
PRO
0
120
Typedesign – Prime Four
hannesfritz
42
3k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
49
9.9k
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
0
170
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
300
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
10k
Six Lessons from altMBA
skipperchong
29
4.2k
Stop Working from a Prison Cell
hatefulcrawdad
274
21k
The Mindset for Success: Future Career Progression
greggifford
PRO
0
290
Darren the Foodie - Storyboard
khoart
PRO
3
3k
職位にかかわらず全員がリーダーシップを発揮するチーム作り / Building a team where everyone can demonstrate leadership regardless of position
madoxten
62
53k
Transcript
DSL DESIGN Sven Efftinge
Why an External DSL • Write the thing you care
in the way you want • Have compile time feedback, that understand your domain • Be cross platform / platform independent
DSL Design != GPL Design
A Good DSL makes editing simpler makes reading simpler improves
stakeholder communication uses a familiar syntax nicely integrates into workflow tools and execution are fast is highly maintainable
DSL A Powerful Programming Interface User Interface
Who does What Requirements Engineering
Use Existing Domain Terminology
Use Familiar SYNTAX
When To Sugar Be explicit and regular unless the concept
is used often and well known
Never Change
class { visibility=public name="HelloWorld" members = [ method { visibility=public
static=true returnType=void name="main" parameters = [ parameter { type = String varArgs = true name = args } ] ... } ] } public class HelloWorld { public static void main(String... args) { System.out.println("Hello World"); } } Generic vs. Specific
Business Readable DSLs
Use Structure, use Whitespace
Be Regular
Keywords First reduces look ahead for the parser &
the reader visual anchor
Good Defaults
Multiple Files FTW a package or namespace is a logical
container but not necessarily a physical! improves collaboration
Names! Simple name clashes are rare We think in names
No more UUIDs!
Loose Grammar
Strict Validation
you ain’t gonna need it
Don’t Reinvent Expressions
Invasiveness • The outside view must only change when
the file changes physically • Bad Example: Xtend return types
Dynamic Scoping Never!
Preprocessors Nooo!
N-to-1 Code Generation source source generated No more incremental builds!
OutOfMemoryException!
Questions