SlideShare une entreprise Scribd logo
1  sur  48
Télécharger pour lire hors ligne
STORY DRIVEN
WEB DEVELOPMENT
MICHAEL KOUKOULLIS
PROGRAMMER
DESIGN
BUILD
WEB APPLICATIONS
STYLE OF DEVELOPMENT
SET OF TOOLS
WE FIND USEFUL
STORY DRIVEN DEVELOPMENT
CODE
RUBY
RAILS
CUCUMBER
HAPPY HAPPY SAD
WHAT I REALLY WANT?
WHY IT WORKS FOR US!
EVOLVING METHOD
DELIVERING BETTER SOFTWARE
ELEGANCE
ENJOYABLE
CREATIVE
STANDS ON ITS FEET
FOCUS. PEOPLE. TOOLS.
ON WITH THE SHOW
STORY DRIVEN DEVELOPMENT
EXAMPLE. FEATURE.
 Feature: Article tags
   In order to work with article tags
   As a site user
   I want to both create and delete tags
EXAMPLE. FEATURE.


  Scenario: Creating a tag
    Given an article exists with no tags
    When I submit a new tag for the article
    Then the article should have one tag
    And I am redirected to the article
EXAMPLE. FEATURE.


  Scenario: Creating a tag
    Given an article exists with no tags
    When I submit a new tag for the article
    Then the article should have one tag
    And I am redirected to the article

  Scenario: Deleting a tag
    Given an article exists with one tag
    When I delete the article tag
    Then the article should have no tags
    And I am redirected to the article
EXAMPLE. FEATURE.
 Feature: Article tags
   In order to work with article tags
   As a site user
   I want to both create and delete tags

   Scenario: Creating a tag
     Given an article exists with no tags
     When I submit a new tag for the article
     Then the article should have one tag
     And I am redirected to the article

   Scenario: Deleting a tag
     Given an article exists with one tag
     When I delete the article tag
     Then the article should have no tags
     And I am redirected to the article
DECLARATION OF INTENTION
NATURAL LANGUAGE
IMMENSELY POWERFUL
BEST THING YOU CAN DO AS A
PROGRAMMER?
CODE LESS.
EXAMPLE. FEATURE.
 Feature: Article tags
   In order to work with article tags
   As a site user
   I want to both create and delete tags

   Scenario: Creating a tag
     Given an article exists with no tags
     When I submit a new tag for the article
     Then the article should have one tag
     And I am redirected to the article

   Scenario: Deleting a tag
     Given an article exists with one tag
     When I delete the article tag
     Then the article should have no tags
     And I am redirected to the article
WRITE PROSE
AVOID GETTING PROGRAMMATIC
MAKE IT A ‘REAL’ STORY
ITS EXECUTABLE!
WORKFLOW
RUNNING THE STORY
FEATURE. RUNNER.
DEFINING. STEPS.
DEFINING. MODELS.
DEFINING. MODELS.
class Article < ActiveRecord::Base
  has_many :taggings, :dependent => :destroy
  has_many :tags, :through => :taggings

  def add_tag(value)
    new_tag = Tag.find_or_create_by_name(value)
    unless Tagging.exists?(:article_id => self.id, :tag_id => new_tag)
      taggings.create(:tag => new_tag)
    end
  end
end
DEFINING. MODELS.
class Article < ActiveRecord::Base
  has_many :taggings, :dependent => :destroy
  has_many :tags, :through => :taggings

  def add_tag(value)
    new_tag = Tag.find_or_create_by_name(value)
    unless Tagging.exists?(:article_id => self.id, :tag_id => new_tag)
      taggings.create(:tag => new_tag)
    end
  end
end

class Tagging < ActiveRecord::Base
  belongs_to :tag
  belongs_to :article
end
DEFINING. MODELS.
class Article < ActiveRecord::Base
  has_many :taggings, :dependent => :destroy
  has_many :tags, :through => :taggings

  def add_tag(value)
    new_tag = Tag.find_or_create_by_name(value)
    unless Tagging.exists?(:article_id => self.id, :tag_id => new_tag)
      taggings.create(:tag => new_tag)
    end
  end
end

class Tagging < ActiveRecord::Base
  belongs_to :tag
  belongs_to :article
end

class Tag < ActiveRecord::Base
  has_many :taggings
end
RERUNNING. FEATURE.
DEFINING. ROUTES.
ActionController::Routing::Routes.draw do |map|
  map.home quot;quot;, :controller => quot;pagesquot;, :action => quot;homequot;

  map.resources :articles do |article|
    article.resources :taggings
  end
