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
Quine, Polyglot, 良いコード
qnighy
4
640
Laravel や Symfony で手っ取り早く OpenAPI のドキュメントを作成する
azuki
2
120
subpath importsで始めるモック生活
10tera
0
300
聞き手から登壇者へ: RubyKaigi2024 LTでの初挑戦が 教えてくれた、可能性の星
mikik0
1
130
WebフロントエンドにおけるGraphQL(あるいはバックエンドのAPI)との向き合い方 / #241106_plk_frontend
izumin5210
4
1.4k
Amazon Qを使ってIaCを触ろう!
maruto
0
410
Generative AI Use Cases JP (略称:GenU)奮闘記
hideg
1
290
ActiveSupport::Notifications supporting instrumentation of Rails apps with OpenTelemetry
ymtdzzz
1
230
CSC509 Lecture 13
javiergs
PRO
0
110
flutterkaigi_2024.pdf
kyoheig3
0
110
Jakarta EE meets AI
ivargrimstad
0
630
카카오페이는 어떻게 수천만 결제를 처리할까? 우아한 결제 분산락 노하우
kakao
PRO
0
110
Featured
See All Featured
The World Runs on Bad Software
bkeepers
PRO
65
11k
Product Roadmaps are Hard
iamctodd
PRO
49
11k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
109
49k
Optimising Largest Contentful Paint
csswizardry
33
2.9k
YesSQL, Process and Tooling at Scale
rocio
169
14k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
48k
The Cost Of JavaScript in 2023
addyosmani
45
6.8k
Designing on Purpose - Digital PM Summit 2013
jponch
115
7k
Why You Should Never Use an ORM
jnunemaker
PRO
54
9.1k
The Pragmatic Product Professional
lauravandoore
31
6.3k
Art, The Web, and Tiny UX
lynnandtonic
297
20k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
131
33k
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 ͦͷଞʹ
͋Γ͕ͱ͏͍͟͝·ͨ͠