SlideShare a Scribd company logo
Domain-Specific Languages

          Phillip Trelford
          Tomas Petricek
 Progressive F# Tutorials NYC 2012
Thoughtworks Tech Radar 2012
F#                              Languages



“F# is excellent at concisely
  expressing business and
  domain logic.”
UML Sequence Diagrams

let fred = Object("FredrnPatron")
let bob = Object("BobrnWaiter")
let hank = Object("HankrnCook")
let renee = Object("ReneernCashier")
Types
F#                                    UML Class Diagram

type Object(name) =
 member this.Name = name

type Action =
 | Call of Object * string *Object
 | Async of Object * string *Object
Functional Program Layout

          Types


         Functions


           API
DSLs for Testing
Internal DSL (NaturalSpec)              External DSL (Gherkin)
• [<Scenario>]                          • Given I input 5
• let ``When calculating factorial of   • When calculating the factorial
  5 it should equal 120``() =           • Then the result is 120
• Given 5
• |> When calculating factorial
• |> It should equal 120
• |> Verify
Learn More
• FParsec: http://www.quanttec.com/fparsec/
• FSLex /FsYacc:
  http://fsharppowerpack.codeplex.com/

More Related Content

PPT
Language processor implementation using python
PPTX
Mercury: A Functional Review
PPTX
Function class in c++
PPTX
Functions in c++
PPTX
05 functional programming
PPTX
Property based testing
PPTX
To Lombok or not to Lombok | J-Fall 2019
PDF
使用Dsl改善软件设计
Language processor implementation using python
Mercury: A Functional Review
Function class in c++
Functions in c++
05 functional programming
Property based testing
To Lombok or not to Lombok | J-Fall 2019
使用Dsl改善软件设计

Similar to Domain specific languages - progressive f sharp tutorials nyc 2012 (20)

PPTX
F# for functional enthusiasts
PPTX
FSharp eye for the Haskell guy - London 2015
PPTX
Introduction to F#
PPTX
Creating Domain Specific Languages in F#
PDF
Functional Programming in F#
PPTX
Functional Programming Fundamentals
PPTX
F# Eye 4 the C# Guy - DDD Cambridge Nights 2014
PPTX
Functional programming with FSharp
PPT
F# and the DLR
PPTX
Functional Architecture - goto copenhagen 2012
PPTX
F# Eye for the C# guy - Øredev 2013
PDF
F# and Reactive Programming for iOS
PDF
Using Language Oriented Programming to Execute Computations on the GPU
PPTX
Mobile F#un
PPTX
Sharper tools with F#
PDF
Functional programming with F#
PPTX
F# Eye For The C# Guy - f(by) Minsk 2014
ODP
F# 101
PPTX
F# Eye 4 the C# Guy
PPTX
Introduction to Functional Programming in FSharp
F# for functional enthusiasts
FSharp eye for the Haskell guy - London 2015
Introduction to F#
Creating Domain Specific Languages in F#
Functional Programming in F#
Functional Programming Fundamentals
F# Eye 4 the C# Guy - DDD Cambridge Nights 2014
Functional programming with FSharp
F# and the DLR
Functional Architecture - goto copenhagen 2012
F# Eye for the C# guy - Øredev 2013
F# and Reactive Programming for iOS
Using Language Oriented Programming to Execute Computations on the GPU
Mobile F#un
Sharper tools with F#
Functional programming with F#
F# Eye For The C# Guy - f(by) Minsk 2014
F# 101
F# Eye 4 the C# Guy
Introduction to Functional Programming in FSharp
Ad

More from Phillip Trelford (20)

