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

Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
panagenda
 

Dernier (20)

Overview of Hyperledger Foundation
Overview of Hyperledger FoundationOverview of Hyperledger Foundation
Overview of Hyperledger Foundation
 
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
 
A Business-Centric Approach to Design System Strategy
A Business-Centric Approach to Design System StrategyA Business-Centric Approach to Design System Strategy
A Business-Centric Approach to Design System Strategy
 
Long journey of Ruby Standard library at RubyKaigi 2024
Long journey of Ruby Standard library at RubyKaigi 2024Long journey of Ruby Standard library at RubyKaigi 2024
Long journey of Ruby Standard library at RubyKaigi 2024
 
BT & Neo4j _ How Knowledge Graphs help BT deliver Digital Transformation.pptx
BT & Neo4j _ How Knowledge Graphs help BT deliver Digital Transformation.pptxBT & Neo4j _ How Knowledge Graphs help BT deliver Digital Transformation.pptx
BT & Neo4j _ How Knowledge Graphs help BT deliver Digital Transformation.pptx
 
PLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. StartupsPLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. Startups
 
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
 
WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024
 
Easier, Faster, and More Powerful – Notes Document Properties Reimagined
Easier, Faster, and More Powerful – Notes Document Properties ReimaginedEasier, Faster, and More Powerful – Notes Document Properties Reimagined
Easier, Faster, and More Powerful – Notes Document Properties Reimagined
 
Continuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
Continuing Bonds Through AI: A Hermeneutic Reflection on ThanabotsContinuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
Continuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
 
WSO2CONMay2024OpenSourceConferenceDebrief.pptx
WSO2CONMay2024OpenSourceConferenceDebrief.pptxWSO2CONMay2024OpenSourceConferenceDebrief.pptx
WSO2CONMay2024OpenSourceConferenceDebrief.pptx
 
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdfHow Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
 
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdfThe Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
 
Intro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджераIntro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджера
 
Oauth 2.0 Introduction and Flows with MuleSoft
Oauth 2.0 Introduction and Flows with MuleSoftOauth 2.0 Introduction and Flows with MuleSoft
Oauth 2.0 Introduction and Flows with MuleSoft
 
What's New in Teams Calling, Meetings and Devices April 2024
What's New in Teams Calling, Meetings and Devices April 2024What's New in Teams Calling, Meetings and Devices April 2024
What's New in Teams Calling, Meetings and Devices April 2024
 
WebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM PerformanceWebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM Performance
 
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
 
AI mind or machine power point presentation
AI mind or machine power point presentationAI mind or machine power point presentation
AI mind or machine power point presentation
 
Designing for Hardware Accessibility at Comcast
Designing for Hardware Accessibility at ComcastDesigning for Hardware Accessibility at Comcast
Designing for Hardware Accessibility at Comcast
 

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