$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 MagmaLabs that have helped us to become a world-class company.

Talk given in FSLVallarta 2016:
http://fsl.mx

Fernando Perales

November 04, 2016
Tweet

More Decks by Fernando Perales

Other Decks in Programming

Transcript

  1. http://images.meredith.com/wood/images/p_411_1_1.gif
    Prácticas de desarrollo
    de software de alta calidad

    View Slide


  2. View Slide

  3. Ingeniero en
    Computación @ CUCEI
    Senior Consultant @
    MagmaLabs
    http://ferperales.net
    Promotor @
    FLOSS
    Apasionado @
    Desarrollo Web

    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. Marzo 2017

    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
    REQUERIMIENTOS

    View Slide

  20. Entregar el
    software
    correcto

    View Slide

  21. Specification
    by
    example

    View Slide

  22. “Es un enfoque
    colaborativo para definir
    requetimientos y pruebas
    funcionales orientadas al
    negocio para productos de
    software con base en
    capturar e ilustrar los
    requerimientos usando
    ejemplos reales en lugar de
    sentencias abstractas”

    View Slide

  23. Traducimos
    esto:

    View Slide

  24. http://www.pmscs.net/images/Client.png
    Quiero que mi sistema tenga un
    Login de usuarios

    View Slide

  25. En
    Esto:

    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. “Es un lenguaje de dominio
    específico, leíble desde el
    lago de negocios que
    permite describir el
    funcionamiento del
    software sin detallar cómo
    será implementado”

    View Slide

  29. Ya que
    Tenemos
    Lo que
    necesitamos

    View Slide

  30. Manejo del proyecto
    http://www.targetprocess.com/blog/wp-content/uploads/2014/06/Kanban-with-time.jpg

    View Slide

  31. “Una holística y
    flexicle estrategia de
    desarrollo de
    producto donde un
    equipo de desarrollo
    trabaja como una
    unidad para alcanzar
    un objetivo común "

    View Slide

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

    View Slide

  33. Team
    Members:
    hacen las
    cosas

    View Slide

  34. Product
    Owners:
    Representan la voz
    del cliente

    View Slide

  35. Scrum master:
    Se asegura de que
    todo marche sobre
    ruedas

    View Slide

  36. Product
    backlog

    View Slide

  37. “Una comprensible
    lista de tareas,
    expresadas en
    orden de
    importancia para
    el negocio y
    cuánto valor
    aportan al mismo”

    View Slide

  38. Herramientas

    View Slide

  39. Sistema de Control de Versiones
    http://blog.laaz.org/tech/wp-content/uploads/2011/08/git-tree.png

    View Slide

  40. “Un sistema que
    guarda los cambios
    hechos a un archivo
    o conjunto de
    archivos a través
    del tiempo”

    View Slide

  41. Herramientas

    View Slide

  42. Pruebas
    http://venturebeat.com/wp-

    View Slide

  43. Pruebas
    unitarias

    View Slide

  44. “Una metodología de
    pruebas de software en la
    que las unidades
    individuales de código son
    probadas para determinar si
    son aptas para ser
    utilizadas”

    View Slide

  45. Herramientas

    View Slide

  46. class User < ActiveRecord::Base
    # Método que prueba si un usuario tiene
    una cuenta de @magmalabs.io
    def has_magmalabs_account?
    !!self.email.match(/@magmalabs.io$/)
    end
    end

    View Slide

  47. require 'rails_helper'
    describe User do
    let(:user_with_magmalabs_account) { User.create email:
    '[email protected]' }
    let(:user_with_gmail_account) { User.create email: '[email protected]' }
    describe '.has_magmalabs_account?' do
    it 'returns true when email ends with "@magmalabs.io"' do
    expect(
    user_with_magmalabs_account.has_magmalabs_account?
    ).to be true
    end
    it 'returns false when email ends with "other domain"' do
    expect(
    user_with_gmail_account.has_magmalabs_account?
    ).to be false
    end
    end
    end

    View Slide

  48. View Slide

  49. Pruebas
    de
    Integración

    View Slide

  50. “La fase de pruebas de
    software en la cual las
    unidades individuales se
    combinan y prueban
    como un grupo”

    View Slide

  51. Herramientas

    View Slide

  52. Desarrollo basado
    En comportamiento

    View Slide

  53. “Un método de
    pruebas en el que se
    utilizan ejemplos para
    describir el
    comportamiento de la
    aplicación o el
    comportamiento de la
    misma”

    View Slide

  54. ¿Recuerdan
    esto?

    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. ¡Se puede
    convertir en
    código!

    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. Herramientas

    View Slide

  64. Pruebas
    multinavegador

    View Slide

  65. Tools

    View Slide

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

    View Slide

  67. Platform as
    A Service
    (PaaS)

    View Slide

  68. Servicios

    View Slide

  69. Virtual
    Private
    Servers
    (VPS)

    View Slide

  70. Servicios

    View Slide

  71. Herramientas

    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. Hacer un deploy es
    tán fácil como
    correr:

    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/Continu
    ous-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/Continu
    ous-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/Continu
    ous-Delivery-vs-Continuous-Deployment-vs-Continuous-Integration-Wait-
    huh.aspx

    View Slide

  79. Herramientas

    View Slide

  80. Calidad de código
    http://www.pts-qc.com/images/AUDITING.jpg

    View Slide

  81. Code
    review

    View Slide

  82. Herramientas

    View Slide

  83. View Slide

  84. Métricas
    de
    código

    View Slide

  85. Herramientas

    View Slide

  86. View Slide

  87. Analizadores
    sintácticos

    View Slide

  88. Rubocop
    CSSLinter
    JSHint
    Hound CI
    Herramientas

    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. Mantenimiento
    http://www.mengsolutions.com.au/wp-

    View Slide

  92. Reporte
    de
    errores

    View Slide

  93. Herramientas

    View Slide

  94. View Slide

  95. Disponibilidad
    del sitio

    View Slide

  96. Herramientas

    View Slide

  97. View Slide

  98. Hasta ahora sólo
    he hablado sobre
    herramientas y
    metodologías

    View Slide

  99. Pero lo más
    Importante
    es

    View Slide

  100. http://magmalabs.io/
    about-us

    View Slide

  101. “El software de alta
    calidad es creado por
    personas que se
    preocupan y aman su
    trabajo”

    View Slide

  102. ¿Preguntas?

    View Slide

  103. ¡Gracias!
    [email protected]

    View Slide