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.1k
開発 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
KubeCon NA 2024 Recap: How to Move from Ingress to Gateway API with Minimal Hassle
ysakotch
0
200
Snykで始めるセキュリティ担当者とSREと開発者が楽になる脆弱性対応 / Getting started with Snyk Vulnerability Response
yamaguchitk333
2
180
オプトインカメラ:UWB測位を応用したオプトイン型のカメラ計測
matthewlujp
0
170
統計データで2024年の クラウド・インフラ動向を眺める
ysknsid25
2
840
Amazon SageMaker Unified Studio(Preview)、Lakehouse と Amazon S3 Tables
ishikawa_satoru
0
150
10個のフィルタをAXI4-Streamでつなげてみた
marsee101
0
160
AI時代のデータセンターネットワーク
lycorptech_jp
PRO
1
280
スタートアップで取り組んでいるAzureとMicrosoft 365のセキュリティ対策/How to Improve Azure and Microsoft 365 Security at Startup
yuj1osm
0
210
MLOps の現場から
asei
6
630
Qiita埋め込み用スライド
naoki_0531
0
860
宇宙ベンチャーにおける最近の情シス取り組みについて
axelmizu
0
110
ゼロから創る横断SREチーム 挑戦と進化の軌跡
rvirus0817
2
260
Featured
See All Featured
The Illustrated Children's Guide to Kubernetes
chrisshort
48
48k
The Cost Of JavaScript in 2023
addyosmani
45
7k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
656
59k
KATA
mclloyd
29
14k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
95
17k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
45
2.2k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
251
21k
Docker and Python
trallard
42
3.1k
Statistics for Hackers
jakevdp
796
220k
Intergalactic Javascript Robots from Outer Space
tanoku
270
27k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
226
22k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
5
440
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͍༰қʹಡΊΔ
͓͠·͍