SlideShare une entreprise Scribd logo
1  sur  17
Télécharger pour lire hors ligne
Medellín.rb
@RubyMedellin
http://medellinrb.org
Schedule
- Say Hi
- Domain-Specific Language’s in Ruby
- Yummy yummy
- Code Kata
@RubyMedellin
http://medellinrb.org
Domain-Specific Language
A domain-specific language (DSL) is a
computer language specialized to a
particular application domain. This is in
contrast to a general-purpose language
(GPL), which is broadly applicable across
domains, and lacks specialized features
for a particular domain.
http://en.wikipedia.org/wiki/Domain-specific_language
Domain-Specific Language
A domain-specific language (DSL) is a
computer language specialized to a
particular application domain. This is in
contrast to a general-purpose language
(GPL), which is broadly applicable across
domains, and lacks specialized features
for a particular domain.
http://en.wikipedia.org/wiki/Domain-specific_language
Mini-Language’s
Mini-Language’s
RSpec
describe 'dashboard statistics panel' do
context 'when logged in' do
it { is_expected.to respond_with 200 }
end
context 'when logged out' do
it { is_expected.to respond_with 401 }
end
end
Cucumber
Scenario: eat 5 out of 12
Given there are 12 cucumbers
When I eat 5 cucumbers
Then I should have 7 cucumbers
Scenario: eat 5 out of 20
Given there are 20 cucumbers
When I eat 5 cucumbers
Then I should have 15 cucumbers
Factory Girl
FactoryGirl.define do
factory :user do
first_name "John"
last_name "Doe"
admin false
end
factory :admin, class: User do
first_name "Admin"
last_name "User"
admin true
end
end
ActiveRecord::Migration
class CreateProducts < ActiveRecord::Migration
def change
create_table :products do |t|
t.string :name
t.text :description
t.timestamps null: false
end
end
end
ActionDispatch::Routing
Rails.application.routes.draw do
resources :products
end
Prefix Verb URI Pattern Controller#Action
products GET /products(.:format) products#index
POST /products(.:format) products#create
new_product GET /products/new(.:format) products#new
edit_product GET /products/:id/edit(.:format) products#edit
product GET /products/:id(.:format) products#show
PATCH /products/:id(.:format) products#update
PUT /products/:id(.:format) products#update
DELETE /products/:id(.:format) products#destroy
DEMO
Code will be uploaded to: https://github.com/medellinrb/ruby_dsl
Yummy yummy
Code Kata
Code Kata
Kata (型 or 形 literally: "form"?
), a Japanese word, are the
detailed choreographed patterns of movements practised
either solo or in pairs.
A code kata is an exercise in programming which helps a
programmer hone their skills through practice and
repetition.
http://en.wikipedia.org/wiki/Kata_(programming) - http://en.wikipedia.org/wiki/Kata
Today’s Kata
markup = FancyMarkup.new
markup.document do
body do
div id: ‘container’, class: ‘kool’ do
list class: ‘pretty’ do
item “item 1”
item “item 2”
end
end
end
end
markup.to_html
“<html>
<body>
<div id=”container”>
<ul class=”pretty”>
<li>item 1</li>
<li>item 2</li>
</ul>
</div>
</body>
</html>”
Fork https://github.com/medellinrb/ruby_dsl and submit your solutions
Thanks <3
Medellín.rb
@RubyMedellin
http://medellinrb.org

Contenu connexe

En vedette

Keynote01 -boris--foundation update-8-10-2012
Keynote01 -boris--foundation update-8-10-2012Keynote01 -boris--foundation update-8-10-2012
Keynote01 -boris--foundation update-8-10-2012
OpenCity Community
 
Civil Society - recommendations from AIGLIA2014
Civil Society - recommendations from AIGLIA2014Civil Society - recommendations from AIGLIA2014
Civil Society - recommendations from AIGLIA2014
futureagricultures
 
M6d cassandrapresentation
M6d cassandrapresentationM6d cassandrapresentation
M6d cassandrapresentation
Edward Capriolo
 
Motion Sensors + Audio Visual Performance
Motion Sensors + Audio Visual PerformanceMotion Sensors + Audio Visual Performance
Motion Sensors + Audio Visual Performance
SkyRonDotOrg
 
Stop motion evaluation
Stop motion evaluationStop motion evaluation
Stop motion evaluation
aq101824
 
Evaluation Question 1: Prep for Interview
Evaluation Question 1: Prep for InterviewEvaluation Question 1: Prep for Interview
Evaluation Question 1: Prep for Interview
Sammi Wilde
 

En vedette (20)

Seko profile n-networking_racks
Seko profile n-networking_racksSeko profile n-networking_racks
Seko profile n-networking_racks
 
Bio-vision_Kerala quiz 2016
Bio-vision_Kerala quiz 2016Bio-vision_Kerala quiz 2016
Bio-vision_Kerala quiz 2016
 