PPTX
How to be a rock star developer
PPTX
F# eXchange Keynote 2016
PPTX
Beyond lists - Copenhagen 2015
PPTX
F# for C# devs - Copenhagen .Net 2015
PPTX
Generative Art - Functional Vilnius 2015
PPTX
24 hours later - FSharp Gotham 2015
PPTX
Building cross platform games with Xamarin - Birmingham 2015
PPTX
Beyond Lists - Functional Kats Conf Dublin 2015
PPTX
FSharp On The Desktop - Birmingham FP 2015
PPTX
Ready, steady, cross platform games - ProgNet 2015
PPTX
F# for C# devs - NDC Oslo 2015
PPTX
F# for C# devs - Leeds Sharp 2015
PPTX
Build a compiler in 2hrs - NCrafts Paris 2015
PPTX
24 Hours Later - NCrafts Paris 2015
PPTX
Real World F# - SDD 2015
PPTX
F# for C# devs - SDD 2015
PPTX
Machine learning from disaster - GL.Net 2015
PPTX
F# for Trading - QuantLabs 2014
PPTX
Write Your Own Compiler in 24 Hours
PPTX
FParsec Hands On - F#unctional Londoners 2014
How to be a rock star developer
F# eXchange Keynote 2016
Beyond lists - Copenhagen 2015
F# for C# devs - Copenhagen .Net 2015
Generative Art - Functional Vilnius 2015
24 hours later - FSharp Gotham 2015
Building cross platform games with Xamarin - Birmingham 2015
Beyond Lists - Functional Kats Conf Dublin 2015
FSharp On The Desktop - Birmingham FP 2015
Ready, steady, cross platform games - ProgNet 2015
F# for C# devs - NDC Oslo 2015
F# for C# devs - Leeds Sharp 2015
Build a compiler in 2hrs - NCrafts Paris 2015
24 Hours Later - NCrafts Paris 2015
Real World F# - SDD 2015
F# for C# devs - SDD 2015
Machine learning from disaster - GL.Net 2015
F# for Trading - QuantLabs 2014
Write Your Own Compiler in 24 Hours
FParsec Hands On - F#unctional Londoners 2014
Ad

Recently uploaded (20)

PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Machine learning based COVID-19 study performance prediction
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
NewMind AI Weekly Chronicles - August'25-Week II
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
A comparative analysis of optical character recognition models for extracting...
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PPTX
Machine Learning_overview_presentation.pptx
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Electronic commerce courselecture one. Pdf
PPTX
A Presentation on Artificial Intelligence
“AI and Expert System Decision Support & Business Intelligence Systems”
Building Integrated photovoltaic BIPV_UPV.pdf
Diabetes mellitus diagnosis method based random forest with bat algorithm
Machine learning based COVID-19 study performance prediction
gpt5_lecture_notes_comprehensive_20250812015547.pdf
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Encapsulation_ Review paper, used for researhc scholars
Dropbox Q2 2025 Financial Results & Investor Presentation
Agricultural_Statistics_at_a_Glance_2022_0.pdf
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
NewMind AI Weekly Chronicles - August'25-Week II
MYSQL Presentation for SQL database connectivity
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
A comparative analysis of optical character recognition models for extracting...
Reach Out and Touch Someone: Haptics and Empathic Computing
Machine Learning_overview_presentation.pptx
Assigned Numbers - 2025 - Bluetooth® Document
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Electronic commerce courselecture one. Pdf
A Presentation on Artificial Intelligence

Domain specific languages - progressive f sharp tutorials nyc 2012

  • 1. Domain-Specific Languages Phillip Trelford Tomas Petricek Progressive F# Tutorials NYC 2012
  • 2. Thoughtworks Tech Radar 2012 F# Languages “F# is excellent at concisely expressing business and domain logic.”
  • 3. UML Sequence Diagrams let fred = Object("FredrnPatron") let bob = Object("BobrnWaiter") let hank = Object("HankrnCook") let renee = Object("ReneernCashier")
  • 4. Types F# UML Class Diagram type Object(name) = member this.Name = name type Action = | Call of Object * string *Object | Async of Object * string *Object
  • 5. Functional Program Layout Types Functions API
  • 6. DSLs for Testing Internal DSL (NaturalSpec) External DSL (Gherkin) • [<Scenario>] • Given I input 5 • let ``When calculating factorial of • When calculating the factorial 5 it should equal 120``() = • Then the result is 120 • Given 5 • |> When calculating factorial • |> It should equal 120 • |> Verify
  • 7. Learn More • FParsec: http://www.quanttec.com/fparsec/ • FSLex /FsYacc: http://fsharppowerpack.codeplex.com/

Editor's Notes

  • #5: Lightweight types with correct defaultsImmutabilityCompositionSeparation of concernsLightweight functions with correct defaultsIdempotentTestableType signatures