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
18k
Other Decks in Technology
See All in Technology
あなたの知らない Linuxカーネル脆弱性の世界
recruitengineers
PRO
3
150
Wasmの気になる最新情報
askua
0
180
Implementing and Evaluating a High-Level Language with WasmGC and the Wasm Component Model: Scala’s Case
tanishiking
0
170
JSConf JPのwebsiteをGatsbyからNext.jsに移行した話 - Next.jsの多言語静的サイトと課題
leko
2
180
AIプロダクトのプロンプト実践テクニック / Practical Techniques for AI Product Prompts
saka2jp
0
100
Observability for the system understanding and curious by developers
maruloop
1
310
serverless team topology
_kensh
3
200
今この時代に技術とどう向き合うべきか
gree_tech
PRO
2
2.2k
AWS UG Grantでグローバル20名に選出されてre:Inventに行く話と、マルチクラウドセキュリティの教科書を執筆した話 / The Story of Being Selected for the AWS UG Grant to Attending re:Invent, and Writing a Multi-Cloud Security Textbook
yuj1osm
1
130
「最速」で Gemini CLI を使いこなそう! 〜Cloud Shell/Cloud Run の活用〜 / The Fastest Way to Master the Gemini CLI — with Cloud Shell and Cloud Run
aoto
PRO
1
170
現場データから見える、開発生産性の変化コード生成AI導入・運用のリアル〜 / Changes in Development Productivity and Operational Challenges Following the Introduction of Code Generation AI
nttcom
1
460
AWS DMS で SQL Server を移行してみた/aws-dms-sql-server-migration
emiki
0
150
Featured
See All Featured
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.1k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
657
61k
The Straight Up "How To Draw Better" Workshop
denniskardys
238
140k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
26
3.1k
Side Projects
sachag
455
43k
Optimizing for Happiness
mojombo
379
70k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.6k
Testing 201, or: Great Expectations
jmmastey
45
7.7k
The Art of Programming - Codeland 2020
erikaheidi
56
14k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
132
19k
YesSQL, Process and Tooling at Scale
rocio
173
15k
Imperfection Machines: The Place of Print at Facebook
scottboms
269
13k
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