Keynote01 -boris--foundation update-8-10-2012
Keynote01 -boris--foundation update-8-10-2012Keynote01 -boris--foundation update-8-10-2012
Keynote01 -boris--foundation update-8-10-2012
 
Trabajo extractase de ingles
Trabajo extractase de inglesTrabajo extractase de ingles
Trabajo extractase de ingles
 
Civil Society - recommendations from AIGLIA2014
Civil Society - recommendations from AIGLIA2014Civil Society - recommendations from AIGLIA2014
Civil Society - recommendations from AIGLIA2014
 
Final
FinalFinal
Final
 
Comicus-HouseOfTrumps
Comicus-HouseOfTrumpsComicus-HouseOfTrumps
Comicus-HouseOfTrumps
 
affTA11 - LampiranC
affTA11 - LampiranCaffTA11 - LampiranC
affTA11 - LampiranC
 
An Ounce of Prevention
An Ounce of PreventionAn Ounce of Prevention
An Ounce of Prevention
 
Ideas generation
Ideas generationIdeas generation
Ideas generation
 
M6d cassandrapresentation
M6d cassandrapresentationM6d cassandrapresentation
M6d cassandrapresentation
 
Презентация
ПрезентацияПрезентация
Презентация
 
Motion Sensors + Audio Visual Performance
Motion Sensors + Audio Visual PerformanceMotion Sensors + Audio Visual Performance
Motion Sensors + Audio Visual Performance
 
Perfil losa deportiva
Perfil losa deportivaPerfil losa deportiva
Perfil losa deportiva
 
Развитие сотрудников в Superjob
Развитие сотрудников в SuperjobРазвитие сотрудников в Superjob
Развитие сотрудников в Superjob
 
Маркетинговая программа "Быстрого роста 3+3"
Маркетинговая программа "Быстрого роста 3+3"Маркетинговая программа "Быстрого роста 3+3"
Маркетинговая программа "Быстрого роста 3+3"
 
Stop motion evaluation
Stop motion evaluationStop motion evaluation
Stop motion evaluation
 
1 17
1 171 17
1 17
 
Evaluation Question 1: Prep for Interview
Evaluation Question 1: Prep for InterviewEvaluation Question 1: Prep for Interview
Evaluation Question 1: Prep for Interview
 
Time for a more nuanced debate on child labour
Time for a more nuanced debate on child labourTime for a more nuanced debate on child labour
Time for a more nuanced debate on child labour
 

Similaire à Domain Specific Languages in Ruby - Medellin.rb

Bdd and dsl как способ построения коммуникации на проекте
Bdd and dsl как способ построения коммуникации на проектеBdd and dsl как способ построения коммуникации на проекте
Bdd and dsl как способ построения коммуникации на проекте
ISsoft
 
Sprache als Werkzeug: DSLs mit Kotlin (JAX 2020)
Sprache als Werkzeug: DSLs mit Kotlin (JAX 2020)Sprache als Werkzeug: DSLs mit Kotlin (JAX 2020)
Sprache als Werkzeug: DSLs mit Kotlin (JAX 2020)
Frank Scheffler
 
Os Alrubaie Ruby
Os Alrubaie RubyOs Alrubaie Ruby
Os Alrubaie Ruby
oscon2007
 

Similaire à Domain Specific Languages in Ruby - Medellin.rb (20)

Defining DSL (Domain Specific Language) using Ruby
Defining DSL (Domain Specific Language) using RubyDefining DSL (Domain Specific Language) using Ruby
Defining DSL (Domain Specific Language) using Ruby
 
What's DSL and what isn't
What's DSL and what isn'tWhat's DSL and what isn't
What's DSL and what isn't
 
Bdd and dsl как способ построения коммуникации на проекте
Bdd and dsl как способ построения коммуникации на проектеBdd and dsl как способ построения коммуникации на проекте
Bdd and dsl как способ построения коммуникации на проекте
 
BDD or DSL как способ построения коммуникации на проекте - опыт комплексного ...
BDD or DSL как способ построения коммуникации на проекте - опыт комплексного ...BDD or DSL как способ построения коммуникации на проекте - опыт комплексного ...
BDD or DSL как способ построения коммуникации на проекте - опыт комплексного ...
 
Domain Specific Languages
Domain Specific LanguagesDomain Specific Languages
Domain Specific Languages
 
Groovy DSL
Groovy DSLGroovy DSL
Groovy DSL
 
DSL Construction with Ruby - ThoughtWorks Masterclass Series 2009
DSL Construction with Ruby - ThoughtWorks Masterclass Series 2009DSL Construction with Ruby - ThoughtWorks Masterclass Series 2009
DSL Construction with Ruby - ThoughtWorks Masterclass Series 2009
 
Fukuoka Ruby Award 2023 - Opal
Fukuoka Ruby Award 2023 - OpalFukuoka Ruby Award 2023 - Opal
Fukuoka Ruby Award 2023 - Opal
 
