RubyKaigi2013に参加しました
2013/05/30~6/1の3日間で開催されたRubyKaigiに参加してきました。自分が参加した発表について、内容をまとめておきます。Ustream・スライドはここにまとまっています。
Ruby2.0 reference manual for Japanese
http://rubykaigi.org/2013/talk/S69
るりまの活動報告と、サードパーティ製ツールの紹介
The Future of JRuby?
Ruby 'root'
https://speakerdeck.com/hsbt/ruby-root
Rubyコミッターの仕事の紹介。pull requestのmergeや、Rubyでライブラリのテストが通るかの確認(http://ci.hsbt.org/)などを行なっている。
Toward efficient Ruby 2.1
http://rvm.jp/t.pdf
Ruby2.1のRestricted generational Garbage Collection (RGenGC) の説明。
bundle install` Y U SO SLOW: Server Edition'
BundlerAPIをHeroku上で動かした話。
Refining refinements
https://speakerdeck.com/shugo/refining-refinements
Ruby2.0で追加されたrefinements機能の説明。main.using(mod)を呼んだ以降でそのmoduleの関数が使えるようになる。monkey patchに似ているが、monkey patchは全てのクラスが影響を受けるのに対し、refinementsはusingが呼ばれたファイルのみ影響を受けるため、影響範囲を小さくできる。
High Performance Rails
http://rubykaigi.org/2013/talk/S76
CockpadでのRailsの高速化の話。
- response time (X-Runtime) を200ms以内にしている。
- Rubyは遅いので、できるだけRubyに処理をさせない。
- Rubyのバージョンを上げる。1.9.3から2.0.0にすると20ms早くなった。
- Railsの遅い、高速化が必要な場所
- ActiveRecordのモデル作成
- routing: url_forを含むviewのhelper
link_to 'hello', hello_index_url #=> 0.09659 ms link_to 'hello', controller: 'hello', action: 'index' #=> 10.97867 ms
# config.ru require "unicorn/oob_gc" use Unicorn::OobGC, 10 # unicorn config after_fork do |server, worker| GC.disable end
-
- unicorn-worker-killerを使って、メモリを使いすぎたときにworkerをkillできるようにする。
- Slow Queryを集計しておく
Continuous gem dependency updating with Jenkins and Pull Request
https://speakerdeck.com/kyanny/continuous-gem-dependency-updating-with-jenkins-and-pull-request
Gemfile.lockを更新してpull requestを送るJenkinsタスクを作成し、毎日実行する。
git checkout -b bundle-update-YYYYMMDD bundle update git add Gemfile.lock git cimmit -m 'bundle update' bundle exec rake spec hub pull-request
Security is hard, but we can’t go shopping
Concerning 'Applications'
https://speakerdeck.com/moro/concerning-application
ActiveSupport::Concernの紹介。
Refactoring Fat Models with Patterns
http://www.ustream.tv/recorded/33569967
https://github.com/codeclimate/refactoring-fat-models
codeclimateのブログと同じ内容。concernを使ったmix-inを否定しているところが、前の発表と真逆。
Millions of Apps Deployed: What We've Learned
アプリ作成のTips集
If you do not enter the tiger's cave, you will not catch its cub: Objects, DCI, and Programming
DCI (Data, context and interaction) の紹介。DCIは面白そうなので後で調べる。参考資料:
The Origamist's Ruby: Folding better code
リファクタリング方法について。
- Sandi Metz’ rules for developers
- Classes can be no longer than one hundred lines of code.
- Methods can be no longer than five lines of code.
- Pass no more than four parameters into a method. Hash options are parameters.
- Controllers can instantiate only one object. Therefore, views can only know about one instance variable and views should only send messages to that object (@object.collaborator.value is not allowed).
- “Learn the rules like a pro, so you can break them like an artist.” - Pablo Picasso
Be a library developer!
http://www.slideshare.net/kou/rubykaigi-2013
- Remember Than Imagine
- 問題を解決するための知識(パターン)があると、解決方法を創造するよりも早い
- Libraryを書くことで、知識を実装にする練習をしよう
'The Metric Talks or Not
https://speakerdeck.com/irohiroki/the-metric-talks-or-not
- burndownチャートは進捗を可視化することで、コードを汚くする圧力をかけてくる。コードをきれいにする圧力をかけるために、コードの綺麗さを可視化する必要がある。
- Static Analysis: https://github.com/metricfu/metric_fu
- Statistical Analysis: https://github.com/igrigorik/bugspots
Contributing to Ruby
どうやってRubyコミュニティーに貢献するか。rdocでドキュメンテーションされていない関数を探し、修正してpull requestを送るところまでをライブコーディングしていた。
LT
- 暗記用ツールankiの紹介。なぜPythonのツールをRubyKaigiで紹介したのかは謎。
- rspecの自動作成ツールrspec-kickstarterの紹介。既存のテストがないクラスを修正する際に、これでテストを作っておくとデグレが減るかも。