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
Java で書かれた Android アプリを Kotlin で書き直すまでの話 / ...
Search
Ryutaro Miyashita
July 03, 2018
Technology
0
1.6k
Java で書かれた Android アプリを Kotlin で書き直すまでの話 / Talk of rewrite Android app for Java to Kotlin
集まれ Kotlin 好き ! Kotlin 愛好会 vol 2 @ DeNA
Ryutaro Miyashita
July 03, 2018
Tweet
Share
More Decks by Ryutaro Miyashita
See All by Ryutaro Miyashita
開発 4 年目のアプリへの Kotlin 導入
ryugoo
0
410
チーム開発と Android アプリの構成
ryugoo
5
1.2k
開発 4 年目のアプリへの Kotlin 導入
ryugoo
1
2.6k
Either で想定内のエラーと想定外のエラーを別ものにしたい!
ryugoo
2
1.6k
全て S になる -RxJava と LWS を持ち込む楽しさ-
ryugoo
4
720
Transition at RxJava 1.x to 2.x
ryugoo
0
520
Kotlin さんと誕生日が近いだけの男の話
ryugoo
2
500
Android エンジニアになって 2 年の学び
ryugoo
1
2.6k
年末だしお掃除をしよう!
ryugoo
0
770
Other Decks in Technology
See All in Technology
社内イベント管理システムを1週間でAKSからACAに移行した話し
shingo_kawahara
0
200
【re:Invent 2024 アプデ】 Prompt Routing の紹介
champ
0
160
サービスでLLMを採用したばっかりに振り回され続けたこの一年のあれやこれや
segavvy
2
550
20241220_S3 tablesの使い方を検証してみた
handy
4
700
PHPerのための計算量入門/Complexity101 for PHPer
hanhan1978
5
680
GitHub Copilot のテクニック集/GitHub Copilot Techniques
rayuron
39
16k
いまからでも遅くないコンテナ座学
nomu
0
130
Server-Side Engineer of LINE Sukimani
lycorp_recruit_jp
0
360
2024年にチャレンジしたことを振り返るぞ
mitchan
0
150
生成AIをより賢く エンジニアのための RAG入門 - Oracle AI Jam Session #20
kutsushitaneko
4
290
Storage Browser for Amazon S3
miu_crescent
1
290
ハイテク休憩
sat
PRO
2
180
Featured
See All Featured
Imperfection Machines: The Place of Print at Facebook
scottboms
266
13k
How To Stay Up To Date on Web Technology
chriscoyier
789
250k
The Invisible Side of Design
smashingmag
298
50k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
45
2.2k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
The Straight Up "How To Draw Better" Workshop
denniskardys
232
140k
Product Roadmaps are Hard
iamctodd
PRO
50
11k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
127
18k
Fontdeck: Realign not Redesign
paulrobertlloyd
82
5.3k
Gamification - CAS2011
davidbonilla
80
5.1k
VelocityConf: Rendering Performance Case Studies
addyosmani
326
24k
Building Adaptive Systems
keathley
38
2.3k
Transcript
+BWBͰॻ͔Εͨ"OESPJEΞϓϦΛ ,PUMJOͰॻ͖͢·Ͱͷ ू·Ε,PUMJO͖,PUMJOѪձWPM
ٶԼཽେ $IBU8PSLגࣜձࣾ ΫϥΠΞϯτΞϓϦέʔγϣϯ։ൃ෦ !SZVHPP@ ͖ͳ,PUMJOͷػೳ4NBSU$BTU
$IBU8PSL
$IBU8PSL ‣ Ϗδωε͚ͷνϟοταʔϏε 8FCJ04"OESPJEσεΫτοϓΞϓϦͰఏڙ "OESPJEΞϓϦ͔Β+BWB ‣ ʙ·Ͱ5JUBOJVN +BWB4DSJQU
ͩͬͨ ‣ +BWB൛͔Β։ൃΛ։࢝ ‣ ,PUMJOΛݕ౼͢ΔͨΊʹͷ,PUMJOษڧձʹࢀՃ ‣ ࠾༻ڧԽத J04"OESPJE4DBMB1)143&ͳͲ ৄ͘͠8FCαΠτͰ ‣ IUUQTDPSQDIBUXPSLDPNKBSFDSVJU ‣ ؾʹͳΔ͜ͱ͕͋ͬͨΒ͔͚ͯԼ͍͞
,PUMJO
,PUMJO ‣ (PPHMF*0Ͱ"OESPJEެࣜݴޠԽ ͦΕ·Ͱ,PUMJOͷ։ൃࣄྫଟ͋ͬͨ͘ ެࣜݴޠʹͳΔ͜ͱͰ҆৺ΛखʹೖΕͨ طଘͷΞϓϦͱͷ͖߹͍ํΛͲ͏͢Δ͔ʁ ‣
෦తʹಋೖPSશ໘తʹಋೖ ͜Εͱ͍ͬͨਖ਼ղͳ͍ ৽نϓϩδΣΫτͳΒ,PUMJOͰྑ͍ $IBU8PSLͰશ໘తͳಋೖΛܾఆͨ͠
Ͳ͔͜Β ‣ ಋೖॳશ໘తͳಋೖ༧ఆͳ͔ͬͨ খ͞ͳμΠΞϩά͔ͭΒಋೖΛ։࢝ ‣ (PPHMF*0ͷཌ͔Βελʔτ ࣍ʹطଘͷը໘Λͭॻ͖͑ͯΈͨ
৽͍͠ػೳͷՃΛ,PUMJOͰॻ͍ͯΈͨ ‣ +BWBͱͷͭͳ͗ࠐΈ͕ωοΫʹͳ͍ͬͯͬͨ ͔֬ʹ,PUMJO+BWBͱͷ࿈ܞόονϦͰ͖Δ ͏·͘࿈ܞ͢Δʹಛผͳҙ͚͕ࣝඞཁ ‣ !+WN'JFME!+WN4UBUJD!+WN0WFSMPBET ‣ SFUVSO6OJU*/45"/$& ‣ 1MBUGPSN5ZQFT
!+WNʙΞ ϊςʔγϣϯ ‣ +BWB͔ΒͷΞΫηεΛҙࣝ͢Δඞཁ͕͋Δ class MyFragment : Fragment() { companion
object { @JvmField val TAG: String = MyFragment::class.java.simpleName } @JvmOverloads fun logic(label: String = "") {} } ,PUMJO
SFUVSO6OJU*/45"/$& ‣ ,PUMJOʹlWPJEzଘࡏ͠ͳ͍ class BusinessLogic { fun async(callback: () ->
Unit) { // Some async logic callback(); } } BusinessLogic logic = new BusinessLogic(); logic.async(() -> { return Unit.INSTANCE; }); ,PUMJO +BWB
IUUQTEJTDVTTLPUMJOMBOHPSHUKBWBJOUFSPQVOJUDMPTVSFTSFRVJSFEUPSFUVSOLPUMJOVOJU !+WN7PJEͷఏҊ ʹಉ͡ఏى
1MBUGPSN5ZQFT ‣ /PO/VMM͔/VMMBCMF͔એݴ͞Ε͍ͯͳ͍ܕ ܕใΛݟΔͱlzϚʔΫ͕͍͍ͯΔ ‣ "OESPJE4%,جຊతʹ1MBUGPSN5ZQFT ‣ !/PO/VMM!/VMMBCMF͕͍ͯͨΒϥοΩʔ
1MBUGPSN5ZQFT ‣ "OESPJE4%,Ͱ͋ΕίʔυΛಡΜͰܕΛܾఆ͢Δ val inflater: LayoutInflater = LayoutInflater.from(this) ,PUMJO
,PUMJOͷ͏·ຯΛҾ͖ग़͍ͨ͠ ‣ ,PUMJOΛ෦తʹಋೖ͢Δͱ+BWBʹӨڹ͕ग़Δ ٯʹ+BWBͷ࣮͕,PUMJOʹӨڹ͢Δ ‣ +BWB0QUJPOBMWT,PUMJO/PO/VMM/VMMBCMF5ZQF ࣗୡ͕ॻ͍ͨ+BWBͷίʔυΛݟฦ͢ ‣
!/PO/VMM!/VMMBCMFΞ ϊςʔγϣϯΛ͚͍ͯ͘ʁ ‣ ͍ͬͦͷ͜ͱ,PUMJOʹஔ͖͑ͨํ͕ྑ͍ͷͰͳ͍͔ʁ ‣ ͭͣͭஸೡʹ,PUMJOԽΛਐΊ͍ͯ͘ ਓͷνʔϜͰ,PUMJOͷशख़όϥόϥ ૬ޓʹϨϏϡʔΛ͠ͳ͕ΒཧղΛਂΊ͍ͯ͘ 1VMM3FRVFTUʹ,PUMJOͷݴޠػೳͷઆ໌Λॻ͘
,PUMJOͷ͏·ຯΛҾ͖ग़͢ಓఔ (PPHMF*0b $IBU8PSL"OESPJE 7FSTJPO 'VMM+BWB ߦ $IBU8PSL"OESPJE
7FSTJPO 'VMM,PUMJO ߦ Ի௨ "OESPJE ߦ
,PUMJOͷ͏·ຯΛҾ͖ग़ͨ݁͠Ռ ‣ ϲ݄ͰશͯͷίʔυΛ,PUMJOԽͨ͠ ͦͷؒʹػೳՃϦϑΝΫλϦϯάͰ͖ͨ ,PUMJOԽલޙͰίʔυͷྔʹͳͬͨ ‣ νʔϜͷਁಁͱޮՌ
/VMM1PJOUFS&YDFQUJPOͷ໓ ‣ ΄΅ग़ձ͍ͬͯͳ͍ ‣ 1MBUGPSN5ZQFTͷऔΓѻ͍͕పఈ͞Εͨ ‣ +BWBͷ0QUJPOBMΑΓऔΓѻָ͍͕ ίʔυͷՄಡੑͷ্ ‣ جຊWBMͰڱ͍ൣғͰWBSΛ͏ͳͲͷҙ͚ࣝ
,PUMJOͷ͏·ຯΛҾ͖ग़ͨ͢Ίʹ ‣ ,PUMJOଆͷ࣮ݟͨํ͕ྑ͍ ྫ͑NBQˠUP-JTUͷྲྀΕ ‣ +BWBͷ4USFBNΛͬͯΔͱ͍ͭΓͨ͘ͳΔ ‣ ࣮ࡍNBQͷ࣌Ͱ-JTU3͕ಘΒΕΔ val
results: List<R> = someCollection .map { it.convert() } .toList() ,PUMJO
,PUMJOͷ͏·ຯΛҾ͖ग़ͨ͢Ίʹ ‣ 4IPX,PUMJO#ZUFDPEFˠ%FDPNQJMF͢Δ val source = listOf(1, 2, 3, 4,
5) val results: List<String> = source .map { it.toString(10) } ,PUMJO UP-JTUແ UP-JTU༗
,PUMJOͷ͏·ຯΛҾ͖ग़͠ଛͶͨࣄྫ ‣ ,PUMJOͱ"OESPJE +%, ͷ"1*͕ಉ໊͡લ ‣ ਖ਼ղ൪ԼͷGPS&BDIͰͨ͠ʂ ൪ԼLPUMJODPMMFDUJPOTGPS&BDI ‣
.BQͷ֦ுؔͱͯ͠ఆٛ͞Ε͍ͯΔ ্͔ΒͭΊKBWBVUJM.BQGPS&BDI ‣ "OESPJEͰ͑ΔΑ͏ʹͳͬͨͷ-W͔Β ‣ /P$MBTT%FG'PVOE&SSPS͕ൃੜͨ͠
࠷ޙʹ
࠷ޙʹ ‣ طଘͷΞϓϦஈ֊తʹ,PUMJOԽ͍͚ͯ͠Δ ͨ +BWBͱͷ૬ޓӡ༻ੑͷߴ͞ ‣ த్ʹಋೖ͢Δ͙Β͍ͳΒશͯॻ͖͍͑ͨ
+BWBͱ,PUMJOؒͰͦΕͧΕΛҙࣝ͢Δखؒ ‣ ਓखͰؾΛ͚ͭͳ͍ͱ͍͚ͳ͍Օॴඞͣࣄނ͕ੜ·ΕΔ ‣ ଞνʔϜ͔Βݟͨ৺ཧతোน͕Լ͕ͬͨ ෭࣍తͳޮՌ ‣ J04νʔϜ͕,PUMJOͷίʔυΛಡΜͰ4XJGUʹҠ২ ‣ 4DBMB ؚ4DBMB+4 5ZQF4DSJQU͍༰қʹಡΊΔ
͓͠·͍