Building domain-specific languages with Groovy
Building domain-specific languages with GroovyBuilding domain-specific languages with Groovy
Building domain-specific languages with Groovy
 
Presentation on Programming Languages.
Presentation on Programming Languages.Presentation on Programming Languages.
Presentation on Programming Languages.
 
Modular Language Composition for the Masses
Modular Language Composition for the MassesModular Language Composition for the Masses
Modular Language Composition for the Masses
 
groovy DSLs from beginner to expert
groovy DSLs from beginner to expertgroovy DSLs from beginner to expert
groovy DSLs from beginner to expert
 
vb script
vb scriptvb script
vb script
 
GroovyDSLs
GroovyDSLsGroovyDSLs
GroovyDSLs
 
Sprache als Werkzeug: DSLs mit Kotlin (JAX 2020)
Sprache als Werkzeug: DSLs mit Kotlin (JAX 2020)Sprache als Werkzeug: DSLs mit Kotlin (JAX 2020)
Sprache als Werkzeug: DSLs mit Kotlin (JAX 2020)
 
Os Alrubaie Ruby
Os Alrubaie RubyOs Alrubaie Ruby
Os Alrubaie Ruby
 
Barcelona Multilanguage
Barcelona MultilanguageBarcelona Multilanguage
Barcelona Multilanguage
 
The Ring programming language version 1.5.2 book - Part 5 of 181
The Ring programming language version 1.5.2 book - Part 5 of 181The Ring programming language version 1.5.2 book - Part 5 of 181
The Ring programming language version 1.5.2 book - Part 5 of 181
 
Enlightenment: A Cross Platform Window Manager & Toolkit
Enlightenment: A Cross Platform Window Manager & ToolkitEnlightenment: A Cross Platform Window Manager & Toolkit
Enlightenment: A Cross Platform Window Manager & Toolkit
 
Metaprogramming patterns
Metaprogramming patternsMetaprogramming patterns
Metaprogramming patterns
 

Dernier

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Dernier (20)

Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
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...
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
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
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
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
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 

Domain Specific Languages in Ruby - Medellin.rb

  • 2. Schedule - Say Hi - Domain-Specific Language’s in Ruby - Yummy yummy - Code Kata @RubyMedellin http://medellinrb.org
  • 3. Domain-Specific Language A domain-specific language (DSL) is a computer language specialized to a particular application domain. This is in contrast to a general-purpose language (GPL), which is broadly applicable across domains, and lacks specialized features for a particular domain. http://en.wikipedia.org/wiki/Domain-specific_language
  • 4. Domain-Specific Language A domain-specific language (DSL) is a computer language specialized to a particular application domain. This is in contrast to a general-purpose language (GPL), which is broadly applicable across domains, and lacks specialized features for a particular domain. http://en.wikipedia.org/wiki/Domain-specific_language
  • 7. RSpec describe 'dashboard statistics panel' do context 'when logged in' do it { is_expected.to respond_with 200 } end context 'when logged out' do it { is_expected.to respond_with 401 } end end
  • 8. Cucumber Scenario: eat 5 out of 12 Given there are 12 cucumbers When I eat 5 cucumbers Then I should have 7 cucumbers Scenario: eat 5 out of 20 Given there are 20 cucumbers When I eat 5 cucumbers Then I should have 15 cucumbers
  • 9. Factory Girl FactoryGirl.define do factory :user do first_name "John" last_name "Doe" admin false end factory :admin, class: User do first_name "Admin" last_name "User" admin true end end
  • 10. ActiveRecord::Migration class CreateProducts < ActiveRecord::Migration def change create_table :products do |t| t.string :name t.text :description t.timestamps null: false end end end
  • 11. ActionDispatch::Routing Rails.application.routes.draw do resources :products end Prefix Verb URI Pattern Controller#Action products GET /products(.:format) products#index POST /products(.:format) products#create new_product GET /products/new(.:format) products#new edit_product GET /products/:id/edit(.:format) products#edit product GET /products/:id(.:format) products#show PATCH /products/:id(.:format) products#update PUT /products/:id(.:format) products#update DELETE /products/:id(.:format) products#destroy
  • 12. DEMO Code will be uploaded to: https://github.com/medellinrb/ruby_dsl
  • 15. Code Kata Kata (型 or 形 literally: "form"? ), a Japanese word, are the detailed choreographed patterns of movements practised either solo or in pairs. A code kata is an exercise in programming which helps a programmer hone their skills through practice and repetition. http://en.wikipedia.org/wiki/Kata_(programming) - http://en.wikipedia.org/wiki/Kata
  • 16. Today’s Kata markup = FancyMarkup.new markup.document do body do div id: ‘container’, class: ‘kool’ do list class: ‘pretty’ do item “item 1” item “item 2” end end end end markup.to_html “<html> <body> <div id=”container”> <ul class=”pretty”> <li>item 1</li> <li>item 2</li> </ul> </div> </body> </html>” Fork https://github.com/medellinrb/ruby_dsl and submit your solutions