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

Crafting Rails Culture

Crafting Rails Culture

SHIBATA Hiroshi

September 27, 2014
Tweet

More Decks by SHIBATA Hiroshi

Other Decks in Technology

Transcript

  1. Crafting Rails Culture
    to Your Company
    Hiroshi SHIBATA
    @hsbt
    RailsPacific

    View Slide

  2. Thank you!

    View Slide

  3. SHIBATA
    Hiroshi
    @hsbt

    View Slide

  4. Tokyo
    Matze

    View Slide

  5. RailsGirls in Japan

    View Slide

  6. asakusa.rb

    View Slide

  7. RubyKaigi 2014
    RubyConf Taiwan
    2014
    RedDotRubyConf
    2014
    RailsPacific
    OedoRubyKaigi04

    View Slide

  8. Ruby Committer

    View Slide

  9. ruby
    rubygems
    rake
    rdoc
    psych
    syck
    ruby-build
    railsgirls
    railsgirls-jp
    kaminari
    tdiary
    hiki
    jenkins.rb
    fastladder
    commit bit collector

    View Slide

  10. My work of Ruby 2.2.0
    Update test-unit and minitest
    (removed from repository but
    bundled in tarball)
    coordinate to Ruby committers
    negotiate to sponsors
    make development environment

    View Slide

  11. View Slide

  12. View Slide

  13. View Slide

  14. View Slide

  15. View Slide

  16. View Slide

  17. View Slide

  18. View Slide

  19. "MPOHUJNFBHP

    View Slide

  20. View Slide

  21. View Slide

  22. View Slide

  23. Pepabo
    Hosting EC Media

    View Slide

  24. 0WFSQFPQMF

    View Slide

  25. organizations which design systems ... are constrained to
    produce designs which are copies of the communication
    structures of these organizations
    — M. Conway

    View Slide

  26. PHP
    MySQL5
    PHP
    MySQL4
    Ruby and PHP
    Rails
    MySQL5
    Pepabo

    View Slide

  27. ϛυϧ΢ΣΞͷΞοϓάϨʔυ
    ࣾ಺։ൃج൫ͷߏங
    ౷ܭج൫ͷߏங
    +409ͷӡ༻੔උ
    HJUIVC
    ηΩϡϦςΟ؂ࠪ
    ίʔυϨϏϡʔ
    ςετج൫ͷߏங
    ΞΫηεղੳج൫ͷߏங
    ։ൃϓϩηε
    ৽ਓڭҭ
    ݪߘࣥච
    ΧϯϑΝϨϯεൃද
    044։ൃ αʔόʔߏ੒؅ཧͷ࡮৽
    ϦʔϯελʔτΞοϓ
    +FOLJOT
    3VCZ3BJMT
    3%#.4
    ٕज़ج൫νʔϜ

    View Slide

  28. Pepabo
    ٕज़ج൫νʔϜ
    PHP
    MySQL5
    PHP
    MySQL4
    Ruby and PHP
    Rails
    MySQL5

    View Slide

  29. Ruby
    Rails
    MySQL5
    Ruby
    Rails
    MySQL5
    Ruby and PHP
    Rails
    MySQL5
    Pepabo
    ٕज़ج൫νʔϜ

    View Slide

  30. Why Ruby?

    View Slide

  31. 3. references
    Why Ruby?
    2. environment
    1. testing

    View Slide

  32. Testing

    View Slide

  33. 3. rspec
    powerful testing
    framework
    2. minitest
    1. test-unit

    View Slide

  34. Capybara

    View Slide

  35. 1) Failure:
    TestPowerAssert#test_power_assert_failed [test/test_power_assert.rb:10]:
    assert { "0".class == "3".to_i.times.map {|i| i + 1 }.class }
    | | | | |
    | | | | Array
    | | | [1, 2, 3]
    | | #
    | 3
    String
    Power Assert

    View Slide

  36. View Slide

  37. 1) Failure:
    TestPowerAssert#test_power_assert_failed [test/test_power_assert.rb:10]:
    assert { "0".class == "3".to_i.times.map {|i| i + 1 }.class }
    | | | | |
    | | | | Array
    | | | [1, 2, 3]
    | | #
    | 3
    String
    class TestPowerAssert < Minitest::Test
    def test_power_assert_failed
    assert { "0".class == "3".to_i.times.map {|i| i + 1 }.class }
    end
    end
    testcase
    assertion

    View Slide

  38. 3. run test -> fail -> detect fail reason
    Typical usecase
    2. add inspection code
    1. run test -> fail
    5. run test -> success
    4. fix code

    View Slide

  39. 3. run test -> fail -> detect fail reason
    Typical usecase
    2. add inspection code
    1. run test -> fail
    5. run test -> fail!!! -> turn to 2
    4. fix code

    View Slide

  40. Typical usecase
    1. run test -> fail
    5. run test -> fail!!! -> turn to 4
    4. fix code
    1) Failure:
    TestPowerAssert#test_power_assert_failed [test/test_power_assert.rb:10]:
    assert { "0".class == "3".to_i.times.map {|i| i + 1 }.class }
    | | | | |
    | | | | Array
    | | | [1, 2, 3]
    | | #
    | 3
    String

    View Slide

  41. View Slide

  42. Development
    Environment
    2. rbenv + ruby-build
    1. osx + homebrew

    View Slide

  43. Many references

    View Slide

  44. Rails Good Parts
    Why
    Rails?

    View Slide

  45. 3. admin integration
    Why Rails?
    2. oss way
    1. modern architecture

    View Slide

  46. enforce
    modern architecture

    View Slide

  47. case.1
    Ruby 1.8.6 to Ruby 2.1.2

    View Slide

  48. Ruby 1.8.6
    Rails 2.0.2
    Ruby 2.1.3
    Rails 4.1.6 new!

    View Slide

  49. Ruby
    1.8.6 1.8.7 1.9.3 2.0.0 2.1
    Rails
    2.0/2.1
    2.3
    3.0
    3.2
    4.0/4.1

    View Slide

  50. KyotoTycoon
    to
    memcached
    case.2
    replace legacy middleware

    View Slide

  51. app1
    app2

    View Slide

  52. begin
    require 'dalli'
    rescue LoadError => e
    $stderr.puts "You don't have dalli installed in your
    application. Please add it to your Gemfile and run
    bundle install"
    raise e
    end
    rails4 need to dalli

    View Slide

  53. kyoto tycoon is slower
    than mysql…
    dalli is not support
    to kyoto tycoon…

    View Slide

  54. View Slide

  55. enforce oss way

    View Slide

  56. Ruby
    Rails
    MySQL5
    Ruby
    Rails
    MySQL5
    Ruby and PHP
    Rails
    MySQL5
    Pepabo
    ٕज़ج൫νʔϜ

    View Slide

  57. View Slide

  58. class Bar
    def bar(foo = foo())
    foo
    end
    def buzz(foo = foo)
    foo
    end
    def foo
    :buzz
    end
    end
    p Bar.new.bar
    p Bar.new.buzz

    View Slide

  59. % ruby -v r45272.rb
    ruby 2.2.0dev (2014-04-13 trunk 45580) [x86_64-darwin13]
    :buzz
    nil
    % ruby -v r45272.rb
    ruby 2.1.2p80 (2014-03-01 revision 45231) [x86_64-darwin13.0]
    :buzz
    :buzz

    View Slide

  60. View Slide

  61. admin integration

    View Slide

  62. 3. no console
    What’s admin?
    2. payment/refund
    1. customer support

    View Slide

  63. organizations which design systems ... are constrained to
    produce designs which are copies of the communication
    structures of these organizations
    — M. Conway

    View Slide

  64. Developer Director
    Customer
    Support
    Our Typical Team

    View Slide

  65. VONBJOUBJOFEʜ

    View Slide

  66. 3. other app
    better admin
    2. Rails Engine
    1. app internal

    View Slide

  67. app internal
    pros
    better testing
    better deploy
    cons
    including difference application
    including effective code

    View Slide

  68. Rails Engine
    pros
    splitting application code
    better deploy
    cons
    difficulty testing
    can’t use production code directly

    View Slide

  69. Other app
    pros
    definitely splitting app
    cons
    separated develop cycle
    duplicated code

    View Slide

  70. No silver bullet

    View Slide

  71. Rails
    like a php
    MySQL5
    Rails
    like a java
    MySQL5
    Rails
    like a php
    MySQL5
    Optimize Your Company
    ٕज़ج൫νʔϜ

    View Slide

  72. Lern to
    Rails
    Internal
    step
    by
    step

    View Slide

  73. Lern to
    Active
    Record
    Internal

    View Slide

  74. github workflow

    View Slide

  75. ChatOps
    github issue
    costomer’s
    contact
    nagios

    View Slide

  76. DevOps

    View Slide

  77. Go to the
    next
    10 years

    View Slide