end
RERUNNING. FEATURE.
DEFINING. CONTROLERS.
class TaggingsController < ApplicationController
  def create
    article = Article.find(params[:article_id])
    article.add_tag(params[:tags])
    redirect_to article_path(article)
  end

  def destroy
    article = Article.find(params[:article_id])
    tagging = article.taggings.find(params[:id])
    tagging.destroy
    redirect_to article_path(article)
  end
end
RERUNNING. FEATURE. SUCCESS!
JUST IN TIME
APP DEV
WORKFLOW
SHARED STEPS
REGEX
DRY IT UP
DRY IT UP. REGEX MATCHING.
Given /^an article exists with no tags$/ do
  @article = Article.create!(:title => quot;Beautiful Evidencequot;)
end

Given /^an article exists with one tag$/ do
  @article = Article.create!(:title => quot;Beautiful Evidencequot;)
  @tag = Tag.create!(:name => quot;visualisationquot;)
  @tagging = @article.taggings.create!(:tag => @tag)
end
DRY IT UP. REGEX MATCHING.
Given /^an article exists with no tags$/ do
  @article = Article.create!(:title => quot;Beautiful Evidencequot;)
end

Given /^an article exists with one tag$/ do
  @article = Article.create!(:title => quot;Beautiful Evidencequot;)
  @tag = Tag.create!(:name => quot;visualisationquot;)
  @tagging = @article.taggings.create!(:tag => @tag)
