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
680
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
Cloudflareで実現する AIエージェント ワークフロー基盤
kmd09
0
280
コロプラのオンボーディングを採用から語りたい
colopl
5
950
Reactフレームワークプロダクトを モバイルアプリにして、もっと便利に。 ユーザに価値を届けよう。/React Framework with Capacitor
rdlabo
0
120
技術に触れたり、顔を出そう
maruto
1
150
KMP with Crashlytics
sansantech
PRO
0
240
シフトライトなテスト活動を適切に行うことで、無理な開発をせず、過剰にテストせず、顧客をビックリさせないプロダクトを作り上げているお話 #RSGT2025 / Shift Right
nihonbuson
3
2.1k
Building Scalable Backend Services with Firebase
wisdommatt
0
110
CDKのコードレビューを楽にするパッケージcdk-mentorを作ってみた/cdk-mentor
tomoki10
0
200
深層学習と3Dキャプチャ・3Dモデル生成(土木学会応用力学委員会 応用数理・AIセミナー)
pfn
PRO
0
460
EMConf JP の楽しみ方 / How to enjoy EMConf JP
pauli
2
150
I could be Wrong!! - Learning from Agile Experts
kawaguti
PRO
8
3.3k
生成AI × 旅行 LLMを活用した旅行プラン生成・チャットボット
kominet_ava
0
150
Featured
See All Featured
We Have a Design System, Now What?
morganepeng
51
7.3k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
98
18k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
6
500
Mobile First: as difficult as doing things right
swwweet
222
9k
How to train your dragon (web standard)
notwaldorf
89
5.8k
Fireside Chat
paigeccino
34
3.1k
Code Review Best Practice
trishagee
65
17k
Measuring & Analyzing Core Web Vitals
bluesmoon
5
210
Scaling GitHub
holman
459
140k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
VelocityConf: Rendering Performance Case Studies
addyosmani
327
24k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
192
16k
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