SlideShare una empresa de Scribd logo
1 de 18
Domain Specific Languages Dror Helper
About.Me Software developer  Blogger (http://blog.drorhelper.com) Language geek
What do they mean? Bug Feature Release Candidate Show stopper “The next release candidate would contain features X, Y & Z and no more than 5 high priority Bugsandno show stoppers”
Agenda Why should I use DSLs Domain Specific Languages Fluent interface
Domain Specific Languages created specifically to solve problems in a particular domain Layer of abstraction on top of an existing domain model Can be used by domain experts
DSL classification External vs. Internal Textual vs. Graphic
Graphical DSLs
External DSLs SELECTBook.title, count(*) ASAuthors FROMBook JOINBook_authorONBook.isbn = Book_author.isbnGROUPBYBook.title; <([A-Z][A-Z0-9]*)[^>]*>(.*?)</> buyIBM @ 100 forNOMURA sellGOOGLE @ limitprice= 70 for CHASE
Internal DSLs Built on top of an existing language Use languages like Ruby, Python, BOO
Fluent interfaces coined by Eric Evans and Martin Fowler An OOP API that aims to provide readable code Use method chaining an pass context via return value ,[object Object]
DateTime.Now.AddDays(7);  DateTime.Now.AddWeeks(1);,[object Object]
Fluent Interface design Hide your working. Keep your state to yourself. Think really hard about names. Take advantage of your implementation language. If you have them, blocks are you friends. Test first design can be a useful way of exploring what your interface should be. Reasonable defaults.
Tips & Tricks  Use Interfaces Return different interface to change functionality Generics are handy if user need to specify type Lambda and delegates for custom functionality
Books DSLs in Action DSLs in Boo
The shopping cart	 A Domain Specific exercise
The Story You need to create a simple rule engine that would enable developers to add custom rules to the company’s Shopping cart application.
The engine Three customer types: regular, preferred & VIP Customer the following fields:  name  address date of birth The system tracks the customer’s purchases (date, amount) Products can be on Sale (discount) Discount changes according to rules Each rule must have a customer type
Usage examples A VIP customer get 15% discount on all purchases Buying product A would give you 10% discount on product B Preferred and VIP customers can buy 5 + 1 of a specific product All customers can get 20% off purchase using specific coupon If amount of purchase > 100$ customer is entitled for 10% discount. If customer have purchased > 100$ the last three months upgrade him to VIP On the customer’s birthday he’s entitled to 50% discount All customers living in New York can get up to 25% off all purchases

Más contenido relacionado

Destacado

Destacado (11)

Introduction to Agile & scrum
Introduction to Agile & scrumIntroduction to Agile & scrum
Introduction to Agile & scrum
 
Infrastructure code in Agile software development
Infrastructure code in Agile software developmentInfrastructure code in Agile software development
Infrastructure code in Agile software development
 
Scrum intro
Scrum intro Scrum intro
Scrum intro
 
Scrum training day 2
Scrum training day 2Scrum training day 2
Scrum training day 2
 
Scrum training day 1
Scrum training day 1Scrum training day 1
Scrum training day 1
 
Less intro workshop
Less intro workshopLess intro workshop
Less intro workshop
 
Lean sw development il tech-talks
Lean sw development   il tech-talksLean sw development   il tech-talks
Lean sw development il tech-talks
 
Agile estimation and planning
Agile estimation and planning Agile estimation and planning
Agile estimation and planning
 
Practical-Agile Product owner workshop
Practical-Agile Product owner workshopPractical-Agile Product owner workshop
Practical-Agile Product owner workshop
 
Advanced Scrum master workshop
Advanced Scrum master workshopAdvanced Scrum master workshop
Advanced Scrum master workshop
 
Get rid of boring retrospectives
Get rid of boring retrospectivesGet rid of boring retrospectives
Get rid of boring retrospectives
 

Similar a Domain specific languages

Ahrefs SEO Toolset Quick Guide ( Updated in August 2013)
Ahrefs SEO Toolset Quick Guide  ( Updated in August 2013) Ahrefs SEO Toolset Quick Guide  ( Updated in August 2013)
Ahrefs SEO Toolset Quick Guide ( Updated in August 2013)
Clare Hoang
 

Similar a Domain specific languages (20)

Website development proposal - Leadtrance Technologies
Website development proposal - Leadtrance TechnologiesWebsite development proposal - Leadtrance Technologies
Website development proposal - Leadtrance Technologies
 
Domain Driven Design Introduction
Domain Driven Design IntroductionDomain Driven Design Introduction
Domain Driven Design Introduction
 
Salesforce CPQ by yuvaraj
Salesforce CPQ by yuvarajSalesforce CPQ by yuvaraj
Salesforce CPQ by yuvaraj
 
Front-End Performance Checklist 2020
Front-End Performance Checklist 2020Front-End Performance Checklist 2020
Front-End Performance Checklist 2020
 
Code & Cannoli - Domain Driven Design
Code & Cannoli - Domain Driven DesignCode & Cannoli - Domain Driven Design
Code & Cannoli - Domain Driven Design
 
SMX West 2012 - Duplication, Aggregation, Syndication, Affiliates, Scraping &...
SMX West 2012 - Duplication, Aggregation, Syndication, Affiliates, Scraping &...SMX West 2012 - Duplication, Aggregation, Syndication, Affiliates, Scraping &...
SMX West 2012 - Duplication, Aggregation, Syndication, Affiliates, Scraping &...
 
SBF STEALTH (en)
SBF STEALTH (en)SBF STEALTH (en)
SBF STEALTH (en)
 
Ahrefs SEO Toolset Quick Guide ( Updated in August 2013)
Ahrefs SEO Toolset Quick Guide  ( Updated in August 2013) Ahrefs SEO Toolset Quick Guide  ( Updated in August 2013)
Ahrefs SEO Toolset Quick Guide ( Updated in August 2013)
 
Sage X3 Sales App: Gain Mobile Access to Sage X3
Sage X3 Sales App: Gain Mobile Access to Sage X3Sage X3 Sales App: Gain Mobile Access to Sage X3
Sage X3 Sales App: Gain Mobile Access to Sage X3
 
Internal DSLs For Automated Functional Testing
Internal DSLs For Automated Functional TestingInternal DSLs For Automated Functional Testing
Internal DSLs For Automated Functional Testing
 
IBM Forms Experience Builder on Cloud
IBM Forms Experience Builder on Cloud IBM Forms Experience Builder on Cloud
IBM Forms Experience Builder on Cloud
 
SDWest2005Goetsch
SDWest2005GoetschSDWest2005Goetsch
SDWest2005Goetsch
 
Local edge
Local edgeLocal edge
Local edge
 
Wordpress org support_topic_displaying_phone_numbers
Wordpress org support_topic_displaying_phone_numbersWordpress org support_topic_displaying_phone_numbers
Wordpress org support_topic_displaying_phone_numbers
 
AI Builder Deepdive DynamicsPower! Brussels 2019
AI Builder Deepdive DynamicsPower! Brussels 2019AI Builder Deepdive DynamicsPower! Brussels 2019
AI Builder Deepdive DynamicsPower! Brussels 2019
 
Versioned Page Objects: How to handle 12 versions of web application
Versioned Page Objects: How to handle 12 versions of web applicationVersioned Page Objects: How to handle 12 versions of web application
Versioned Page Objects: How to handle 12 versions of web application
 
Responsive Web Design Basics
Responsive Web Design BasicsResponsive Web Design Basics
Responsive Web Design Basics
 
How to reduce DTP and translation costs with FrameMaker
How to reduce DTP and translation costs with FrameMakerHow to reduce DTP and translation costs with FrameMaker
How to reduce DTP and translation costs with FrameMaker
 
Conga composer
Conga composerConga composer
Conga composer
 
Select an e forms vendor
Select an e forms vendorSelect an e forms vendor
Select an e forms vendor
 

Más de Dror Helper

Más de Dror Helper (20)

Unit testing patterns for concurrent code
Unit testing patterns for concurrent codeUnit testing patterns for concurrent code
Unit testing patterns for concurrent code
 
The secret unit testing tools no one ever told you about
The secret unit testing tools no one ever told you aboutThe secret unit testing tools no one ever told you about
The secret unit testing tools no one ever told you about
 
Debugging with visual studio beyond 'F5'
Debugging with visual studio beyond 'F5'Debugging with visual studio beyond 'F5'
Debugging with visual studio beyond 'F5'
 
From clever code to better code
From clever code to better codeFrom clever code to better code
From clever code to better code
 
From clever code to better code
From clever code to better codeFrom clever code to better code
From clever code to better code
 
A software developer guide to working with aws
A software developer guide to working with awsA software developer guide to working with aws
A software developer guide to working with aws
 
The secret unit testing tools no one has ever told you about
The secret unit testing tools no one has ever told you aboutThe secret unit testing tools no one has ever told you about
The secret unit testing tools no one has ever told you about
 
The role of the architect in agile
The role of the architect in agileThe role of the architect in agile
The role of the architect in agile
 
Harnessing the power of aws using dot net core
Harnessing the power of aws using dot net coreHarnessing the power of aws using dot net core
Harnessing the power of aws using dot net core
 
Developing multi-platform microservices using .NET core
 Developing multi-platform microservices using .NET core Developing multi-platform microservices using .NET core
Developing multi-platform microservices using .NET core
 
Harnessing the power of aws using dot net
Harnessing the power of aws using dot netHarnessing the power of aws using dot net
Harnessing the power of aws using dot net
 
Secret unit testing tools no one ever told you about
Secret unit testing tools no one ever told you aboutSecret unit testing tools no one ever told you about
Secret unit testing tools no one ever told you about
 
C++ Unit testing - the good, the bad & the ugly
C++ Unit testing - the good, the bad & the uglyC++ Unit testing - the good, the bad & the ugly
C++ Unit testing - the good, the bad & the ugly
 
Working with c++ legacy code
Working with c++ legacy codeWorking with c++ legacy code
Working with c++ legacy code
 
Visual Studio tricks every dot net developer should know
Visual Studio tricks every dot net developer should knowVisual Studio tricks every dot net developer should know
Visual Studio tricks every dot net developer should know
 
Secret unit testing tools
Secret unit testing toolsSecret unit testing tools
Secret unit testing tools
 
Electronics 101 for software developers
Electronics 101 for software developersElectronics 101 for software developers
Electronics 101 for software developers
 
Navigating the xDD Alphabet Soup
Navigating the xDD Alphabet SoupNavigating the xDD Alphabet Soup
Navigating the xDD Alphabet Soup
 
Building unit tests correctly
Building unit tests correctlyBuilding unit tests correctly
Building unit tests correctly
 
Who’s afraid of WinDbg
Who’s afraid of WinDbgWho’s afraid of WinDbg
Who’s afraid of WinDbg
 

Último

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Último (20)

Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 

Domain specific languages

  • 2. About.Me Software developer Blogger (http://blog.drorhelper.com) Language geek
  • 3. What do they mean? Bug Feature Release Candidate Show stopper “The next release candidate would contain features X, Y & Z and no more than 5 high priority Bugsandno show stoppers”
  • 4. Agenda Why should I use DSLs Domain Specific Languages Fluent interface
  • 5. Domain Specific Languages created specifically to solve problems in a particular domain Layer of abstraction on top of an existing domain model Can be used by domain experts
  • 6. DSL classification External vs. Internal Textual vs. Graphic
  • 8. External DSLs SELECTBook.title, count(*) ASAuthors FROMBook JOINBook_authorONBook.isbn = Book_author.isbnGROUPBYBook.title; <([A-Z][A-Z0-9]*)[^>]*>(.*?)</> buyIBM @ 100 forNOMURA sellGOOGLE @ limitprice= 70 for CHASE
  • 9. Internal DSLs Built on top of an existing language Use languages like Ruby, Python, BOO
  • 10.
  • 11.
  • 12. Fluent Interface design Hide your working. Keep your state to yourself. Think really hard about names. Take advantage of your implementation language. If you have them, blocks are you friends. Test first design can be a useful way of exploring what your interface should be. Reasonable defaults.
  • 13. Tips & Tricks Use Interfaces Return different interface to change functionality Generics are handy if user need to specify type Lambda and delegates for custom functionality
  • 14. Books DSLs in Action DSLs in Boo
  • 15. The shopping cart A Domain Specific exercise
  • 16. The Story You need to create a simple rule engine that would enable developers to add custom rules to the company’s Shopping cart application.
  • 17. The engine Three customer types: regular, preferred & VIP Customer the following fields: name address date of birth The system tracks the customer’s purchases (date, amount) Products can be on Sale (discount) Discount changes according to rules Each rule must have a customer type
  • 18. Usage examples A VIP customer get 15% discount on all purchases Buying product A would give you 10% discount on product B Preferred and VIP customers can buy 5 + 1 of a specific product All customers can get 20% off purchase using specific coupon If amount of purchase > 100$ customer is entitled for 10% discount. If customer have purchased > 100$ the last three months upgrade him to VIP On the customer’s birthday he’s entitled to 50% discount All customers living in New York can get up to 25% off all purchases

Notas del editor

  1. An internal DSL is one that uses the infrastructure of an existing programming language(also called the host language of the DSL) to build domain-specific semanticson top of it. One of the most popular internal DSLs used today is Rails, which is implementedon top of the Ruby programming language. When you write Rails code,you’re programming in Ruby, based on the semantics that Rails implements for developingweb applications. In most cases, an internal DSL is implemented as a library ontop of the existing host language.An external DSL is one that’s developed ground-up and has separate infrastructure forlexical analysis, parsing techniques, interpretation, compilation, and code generation.Developing an external DSL is similar to implementing a new language fromscratch with its own syntax and semantics. Build tools like make, parser generators likeYACC, and lexical analysis tools like LEX are examples of popular external DSLs.
  2. Fromhttp://en.wikipedia.org/wiki/Fluent_interface