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
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
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
1.3k
Kotlin 最新動向2022 #tfcon #techfeed
ntaro
1
2.3k
#Ubie 狂気の認知施策と選考設計
ntaro
13
14k
UbieにおけるサーバサイドKotlin活用事例
ntaro
1
1.2k
KotlinでSpring 完全理解ガイド #jsug
ntaro
6
3.6k
Kotlinでサーバサイドを始めよう!
ntaro
1
1k
Androidからサーバーサイドまで!プログラミング言語 Kotlinの魅力 #devboost
ntaro
5
2.9k
Kotlin Contracts #m3kt
ntaro
4
4.3k
How_to_Test_Server-side_Kotlin.pdf
ntaro
1
540
Other Decks in Programming
See All in Programming
RubyとGoでゼロから作る証券システム: 高信頼性が求められるシステムのコードの外側にある設計と運用のリアル
free_world21
0
300
Kubernetesでセルフホストが簡単なNewSQLを求めて / Seeking a NewSQL Database That's Simple to Self-Host on Kubernetes
nnaka2992
0
120
Unity6.3 AudioUpdate
cova8bitdots
0
130
Fundamentals of Software Engineering In the Age of AI
therealdanvega
1
260
Windows on Ryzen and I
seosoft
0
300
DevinとClaude Code、SREの現場で使い倒してみた件
karia
1
1.1k
new(1.26) ← これすき / kamakura.go #8
utgwkk
0
2.3k
grapheme_strrev関数が採択されました(あと雑感)
youkidearitai
PRO
1
220
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
580
コードレビューをしない選択 #でぃーぷらすトウキョウ
kajitack
3
990
ふつうの Rubyist、ちいさなデバイス、大きな一年
bash0c7
0
970
AWS Infrastructure as Code の新機能 2025 総まとめ 〜SA 4人による怒涛のデモ祭り〜
konokenj
10
3.4k
Featured
See All Featured
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.7k
The Spectacular Lies of Maps
axbom
PRO
1
620
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.4k
From π to Pie charts
rasagy
0
150
Optimizing for Happiness
mojombo
378
71k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
287
14k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
1.8k
HU Berlin: Industrial-Strength Natural Language Processing with spaCy and Prodigy
inesmontani
PRO
0
260
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
0
450
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
49
9.9k
Statistics for Hackers
jakevdp
799
230k
Designing Powerful Visuals for Engaging Learning
tmiket
0
280
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 ͦͷଞʹ
͋Γ͕ͱ͏͍͟͝·ͨ͠