$30 off During Our Annual Pro Sale. View Details »

High-quality software practices

High-quality software practices

The purpose of the talk is to show some of the methodologies, tools and practices performed in Crowd Interactive that have helped us to become a world-class company.

Talk given to Tech Women Community during their 14th monthly meetup

Fernando Perales

June 03, 2015
Tweet

More Decks by Fernando Perales

Other Decks in Programming

Transcript

  1. http://images.meredith.com/wood/images/p_411_1_1.gif
    High-quality
    Software practices

    View Slide


  2. View Slide

  3. Bs. c. Computer
    Engineering @ CUCEI
    Software engineer @
    Crowd Interactive
    http://ferperales.net
    Advocate @ FLOSS
    Passionate @
    Web Development

    View Slide


  4. View Slide

  5. View Slide

  6. View Slide

  7. View Slide

  8. View Slide

  9. View Slide

  10. View Slide

  11. View Slide

  12. View Slide

  13. View Slide

  14. View Slide

  15. Junio 2015

    View Slide


  16. View Slide


  17. View Slide

  18. View Slide

  19. http://cwebhealth.com/wp-content/uploads/2013/12/need-want-like-keys-showing-craving-and-
    desire_GyMuC-vu-702x336.jpg
    REQUIREMENTS

    View Slide

  20. Deliver the
    right
    software

    View Slide

  21. Specification
    by
    example

    View Slide

  22. “A collaborative approach to
    defining requirements and
    business-oriented functional
    tests for software products
    based on capturing and
    illustrating requirements using
    realistic examples instead of
    abstract statements”

    View Slide

  23. We
    translate*
    this:

    View Slide

  24. http://www.pmscs.net/images/Client.png
    I want my system to have a login

    View Slide

  25. Into
    this:

    View Slide

  26. Feature: Login
    In order to use the application
    As a user
    I want to be able to login
    Scenario: with invalid credentials
    Given I visit the / page
    And I have entered demo as my username
    And I have entered demo1234 as my password
    When I press Sign in
    Then I will be shown a message error
    Scenario: with valid credentials
    Given I have created an account in the past
    And I visit the /events page
    And I have entered demo as my username
    And I have entered demo1234 as my password
    When I press Sign in
    Then I will be redirected to events page

    View Slide

  27. Gherkin!

    View Slide

  28. “It is a Business Readable, Domain
    Specific Language that lets you
    describe software's behaviour
    without detailing how that
    behaviour is implemented”

    View Slide

  29. Once we
    got what
    we need...

    View Slide

  30. Project Management
    http://www.targetprocess.com/blog/wp-content/uploads/2014/06/Kanban-with-time.jpg

    View Slide

  31. “A flexible, holistic
    product
    development
    strategy where a
    development team
    works as a unit to
    reach a common
    goal"

    View Slide

  32. Three roles:
    http://braintrustgroup.com/assets/2012/09/SM-TM-PO-3pigs-01.png

    View Slide

  33. Team
    Members:
    get things
    done

    View Slide

  34. Product
    Owners:
    represents
    stakeholders and the
    voice of customer

    View Slide

  35. Scrum master:
    grease that keeps
    everything running
    smoothly

    View Slide

  36. Product
    backlog

    View Slide

  37. “A comprehensive to-
    do list, expressed in
    priority order based on
    the business value each
    piece of work will
    generate”

    View Slide

  38. Tools

    View Slide

  39. Version Control System
    http://blog.laaz.org/tech/wp-content/uploads/2011/08/git-tree.png

    View Slide

  40. “A system that records
    changes to a file or set of
    files over time so that
    you can recall specific
    versions later”

    View Slide

  41. Tools

    View Slide

  42. Testing
    http://venturebeat.com/wp-content/uploads/2013/05/origin_1703252007.jpg

    View Slide

  43. Unit
    testing

    View Slide

  44. “A software testing
    method by which
    individual units of
    source code are tested
    to determine whether
    they are fit for use”

    View Slide

  45. Tools

    View Slide

  46. class User < ActiveRecord::Base
    # Method that checks if a user
    has a @crowdint.com account
    def has_crowdint_account?
    !!self.email.match(/@crowdint.com$/)
    end
    end

    View Slide

  47. require 'rails_helper'
    describe User do
    let(:user_with_crowdint_account) { User.create email:
    '[email protected]' }
    let(:user_with_gmail_account) { User.create email: '[email protected]' }
    describe '.has_crowdint_account?' do
    it 'returns true when email ends with "@crowdint.com"' do
    expect(user_with_crowdint_account.has_crowdint_account?).to be_truthy
    end
    it 'returns false when email ends with "@crowdint.com"' do
    expect(user_with_gmail_account.has_crowdint_account?).to be_falsy
    end
    end
    end

    View Slide

  48. View Slide

  49. Integration
    test

    View Slide

  50. “The phase in software testing
    in which individual software
    modules are combined and
    tested as a group”

    View Slide

  51. Tools

    View Slide

  52. Behaviour
    driven
    Development

    View Slide

  53. “A test method in which
    examples are used to
    describe the behavior of the
    application, or of units of
    code”

    View Slide

  54. Remember
    this?

    View Slide

  55. Feature: Login
    In order to use the application
    As a user
    I want to be able to login
    Scenario: with invalid credentials
    Given I visit the / page
    And I have entered demo as my username
    And I have entered demo1234 as my password
    When I press Sign in
    Then I will be shown a message error
    Scenario: with valid credentials
    Given I have created an account in the past
    And I visit the /events page
    And I have entered demo as my username
    And I have entered demo1234 as my password
    When I press Sign in
    Then I will be redirected to events page

    View Slide

  56. Can
    become
    Code!

    View Slide

  57. Feature: Login
    In order to use the application
    As a user
    I want to be able to login
    Scenario: with invalid credentials
    Given I visit the / page
    And I have entered demo as my username
    And I have entered demo1234 as my password
    When I press Sign in
    Then I will be shown a message error
    Scenario: with valid credentials
    Given I have created an account in the past
    And I visit the /events page
    And I have entered demo as my username
    And I have entered demo1234 as my password
    When I press Sign in
    Then I will be redirected to events page

    View Slide

  58. Given(/^I visit the (.*) page$/) do |page|
    visit page
    end

    View Slide

  59. Feature: Login
    In order to use the application
    As a user
    I want to be able to login
    Scenario: with invalid credentials
    Given I visit the / page
    And I have entered demo as my username
    And I have entered demo1234 as my password
    When I press Sign in
    Then I will be shown a message error
    Scenario: with valid credentials
    Given I have created an account in the past
    And I visit the /events page
    And I have entered demo as my username
    And I have entered demo1234 as my password
    When I press Sign in
    Then I will be redirected to events page

    View Slide

  60. And(/^I have entered (.*) as my username$/) do |username|
    fill_in 'user[login]', with: username
    end
    And(/^I have entered (.*) as my password$/) do |password|
    fill_in 'user[password]', with: password
    end

    View Slide

  61. Feature: Login
    In order to use the application
    As a user
    I want to be able to login
    Scenario: with invalid credentials
    Given I visit the / page
    And I have entered demo as my username
    And I have entered demo1234 as my password
    When I press Sign in
    Then I will be shown a message error
    Scenario: with valid credentials
    Given I have created an account in the past
    And I visit the /events page
    And I have entered demo as my username
    And I have entered demo1234 as my password
    When I press Sign in
    Then I will be redirected to events page

    View Slide

  62. Given(/^I have created an account in the past$/) do
    @user = FactoryGirl.create :user, username: 'demo',
    password: 'demo1234'
    End
    Then(/^I will be shown a message error$/) do
    expect(page).to have_content 'Invalid login or password.'
    end
    When(/^I press Sign in$/) do
    click_button 'Sign in'
    end
    Then(/^I will be redirected to home page$/) do
    expect(page).to have_content 'Login successful'
    end
    Then(/^I will be redirected to (.*) page$/) do |url|
    path = URI.parse(current_url).path
    expect(path).to match "/#{url}"
    end

    View Slide

  63. Tools

    View Slide

  64. Cross-
    browser
    Testing

    View Slide

  65. Tools

    View Slide

  66. Deployment
    http://i.dawn.com/primary/2013/06/51b99d8da936d.jpg

    View Slide

  67. Platform as
    A Service
    (PaaS)

    View Slide

  68. Services

    View Slide

  69. Virtual
    Private
    Servers
    (VPS)

    View Slide

  70. Services

    View Slide

  71. Tools

    View Slide

  72. role :demo, %w{example.com example.org example.net}
    task :uptime do
    on roles(:demo), in: :parallel do |host|
    uptime = capture(:uptime)
    puts "#{host.hostname} reports: #{uptime}"
    end
    end

    View Slide

  73. Deployments are
    as easy as
    running

    View Slide

  74. cap production
    deploy

    View Slide

  75. Continuos
    integration/
    delivery/
    deployment

    View Slide

  76. “Continuous Integration is the practice of
    merging development work with a
    Master/Trunk/Mainline branch constantly
    so that you can test changes, and test
    that changes work with other changes”
    http://blog.assembla.com/AssemblaBlog/tabid/12618/bid/92411/Continuous-Delivery-vs-
    Continuous-Deployment-vs-Continuous-Integration-Wait-huh.aspx

    View Slide

  77. “Continuous Delivery is the continual
    delivery of code to an environment once
    the developer feels the code is ready to
    ship.”
    http://blog.assembla.com/AssemblaBlog/tabid/12618/bid/92411/Continuous-Delivery-vs-
    Continuous-Deployment-vs-Continuous-Integration-Wait-huh.aspx

    View Slide

  78. “Continuous Deployment is the
    deployment or release of code to
    Production as soon as it is ready”
    http://blog.assembla.com/AssemblaBlog/tabid/12618/bid/92411/Continuous-Delivery-vs-
    Continuous-Deployment-vs-Continuous-Integration-Wait-huh.aspx

    View Slide

  79. Tools

    View Slide

  80. Code quality
    http://www.pts-qc.com/images/AUDITING.jpg

    View Slide

  81. Code
    review

    View Slide

  82. Tools

    View Slide

  83. View Slide

  84. Code
    metrics

    View Slide

  85. Tools

    View Slide

  86. View Slide

  87. Syntax
    analyzer

    View Slide

  88. Tools
    Rubocop
    CSSLinter
    JSHint
    Hound CI

    View Slide

  89. scss_files: "**/*.scss"
    linters:
    BangFormat:
    enabled: true
    space_before_bang: true
    space_after_bang: false
    BorderZero:
    enabled: true
    convention: zero # or `none`
    ColorKeyword:
    enabled: true
    ColorVariable:
    enabled: true
    Comment:
    enabled: true
    DebugStatement:
    enabled: true

    View Slide

  90. View Slide

  91. Maintenance
    http://www.mengsolutions.com.au/wp-content/uploads/2012/06/image041.jpg

    View Slide

  92. Error
    reporting

    View Slide

  93. Tools

    View Slide

  94. View Slide

  95. Site
    availability

    View Slide

  96. Tools

    View Slide

  97. View Slide

  98. I've only talked about
    procedures,
    methodologies and
    tools

    View Slide

  99. But most
    important is

    View Slide

  100. crowdint.com/team

    View Slide

  101. “High-quality
    software is done
    by people who
    care and love
    what they do”

    View Slide

  102. Questions?

    View Slide

  103. View Slide