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

How to Change Organization

SHIBATA Hiroshi
December 12, 2014
280

How to Change Organization

SHIBATA Hiroshi

December 12, 2014
Tweet

Transcript

  1. !
    How to Change
    Organization
    !
    Hiroshi SHIBATA
    @hsbt
    Rakuten TechTalk

    View full-size slide

  2. SHIBATA
    !
    Hiroshi
    !
    @hsbt

    View full-size slide

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

    View full-size slide

  4. Ruby Committer

    View full-size slide

  5. RailsGirls in Japan

    View full-size slide

  6. ΋ͬͱ
    ͓΋͠Ζ͘
    Ͱ͖Δ

    View full-size slide

  7. ຊࣾ
    ࢧࣾ

    View full-size slide

  8. "MPOHUJNFBHP

    View full-size slide

  9. Pepabo
    Hosting EC Media

    View full-size slide

  10. organizations which design systems ... are constrained to
    produce designs which are copies of the communication
    structures of these organizations

    — M. Conway

    View full-size slide

  11. PHP

    MySQL5
    PHP

    MySQL4
    Ruby and PHP

    Rails

    MySQL5
    Pepabo

    View full-size slide

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

    View full-size slide

  13. Pepabo
    ٕज़ج൫νʔϜ
    PHP

    MySQL5
    PHP

    MySQL4
    Ruby and PHP

    Rails

    MySQL5

    View full-size slide

  14. Ruby

    Rails

    MySQL5
    Ruby

    Rails

    MySQL5
    Ruby and PHP

    Rails

    MySQL5
    Pepabo
    ٕज़ج൫νʔϜ

    View full-size slide

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

    View full-size slide

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

    View full-size slide

  17. 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 full-size slide

  18. 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 full-size slide

  19. 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 full-size slide

  20. 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 full-size slide

  21. 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 full-size slide

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

    View full-size slide

  23. Many references

    View full-size slide

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

    View full-size slide

  25. enforce
    modern architecture

    View full-size slide

  26. case.1
    Ruby 1.8.6 to Ruby 2.1.2

    View full-size slide

  27. http://30d.jp

    View full-size slide

  28. 380,000 users
    230,000,000 photos

    View full-size slide

  29. Our Rails app
    46 models
    5000 lines in controllers
    400 lines in routes.rb
    1:1.3 code to test ratio

    View full-size slide

  30. storage is over
    450 TB

    View full-size slide

  31. system architecture

    View full-size slide

  32. application server

    View full-size slide

  33. storage server

    View full-size slide

  34. transaction server

    View full-size slide

  35. Ruby 1.8.6
    Rails 2.0.2

    View full-size slide

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

    View full-size slide

  37. 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 full-size slide

  38. Rails 2.0
    Rails 2.3

    View full-size slide

  39. Rails 2.0
    Rails 2.3
    hotfix A
    migration A

    View full-size slide

  40. Rails 2.0
    Rails 2.3
    hotfix A
    migration A

    View full-size slide

  41. Rails 2.0
    Rails 2.3
    hotfix A
    migration A

    View full-size slide

  42. KyotoTycoon
    to
    memcached
    case.2
    replace legacy middleware

    View full-size slide

  43. 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 full-size slide

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

    View full-size slide

  45. enforce oss way

    View full-size slide

  46. Ruby

    Rails

    MySQL5
    Ruby

    Rails

    MySQL5
    Ruby and PHP

    Rails

    MySQL5
    Pepabo
    ٕज़ج൫νʔϜ

    View full-size slide

  47. Use trunk everyday.

    View full-size slide

  48. 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 full-size slide

  49. % 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 full-size slide

  50. source 'https://rubygems.org'!
    !
    gem 'rails', '~> 2.3.18'!
    gem 'rake', '~> 0.9.2'!
    gem 'rdoc'!
    gem 'rake-confirm'!
    !
    gem 'mysql'!
    gem "mysql_retry_lost_connection"!
    gem 'acts_as_paranoid', :github => 'paperboy-30days/acts_as_paranoid'!
    gem 'passenger', '~> 3.0'!
    gem 'memcache-client', :require => 'memcache'!
    gem 'system_timer'!
    gem 'yajl-ruby', :require => 'yajl'!
    gem 'will_paginate', '~> 2.3'!
    gem 'mail'!
    !
    gem 'sass'!
    gem 'compass-rails'!
    !
    gem 'osaipo_client', :git => '[email protected]:paperboy-all/
    osaipo_client.git', :branch => 'legacy'!
    gem 'jugem_client', :git => '[email protected]:paperboy-all/
    jugem_client.git'!
    gem 'ppb_footer', :github => 'paperboy-all/ppb_footer'!

    View full-size slide

  51. admin integration

    View full-size slide

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

    View full-size slide

  53. organizations which design systems ... are constrained to
    produce designs which are copies of the communication
    structures of these organizations

    — M. Conway

    View full-size slide

  54. Developer Director
    Customer

    Support
    Our Typical Team

    View full-size slide

  55. VONBJOUBJOFEʜ

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

  60. No silver bullet

    View full-size slide

  61. Rails

    like a php

    MySQL5
    Rails

    like a java

    MySQL5
    Rails

    like a php

    MySQL5
    Optimize Your Company
    ٕज़ج൫νʔϜ

    View full-size slide

  62. Ͱ͖Δ͚ͩ௕͍ؒ ϢʔβʹՁ஋Λ
    ఏڙ͠ ར५ΛੜΈଓ͚Δ8FCαʔ
    ϏεΛӡӦ͢ΔͨΊʹ͸ ܧଓతͳ
    վળΛߦ͏͜ͱ͕ඞཁͰ͢ɻ8FCαʔ
    ϏεΛվળ͢Δʹ͸ ٕज़తͳऔΓ૊
    Έ͸΋ͪΖΜ ։ൃ౤ࢿͱͦͷϦλʔ
    ϯͱ͍͏ܦӦతͳ؍఺ νʔϜϏϧ
    σΟϯάͳͲͷ։ൃϓϩηε Ϗδω
    εϝτϦΫε΁ͷ஫ࢹͳͲ ߟྀ͢΂
    ͖͜ͱ͕ͨ͘͞Μ͋Γ·͢ɻ

    View full-size slide

  63. εΫϥϜ͸ɺʮෳࡶͰมԽͷܹ͍͠
    ໰୊ʯʹରԠ͢Δ͜ͱΛୈҰ໨ඪ
    ͱͨ͠ΞδϟΠϧ։ൃख๏Ͱ͢ɻ਺
    ͋ΔΞδϟΠϧ։ൃख๏ͷதͰ΋ɺ
    ͍·ѹ౗తʹ࠾༻͞Ε͍ͯ·͢ɻ
    ɹ
    ຊಛूͰ͸ɺݱࡏͷιϑτ΢ΣΞ
    ։ൃʹ͓͚ΔεΫϥϜͷҙ͔ٛΒɺ
    ࣮ࡍͷݱ৔ʹ͓͚ΔऔΓ૊Έ·
    ͰɺεΫϥϜΛపఈղઆ͠·͢ɻ

    View full-size slide

  64. ฏು͞ΜʹΑΔߨԋ

    View full-size slide

  65. ΞδϟΠϧಋೖݚम

    View full-size slide

  66. Lern to
    Rails
    Internal
    step
    by
    step

    View full-size slide

  67. Lern to
    Active
    Record
    Internal

    View full-size slide

  68. github workflow

    View full-size slide

  69. ChatOps
    github issue
    costomer’s
    contact
    nagios

    View full-size slide

  70. 4 deploy/day

    View full-size slide

  71. Go to the
    next
    10 years

    View full-size slide

  72. ΋ͬͱ
    ͓΋͠Ζ͘
    Ͱ͖Δ

    View full-size slide