Upgrade to Pro — share decks privately, control downloads, hide ads and more …

A Gentle Introduction to Outside-In Development

Tim Tyrrell
September 24, 2013

A Gentle Introduction to Outside-In Development

Tim Tyrrell

September 24, 2013
Tweet

More Decks by Tim Tyrrell

Other Decks in Programming

Transcript

  1. oh hai • Tim Tyrrell • Austinite for almost 4

    years • Coming to Austin On Rails for about 4 yrs • I write ruby/rails/javascript • Employed at WellMatch Wednesday, September 25, 13
  2. I got this great idea Wednesday, September 25, 13 •

    “instamanager” to manage my instapaper, otherwise known as “the place where my save articles go to die”
  3. Instamanager • rails new instamanager • TDD an InstamanagerService •

    .... Wednesday, September 25, 13 - Wait, so is this fetch method going to return 10 articles or all of them or what?
  4. • “It starts at the outside by identifying business outcomes,

    and then drills down into the feature set that will achieve those outcomes.” Wednesday, September 25, 13
  5. • You *don’t* start at the service class and work

    your way out • You *don’t* start by creating your domain/ object model Wednesday, September 25, 13 When you need an object, you add it. It happens “organically”
  6. • You don’t write the code until a failing test

    tells you that you need it Wednesday, September 25, 13 one of the tenets of TDD
  7. When? Wednesday, September 25, 13 - Now - Before you

    write the code - Green-field or brown-field Here is the deal: - Think of it like your “game plan” that actually serves as driving out the features you need and serves as a test framework and documentation
  8. Why • You want to deliver the right thing •

    You are a professional • You don’t want to go off on tangents • You want to go home at night • It is fun! Wednesday, September 25, 13 - Tests stay up to date, docs do not - Gives you documentation
  9. How • Write a story • Work your way down

    the stack Wednesday, September 25, 13
  10. Title (one line describing the story) Narrative: As a [role]

    I want [feature] So that [benefit] Acceptance Criteria: (presented as Scenarios) Scenario 1: Title Given [context] And [some more context]... When [event] Then [outcome] And [another outcome]... Scenario 2: ... Wednesday, September 25, 13 BDD provides the structure of a story Keith Gaddis taught a BDD class and stated “If you can’t fill out the narrative, then you don’t know what you are doing enough to write the code”
  11. Wednesday, September 25, 13 - not a “pie in the

    sky” idea - this works - used by myself at Wellmatch. You would never do this an regret it. Every time ... - used by many other badass shops (Hashrocket, Pivotal, Thoghtbot, Carbon5, etc.) - this is just one way to work, but it does work
  12. Tools • Cucumber • RSpec && Shoulda • Jasmine (sorry,

    cut from the talk #haters) Wednesday, September 25, 13
  13. Cucumber • “...serves as documentation, automated tests and development-aid -

    all rolled into one format.” • Gherkin - plain text DSL • Makes the requests, gets the results, you assert on it Wednesday, September 25, 13 - Cucumber makes the requests and gets the results and you assert on it. This is not a tools talk or a BDD theory talk, but a “flow” talk
  14. When /^(?:|I )fill in "([^"]*)" with "([^"]*)"$/ do |field, value|

    fill_in(field, :with => value) end Wednesday, September 25, 13
  15. Some Thoughts Wednesday, September 25, 13 - This tests are

    really too high level to have alone, they are better than nothing but they might hide crap underneath - Good Smoke test - Happy path testing - We usually have the UI done for us already, we just have to go plug it in. So this really is the flow, besides more rspec for business logic. - Generally accepted practice to not test controller. Keep them light,
  16. describe "the signin process", :type => :feature do before :each

    do User.make(:email => '[email protected]', :password => 'caplin') end it "signs me in" do visit '/sessions/new' within("#session") do fill_in 'Login', :with => '[email protected]' fill_in 'Password', :with => 'password' end click_link 'Sign in' expect(page).to have_content 'Success' end end Wednesday, September 25, 13 - turnip, spinich, straight selenium
  17. WellMatch is Hiring • Sr. Rails Dev • (less Sr.)

    Rails Dev • Sr. QA • 2 (less Sr.) QA • Great team, WFH, pair-programming • Healthcare Cost-Transparency Software Wednesday, September 25, 13 not some boring ass Accounting software, maybe this will make people’s lives better?