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
How to use Scala.js in real world?
Search
kyo_ago
January 29, 2016
Technology
1
2.1k
How to use Scala.js in real world?
kyo_ago
January 29, 2016
Tweet
Share
More Decks by kyo_ago
See All by kyo_ago
フロントエンドの リソース管理の話 TechFeed Summit#1 #techfeed #techfeedsummit
kyo_ago
5
2k
TypeScriptでType Match的なことをする話 #すえなみチャンス暑気払い
kyo_ago
1
1.3k
WebReplayから見るWeb開発の未来 #builderscon
kyo_ago
2
970
今日から始めるbugbounty
kyo_ago
0
280
karmaを使ったSPA向けE2Eテスト技法
kyo_ago
6
5.5k
E2Eという名称の指すもの
kyo_ago
0
2.5k
Other Decks in Technology
See All in Technology
The Madness of Multiple Gemini CLIs Developing Simultaneously with Jujutsu
gunta
1
2.5k
分散トレーシングによる コネクティッドカーのデータ処理見える化の試み
thatsdone
0
200
P2P ではじめる WebRTC のつまづきどころ
tnoho
1
210
RapidPen: AIエージェントによる高度なペネトレーションテスト自動化の研究開発
laysakura
1
390
MCPと認可まわりの話 / mcp_and_authorization
convto
1
130
20150719_Amazon Nova Canvas Virtual try-onアプリ 作成裏話
riz3f7
0
130
MCPに潜むセキュリティリスクを考えてみる
milix_m
1
710
ML Pipelineの開発と運用を OpenTelemetryで繋ぐ @ OpenTelemetry Meetup 2025-07
getty708
0
230
SREを知らずに SREマネージャーになった話 / How I Became an SRE Manager Without Knowing What SRE Is
moneyforward
0
300
PHPからはじめるコンピュータアーキテクチャ / From Scripts to Silicon: A Journey Through the Layers of Computing
tomzoh
2
380
Ktor + Google Cloud Tasks/PubSub におけるOTel Messaging計装の実践
sansantech
PRO
1
260
スプリントゴール未達症候群に送る処方箋
kakehashi
PRO
1
190
Featured
See All Featured
Why Our Code Smells
bkeepers
PRO
337
57k
Balancing Empowerment & Direction
lara
1
490
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
48
2.9k
Building a Scalable Design System with Sketch
lauravandoore
462
33k
A designer walks into a library…
pauljervisheath
207
24k
How GitHub (no longer) Works
holman
314
140k
4 Signs Your Business is Dying
shpigford
184
22k
Done Done
chrislema
184
16k
Measuring & Analyzing Core Web Vitals
bluesmoon
7
530
Automating Front-end Workflow
addyosmani
1370
200k
Building Better People: How to give real-time feedback that sticks.
wjessup
367
19k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
50
5.5k
Transcript
How to use Scala.js in real world? Kyo Ago
About me - work for ChatWork - using JavaScript for
9 years - using Scala for 0.5 year ࣗݾհɻChatWorkͰJavaScriptॻ͍ͯ·͢
Scala is great! Scala͍͍Ͱ͢Ͷʂ
But Ͱ
We want to develop UI, don't we!? UIΛ࡞Γ͍ͨʂ
Hmm... ͡Ό͋
Scala.js!! Scala.jsͰ͢Ͷʂ
Wait ... Ͱ
Scala.js is production ready yet? Scala.js͑Δͷʁ
Yes, it is! ͑Δ
1. "almost" compatible to Javascript JavaScriptͱͷޓੑ΄΅ສશ - bit-size in number
types - runtime semantics in exceptions - difference of regex defs
2. Type definition can be applied by using TypeScript ܕఆٛTypeScript͔ΒಋೖՄೳ
sjrd/scala-js-ts-importer
3. fast compile ߴͳίϯύΠϧ 1-2 seconds even when optimized fullOptJS
is used
4. small footprint ܰྔ Hello world! is 17KB(with fullOptJS). 6KB
with gzip
5. supports SourceMap SourceMapαϙʔτ
6. Java API implementation is going actively Java APIͷ࣮ਐΜͰΔ
Why isn't Scala.js widely used? ͡Ό͋ɺͳΜͰΘΕͯͳ͍ͷʁ
1. type safety is too much for small projects খنͳΒܕ҆શੑͷඞཁੑ͍
2. widely proven framework is preferred in large projects. େنͳΒ࣮͕ͳ͍ϑϨʔϜϫʔΫ࠾༻͠ʹ͍͘
3. difficult to call Scala.js from Javascript JavaScript͔ΒScala.jsΛݺͼग़͢ͷ͕͍͠ The part
actively developed right now
4. difficult to change if html was embedded to code
ίʔυʹhtmlΛຒΊࠐΉͱUIมߋʹऑ͍
5. compatibility/ability to track the latest version between other JavaScript
libraries JavaScriptϥΠϒϥϦͱͷޓੑɺ࠷৽൛ͷैੑ
6. debugging cost on browsers ϒϥβ্Ͱͷσόοάίετ
Then, we can't use, can we!? ͡Ό͋ɺ͑ͳ͍ͷʁ
Architecture can be an answer ΞʔΩςΫνϟͰղܾ
Scala.js should covers only logic. Scala.jsϩδοΫͷΈΛ࣮
Javascript should covers UI JavaScriptͰUIΛ࣮
communicate each other by JSON ͓ޓ͍ʹJSONͰ௨৴
UI should be contsructed by JSON UIJSON͔Βߏங͢Δ
Pros ར
1. reduces integration between Scala.js and JavaScript Scala.jsͱJavaScriptͷ࿈ܞ͕ݮΔ
2. we can develop in Scala.js similar to usual development
in Scala ௨ৗͷScala։ൃͱಉ͡Α͏ʹScala.jsͰ։ൃͰ͖Δ
3. flexibility of implementing UI UI࣮ͷࣗ༝্͕͕Δ
Cons ܽ
1. communication cost between Scala.js and UI Scala.jsͱUI෦ͱͷ௨৴͕සൃ͢Δ
2. logic is prone to be complex ϩδοΫ͕ෳࡶԽ͢Δ
Is this really achievable? ࣮ݱՄೳʁ
Yes, at least on the architecture level ΞʔΩςΫνϟతʹՄೳ
Let's discuss together at ChatWork Booth! ৄ͘͠ϒʔεͰ
Thank you! ͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠ɻ
We're Hiring!! ͝Ԡื͓͍ͪͯ͠·͢ʂ http://corp.chatwork.com/ja/recruit/engineer/