Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
RailsとYesodの比較
Search
Fujimura Daisuke
April 21, 2012
Programming
3
2.5k
RailsとYesodの比較
Fujimura Daisuke
April 21, 2012
Tweet
Share
More Decks by Fujimura Daisuke
See All by Fujimura Daisuke
庭と負債
fujimura
4
990
AIの時代で我々はどのようにコードを書くのか
fujimura
3
780
SaaSを作るという仕事について
fujimura
12
5.7k
一文字エイリアスのすすめ
fujimura
0
320
現役CTOが語る!RubyKaigiの楽しみ方
fujimura
0
1.2k
いかにして文系新卒エンジニアが「大きな問い」を大事にするCTOになったのか
fujimura
2
660
Kaigi on Rails 2022 - 既存Railsアプリ攻略法 CTOが見ること・やること・考えること
fujimura
14
3.9k
SimpleDelegator活用のご提案
fujimura
0
1.5k
入門 名前
fujimura
23
13k
Other Decks in Programming
See All in Programming
watsonx.ai Dojo #4 生成AIを使ったアプリ開発、応用編
oniak3ibm
PRO
1
200
ActiveSupport::Notifications supporting instrumentation of Rails apps with OpenTelemetry
ymtdzzz
1
250
cmp.Or に感動した
otakakot
3
250
最新TCAキャッチアップ
0si43
0
210
광고 소재 심사 과정에 AI를 도입하여 광고 서비스 생산성 향상시키기
kakao
PRO
0
180
Outline View in SwiftUI
1024jp
1
340
OSSで起業してもうすぐ10年 / Open Source Conference 2024 Shimane
furukawayasuto
0
110
デザインパターンで理解するLLMエージェントの作り方 / How to develop an LLM agent using agentic design patterns
rkaga
9
1.1k
Better Code Design in PHP
afilina
PRO
0
130
WebフロントエンドにおけるGraphQL(あるいはバックエンドのAPI)との向き合い方 / #241106_plk_frontend
izumin5210
4
1.4k
Flutterを言い訳にしない!アプリの使い心地改善テクニック5選🔥
kno3a87
1
210
DevTools extensions で 独自の DevTool を開発する | FlutterKaigi 2024
kokiyoshida
0
130
Featured
See All Featured
Making Projects Easy
brettharned
115
5.9k
Writing Fast Ruby
sferik
627
61k
Designing on Purpose - Digital PM Summit 2013
jponch
115
7k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
38
1.8k
Building Adaptive Systems
keathley
38
2.3k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
93
17k
Designing for Performance
lara
604
68k
Building Flexible Design Systems
yeseniaperezcruz
327
38k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
226
22k
Teambox: Starting and Learning
jrom
133
8.8k
Designing the Hi-DPI Web
ddemaree
280
34k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
126
18k
Transcript
RailsͱYesodͷൺֱ ౻ଜେհ Sunday, April 22, 12
ࣗݾհ • ౻ଜେհ • גࣜձࣾAiming • @ffu_ • http://fujimuradaisuke.com Sunday,
April 22, 12
ࣗݾհ (2) Rubyͱࢲ • ੲABAPerͩͬͨɻ·ͱͳݴޠ͕Γͨ͘ͳΓRubyʹస • ͔Ε͜Ε3͘Β͍ϑϧλΠϜͰRailsͷࣄΛͯ͠Δ • Railsίϛολ @a_matsuda
ࣄͯ͠Rails෦ʹ͚ͬ͜͏ৄ͘͠ͳͬͨ • WEB+DB PRESSͷRails3ಛूΛͪΐͬͱखͬͨ • Railsͷ࡞ऀɺDHHͱ൴ͷಇ͘37signalsͷϑΝϯ Sunday, April 22, 12
ࣗݾհ (3) Haskellͱࢲ • The Little SchemerͰؔϓϩάϥϛϯάΛΔ • Seven Languages
in Seven WeeksͰHaskellΛΔ • ελʔτHaskellͰຊ֨తʹHaskell͕͖ʹͳΔ • ݱࡏɺձࣾͰYesodΛࢼݧతʹಋೖத Sunday, April 22, 12
ΞδΣϯμ • Railsʹ͋ͬͯYesodʹͳ͍ͷհ • Rails͍͔ΒݟͨYesod(ͱHaskell)ͷ͍͍ͱ͜Ζ • Yesodʹཉ͍͠ͷհ Sunday, April 22,
12
Yesodʹͳ͍ͷ(1) σϓϩΠπʔϧ • RailsʹCapistranoͱ͍͏σϓϩΠࣗಈԽπʔϧ͕͋Γ·͢ɻ • $ cap deploy ͰσϓϩΠ •
$ cap deploy:rollbackͰલճσϓϩΠͨ͠ίʔυʹϩʔϧόοΫ • ͦͷଞɺSSHͰೖͬͯσϓϩΠ࣌ʹߦ͏࡞ۀͷࣗಈԽҰൠ͕ՄೳͰ͢ɻ • https://github.com/capistrano/capistrano/wiki/2.x-Getting-Started Sunday, April 22, 12
Yesodʹͳ͍ͷ(1) σϓϩΠπʔϧ • cabal-dev ΛͬͨΒͰ͖·ͨ͠… • ͨͩ͠ຖճશґଘϥΠϒϥϦΛΠϯετʔϧ͢ΔͷͰ͕͔͔࣌ؒΔ • ͦͦHaskellerͱͯ͠ʮRubyͷπʔϧΛ͏ʯͰOKͳͷ͔ʁ Sunday,
April 22, 12
Yesodʹͳ͍ͷ(2) CRUDͷੜ • RailsscaffoldͰCRUD͕Ͱ͖Δίʔυ͕ੜ͞Ε·͢ɻ • ͜ͷҐͷίʔυ͕ ੜ͞ΕΔ • RailsྲྀͷRESTfulͳϧʔςΟϯάʹԊͬͨίʔυ͕ੜ͞ΕΔͷͰɺͦΕΛݩ ʹ։ൃ͍ͯ͠ΕɺࣗવͱRailsతͳΘ͔Γ͍͢ίʔυʹͳΓ·͢ɻ
• ࣗવͱRails wayͰ։ൃ͢Δ͜ͱʹͳΔͷͰɺ·ͳ͍ͰࡁΉͱ͍͏རɻ • YesodͰ·ͣ։ൃΛਐΊΒΕΔఔʹscaffoldͰίʔυΛੜͯ͠΄͠ ͍ɻ Sunday, April 22, 12
Yesodʹͳ͍ͷ(3) RSpec • ΄΅σϑΥϧτ࠾༻͞ΕͯΔςετϑϨʔϜϫʔΫɻ • ಈ࡞ݕূͰͳ͘ιϑτΣΞͷʮৼΔ͍ʯΛܾΊΔͨΊͷϥΠϒϥϦ • http://jp.rubyist.net/magazine/?0021-Rspec ʹ֓ཁ͕·ͱ·ͬͯ·͢ɻ •
rspec-railsͱ͍͏ϥΠϒϥϦͰRailsͷςετ͕ܹ͘͠ੜ࢈తʹͳΓ·͢ɻ • ͦͷଞपลϥΠϒϥϦଟɻ Sunday, April 22, 12
ͳͥRSpec͕ཉ͍͔͠ • RSpecઃܭπʔϧͱͯ͠ຊʹ༏लɻ·ͣSpecΛεέονײ֮Ͱॻ͍ͯҰ ୴ઃܭΛจষԽ͢ΔͱɺAPIશମ͕ݟ௨ͤΔΑ͏ʹͳΓ·͢ɻ͜͜Ͱઃܭͷྑ ͠ѱ͠Λݕ౼Ͱ͖ΔͷૉΒ͍͠Ͱ͢ɻ ͜Μͳ۩߹ʹઃܭΛઌʹॻ͘ ࣮ߦ͢Δͱ“PENDING” Sunday, April 22,
12
ͳͥRSpec͕ཉ͍͔͠ • request specཉ͍͠Ͱ͢ɻrequest specSeleniumͳͲͰ࣮ࡍʹΞϓϦέʔ γϣϯΛಈ͔ͯ͠ɺϑϩϯτΤϯυ͔ΒΞϓϦέʔγϣϯΛݕࠪ͢Δ Έɻclick_link(‘#submit-button’)ͱ͍ͬͨײ͡ͰखಈͰ͍ͯͨ͠ಈ࡞֬ೝΛࣗ ಈԽͰ͖·͢ɻ • ਅʹॻ͘ͱɺ࣮ߦՄೳͳड͚ೖΕςετܭըॻʹͳΓ·͢ɻ
• ෳͷػೳΛ·͙ͨγφϦΦςετ͕ॻ͖͍͢ɻ • ͜͜ɺRails͜ͷϨΠϠʔ·Ͱςετ͢Δͷ͕σϑΥϧτɻ Sunday, April 22, 12
ͳ͍ͷ(3) RSpec • ͪͳΈʹHaskellͰhspecͱ͍͏RSpecతͳϥΠϒϥϦ͕͋Γ·͢ɻ • http://hspec.github.com/ • ࠷ۙ1.1ʹͳΓ·ͨ͠ʂ • ͔͠͠ɺdescribe/contextͷೖΕࢠͰ͖ͳ͍͠ɺsetup/teardownແ͍͠ɺ
RSpecʹࣅͨߏจͷxUnitͱ͍͏ͷ͕࣮…ɻ • ࠓޙʹظɻ Sunday, April 22, 12
Rails͍͔ΒݟͨYesod(ͱHaskell)ͷ͍͍ͱ͜Ζ • NullPointerException͕ແ͍ʂ • ܕΛ͋ΘͤΔͱ͍͍ͩͨظ௨Γʹಈ͘ • undefinedΛ͏ͱςετίʔυͳ͠ͰBDDͬΆ͍͜ͱ͕Ͱ͖Δ • ى͜Γ͏Δ͜ͱΛશ෦ߟྀ͠ͳ͍ͱ͍͚ͳ͍ͷͰɺఆΕͷόά͕ͳ͘ͳ Δ
• ΞυϗοΫଟ૬͕RubyͷMix-inͱࣅ͍ͯΔͷͰ͠Έ͍͢ Sunday, April 22, 12
Yesodʹཉ͍͠ͷ(1) • ϏδωεϩδοΫΛهड़͢ΔͨΊͷϥΠϒϥϦ • PersistentΑΓ͏ͪΐͬͱநߴ͍هड़͕͍ͨ͠Ͱ͢ɻ • RailsͰActiveRecordͰϢʔβʔͷϝϯλϧϞσϧʹ͍ۙܗͷදݱ͕Ͱ͖ ͨɻ • ͱ͍ͬͯORϚούʔΛ࡞Δͷҧ͍·͢ΑͶɻDCI
͕ࢀߟʹͳΔؾ͕͠ ͍ͯ·͢ɻ • ࡞ͬͯΈ͍ͨͰ͢ɻ Sunday, April 22, 12
Yesodʹཉ͍͠ͷ(2) • Yesod way • RailsʹϨʔϧ͕͋ͬͯɺͦΕʹΕΔɻ • DHHᐌ͘ʮConstraints are liberatingʯ
• ࠓͷͱ͜ΖYesodʹϨʔϧ͕ݟͨΒͳ͍ɻ Sunday, April 22, 12
͓ΘΓ • ए͍ϥΠϒϥϦͳͷͰɺࠓޙʹظͰ͢ Sunday, April 22, 12
༨ஊ • ςϯϓϨʔτΤϯδϯͷ…ʁ • ձࣾͰ࡞ͬͯΔͷJSON APIͳͷͰɺ৮ͬͯͳ͍ΜͰ͢ɻ • ͠ΔͳΒmustacheΛ͏ͱࢥ͍·͢ɻShakespearean Templatesϑ ϩϯτΤϯυͷਓͱͷίϥϘϨʔγϣϯ͕ͦ͠͏ͳҹͰ͢ɻ
• scottyؾʹͳͬͯ·͢ • Web API࡞ΔͷͰ͋Εͬͪ͜ͷ΄͏͕खܰͦ͏ Sunday, April 22, 12