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
Scala: Mobile Backend on AWS
Search
arai-yusuke
February 20, 2016
Technology
1
670
Scala: Mobile Backend on AWS
arai-yusuke
February 20, 2016
Tweet
Share
More Decks by arai-yusuke
See All by arai-yusuke
Serverless Scala
cmaraiyusuke
0
1.9k
Play Scala on AWS, C10K and DevOps
cmaraiyusuke
2
1.3k
Other Decks in Technology
See All in Technology
re:Invent 2024 Innovation Talks(NET201)で語られた大切なこと
shotashiratori
0
300
多領域インシデントマネジメントへの挑戦:ハードウェアとソフトウェアの融合が生む課題/Challenge to multidisciplinary incident management: Issues created by the fusion of hardware and software
bitkey
PRO
2
100
kargoの魅力について伝える
magisystem0408
0
200
ずっと昔に Star をつけたはずの思い出せない GitHub リポジトリを見つけたい!
rokuosan
0
150
開発生産性向上! 育成を「改善」と捉えるエンジニア育成戦略
shoota
1
270
2024年にチャレンジしたことを振り返るぞ
mitchan
0
130
AWS re:Invent 2024で発表された コードを書く開発者向け機能について
maruto
0
190
How to be an AWS Community Builder | 君もAWS Community Builderになろう!〜2024 冬 CB募集直前対策編?!〜
coosuke
PRO
2
2.8k
【re:Invent 2024 アプデ】 Prompt Routing の紹介
champ
0
140
社外コミュニティで学び社内に活かす共に学ぶプロジェクトの実践/backlogworld2024
nishiuma
0
260
フロントエンド設計にモブ設計を導入してみた / 20241212_cloudsign_TechFrontMeetup
bengo4com
0
1.9k
UI State設計とテスト方針
rmakiyama
2
440
Featured
See All Featured
GitHub's CSS Performance
jonrohan
1030
460k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
229
52k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
330
21k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
169
50k
Scaling GitHub
holman
458
140k
Optimizing for Happiness
mojombo
376
70k
GraphQLの誤解/rethinking-graphql
sonatard
67
10k
The Straight Up "How To Draw Better" Workshop
denniskardys
232
140k
How To Stay Up To Date on Web Technology
chriscoyier
789
250k
Why You Should Never Use an ORM
jnunemaker
PRO
54
9.1k
The Cost Of JavaScript in 2023
addyosmani
45
7k
The World Runs on Bad Software
bkeepers
PRO
65
11k
Transcript
%FWFMPQFST*0 # ߥҪ༞ี ⡥$MBTTNFUIPE *OD ݄ 4DBMB .PCJMF#BDLFOEPO"84
#cmdevio2016 #B
whoami • Yusuke Arai • Classmethod (2014/11~) • Mobile Backend
API Team (2015/02~) • AWS / Scala / Javascript / android • dev.classmethod.jp/author/arai-yusuke
Today's topics • Scalaͷoverview • ScalaΛͬͨϞόΠϧόοΫΤϯυAPI • ͳͥAWSωΠςΟϒͷ࣌ʹScala͕ඞཁ͔ • How
to આಘ your client in "Scala͍·͢!"
Today's topics • Scalaͷoverview • ScalaΛͬͨϞόΠϧόοΫΤϯυAPI • ͳͥAWSωΠςΟϒͷ࣌ʹScala͕ඞཁ͔ • How
to આಘ your client in "Scala͍·͢!"
Scalaͷoverview
Martin Odersky Deutscher Informatiker / 1958~
Scala • JVMݴޠʢJavaόΠτίʔυΛੜʣ • JavaͷطଘίʔυΛࢀরՄೳ • ڧ͍੩తܕ͚ݴޠ • ໊લ"Scalable"͔Β
Scala ͷจ๏ • ηϛίϩϯͷͳ͍JavaͬΆ͘ॻ͚Δ • RubyͬΆ͘ॻ͚Δ • هड़ྔ͕গͳ͍ • ৄ͘͠άά͍ͬͯͩ͘͞m(_
_)m
Scala ͷιɾϗϯτ
Αࣖ͘ʹ͢Δ • ؔܕͷϓϩάϥϛϯάݴޠ • Rubyʹ͍ۙͷͰLLܦݧऀͳΒָউ • Java͕Θ͔Ε͙͢ʹॻ͚ΔΑ͏ʹͳΔ • ΤίγεςϜʢPlayʣRailsϥΠΫ
શ෦ιͰ͢ • ؔܕͷϓϩάϥϛϯάݴޠ • Rubyʹ͍ۙͷͰLLܦݧऀͳΒָউ • Java͕Θ͔Ε͙͢ʹॻ͚ΔΑ͏ʹͳΔ • ΤίγεςϜʢPlayʣRailsϥΠΫ
Scala ͷϗϯτ
Scalaͷϗϯτ • ચ࿅͞ΕͨOOPݴޠ ͨͩ͠HaskellͷӨڹΛڧ͘ड͚͓ͯΓɺؔܕͷ ॻ͖ํͰॻ͘͜ͱՄೳʹͳ͍ͬͯΔ • JVMJavaݴޠͷཧղ͕ඞཁ • ΤίγεςϜʢPlayʣڧྗͳܕγεςϜΛแ͠ FP,
FRPΛલఏͱ͍ͯ͠Δ
Not ؔܕݴޠ • ݁ߏ͋Δצҧ͍ʮScalaؔܕݴޠDA!ʯ • Scalaࣗମચ࿅͞ΕͨOOPݴޠ • ͨͩ͠७ਮؔϕʔεͷ։ൃΛڧ͘αϙʔτͯ͠Δ • Haskellͱಉ͡ॻ͖ํΛ͠Α͏ͱࢥ͑Մೳ
ओͳཧ༝ͱͯ͠Scala͕ΞυϗοΫଟ૬ੑΛදݱͰ͖ Δ͔Β
Java/JVMͷཧղ͕ඞཁ • JVM͕ܕফڈϞσϧͰ͋Δ͜ͱʢॏཁʣ • GenericsJava 1.5ͰՃ͞Εͨ͜ͱ, ClassManifestͷڍಈ, etc… • Javaͷจ๏ͳͲΑΓɺJavaͷྺ࢙ʹର͢Δ
ཧղ͕ඞཁ
☓ LLऀͳΒೃછΈ͍͢ • ScalaaltJavaͱͯ͠ར༻Ͱ͖Δ͕ ͦΕ"Scalaݴޠ"ʹݶͬͨͰɺΤίγεςϜ͕ͦΕΛ ڐ͢ͱݶΒͳ͍ • Play Framework 2.4
ڧྗͳܕγεςϜΛ෦ʹ࣋ͪɺ ਵॴͰܕγεςϜͷཧղΛཁٻ͢Δɻ • ྫ: JsResult Applicative Functor Writes Contravariant Functor
ࢹΛม͑Δ
Scala Λ͍͚ͬͯ…… • JVMJavaͷྺ࢙ʹ͍ͭͯਂ͘ཧղͰ͖Δ • ؔܕͷάουϓϥΫςΟε͕औΓࠐΊΔ • ܕΫϥεɺతσʔλܕɺؔखɺϞφυ ͳͲͷమ൘ύλʔϯ͕͑ΔΑ͏ʹͳΔ •
৽͠ΊͷݴޠͰ͍͍ͩͨˢ͕Ұ෦·ͨશ෦͑Δ ྫ͑SwiftʹflatMapϝιου͕༻ҙ͞Ε͍ͯ·͢ • ৽͍͠ػೳΛ͍͜ͳ࣭͠ͷߴ͍ΞϓϦΛ࡞Δ͜ͱ͕Մೳʹʂ
Scalaͷoverview ͜Μͳײ͡Ͱ͢
Today's topics • Scalaͷoverview • ScalaΛͬͨϞόΠϧόοΫΤϯυAPI • ͳͥAWSωΠςΟϒͷ࣌ʹScala͕ඞཁ͔ • How
to આಘ your client in "Scala͍·͢!"
ScalaΛͬͨ ϞόΠϧόοΫΤϯυAPI
ϞόΠϧAPIαʔόʔΛ࡞ͬͨ • डୗϞόΠϧΞϓϦҊ݅ • ϦϦʔεޙC100K͕΄΅ؒҧ͍ͳ͍ • ҆ఆͯ͠ࡹͨ͘ΊʹϑϩϯτAPIαʔόʔʹ Play-ScalaΛ࠾༻ • όοΫΤϯυAkkaΛ͍͍ͨͱ͍͏ཧ༝͔Β
Play-Scalaʹͨ͠
None
։ൃͷਐΊํ • ϑϧͰςετॻ͘ ʢશΫϥεϢχοτςετɺAPIຖ࠷̍݁߹ςετʣ • pull reqϨϏϡʔඞਢ • ScalazCatsΘͳ͍ •
ࠓϦϦʔεલͳͷͰύϑΥʔϚϯεɾӡ༻ʹ͍ͭͯͷ͜ͱԿͱ ݴ͑ͳ͍ʢϦϦʔεͰ͖͍ͯͨΒӡ༻ϊϋΛ͓͔͑ͨͬͨ͠Ͱ͢……ʣ
։ൃͰײͨ͜͡ͱ
͑͛ͭͳ͍΄Ͳॻ͖͍͢ • ϘΠϥʔϓϨʔτίʔυͷগͳ͞ʹҺͼٽ͘ • ݴޠͦͷͷ͕ImmutableΛਪͯ͘͠ΕͯΔ ͜ͱͷ༗ΓΈΛࢥ͍Δ • ผʹΧοίΑ͘ॻ͜͏ͱͯ͠ͳ͍ͷʹؔ ͍͍ͩͨ5ߦҎʹ·ͱ·Δ
ΊͬͪΌಡΈ͍͢ • ʮScalaه߸͔ͬͰಡΈʹ͍͘ʯͬͯ ͱ͓͍ੲʹฉ͍ͨ͜ͱ͕͋ͬͨ • ͦΕHaskellͬΆ͘ॻ͍ͨ߹ͷͩͬͨ • γϯϓϧʹॻ͍͍ͯ͘ͱӳޠͬΆ͍จ຺Λ࣋ͭ • pull
reqϨϏϡʔ͕ḿΔ
ͳΜͱͳ͘ӳޠͬΆ͍ͷͰ͢
Akka • ࠓճϫʔΧʔΛAkka SchedulerͰ࣮ • AkkaͷFault ToleranceΛങͬͨ • Amazon SQSAmazon
SNSͱ͏·݁͘߹͢Δ • DynamoDB StreamKinesisͱ͚ͬͭͨ͘Β ઈରָ͍͠ͰΑ͢Ͷ
AWS Java SDK͕͑Δ • AWSͷϑϧϚωʔδυαʔϏεʢCognitoDynamoDBʣ ͱΓऔΓ͢ΔΞϓϦΛ࡞Δ߹ɺ AWS SDKͷυΩϡϝϯςʔγϣϯ۩߹ࢮ׆ • AWS
Java SDKʹԿͷ৺ͳ͔ͬͨ • Scalaͷݴޠࢥͱͯ͠ʮmutable࣮ΛimmutableͳΠϯ λϑΣʔεͰӅṭʯͱ͍͏ͷ͕͋Δ ˠ AWS Java SDK ΠϯϑϥͰӅṭͰ͖ΔͷͰແ
ΞʔΩςΫνϟͷརʢ1ʣ • ७ਮؔܕݴޠͩͱmainؔͷ֎ଆɺͭ·ΓࣗͰίϯτ ϩʔϧͰ͖ͳ͍ྖҬ·Ͱ෭࡞༻ΛԆ͠ͳ͚ΕͳΒͳ͍ ʢ͜ͱ͕ଟ͍ʣ • ScalaͰ෭࡞༻Λى͜͢λΠϛϯάΛࣗͰ ίϯτϩʔϧͯ͠OK ※ HaskellʹunsafePerformIOͱ͔͋Γ·͕͢……
• ຊʹԆ͖͢෭࡞༻ʢυϝΠϯϩδοΫ͕ى͜͢෭࡞༻ʣ ͱͦΕҎ֎ʢϩάͱ͔ʣΛผͷͷͱͯ͠ѻ͏͜ͱ͕༰қ ιϑτΣΞ
ΞʔΩςΫνϟͷརʢ2ʣ • ݴޠϨϕϧͰDIΛڧ͘αϙʔτ͢ΔͷͰ DIPୡͷલఏ͕͋ΔΞʔΩςΫνϟͱೃછΉ • Layered Architecture, Onion Architecture… •
DDDͳͲͰΑ͘࠾༻͞ΕΔΞʔΩςΫνϟ ιϑτΣΞ
ଓ͖·ͨޙͰ ࣌ؒʹ༨༟͕͋Ε
Today's topics • Scalaͷoverview • ScalaΛͬͨϞόΠϧόοΫΤϯυAPI • ͳͥAWSωΠςΟϒͷ࣌ʹScala͕ඞཁ͔ • How
to આಘ your client in "Scala͍·͢!"
ͳͥAWSωΠςΟϒ࣌ʹ Scala͕ඞཁ͔
ϚΠΫϩαʔϏε ΞʔΩςΫνϟ
ϚΠΫϩαʔϏεΞʔΩςΫνϟ • ҰͭͷׂΛͬͨૄ݁߹Ͱখ͞ͳαʔϏε ʢίϯϙʔωϯτʣͷू߹Ͱେ͖ͳαʔϏε ʢΞϓϦέʔγϣϯʣΛߏங͢Δ • ͦΕͧΕͷαʔϏεDockerίϯςφEC2 Πϯελϯεͱͯ͠දݱ͞ΕΔ • ϚΠΫϩαʔϏεಉ࢜HTTPSͳͲͰ௨৴
© NGINX via https://www.nginx.com/blog/service-discovery-in-a-microservices-architecture/
࣮ࡍͲ͏ͳͷ • ScalaMatsuri 2016Ͱ৭ʑͳηογϣϯΛ ฉ͍ͯདྷ·͕ͨ͠ʮϦΞΫςΟϒʯʮϚΠΫϩ αʔϏεʯʹ·ͭΘΔηογϣϯ͕ଟ • ຊͷํΑΓւ֎ͷํͷηογϣϯଟ͠ ˠ ւ֎ͰطʹσϑΝΫτʹͳ͖ͬͯͯͦ͏
• “ϦΞΫςΟϒResiliencyͷͨΊͷखஈͰ͋Δ”
ߋʹઌΛோΊΔ
ͦͷઌʹ߇͑Δͷ ͕ओମͷΞʔΩςΫνϟ
AWS Lambda ͕ओମ • όοΫΤϯυʹ͋Δmicro servicesͷ ΦʔέετϨʔγϣϯͰͳ͍ • υϝΠϯϩδοΫ͕AWS Lambda
Functionͱ ͯ͠දݱ͞ΕΔαʔόʔϨεΞʔΩςΫνϟ • ୯Ґ͕ micro services ͔Β functions
Evolution of Compute – Public Cloud Infrastructure Instances Application code
©Amazon Web Services via http://www.slideshare.net/AmazonWebServices/arc308-the-serverless-company-using-aws-lambda/
Evolution of Compute – Containers Infrastructure Instances Application code Containers
©Amazon Web Services via http://www.slideshare.net/AmazonWebServices/arc308-the-serverless-company-using-aws-lambda/
Evolution of Compute – Serverless Application code ©Amazon Web Services
via http://www.slideshare.net/AmazonWebServices/arc308-the-serverless-company-using-aws-lambda/
࣮ࡍͲ͏ͳͷ • AWS re:Invent 2015ͰϚΠΫϩαʔϏεؔ࿈ͷηο γϣϯ͕ଟ͘ൃද͞ΕΔதͰɺੈքʹ͚ͯൃ৴͞Ε ͨ֓೦ʢൃද͞Εͨͷ͢Ͱʹ࣮ફ͞Εͨͷʣ • ͍ͣΕɺඞͣདྷΔαʔόʔϨεͷະདྷΛ͍ͯ͠Δ •
ͦͷ”ະདྷ”͕དྷΔͷ͜ͱΛɺ ݸਓతʹ”Lambda Xσʔ”ͱݺΜͰ·͢
None
ਂΈʹμΠϒ͍ͨ͠ํฐࣾ୮ͷهࣄΛͥͻνΣοΫʂ reinvent2015 ϚΠΫϩαʔϏε
For Your Information
2015.02 Lambda in VPC!! ©Amazon Web Services via http://aws.typepad.com/aws_japan/2016/02/access-resources-in-a-vpc-from-your- lambda-functions.html
ͯ͞
ͰΞϓϦέʔγϣϯ Λ։ൃ͢Δ߹ͷબࢶ
None
None
None
Scala in AWS Lambda • LambdaScalaͰॻ͚·͢ɻ͜ΕScalaʹݶͬͨ Ͱͳ͘ɺJVMݴޠͳΒOKɻ • ͬ͟ͱࢼͨ͠ײ͡ͰແཧΓײ͕ͰΔ͜ͱͳ͘ɺ ͍͍ײ͡ʹॻ͚·͢ɻ
• ٕज़ௐࠪΛਐΊ͍ͯͯɺ͏গ͠φϨοδ͕ཷ·Ε ͍ۙ͏ͪʹຊ൪ద༻ՄೳʹͳΓͦ͏ɻ
Scala in AWS Lambda • LambdaScalaͰॻ͚·͢ɻ͜ΕScalaʹݶͬͨ Ͱͳ͘ɺJVMݴޠͳΒOKɻ • ͬ͟ͱࢼͨ͠ײ͡ͰແཧΓײ͕ͰΔ ͜ͱͳ͘ɺ͍͍ײ͡ʹॻ͚·͢ɻ
• ٕज़ௐࠪΛਐΊ͍ͯͯɺ͏গ͠φϨοδ͕ཷ·Ε ͍ۙ͏ͪʹຊ൪ద༻ՄೳʹͳΓͦ͏ɻ ͜ͷลΓΛ۷ΓԼ͛ΔΛ݄̑ʹԬͰ͠·͢ʂ ʲScalaԬ2016ʳͰݕࡧݕࡧʂ
ͳͥScalaΛબͿ͖͔ • AWS LambdaΛ͏্ͰΓӽ͑ͳ͚ΕͳΒͳ ͍ͷ”݁߹ςετͷॻ͖ʹ͘͞” • ݁߹ςετΨϯΨϯॻ͍ͯͽΎΜͽΎΜਐΊΑ͏ͥ ͱ͍͏จԽͱ͏·͘߹க͠ͳ͍ • ϢχοτςετͷΈͰΑΓଟ͘ͷ৺ࣄΛ
ղফ͢ΔʹͲ͏͖͔͢
ͳͥScalaΛબͿ͖͔ • AWS LambdaΛ͏্ͰΓӽ͑ͳ͚ΕͳΒͳ ͍ͷ”݁߹ςετͷॻ͖ʹ͘͞” • ݁߹ςετΨϯΨϯॻ͍ͯͽΎΜͽΎΜਐΊΑ͏ͥ ͱ͍͏จԽͱ͏·͘߹க͠ͳ͍ • ϢχοτςετͷΈͰΑΓଟ͘ͷ৺ࣄΛ
ղফ͢ΔʹͲ͏͖͔͢ ڧ͍੩తܕγεςϜͷݎ࿚͞ͱ ؔܕͷҟৗܥදݱྗΛۦ͢͠ʂ
rapture.core.Result via https://github.com/propensive/rapture
scalaz.\/ via https://github.com/scalaz/scalaz ʢEitherT͋ΔΜͩΑʂʣ
scala.util.Either via https://github.com/scala/scala
ؔܕͷҟৗܥදݱྗ • ͋ΔৼΔ͍Λςετ͢Δʹ͋ͨΓɺͦͷৼ Δ͍͕ى͜͢෭࡞༻ࠐΈͰςετ͢ΔͷͰ ͳ͘ɺҟৗܥIOΞΫηεΛදݱՄೳͳܕ Λѻ͍ɺ෭࡞༻ͷൃੜՕॴΛΪϦΪϦ·ͰΞ ϓϦέʔγϣϯͷ֎ଆʹ࣋ͪӽ͢Α͏ʹ͢Δ ͜ͱͰɺ෭࡞༻ൃੜલͷ͕ਖ਼͍͜͠ͱ ʢ==ʣΛอূ͢Δςετ͕ॻ͚Δɻ
ݱঢ়ͷࡉ͔͍Cons • Artifact ZIPʹ50MB੍ݶ͕͋Δ → ࡞ΓํΛ͢Δඞཁ͕͋Δͷͷɺ ɹ ϚΠΫϩαʔϏεͷߟ͑ํΛܧঝ͢ΔͳΒ ɹ ରॲՄೳͳ੍ݶ
• JVMͷॳճىಈίετ͕Φʔόʔϔουʹʁ ˠ Lambda in VPCͳΒENIίετ͋ΔͷͰɺ ɹ ॳճ͍ͷͱׂΓΔ
Ұ൪͔͑ͨͬͨࣄͳͷͰ ͪΐͬͱৼΓฦΓ
ͳͥAWS࣌ʹScala͔ • Lambda XσʔඞͣདྷΔ • େنΞϓϦΛLambdaͰ࡞Δ͕͘Δ • AWS݁߹ςετΛແཧΓॻ͘ͷͰͳ͘ ϢχοτςετͰ୲อͰ͖ΔྖҬΛ૿͢ •
ͦ͏͍͏ॻ͖ํΛڧ͘αϙʔτ͍ͯ͠Δͷ͕Scala
Today's topics • Scalaͷoverview • ScalaΛͬͨϞόΠϧόοΫΤϯυAPI • ͳͥAWSωΠςΟϒͷ࣌ʹScala͕ඞཁ͔ • How
to આಘ your client in "Scala͍·͢!"
How to આಘ your client in "Scala͍͍ͨ!"
"Play-ScalaΛ͍·͢!" ͱ͍͏ఏҊΛ͢ΔͨΊʹ ͍͔ͭ͘ͷFrameworkͱ ൺֱݕ౼Λߦ͏ඞཁ͕͋ͬͨ
දతFramework • Ruby on Rails (Ruby) • Express (Node.js) •
Laravel (PHP) • Play Framework (Java) • etc
લḗઓ vs Rails, Node, PHP
vs Rails, Node, PHP • Play-ScalaͱղܾͷϞσϧ͕͖ͬΓ ҧ͏ͷͰɺઆ໌ʢઆಘʣ͍͢͠ɻ • োੑʢResiliencyʣ, ৳ॖੑʢElasticityʣ
৴པੑʢReliabilityʣͳͲͰѹউ͢Δɻ • ڧ͍ͯݴ͑1ΠϯελϯεͰC100Kͷޭ͕͋Δ Node͕Ұ൪ͷϥΠόϧɻ
োੑʢResiliencyʣ • AkkaͷFault ToleranceઓུErlang/OTPͳͲ ͱฒͼ࠷ڧΫϥεͷোੑΛఏڙ • ΈΛཧղͯ͠ਖ਼͑͘͠ɺۚ༥ج൫ Πϯϑϥج൫ʹ༻͍͏ΔϨϕϧ • લḗઓͰઆಘͷϝΠϯΣϙϯ
৳ॖੑʢElasticityʣ • ٛͰͷεέʔϥϏϦςΟ • AkkaϕʔεͷΫϥελϦϯά͕༰қ • PlayAkkaͷΈͷ্Ͱಈ͍͍ͯΔ • Play-Scalaͷ୯ମॲཧੑೳNodeΑΓߴ͍ ˞
2015/05࣌ͷϕϯνϚʔΫ
৴པੑʢReliabilityʣ • ͳΜ͔ͩΜͩݴͬͯJVMͰಈ͘ΞϓϦ • JVMͷྺ࢙ͱ৴པੑΛͦͷ··Ҿ͖ܧ͙͜ͱ͕Ͱ ͖Δ • νϡʔχϯά͔Βӡ༻·Ͱ࣮ɾจݙͱʹ๛ • javapίϚϯυͳͲͰղੳ͢Δͱ݁ߏಡΊ·͢
োੑɺ৳ॖੑɺ৴པੑΛ ͔ͬ͠Γ͑Ε Rails, Node, PHPʹ ڝΓෛ͚Δ͜ͱͳ͍ ※ APIαʔόʔ։ൃͷͰ͢
߈ෆམ vs Java
ઌ΄Ͳڍ͛ͨ োੑɺ৳ॖੑɺ৴པੑ ͦΕͧΕ Play, Akka → োੑ Akka → ৳ॖੑ
JVM → ৴པੑ
Play-Java
Akka for Java
JVM
͑ͬɺ ͦΕJavaͰ͍͍Ͱ͢ΑͶʁ
߈ෆམ vs Java
JavaΑΓScalaΛ͍͍ͨཧ༝ • ίʔυهड़ྔ͕ѹతʹগͳ͍ʢφ͍ʣ • ؔܕͰॻ͚Δʢφ͍ʣ • Akka, PlayScalaͰॻ͔ΕͯΔ͔Β͍͍͢ • …͚ͩ͡Όͳ͘Sparkͱ͔Kafkaͱ͔࠷ۙͷ
ॏཁͳOSS͕ScalaͰॻ͔Ε·ͬͯ͘Δʢφ͍ʣ
JavaΛͬͯ΄͍͠ཧ༝ • ݴޠऀͷ͕ѹతʹଟ͍ • Ώ͑ʹϋΠΞϦϯάָ͕ • Ώ͑ʹอकɾӡ༻ମ੍Λཱ͍ͯ͢ • Ώ͑ʹ҆৺ײ͕͋Δ
ຊʹͦ͏Ͱ͠ΐ͏͔ʁ
Java8Λ࣮ϨϕϧͰॻ͚Δ ΤϯδχΞͬͯ ͦΜͳʹଟ͍ΜͰ͠ΐ͏͔ (StreamAPIʹflatMapͱ͔͋Γ·͚͢ͲͦΕେৎͳΜͰ͔͢Ͷ) ※ScalaʹSwiftʹHaskell(*bind)ʹ͋ΔΑʂ
Java8ऀ͔ͭDDDऀͷ ΤϯδχΞͷϋΠΞϦϯά ͬͯͦΜͳʹָͰ͠ΐ͏͔
Java7ऀΛҭͯΕΑ͍ʁ
ͳΒScalaͰ Γ·͠ΐ͏ʂ
"JavaΑΓScala"Λઆಘ͢Δ • ScalaΛͬͨ߹ͷརΛઆ໌͠ • Java8ऀ͕ඞͣ͠ଟ͘ͳ͘ɺ͔ͭJava8ʹ ͔ͳΓֶशίετ͕͔͔Δ͜ͱΛઆ໌͠ • ʢ্࢘ʹʣಉֶ͡शίετΛ͏ͳΒScalaΛ͏͖ ͩͱ͑Δ͠ʂ •
ʢ͓٬͞ΜʹʣScalaͰϦεΫେࠩͳ͍ͱ͑Δ͠ʂ
࣌ؒʹ༨༟͕͋Ε͜͜Ͱ ScalaѪΛޠΔ ిܸɺॳ࿀ɺ૬खͷ͜ͱͬͱΓ͍ͨɺ…
·ͱΊ
·ͱΊ • ScalaؔܕͰ͖ΔOOPݴޠͰ͢Αʂ • དྷΔLambda XσʔʹɺScala։ൃऀʹଟ͘ͷ ͤΛͨΒ͢Ͱ͠ΐ͏ɻ • Resiliency, Elasticity,
Reliability!! • ScalaΛ͏རΛ͔ͬ͠Γઆ໌্ͨ͠Ͱ “JavaͳΒ҆৺” ͱ͍͏ݬΛͿͪյ͢ʂ
None
%FWFMPQFST*0 ͝੩ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠ɻ εϥΠυޙϒϩάͰެ։͠·͢ɻ " ⡥$MBTTNFUIPE *OD #cmdevio2016