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
400
チーム開発と Android アプリの構成
ryugoo
5
1.1k
開発 4 年目のアプリへの Kotlin 導入
ryugoo
1
2.5k
Either で想定内のエラーと想定外のエラーを別ものにしたい!
ryugoo
2
1.6k
全て S になる -RxJava と LWS を持ち込む楽しさ-
ryugoo
4
680
Transition at RxJava 1.x to 2.x
ryugoo
0
510
Kotlin さんと誕生日が近いだけの男の話
ryugoo
2
490
Android エンジニアになって 2 年の学び
ryugoo
1
2.6k
年末だしお掃除をしよう!
ryugoo
0
750
Other Decks in Technology
See All in Technology
SORACOMで実現するIoTのマルチクラウド対応 - IoTでのクリーンアーキテクチャの実現 -
kenichirokimura
0
130
マーケットプレイス版Oracle WebCenter Content For OCI
oracle4engineer
PRO
1
160
Oracle Exadata Database Service(Dedicated Infrastructure):サービス概要のご紹介
oracle4engineer
PRO
0
9.4k
タイミーのBraze活用 ~PUSH通知を活用したレコメンド~
ozeshun
2
120
SHIFTの課題と目指したい組織像 / 20240827 Rinto Ikenoue
shift_evolve
0
150
Zero Data Loss Autonomous Recovery Service サービス概要
oracle4engineer
PRO
0
3.2k
Staff Engineer / 20240827 Yuichiro Masui
shift_evolve
0
150
実践的なバグバウンティ入門
scgajge12
4
2.2k
分野に潜むツールの紹介
pojiro
1
330
CRTO/CRTL/OSEPの比較・勉強法とAV/EDRの検知実験
chayakonanaika
0
590
Datadogの便利な使い方 - 意外と知らない?CoScreenとCloudcraft
taijihagino
PRO
1
600
Azure Cosmos DB での時系列ログの運用と改善
sansantech
PRO
0
190
Featured
See All Featured
Fontdeck: Realign not Redesign
paulrobertlloyd
80
5.1k
Designing with Data
zakiwarfel
98
5k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
157
15k
Making the Leap to Tech Lead
cromwellryan
128
8.8k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
33
1.7k
Building Applications with DynamoDB
mza
89
5.9k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
226
52k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
27
8.9k
Six Lessons from altMBA
skipperchong
26
3.3k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
325
21k
Large-scale JavaScript Application Architecture
addyosmani
508
110k
ParisWeb 2013: Learning to Love: Crash Course in Emotional UX Design
dotmariusz
109
6.9k
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͍༰қʹಡΊΔ
͓͠·͍