end
Given /^an article exists with (d+) tags$/ do |num|
  @article = Article.create!(:title => quot;Beautiful Evidencequot;)
  num.to_i.times do |num|
    @tag = Tag.create!(:name => quot;random-tag-#{num}quot;)
    @tagging = @article.taggings.create!(:tag => @tag)
  end
end
DRY IT UP. REGEX MATCHING.
Then /^the article should have one tag$/ do
  @article.taggings.length.should == 1
end

Then /^the article should have no tags$/ do
  @article.taggings.length.should == 0
end
DRY IT UP. REGEX MATCHING.
Then /^the article should have one tag$/ do
  @article.taggings.length.should == 1
end

Then /^the article should have no tags$/ do
  @article.taggings.length.should == 0
end

Then /^the article should have (d+) tags$/ do |num|
  @article.taggings.length.should == num.to_i
end
DRY IT UP. REGEX MATCHING.
Feature: Article tags
  In order to work with article tags
  As a site user
  I want to both create and delete tags

  Scenario: Creating a tag
    Given an article exists with no tags
    When I submit a new tag for the article
    Then the article should have one tag
    And I am redirected to the article

  Scenario: Deleting a tag
    Given an article exists with one tag
    When I delete the article tag
    Then the article should have no tags
    And I am redirected to the article
DRY IT UP. REGEX MATCHING.


  Given an article exists with 0 tags

  Then the article should have 1 tags




  Given an article exists with 1 tags

  Then the article should have 0 tags
WHAT ABOUT VIEWS?
RESPONSE.SHOULD
WEBRAT
VIEWS. RESPONSE.SHOULD
Feature: Viewing an article
  In order to read an article
  As a site user
  I want access the article

  Scenario: Viewing an article
    Given an article exists with 1 tags
    When I view the article
    Then I should see the page
    And I should see the article title
    And I should see the article tag
VIEWS. RESPONSE.SHOULD
When /^I view the article$/ do
  get article_path(@article)
end

Then /^I should see the page$/ do
  response.should be_success
end

Then /^I should see the article title$/ do
  response.should include_text(@article.title)
end

Then /^I should see the article tag$/ do
  response.should include_text(@tag.name)
end
VIEWS. WEBRAT
Scenario: Submitting the add tag form
  Given an article exists with 0 tags
  When I visit the article page
  And I submit the tag form with 'edward'
  Then I am redirected to the article
  And the article should have 1 tags
  And the article should be tagged with 'edward'
VIEWS. WEBRAT
Scenario: Submitting the add tag form
  Given an article exists with 0 tags
  When I visit the article page
  And I submit the tag form with 'edward'
  Then I am redirected to the article
  And the article should have 1 tags
  And the article should be tagged with 'edward'


When /^I visit the article page$/ do
  visit article_path(@article)
end

When /^I submit the tag form with '(w+)'$/ do |value|
  fill_in quot;tagsquot;, :with => value
  click_button quot;submitquot;
end

Then /^the article should be tagged with '(w+)'$/ do |value|
  @article.tags.map(&:name).include?(value).should be_true
end
STORY DRIVEN DEVELOPMENT
NATURAL LANGUAGE SPECS
ELEGANT
CHANCE TO CODE LESS
ENJOYABLE
THANK
YOU
MICHAEL KOUKOULLIS
twitter: kouky
email : m@agencyrainford.com

Contenu connexe

Tendances

Take a stand_citingsources
Take a stand_citingsourcesTake a stand_citingsources
Take a stand_citingsourceshmfowler
 
How to build testable UIs
How to build testable UIsHow to build testable UIs
How to build testable UIsShi Ling Tai
 
Jquery Complete Presentation along with Javascript Basics
Jquery Complete Presentation along with Javascript BasicsJquery Complete Presentation along with Javascript Basics
Jquery Complete Presentation along with Javascript BasicsEPAM Systems
 
Introduction to Ruby On Rails
Introduction to Ruby On RailsIntroduction to Ruby On Rails
Introduction to Ruby On RailsPiotr Imbierowicz
 
Sending Email with Rails
Sending Email with RailsSending Email with Rails
Sending Email with RailsJames Gray
 
Haml, Sass and Compass for Sane Web Development
Haml, Sass and Compass for Sane Web DevelopmentHaml, Sass and Compass for Sane Web Development
Haml, Sass and Compass for Sane Web Developmentjeremyw
 
Double page spread screenshots
Double page spread screenshotsDouble page spread screenshots
Double page spread screenshotsmichodgo
 
Build and deploy Python Django project
Build and deploy Python Django projectBuild and deploy Python Django project
Build and deploy Python Django projectXiaoqi Zhao
 

Tendances (9)

Take a stand_citingsources
Take a stand_citingsourcesTake a stand_citingsources
Take a stand_citingsources
 
How to build testable UIs
How to build testable UIsHow to build testable UIs
How to build testable UIs
 
Jquery Complete Presentation along with Javascript Basics
Jquery Complete Presentation along with Javascript BasicsJquery Complete Presentation along with Javascript Basics
Jquery Complete Presentation along with Javascript Basics
 
Introduction to Ruby On Rails
Introduction to Ruby On RailsIntroduction to Ruby On Rails
Introduction to Ruby On Rails
 
Sending Email with Rails
Sending Email with RailsSending Email with Rails
Sending Email with Rails
 
Haml, Sass and Compass for Sane Web Development
Haml, Sass and Compass for Sane Web DevelopmentHaml, Sass and Compass for Sane Web Development
Haml, Sass and Compass for Sane Web Development
 
Double page spread screenshots
Double page spread screenshotsDouble page spread screenshots
Double page spread screenshots
 
Build and deploy Python Django project
Build and deploy Python Django projectBuild and deploy Python Django project
Build and deploy Python Django project
 
Anchors!
Anchors!Anchors!
Anchors!
 

Similaire à Story Driven Web Development

Advanced Views with Erector
Advanced Views with ErectorAdvanced Views with Erector
Advanced Views with ErectorAlex Chaffee
 
Markdown tutorial how to add markdown to rails app using redcarpet and codera...
Markdown tutorial how to add markdown to rails app using redcarpet and codera...Markdown tutorial how to add markdown to rails app using redcarpet and codera...
Markdown tutorial how to add markdown to rails app using redcarpet and codera...Katy Slemon
 
Powerful Generic Patterns With Django
Powerful Generic Patterns With DjangoPowerful Generic Patterns With Django
Powerful Generic Patterns With DjangoEric Satterwhite
 
idlesign/django-sitecats · GitHub
idlesign/django-sitecats · GitHubidlesign/django-sitecats · GitHub
idlesign/django-sitecats · GitHubclammyhysteria698
 
idlesign/django-sitecats · GitHub
idlesign/django-sitecats · GitHubidlesign/django-sitecats · GitHub
idlesign/django-sitecats · GitHubclammyhysteria698
 
idlesign/django-sitecats · GitHub
idlesign/django-sitecats · GitHubidlesign/django-sitecats · GitHub
idlesign/django-sitecats · GitHubludicrousexcerp10
 
idlesign/django-sitecats · GitHub
idlesign/django-sitecats · GitHubidlesign/django-sitecats · GitHub
idlesign/django-sitecats · GitHubsuccessfuloutdo12
 
idlesign/django-sitecats · GitHub
idlesign/django-sitecats · GitHubidlesign/django-sitecats · GitHub
idlesign/django-sitecats · GitHubsomberfan2012
 
idlesign/django-sitecats · GitHub
idlesign/django-sitecats · GitHubidlesign/django-sitecats · GitHub
idlesign/django-sitecats · GitHubsomberfan2012
 
idlesign/django-sitecats · GitHub
idlesign/django-sitecats · GitHubidlesign/django-sitecats · GitHub
idlesign/django-sitecats · GitHubludicrousexcerp10
 
idlesign/django-sitecats · GitHub
idlesign/django-sitecats · GitHubidlesign/django-sitecats · GitHub
idlesign/django-sitecats · GitHubsomberfan2012
 
idlesign/django-sitecats · GitHub
idlesign/django-sitecats · GitHubidlesign/django-sitecats · GitHub
idlesign/django-sitecats · GitHubsomberfan2012
 
idlesign/django-sitecats · GitHub
idlesign/django-sitecats · GitHubidlesign/django-sitecats · GitHub
idlesign/django-sitecats · GitHubsuccessfuloutdo12
 
idlesign/django-sitecats · GitHub
idlesign/django-sitecats · GitHubidlesign/django-sitecats · GitHub
idlesign/django-sitecats · GitHubsuccessfuloutdo12
 
idlesign/django-sitecats · GitHub
idlesign/django-sitecats · GitHubidlesign/django-sitecats · GitHub
idlesign/django-sitecats · GitHubclammyhysteria698
 
idlesign/django-sitecats · GitHub
idlesign/django-sitecats · GitHubidlesign/django-sitecats · GitHub
idlesign/django-sitecats · GitHubsomberfan2012
 
idlesign/django-sitecats · GitHub
idlesign/django-sitecats · GitHubidlesign/django-sitecats · GitHub
idlesign/django-sitecats · GitHubflagrantlawsuit53
 
django-sitecats 0.4.0 : Python Package Index
django-sitecats 0.4.0 : Python Package Indexdjango-sitecats 0.4.0 : Python Package Index
django-sitecats 0.4.0 : Python Package Indexflagrantlawsuit53
 

Similaire à Story Driven Web Development (20)

Advanced Views with Erector
Advanced Views with ErectorAdvanced Views with Erector
Advanced Views with Erector
 
Markdown tutorial how to add markdown to rails app using redcarpet and codera...
Markdown tutorial how to add markdown to rails app using redcarpet and codera...Markdown tutorial how to add markdown to rails app using redcarpet and codera...
Markdown tutorial how to add markdown to rails app using redcarpet and codera...
 
Powerful Generic Patterns With Django
Powerful Generic Patterns With DjangoPowerful Generic Patterns With Django
Powerful Generic Patterns With Django
 
idlesign/django-sitecats · GitHub
idlesign/django-sitecats · GitHubidlesign/django-sitecats · GitHub
idlesign/django-sitecats · GitHub
 
idlesign/django-sitecats · GitHub
idlesign/django-sitecats · GitHubidlesign/django-sitecats · GitHub
idlesign/django-sitecats · GitHub
 
idlesign/django-sitecats · GitHub
idlesign/django-sitecats · GitHubidlesign/django-sitecats · GitHub
idlesign/django-sitecats · GitHub
 
idlesign/django-sitecats · GitHub
idlesign/django-sitecats · GitHubidlesign/django-sitecats · GitHub
idlesign/django-sitecats · GitHub
 
idlesign/django-sitecats · GitHub
idlesign/django-sitecats · GitHubidlesign/django-sitecats · GitHub
idlesign/django-sitecats · GitHub
 
idlesign/django-sitecats · GitHub
idlesign/django-sitecats · GitHubidlesign/django-sitecats · GitHub
idlesign/django-sitecats · GitHub
 
idlesign/django-sitecats · GitHub
idlesign/django-sitecats · GitHubidlesign/django-sitecats · GitHub
idlesign/django-sitecats · GitHub
 
idlesign/django-sitecats · GitHub
idlesign/django-sitecats · GitHubidlesign/django-sitecats · GitHub
idlesign/django-sitecats · GitHub
 
idlesign/django-sitecats · GitHub
idlesign/django-sitecats · GitHubidlesign/django-sitecats · GitHub
idlesign/django-sitecats · GitHub
 
idlesign/django-sitecats · GitHub
idlesign/django-sitecats · GitHubidlesign/django-sitecats · GitHub
idlesign/django-sitecats · GitHub
 
idlesign/django-sitecats · GitHub
idlesign/django-sitecats · GitHubidlesign/django-sitecats · GitHub
idlesign/django-sitecats · GitHub
 
idlesign/django-sitecats · GitHub
idlesign/django-sitecats · GitHubidlesign/django-sitecats · GitHub
idlesign/django-sitecats · GitHub
 
idlesign/django-sitecats · GitHub
idlesign/django-sitecats · GitHubidlesign/django-sitecats · GitHub
idlesign/django-sitecats · GitHub
 
idlesign/django-sitecats · GitHub
idlesign/django-sitecats · GitHubidlesign/django-sitecats · GitHub
idlesign/django-sitecats · GitHub
 
Tfbyoweb.4.9.17
Tfbyoweb.4.9.17Tfbyoweb.4.9.17
Tfbyoweb.4.9.17
 
Tfbyoweb.4.9.17
Tfbyoweb.4.9.17Tfbyoweb.4.9.17
Tfbyoweb.4.9.17
 
django-sitecats 0.4.0 : Python Package Index
django-sitecats 0.4.0 : Python Package Indexdjango-sitecats 0.4.0 : Python Package Index
django-sitecats 0.4.0 : Python Package Index
 

Dernier

[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
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 AutomationSafe Software
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
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 Processorsdebabhi2
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 

Dernier (20)

[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
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
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
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
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 

Story Driven Web Development

  • 3.
  • 5. STYLE OF DEVELOPMENT SET OF TOOLS WE FIND USEFUL STORY DRIVEN DEVELOPMENT
  • 7. WHAT I REALLY WANT? WHY IT WORKS FOR US!
  • 9.
  • 12. ON WITH THE SHOW STORY DRIVEN DEVELOPMENT
  • 13. EXAMPLE. FEATURE. Feature: Article tags In order to work with article tags As a site user I want to both create and delete tags
  • 14. EXAMPLE. FEATURE. Scenario: Creating a tag Given an article exists with no tags When I submit a new tag for the article Then the article should have one tag And I am redirected to the article
  • 15. EXAMPLE. FEATURE. Scenario: Creating a tag Given an article exists with no tags When I submit a new tag for the article Then the article should have one tag And I am redirected to the article Scenario: Deleting a tag Given an article exists with one tag When I delete the article tag Then the article should have no tags And I am redirected to the article
  • 16. EXAMPLE. FEATURE. Feature: Article tags In order to work with article tags As a site user I want to both create and delete tags Scenario: Creating a tag Given an article exists with no tags When I submit a new tag for the article Then the article should have one tag And I am redirected to the article Scenario: Deleting a tag Given an article exists with one tag When I delete the article tag Then the article should have no tags And I am redirected to the article
  • 17. DECLARATION OF INTENTION NATURAL LANGUAGE IMMENSELY POWERFUL
  • 18. BEST THING YOU CAN DO AS A PROGRAMMER? CODE LESS.
  • 19. EXAMPLE. FEATURE. Feature: Article tags In order to work with article tags As a site user I want to both create and delete tags Scenario: Creating a tag Given an article exists with no tags When I submit a new tag for the article Then the article should have one tag And I am redirected to the article Scenario: Deleting a tag Given an article exists with one tag When I delete the article tag Then the article should have no tags And I am redirected to the article
  • 20. WRITE PROSE AVOID GETTING PROGRAMMATIC MAKE IT A ‘REAL’ STORY ITS EXECUTABLE!
  • 25. DEFINING. MODELS. class Article < ActiveRecord::Base has_many :taggings, :dependent => :destroy has_many :tags, :through => :taggings def add_tag(value) new_tag = Tag.find_or_create_by_name(value) unless Tagging.exists?(:article_id => self.id, :tag_id => new_tag) taggings.create(:tag => new_tag) end end end
  • 26. DEFINING. MODELS. class Article < ActiveRecord::Base has_many :taggings, :dependent => :destroy has_many :tags, :through => :taggings def add_tag(value) new_tag = Tag.find_or_create_by_name(value) unless Tagging.exists?(:article_id => self.id, :tag_id => new_tag) taggings.create(:tag => new_tag) end end end class Tagging < ActiveRecord::Base belongs_to :tag belongs_to :article end
  • 27. DEFINING. MODELS. class Article < ActiveRecord::Base has_many :taggings, :dependent => :destroy has_many :tags, :through => :taggings def add_tag(value) new_tag = Tag.find_or_create_by_name(value) unless Tagging.exists?(:article_id => self.id, :tag_id => new_tag) taggings.create(:tag => new_tag) end end end class Tagging < ActiveRecord::Base belongs_to :tag belongs_to :article end class Tag < ActiveRecord::Base has_many :taggings end
  • 29. DEFINING. ROUTES. ActionController::Routing::Routes.draw do |map| map.home quot;quot;, :controller => quot;pagesquot;, :action => quot;homequot; map.resources :articles do |article| article.resources :taggings end end
  • 31. DEFINING. CONTROLERS. class TaggingsController < ApplicationController def create article = Article.find(params[:article_id]) article.add_tag(params[:tags]) redirect_to article_path(article) end def destroy article = Article.find(params[:article_id]) tagging = article.taggings.find(params[:id]) tagging.destroy redirect_to article_path(article) end end
  • 33. JUST IN TIME APP DEV WORKFLOW
  • 35. DRY IT UP. REGEX MATCHING. Given /^an article exists with no tags$/ do @article = Article.create!(:title => quot;Beautiful Evidencequot;) end Given /^an article exists with one tag$/ do @article = Article.create!(:title => quot;Beautiful Evidencequot;) @tag = Tag.create!(:name => quot;visualisationquot;) @tagging = @article.taggings.create!(:tag => @tag) end
  • 36. DRY IT UP. REGEX MATCHING. Given /^an article exists with no tags$/ do @article = Article.create!(:title => quot;Beautiful Evidencequot;) end Given /^an article exists with one tag$/ do @article = Article.create!(:title => quot;Beautiful Evidencequot;) @tag = Tag.create!(:name => quot;visualisationquot;) @tagging = @article.taggings.create!(:tag => @tag) end Given /^an article exists with (d+) tags$/ do |num| @article = Article.create!(:title => quot;Beautiful Evidencequot;) num.to_i.times do |num| @tag = Tag.create!(:name => quot;random-tag-#{num}quot;) @tagging = @article.taggings.create!(:tag => @tag) end end
  • 37. DRY IT UP. REGEX MATCHING. Then /^the article should have one tag$/ do @article.taggings.length.should == 1 end Then /^the article should have no tags$/ do @article.taggings.length.should == 0 end
  • 38. DRY IT UP. REGEX MATCHING. Then /^the article should have one tag$/ do @article.taggings.length.should == 1 end Then /^the article should have no tags$/ do @article.taggings.length.should == 0 end Then /^the article should have (d+) tags$/ do |num| @article.taggings.length.should == num.to_i end
  • 39. DRY IT UP. REGEX MATCHING. Feature: Article tags In order to work with article tags As a site user I want to both create and delete tags Scenario: Creating a tag Given an article exists with no tags When I submit a new tag for the article Then the article should have one tag And I am redirected to the article Scenario: Deleting a tag Given an article exists with one tag When I delete the article tag Then the article should have no tags And I am redirected to the article
  • 40. DRY IT UP. REGEX MATCHING. Given an article exists with 0 tags Then the article should have 1 tags Given an article exists with 1 tags Then the article should have 0 tags
  • 42. VIEWS. RESPONSE.SHOULD Feature: Viewing an article In order to read an article As a site user I want access the article Scenario: Viewing an article Given an article exists with 1 tags When I view the article Then I should see the page And I should see the article title And I should see the article tag
  • 43. VIEWS. RESPONSE.SHOULD When /^I view the article$/ do get article_path(@article) end Then /^I should see the page$/ do response.should be_success end Then /^I should see the article title$/ do response.should include_text(@article.title) end Then /^I should see the article tag$/ do response.should include_text(@tag.name) end
  • 44. VIEWS. WEBRAT Scenario: Submitting the add tag form Given an article exists with 0 tags When I visit the article page And I submit the tag form with 'edward' Then I am redirected to the article And the article should have 1 tags And the article should be tagged with 'edward'
  • 45. VIEWS. WEBRAT Scenario: Submitting the add tag form Given an article exists with 0 tags When I visit the article page And I submit the tag form with 'edward' Then I am redirected to the article And the article should have 1 tags And the article should be tagged with 'edward' When /^I visit the article page$/ do visit article_path(@article) end When /^I submit the tag form with '(w+)'$/ do |value| fill_in quot;tagsquot;, :with => value click_button quot;submitquot; end Then /^the article should be tagged with '(w+)'$/ do |value| @article.tags.map(&:name).include?(value).should be_true end
  • 46. STORY DRIVEN DEVELOPMENT NATURAL LANGUAGE SPECS ELEGANT CHANCE TO CODE LESS ENJOYABLE
  • 48. MICHAEL KOUKOULLIS twitter: kouky email : m@agencyrainford.com