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ってこんな言語 #jkug
Search
Taro Nagasawa
July 26, 2013
Programming
2
3.5k
Kotlinってこんな言語 #jkug
Kotlin言語について、その特徴とサードパーティ製ライブラリの簡単な紹介。
Taro Nagasawa
July 26, 2013
Tweet
Share
More Decks by Taro Nagasawa
See All by Taro Nagasawa
Android開発者のための Kotlin Multiplatform入門
ntaro
0
370
Kotlin 最新動向2022 #tfcon #techfeed
ntaro
1
2.1k
#Ubie 狂気の認知施策と選考設計
ntaro
13
12k
UbieにおけるサーバサイドKotlin活用事例
ntaro
1
1.1k
KotlinでSpring 完全理解ガイド #jsug
ntaro
6
3.3k
Kotlinでサーバサイドを始めよう!
ntaro
1
920
Androidからサーバーサイドまで!プログラミング言語 Kotlinの魅力 #devboost
ntaro
5
2.6k
Kotlin Contracts #m3kt
ntaro
4
3.8k
How_to_Test_Server-side_Kotlin.pdf
ntaro
1
430
Other Decks in Programming
See All in Programming
Flutterを言い訳にしない!アプリの使い心地改善テクニック5選🔥
kno3a87
1
210
Creating a Free Video Ad Network on the Edge
mizoguchicoji
0
120
CSC509 Lecture 13
javiergs
PRO
0
110
シェーダーで魅せるMapLibreの動的ラスタータイル
satoshi7190
1
480
ローコードSaaSのUXを向上させるためのTypeScript
taro28
1
630
カンファレンスの「アレ」Webでなんとかしませんか? / Conference “thing” Why don't you do something about it on the Web?
dero1to
1
110
Macとオーディオ再生 2024/11/02
yusukeito
0
380
よくできたテンプレート言語として TypeScript + JSX を利用する試み / Using TypeScript + JSX outside of Web Frontend #TSKaigiKansai
izumin5210
6
1.8k
NSOutlineView何もわからん:( 前編 / I Don't Understand About NSOutlineView :( Pt. 1
usagimaru
0
340
Vapor Revolution
kazupon
1
170
What’s New in Compose Multiplatform - A Live Tour (droidcon London 2024)
zsmb
1
480
ECS Service Connectのこれまでのアップデートと今後のRoadmapを見てみる
tkikuc
2
260
Featured
See All Featured
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
47
2.1k
What’s in a name? Adding method to the madness
productmarketing
PRO
22
3.1k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
665
120k
How to Think Like a Performance Engineer
csswizardry
20
1.1k
Making the Leap to Tech Lead
cromwellryan
133
8.9k
Java REST API Framework Comparison - PWX 2021
mraible
PRO
28
8.2k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
6
430
YesSQL, Process and Tooling at Scale
rocio
169
14k
Embracing the Ebb and Flow
colly
84
4.5k
Build your cross-platform service in a week with App Engine
jlugia
229
18k
How to Ace a Technical Interview
jacobian
276
23k
GitHub's CSS Performance
jonrohan
1030
460k
Transcript
Kotlinͬͯ͜Μͳݴޠ 2013.7.26 ୈ1ճ͔Θ͍͍Kotlinษڧձ @ngsw_taro
͢͜ͱ •Kotlin is Կ •؆ܿ •҆શ •3rd Party Library/FW
Kotlin is Կ
Better Java
JetBrains͕։ൃ͍ͯ͠Δ ੩తܕ͚ݴޠ for JVM, Android, JavaScript
ΫϥεΦϒδΣΫτ εϚʔτΩϟετ ϥϜμࣜ ߴ֊ؔ null҆શ τϨΠτ ֦ுؔ ܕਪ
Scala͑ʁ
·͔͊֬ʹɻɻ
Kotlinͷઃܭඪ̍ JavaฒͷίϯύΠϧ
Kotlinͷઃܭඪ̎ දݱྗΛҡ࣋ͭͭ͠ ScalaΑΓγϯϓϧʹ
؆ܿ
val hoge: Int = 5.inc() ͯ͢ΦϒδΣΫτ ϓϦϛςΟϒܕͳ͍
҉ͷܕมͳ͍ val a: Float = 2 val b: Float =
2.toFloat() ←NG
ߴ֊ؔ/ϥϜμࣜ (1..999).filter { it % 3 == 0 || it
% 5 == 0 }.reduce { sum, e -> sum + e }
Ϋϥε class Person( val name: String, val age: Int =
20 )
Ϋϥε class Person( val name: String, val age: Int =
20 ) ίϯετϥΫλ ϓϩύςΟ σϑΥϧτ
Πϯελϯεੜ Person(“Taro”, 25) Person(“Taro”) Person(name=“Taro”)
Πϯελϯεੜ Person(“Taro”, 25) Person(“Taro”) Person(name=“Taro”) ύϥϝʔλলུ ໊લҾ newෆཁ
֦ுؔ τϨΠτ ςϯϓϨʔτࣜ ͦͷଞʹ ͳͲͳͲ
҆શ
null҆શ Φʔόϔουͷͳ͍ OptionܕͷΑ͏ͳͷ
val name: String = name() assert(name != null) ඞͣ͋Δ
val name: String? = name() ͕ͳ͍͔
val name: String? = name() val len = name.length ҆શͰͳ͍ͷېࢭ
←NG
val name: String? = name() if(name != null) val len
= name.length ҆શͳͷOK
val name: String? = name() val len = name?.length ʮ҆શݺͼग़͠ʯ
Ωϟετ δΣωϦΫε ͦͷଞʹ
3rd Party Library/FW
Kara Web Framework KotlinݴޠDSLͰϧʔςΟϯά͔ΒϏϡʔ·Ͱ࡞ΕΔ
class IndexView(val task: Task = Task()): HtmlView() { override fun
render(context: ActionContext) { h2("λεΫͷొ") formFor(task, "/task".link(), FormMethod.post) { p { labelFor("title", "໊݅") textFieldFor("title") } p { labelFor("content", "༰") textAreaFor("content") } p { input(inputType = InputType.submit, value = "ొ") } } } }
Spek ಡΈ͍༷͢Λهड़͢ΔͨΊͷDSL
public class calculatorSpecs : JUnitSpec() {{ given("a calculator") { val
calculator = Calculator() on("calling sum with two numbers") { val sum = calculator.sum(2, 4) it("should return the result of adding the first number to the second number") { shouldEqual(6, sum) } } } }} https://github.com/hhariri/spekΑΓҾ༻
Node.kt funKTionale ͦͷଞʹ
͋Γ͕ͱ͏͍͟͝·ͨ͠