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
Kotlin学習とライブラリ作成
Search
yagi
March 24, 2016
Technology
1
4.2k
Kotlin学習とライブラリ作成
ライブラリ作成をしながらKotlinを学習するといいんじゃないかなーという話です
yagi
March 24, 2016
Tweet
Share
More Decks by yagi
See All by yagi
医療現場の解像度を上げるために 開発チームが行っている取り組み
sys1yagi
0
650
これどうやって動いてるんだ? Spring Framework/Bootのソースを読む
sys1yagi
1
1.1k
Kotlin コルーチンを 理解しよう 2019 - KotlinFest2019 -
sys1yagi
40
30k
5分でわかるKotlin Coroutines Flow
sys1yagi
21
18k
Androidと非同期処理 とCoroutine1.0.0
sys1yagi
12
13k
Kotlin コルーチンを 理解しよう
sys1yagi
41
24k
アーキテクチャと Scaffolding Template
sys1yagi
8
1.3k
Androidの非同期処理をKotlinコルーチンで行う
sys1yagi
3
23k
解剖Kotlin ~バイトコードを読み解く~
sys1yagi
18
9.9k
Other Decks in Technology
See All in Technology
AIチャットボット開発への生成AI活用
ryomrt
0
170
適材適所の技術選定 〜GraphQL・REST API・tRPC〜 / Optimal Technology Selection
kakehashi
1
690
なぜ今 AI Agent なのか _近藤憲児
kenjikondobai
4
1.4k
アプリエンジニアのためのGraphQL入門.pdf
spycwolf
0
100
プロダクト活用度で見えた真実 ホリゾンタルSaaSでの顧客解像度の高め方
tadaken3
0
180
OCI Security サービス 概要
oracle4engineer
PRO
0
6.5k
BLADE: An Attempt to Automate Penetration Testing Using Autonomous AI Agents
bbrbbq
0
320
100 名超が参加した日経グループ横断の競技型 AWS 学習イベント「Nikkei Group AWS GameDay」の紹介/mediajaws202411
nikkei_engineer_recruiting
1
170
Shopifyアプリ開発における Shopifyの機能活用
sonatard
4
250
Application Development WG Intro at AppDeveloperCon
salaboy
0
190
Taming you application's environments
salaboy
0
190
初心者向けAWS Securityの勉強会mini Security-JAWSを9ヶ月ぐらい実施してきての近況
cmusudakeisuke
0
130
Featured
See All Featured
Designing Experiences People Love
moore
138
23k
How To Stay Up To Date on Web Technology
chriscoyier
788
250k
5 minutes of I Can Smell Your CMS
philhawksworth
202
19k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
246
1.3M
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
27
840
4 Signs Your Business is Dying
shpigford
180
21k
Building Flexible Design Systems
yeseniaperezcruz
327
38k
KATA
mclloyd
29
14k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
26
2.1k
The Power of CSS Pseudo Elements
geoffreycrofte
73
5.3k
Optimising Largest Contentful Paint
csswizardry
33
2.9k
The Language of Interfaces
destraynor
154
24k
Transcript
,PUMJOֶशͱϥΠϒϥϦ࡞ 2016 03 24 @ Sansan Toshihiro Yagi
About Me Toshihiro Yagi Twitter : sys1yagi Programmer at Cookpad
Inc. Android engineer Kotlin2014ॳ಄ลΓ͔ΒŧŔŕŪ৮͍ͬͯΔఔ
Target & Agenda ,PUMJOֶशͷͨΊʹϥΠϒϥϦ࡞ͬͯΈΔͷ݁ ߏ͍͍Μ͡Όͳ͍͔ͳʔͱ͍͏Ͱ͢ɻ LNPDLJUPͱ͍͏ϥΠϒϥϦͱڞʹ࡞࣌ʹͬ ͨ,PUMJOͷػೳͳͲΛհ͠·͢ɻ ,PUMJOͷجຊతͳݴޠͷػೳ͍ͬͯͯ,PUMJO Λͬͯ۩ମతʹͲ͏͍ͬͨࣄ͕Ͱ͖ͦ͏͔ͳ͊ʔ ͱߟ͍͑ͯΔਓ͚
What is kmockito?
Wrapper of Mockito for Kotlin NPDL WBSJUFN*UFNNPDL XIFO JUFNMFOHUI
JOWPLFEUIFO3FUVSO BOTXFS JUFNTPNF.FUIPE BOZ*OU BOZ4USJOH BOZ BOZ JOWPLFE UIFO"OTXFS\ WBM B C D E JUBSHVNFOUT*OU 4USJOH *UFN /BNF EPTPNFUIJOH ^ WFSJGZ JUFNWFSJGZ UJNFT MFOHUI https://github.com/sys1yagi/kmockito
Motivation
bXIFO`,PUMJOͷ༧ޠ WBMJUFNNPDL *UFNDMBTTKBWB AXIFOA JUFNMFOHUI UIFO3FUVSO ༧ޠͱඃΒͳ͍Α͏ʹΤεέʔϓ͕ඞཁ
BOZ ͕OVMMΛฦ͢ AXIFOA JUFNMFOHUI BOZ UIFO3FUVSO ʜ any() return null
and cause runtime error GVOMFOHUI UFYU4USJOH *OU\ʜ^ Non-Null
Yes kmockito!
Using features of Kotlin top-level extensions inline and reified Extension
Properties Destructuring Declarations
top-level extensions
τοϓϨϕϧʹ͕ؔॻ͚ͯศར
TUBUJDϝιου܈Λ࣋ͭΫϥε͕ੜ͞ΕΔ ֦ுؔ܈XX_extension.ktʹूΊΔͱΑͦ͞͏
lnline & reified
ͳܕͷهड़ΛΊΔ WBMJUFNNPDL *UFNDMBTTKBWB WBMJUFN*UFNNPDL JUFNMFOHUI NPDL
ͳܕͷهड़ΛΊΔ GVO5"OZNPDL .PDLJUPNPDL 5DMBTTKBWB
ͳܕͷهड़ΛΊΔ GVO5"OZNPDL .PDLJUPNPDL 5DMBTTKBWB ܕফڈʹΑͬͯΤϥʔ
ͳܕͷهड़ΛΊΔ GVO5"OZNPDL .PDLJUPNPDL 5DMBTTKBWB ܕফڈʹΑͬͯΤϥʔ JOMJOFGVOSFJpFE5"OZNPDL .PDLJUPNPDL 5DMBTTKBWB
ͳܕͷهड़ΛΊΔ GVO5"OZNPDL .PDLJUPNPDL 5DMBTTKBWB ܕফڈʹΑͬͯΤϥʔ JOMJOFGVOSFJpFE5"OZNPDL .PDLJUPNPDL 5DMBTTKBWB JOMJOFԽͯ͠ܕύϥϝʔλʹSFJpFEΛ༩͢Δͱ5Λ۩ܕͱ͔ͯ͋ͭ͑͠Δ ˞LPUMJOSFqFDU͕ඞཁͰ͢
ͳܕͷهड़ΛΊΔ JOMJOFGVOSFJpFE5"OZNPDL .PDLJUPNPDL 5DMBTTKBWB WBMJUFN*UFNNPDL JUFNMFOHUI NPDL :FT
Extension Properties
ͳϝιουݺͼग़͠ΛΊΔ GVO55JOWPLFE .PDLJUPAXIFOA UIJT JUFNMFOHUI JOWPLFE UIFO3FUVSO
ͳϝιουݺͼग़͠ΛΊΔ GVO55JOWPLFE .PDLJUPAXIFOA UIJT JUFNMFOHUI JOWPLFE UIFO3FUVSO ͳͯ͘Α͘ͳ͍ʁ
ͳϝιουݺͼग़͠ΛΊΔ GVO55JOWPLFE .PDLJUPAXIFOA UIJT WBM55JOWPLFE0OHPJOH4UVCCJOH5 HFU JOWPLFE ɾ&YUFOTJPO1SPQFSUJFTͰҙͷΫϥεʹϓϩύςΟΛ༩͢Δ ɾϓϩύςΟΞΫηε࣌ʹϝιουݺͼग़͠
ͳϝιουݺͼग़͠ΛΊΔ GVO55JOWPLFE .PDLJUPAXIFOA UIJT WBM55JOWPLFE0OHPJOH4UVCCJOH5 HFU JOWPLFE ɾ&YUFOTJPO1SPQFSUJFTͰҙͷΫϥεʹϓϩύςΟΛ༩͢Δ ɾϓϩύςΟΞΫηε࣌ʹϝιουݺͼग़͠
JUFNMFOHUI JOWPLFEUIFO3FUVSO
Destructuring Declarations
85' JUFNTPNF.FUIPE BOZ*OU BOZ4USJOH BOZ BOZ JOWPLFE UIFO"OTXFS\ WBMBJUBSHVNFOUT<>BT*OU
WBMCJUBSHVNFOUT<>BT4USJOH WBMDJUBSHVNFOUT<>BT*UFN WBMEJUBSHVNFOUT<>BT/BNF EPTPNFUIJOH ^
%FTUSVDUVSJOH%FDMBSBUJPOT Λͬͨೖ WBM B C 1BJS l)FMMPz Bl)FMMPz
C
%FTUSVDUVSJOH%FDMBSBUJPOT Λͬͨೖ WBM B C 1BJS l)FMMPz Bl)FMMPz
C ಛఆͷϧʔϧʹԊͬͨΫϥεͰ %FTUSVDUVSJOH%FDMBSBUJPOT͕͑Δɻ
%FTUSVDUVSJOH%FDMBSBUJPOTͷϧʔϧ DMBTT'PP\ PQFSBUPSGVODPNQPOFOU 4USJOHʜ PQFSBUPSGVODPNQPOFOU *OUʜ PQFSBUPSGVODPNQPOFOU/ 5ʜ ^ GVOEP4PNFUIJOH
GPP'PP \ WBM B C GPP ʜ ^ DPNQPOFOU/ ͱ͍͏ϝιουΛඞཁͳ͚ͩ࣋ͭ
%BUB$MBTTͰએݴָʑ EBUBDMBTT'PP WBMB4USJOH WBMC*OU GVOEP4PNFUIJOH GPP'PP \ WBM B C
GPP ʜ ^ %BUB$MBTTͰলུՄೳ
*OWPDBUJPO0O.PDLʹϝιουΛՃ JOMJOFGVOSFJpFE" SFJpFE# SFJpFE$ *OWPDBUJPO0O.PDLBSHVNFOUT 5SJQMF BSHVNFOUT<>BT" BSHVNFOUT<>BT# BSHVNFOUT<>BT$
*OWPDBUJPO0O.PDLʹϝιουΛՃ JOMJOFGVOSFJpFE" SFJpFE# SFJpFE$ *OWPDBUJPO0O.PDLBSHVNFOUT 5SJQMF BSHVNFOUT<>BT" BSHVNFOUT<>BT# BSHVNFOUT<>BT$
JUFNTPNF.FUIPE BOZ*OU BOZ4USJOH BOZ JOWPLFE UIFO"OTXFS\ WBM B C D JUBSHVNFOUT*OU 4USJOH *UFN EPTPNFUIJOH ^ :FT
Conclusion
,PUMJOֶशͱϥΠϒϥϦ࡞ ߦఔͰ݁ߏ͑Δͷ͕࡞ΕΔ ϥΠϒϥϦͩͱ"OESPJEͳͲͷϑϨʔϜϫʔΫ ʹ͋·ΓറΒΕͣॻ͚ΔͷͰֶश͕͔ͲΔ େମίʔυ͕ճ͘Β͍ม͢ΔɻͦͷதͰ,PUMJO ͷ༷ػೳॻ͖ํͳͲʹ͍ͭͯ৭ʑͱ۷ΕΔ ࠷ѱࣺͯΒΕΔ
Let’s Enjoy Kotlin life ϥΠϒϥϦΛ࡞ͬͯ
͓·͚
ಉ͡Α͏ͳϥΠϒϥϦཚཱ ͏ʔΜͲ͏ͨ͠ͷ͔
"XFTPNFLPUMJO ͜͜ʹೖΓ͍ͨ https://github.com/JavaBy/awesome-kotlin
ؤுΖ͏