SlideShare a Scribd company logo
1 of 51
Kotlin is charming;
The reasons Java engineers
should start Kotlin.
By Kiyotaka Soranaka:空中清高
About me
Name:空中 清高(Kiyotaka Soranaka)
Work:株式会社ジャストシステム
株式会社ジャストシステム
創業38年、売上182億、平均年収900万円
Javaのプロダクト採用は1.0から。
一太郎Ark:1996年開発着手。
JUST.
SYSTEMS
いろんなwebサービスをJavaで作ってます。
などなど...
株式会社ジャストシステムJUST.
SYSTEMS
Agenda
・What is Kotlin?
・Why Kotlin?
・Kotlin VS Java
・Kotlin AND Java
What is Kotlin?
Statically typed programming language
for the JVM, Android and the browser
https://kotlinlang.org/
Google is adding Kotlin as an official
programming language for Android
development
https://android-developers.googleblog.com/2017/05/android-
announces-support-for-kotlin.html
Why Kotlin?
Concise
Safe
Versatile
Interoperable
Tooling
https://kotlinlang.org/
Concise
Safe
Versatile
Interoperable
Tooling
// Create a POJO in a single line
data class Person(val name: String, val age: Int)
// No need "new" keyword and Semicolons are optional.
val person = Person("Kiyotaka Soranaka", 29)
// String Templates
println("My name is ${person.name}.")
// > My name is Kiyotaka Soranaka.
Concise
Concise
Safe
Versatile
Interoperable
Tooling
// Null Safe: These codes cause error at compile time.
val str: String = null // compile error:String is non-null.
val nullable: String? = null // String? is nullable.
val length:Int = nullable.length // compile error:String? is nullable.
// Below codes don't cause error.
val length:Int = nullable!!.length // But this cause error at runtime if ‘nullable’ is null.
val length:Int = if (nullable != null) { nullable.length } else { 0 } // Smart-cast
val length:Int = nullable?.length ?: 0 // "?." is Safe Calls and "?:" is Elvis Operator.
Safe
Concise
Safe
Versatile
Interoperable
Tooling
Versatile
・Android Development.
・Write code in Kotlin and target JavaScript.
・Application Server.
・Spring Framework support Kotlin.
・Enterprise Java EE.
Concise
Safe
Versatile
Interoperable
Tooling
Interoperable
Kotlin is of 100% Java compatibility.
You can use any existing library on the JVM.
Concise
Safe
Versatile
Interoperable
Tooling
Tooling
IntelliJ IDEA is very powerful!
It is developed by JetBrains, where the team
that created Kotlin itself belongs.
Tooling
(Win)Alt + Enter, (Mac) ⌥Enter
Tooling
(Win)Ctrl + Alt + Shift + K
(Mac) ⌥⇧⌘K
Convert Java to Kotlin.
Kotlin VS Java
public final class Person {
public Person(String name, int age) {
this.name = name;
this.age = age;
}
private final String name;
private int age;
public String getName() { return name; }
public int getAge() { return age; }
public void setAge(int age) {
this.age = age;
}
}
Kotlin JavaKotlin VS Java
class Person(name: String, age: Int) {
val name: String = name
var age: Int = age
}
'val' and 'var' mean read-only and
mutable, respectively.
getter/setter are automatically
generated.
public final class Person {
public Person(String name, int age) {
this.name = name;
this.age = age;
}
private final String name;
private int age;
public String getName() { return name; }
public int getAge() { return age; }
public void setAge(int age) {
this.age = age;
}
}
Kotlin: Level 1 JavaKotlin VS Java
Kotlin: Level 2 JavaKotlin VS Java
class Person(val name: String,
var age: Int)
Properties are automatically generated.
public final class Person {
public Person(String name, int age) {
this.name = name;
this.age = age;
}
private final String name;
private int age;
public String getName() { return name; }
public int getAge() { return age; }
public void setAge(int age) {
this.age = age;
}
}
Kotlin: Level 3 JavaKotlin VS Java
data class Person(val name: String,
var age: Int)
Several members are automatically
generated; e.g.,
getter/setter, equals(), hashCode(),
toString(), copy(), etc..
val person = Person("Bob", 5)
println("$person")
// > Person(name=Bob, age=5)
https://kotlinlang.org/docs/reference/dat
a-classes.html
public final class Person {
public Person(String name, int age) {
this.name = name;
this.age = age;
}
private final String name;
private int age;
public String getName() { return name; }
public int getAge() { return age; }
public void setAge(int age) {
this.age = age;
}
@Override
public boolean equals(Object obj) {
...
Kotlin JavaKotlin VS Java
data class Person(val name: String = "",
var age: Int = 0)
You can use default values.
'Telescoping' is not needed.
'Telescoping' is as follows.
public Person() {
this("");
}
public Person(String name) {
this(name, 0);
}
public Person(String name, int age) {
this.name = name;
this.age = age;
}
Kotlin JavaKotlin VS Java
data class Person(var height: Int = 155,
var weight: Int = 50)
By using 'Named Arguments',
you don't have to care the order of the
arguments.
val p1 = Person(height = 170, weight = 60)
val p2= Person(weight = 60, height = 170)
val p3= Person(height = 170)
val p4= Person(weight = 60)
https://kotlinlang.org/docs/reference/fun
ctions.html
public Person() {
this(155);
}
public Person(int height) {
this(height, 50);
}
public Person(int height, int weight) {
this.height = height;// cm
this.weight = weight;// kg
}
Person p1 = new Person(170, 60);
Person p2 = new Person(60, 170);
Kotlin: Level 1 JavaKotlin VS Java
val cache = HashMap<String, Calendar>()
fun getJJUGDate(): Date {
var jjugCal = cache["JJUG"]
if (jjugCal == null) {
jjugCal = Calendar.getInstance()
jjugCal.set(2017, Calendar.MAY, 20)
cache.put("JJUG", jjugCal)
}
return jjugCal!!.time
}
Map<String, Calendar> cache = new
HashMap<>();
public Date getJJUGDate() {
Calendar jjugCal = cache.get("JJUG");
if (jjugCal == null) {
jjugCal = Calendar.getInstance();
jjugCal.set(2017, Calendar.MAY, 20);
cache.put("JJUG", jjugCal);
}
return jjugCal.getTime();
}
Kotlin: Level 1 JavaKotlin VS Java
val cache = HashMap<String, Calendar>()
fun getJJUGDate(): Date {
var jjugCal = cache["JJUG"]
if (jjugCal == null) {
jjugCal = Calendar.getInstance()
jjugCal.set(2017, Calendar.MAY, 20)
cache.put("JJUG", jjugCal)
}
return jjugCal!!.time
}
Map<String, Calendar> cache = new
HashMap<>();
public Date getJJUGDate() {
Calendar jjugCal = cache.get("JJUG");
if (jjugCal == null) {
jjugCal = Calendar.getInstance();
jjugCal.set(2017, Calendar.MAY, 20);
cache.put("JJUG", jjugCal);
}
return jjugCal.getTime();
}
This code almost the same as Java.
But you can modify more concise.
Kotlin: Level 1 JavaKotlin VS Java
val cache = HashMap<String, Calendar>()
fun getJJUGDate(): Date {
var jjugCal = cache["JJUG"]
if (jjugCal == null) {
jjugCal = Calendar.getInstance()
jjugCal.set(2017, Calendar.MAY, 20)
cache.put("JJUG", jjugCal)
}
return jjugCal!!.time
}
Map<String, Calendar> cache = new
HashMap<>();
public Date getJJUGDate() {
Calendar jjugCal = cache.get("JJUG");
if (jjugCal == null) {
jjugCal = Calendar.getInstance();
jjugCal.set(2017, Calendar.MAY, 20);
cache.put("JJUG", jjugCal);
}
return jjugCal.getTime();
}
To be more concise.
・Simplify the code to initialize the calendar.
・Change the type of "jjugCal" to read-only Calendar.
Kotlin: Level 2 JavaKotlin VS Java
val cache = HashMap<String, Calendar>()
fun getJJUGDate(): Date {
val jjugCal = cache["JJUG"] ?:
Calendar.getInstance().apply {
set(2017, Calendar.MAY, 20)
cache.put("JJUG", this)
}
return jjugCal.time
}
Map<String, Calendar> cache = new
HashMap<>();
public Date getJJUGDate() {
Calendar jjugCal = cache.get("JJUG");
if (jjugCal == null) {
jjugCal = Calendar.getInstance();
jjugCal.set(2017, Calendar.MAY, 20);
cache.put("JJUG", jjugCal);
}
return jjugCal.getTime();
}
Kotlin: Level 2 JavaKotlin VS Java
val cache = HashMap<String, Calendar>()
fun getJJUGDate(): Date {
val jjugCal = cache["JJUG"] ?:
Calendar.getInstance().apply {
set(2017, Calendar.MAY, 20)
cache.put("JJUG", this)
}
return jjugCal.time
}
Map<String, Calendar> cache = new
HashMap<>();
public Date getJJUGDate() {
Calendar jjugCal = cache.get("JJUG");
if (jjugCal == null) {
jjugCal = Calendar.getInstance();
jjugCal.set(2017, Calendar.MAY, 20);
cache.put("JJUG", jjugCal);
}
return jjugCal.getTime();
}
Use "?:"(Elvis Operator).
Use "apply"(scoping function).
Type of "jjugCal" is read-only Calendar.
Kotlin: Level 2 JavaKotlin VS Java
val cache = HashMap<String, Calendar>()
fun getJJUGDate(): Date {
val jjugCal = cache["JJUG"] ?:
Calendar.getInstance().apply {
set(2017, Calendar.MAY, 20)
cache.put("JJUG", this)
}
return jjugCal.time
}
Map<String, Calendar> cache = new
HashMap<>();
public Date getJJUGDate() {
Calendar jjugCal = cache.get("JJUG");
if (jjugCal == null) {
jjugCal = Calendar.getInstance();
jjugCal.set(2017, Calendar.MAY, 20);
cache.put("JJUG", jjugCal);
}
return jjugCal.getTime();
}
To be more concise.
・Delete local variable "jjugCal".
・Use kotlin stdlib function.
Kotlin: Level 3 JavaKotlin VS Java
val cache = HashMap<String, Calendar>()
fun getJJUGDate(): Date {
return cache.getOrPut("JJUG", {
Calendar.getInstance().apply {
set(2017, Calendar.MAY, 20)
}
}).time
}
Map<String, Calendar> cache = new
HashMap<>();
public Date getJJUGDate() {
Calendar jjugCal = cache.get("JJUG");
if (jjugCal == null) {
jjugCal = Calendar.getInstance();
jjugCal.set(2017, Calendar.MAY, 20);
cache.put("JJUG", jjugCal);
}
return jjugCal.getTime();
}
Kotlin: Level 3 JavaKotlin VS Java
val cache = HashMap<String, Calendar>()
fun getJJUGDate(): Date {
return cache.getOrPut("JJUG", {
Calendar.getInstance().apply {
set(2017, Calendar.MAY, 20)
}
}).time
}
Map<String, Calendar> cache = new
HashMap<>();
public Date getJJUGDate() {
Calendar jjugCal = cache.get("JJUG");
if (jjugCal == null) {
jjugCal = Calendar.getInstance();
jjugCal.set(2017, Calendar.MAY, 20);
cache.put("JJUG", jjugCal);
}
return jjugCal.getTime();
}
Use kotlin.stdlib function.
Delete the local variable "jjugCal".
Kotlin: Level 3 JavaKotlin VS Java
val cache = HashMap<String, Calendar>()
fun getJJUGDate(): Date {
return cache.getOrPut("JJUG", {
Calendar.getInstance().apply {
set(2017, Calendar.MAY, 20)
}
}).time
}
Map<String, Calendar> cache = new
HashMap<>();
public Date getJJUGDate() {
Calendar jjugCal = cache.get("JJUG");
if (jjugCal == null) {
jjugCal = Calendar.getInstance();
jjugCal.set(2017, Calendar.MAY, 20);
cache.put("JJUG", jjugCal);
}
return jjugCal.getTime();
}
To be more concise.
・"return" and return type is optional.
Kotlin: Level 4 JavaKotlin VS Java
val cache = HashMap<String, Calendar>()
fun getJJUGDate() =
cache .getOrPut("JJUG", {
Calendar.getInstance().apply {
set(2017, Calendar.MAY, 20)
}
}).time
Map<String, Calendar> cache = new
HashMap<>();
public Date getJJUGDate() {
Calendar jjugCal = cache.get("JJUG");
if (jjugCal == null) {
jjugCal = Calendar.getInstance();
jjugCal.set(2017, Calendar.MAY, 20);
cache.put("JJUG", jjugCal);
}
return jjugCal.getTime();
}
Kotlin: Level 4 JavaKotlin VS Java
val cache = HashMap<String, Calendar>()
fun getJJUGDate() =
cache .getOrPut("JJUG", {
Calendar.getInstance().apply {
set(2017, Calendar.MAY, 20)
}
}).time
Map<String, Calendar> cache = new
HashMap<>();
public Date getJJUGDate() {
Calendar jjugCal = cache.get("JJUG");
if (jjugCal == null) {
jjugCal = Calendar.getInstance();
jjugCal.set(2017, Calendar.MAY, 20);
cache.put("JJUG", jjugCal);
}
return jjugCal.getTime();
}
"return" is omitted.
Kotlin AND Java
Kotlin JavaKotlin AND Java
package example.kotlin
Import example.java.Person
fun example() {
val p = Person("Bob", 5)
p.age = p.age + 1
}
package example.java;
public class Person {
public Person(String name, int age) {
this.name = name;
this.age = age;
}
private final String name;
private int age;
public String getName() { return name; }
public int getAge() { return age; }
public void setAge(int age) {
this.age = age;
}
}
Kotlin JavaKotlin AND Java
You can use any existing library on JVM.
Jackson, for example,
data class Data(val id:Int = 0,
val name:String = "")
val mapper = ObjectMapper()
val data = Data(10, "Soranaka")
val json = mapper
.writeValueAsString(data)
println(json)
// > {"id":10,"name":"Soranaka"}
val data2 = mapper
.readValue(json, Data::class.java)
println(data2)
// > Data(id=10, name=Soranaka)
Kotlin JavaKotlin AND Java
data class Data(val id:Int,var name:String) Data data = new Data(10, "J");
data.setName(data.getName() + "JUG");
System.out.println(data);
// > Data(id=10, name=JJUG)
Kotlin JavaKotlin AND Java
class KotlinUtil {
val cache =
HashMap<String, Calendar>()
fun getJJUGDate() =
cache .getOrPut("JJUG", {
Calendar.getInstance().apply {
set(2017, Calendar.MAY, 20)
}
}).time
}
KotlinUtil kotlinUtil = new KotlinUtil();
Date jjugDate = kotlinUtil.getJJUGDate();
Kotlin JavaKotlin AND Java
class KotlinUtil {
val cache =
HashMap<String, Calendar>()
fun getJJUGDate() =
cache .getOrPut("JJUG", {
Calendar.getInstance().apply {
set(2017, Calendar.MAY, 20)
}
}).time
}
KotlinUtil kotlinUtil = new KotlinUtil();
Date jjugDate = kotlinUtil.getJJUGDate();
Do you want it to be singleton?
Kotlin JavaKotlin AND Java
object KotlinUtil {
val cache =
HashMap<String, Calendar>()
fun getJJUGDate() =
cache .getOrPut("JJUG", {
Calendar.getInstance().apply {
set(2017, Calendar.MAY, 20)
}
}).time
}
Date jjugDate =
KotlinUtil.INSTANCE.getJJUGDate();
Kotlin JavaKotlin AND Java
object KotlinUtil {
val cache =
HashMap<String, Calendar>()
fun getJJUGDate() =
cache .getOrPut("JJUG", {
Calendar.getInstance().apply {
set(2017, Calendar.MAY, 20)
}
}).time
}
Date jjugDate =
KotlinUtil.INSTANCE.getJJUGDate();
Do you want it to be static?
Kotlin JavaKotlin AND Java
class KotlinUtil {
companion object {
private val cache =
HashMap<String, Calendar>()
@JvmStatic
fun getJJUGDate() =
cache.getOrPut("JJUG", {
Calendar.getInstance().apply {
set(2017, Calendar.MAY, 20)
}
}).time
}
}
Date jjugDate = KotlinUtil.getJJUGDate();
株式会社ジャストシステム
Kotlinを使える仕事に興味を持った方
ぜひ、一緒に働きましょう!
JUST.
SYSTEMS
Thank you
Kiyotaka Soranaka:空中清高
@soranakk

More Related Content

What's hot

Google Guava & EMF @ GTUG Nantes
Google Guava & EMF @ GTUG NantesGoogle Guava & EMF @ GTUG Nantes
Google Guava & EMF @ GTUG Nantesmikaelbarbero
 
Event driven javascript
Event driven javascriptEvent driven javascript
Event driven javascriptFrancesca1980
 
Kotlin @ Coupang Backed - JetBrains Day seoul 2018
Kotlin @ Coupang Backed - JetBrains Day seoul 2018Kotlin @ Coupang Backed - JetBrains Day seoul 2018
Kotlin @ Coupang Backed - JetBrains Day seoul 2018Sunghyouk Bae
 
Ten useful JavaScript tips & best practices
Ten useful JavaScript tips & best practicesTen useful JavaScript tips & best practices
Ten useful JavaScript tips & best practicesAnkit Rastogi
 
Alternatives of JPA/Hibernate
Alternatives of JPA/HibernateAlternatives of JPA/Hibernate
Alternatives of JPA/HibernateSunghyouk Bae
 
Clojure for Java developers
Clojure for Java developersClojure for Java developers
Clojure for Java developersJohn Stevenson
 
Clojure, Plain and Simple
Clojure, Plain and SimpleClojure, Plain and Simple
Clojure, Plain and SimpleBen Mabey
 
Ast transformations
Ast transformationsAst transformations
Ast transformationsHamletDRC
 
AST Transformations
AST TransformationsAST Transformations
AST TransformationsHamletDRC
 
JRuby @ Boulder Ruby
JRuby @ Boulder RubyJRuby @ Boulder Ruby
JRuby @ Boulder RubyNick Sieger
 
Little Helpers for Android Development with Kotlin
Little Helpers for Android Development with KotlinLittle Helpers for Android Development with Kotlin
Little Helpers for Android Development with KotlinKai Koenig
 
JavaOne 2011 - JVM Bytecode for Dummies
JavaOne 2011 - JVM Bytecode for DummiesJavaOne 2011 - JVM Bytecode for Dummies
JavaOne 2011 - JVM Bytecode for DummiesCharles Nutter
 
Oscon Java Testing on the Fast Lane
Oscon Java Testing on the Fast LaneOscon Java Testing on the Fast Lane
Oscon Java Testing on the Fast LaneAndres Almiray
 
JJUG CCC 2011 Spring
JJUG CCC 2011 SpringJJUG CCC 2011 Spring
JJUG CCC 2011 SpringKiyotaka Oku
 
Kotlin 101 for Java Developers
Kotlin 101 for Java DevelopersKotlin 101 for Java Developers
Kotlin 101 for Java DevelopersChristoph Pickl
 
Using Reflections and Automatic Code Generation
Using Reflections and Automatic Code GenerationUsing Reflections and Automatic Code Generation
Using Reflections and Automatic Code GenerationIvan Dolgushin
 
Kotlin: Why Do You Care?
Kotlin: Why Do You Care?Kotlin: Why Do You Care?
Kotlin: Why Do You Care?intelliyole
 

What's hot (20)

Google Guava & EMF @ GTUG Nantes
Google Guava & EMF @ GTUG NantesGoogle Guava & EMF @ GTUG Nantes
Google Guava & EMF @ GTUG Nantes
 
Event driven javascript
Event driven javascriptEvent driven javascript
Event driven javascript
 
Kotlin @ Coupang Backed - JetBrains Day seoul 2018
Kotlin @ Coupang Backed - JetBrains Day seoul 2018Kotlin @ Coupang Backed - JetBrains Day seoul 2018
Kotlin @ Coupang Backed - JetBrains Day seoul 2018
 
Ten useful JavaScript tips & best practices
Ten useful JavaScript tips & best practicesTen useful JavaScript tips & best practices
Ten useful JavaScript tips & best practices
 
Requery overview
Requery overviewRequery overview
Requery overview
 
Alternatives of JPA/Hibernate
Alternatives of JPA/HibernateAlternatives of JPA/Hibernate
Alternatives of JPA/Hibernate
 
Clojure for Java developers
Clojure for Java developersClojure for Java developers
Clojure for Java developers
 
Clojure, Plain and Simple
Clojure, Plain and SimpleClojure, Plain and Simple
Clojure, Plain and Simple
 
Ast transformations
Ast transformationsAst transformations
Ast transformations
 
AST Transformations
AST TransformationsAST Transformations
AST Transformations
 
JRuby @ Boulder Ruby
JRuby @ Boulder RubyJRuby @ Boulder Ruby
JRuby @ Boulder Ruby
 
Little Helpers for Android Development with Kotlin
Little Helpers for Android Development with KotlinLittle Helpers for Android Development with Kotlin
Little Helpers for Android Development with Kotlin
 
JavaOne 2011 - JVM Bytecode for Dummies
JavaOne 2011 - JVM Bytecode for DummiesJavaOne 2011 - JVM Bytecode for Dummies
JavaOne 2011 - JVM Bytecode for Dummies
 
Spring data requery
Spring data requerySpring data requery
Spring data requery
 
Oscon Java Testing on the Fast Lane
Oscon Java Testing on the Fast LaneOscon Java Testing on the Fast Lane
Oscon Java Testing on the Fast Lane
 
JJUG CCC 2011 Spring
JJUG CCC 2011 SpringJJUG CCC 2011 Spring
JJUG CCC 2011 Spring
 
Kotlin meets Gadsu
Kotlin meets GadsuKotlin meets Gadsu
Kotlin meets Gadsu
 
Kotlin 101 for Java Developers
Kotlin 101 for Java DevelopersKotlin 101 for Java Developers
Kotlin 101 for Java Developers
 
Using Reflections and Automatic Code Generation
Using Reflections and Automatic Code GenerationUsing Reflections and Automatic Code Generation
Using Reflections and Automatic Code Generation
 
Kotlin: Why Do You Care?
Kotlin: Why Do You Care?Kotlin: Why Do You Care?
Kotlin: Why Do You Care?
 

Viewers also liked

2017spring jjug ccc_f2
2017spring jjug ccc_f22017spring jjug ccc_f2
2017spring jjug ccc_f2Kazuhiro Wada
 
VMの歩む道。 Dalvik、ART、そしてJava VM
VMの歩む道。 Dalvik、ART、そしてJava VMVMの歩む道。 Dalvik、ART、そしてJava VM
VMの歩む道。 Dalvik、ART、そしてJava VMyy yank
 
U-NEXT学生インターン、過激なJavaの学び方と過激な要求
U-NEXT学生インターン、過激なJavaの学び方と過激な要求U-NEXT学生インターン、過激なJavaの学び方と過激な要求
U-NEXT学生インターン、過激なJavaの学び方と過激な要求hajime funaki
 
Arachne Unweaved (JP)
Arachne Unweaved (JP)Arachne Unweaved (JP)
Arachne Unweaved (JP)Ikuru Kanuma
 
Jjugccc2017spring-postgres-ccc_m1
Jjugccc2017spring-postgres-ccc_m1Jjugccc2017spring-postgres-ccc_m1
Jjugccc2017spring-postgres-ccc_m1Kosuke Kida
 
SpotBugs(FindBugs)による 大規模ERPのコード品質改善
SpotBugs(FindBugs)による 大規模ERPのコード品質改善SpotBugs(FindBugs)による 大規模ERPのコード品質改善
SpotBugs(FindBugs)による 大規模ERPのコード品質改善Works Applications
 
Polyglot on the JVM with Graal (English)
Polyglot on the JVM with Graal (English)Polyglot on the JVM with Graal (English)
Polyglot on the JVM with Graal (English)Logico
 
新卒2年目から始めるOSSのススメ~明日からできるコミットデビュー~
新卒2年目から始めるOSSのススメ~明日からできるコミットデビュー~新卒2年目から始めるOSSのススメ~明日からできるコミットデビュー~
新卒2年目から始めるOSSのススメ~明日からできるコミットデビュー~Yoshio Kajikuri
 
Javaチョットデキルへの道〜JavaコアSDKに見る真似したいコード10選〜
Javaチョットデキルへの道〜JavaコアSDKに見る真似したいコード10選〜Javaチョットデキルへの道〜JavaコアSDKに見る真似したいコード10選〜
Javaチョットデキルへの道〜JavaコアSDKに見る真似したいコード10選〜JustSystems Corporation
 
Java8 コーディングベストプラクティス and NetBeansのメモリログから...
Java8 コーディングベストプラクティス and NetBeansのメモリログから...Java8 コーディングベストプラクティス and NetBeansのメモリログから...
Java8 コーディングベストプラクティス and NetBeansのメモリログから...なおき きしだ
 
JJUG CCC 2017 Spring Seasar2からSpringへ移行した俺たちのアプリケーションがマイクロサービスアーキテクチャへ歩み始めた
JJUG CCC 2017 Spring Seasar2からSpringへ移行した俺たちのアプリケーションがマイクロサービスアーキテクチャへ歩み始めたJJUG CCC 2017 Spring Seasar2からSpringへ移行した俺たちのアプリケーションがマイクロサービスアーキテクチャへ歩み始めた
JJUG CCC 2017 Spring Seasar2からSpringへ移行した俺たちのアプリケーションがマイクロサービスアーキテクチャへ歩み始めたKoichi Sakata
 
データ履歴管理のためのテンポラルデータモデルとReladomoの紹介 #jjug_ccc #ccc_g3
データ履歴管理のためのテンポラルデータモデルとReladomoの紹介 #jjug_ccc #ccc_g3 データ履歴管理のためのテンポラルデータモデルとReladomoの紹介 #jjug_ccc #ccc_g3
データ履歴管理のためのテンポラルデータモデルとReladomoの紹介 #jjug_ccc #ccc_g3 Hiroshi Ito
 
Java8移行は怖くない~エンタープライズ案件でのJava8移行事例~
Java8移行は怖くない~エンタープライズ案件でのJava8移行事例~Java8移行は怖くない~エンタープライズ案件でのJava8移行事例~
Java8移行は怖くない~エンタープライズ案件でのJava8移行事例~Hiroyuki Ohnaka
 
Introduction of Project Jigsaw
Introduction of Project JigsawIntroduction of Project Jigsaw
Introduction of Project JigsawYuichi Sakuraba
 
グラフデータベース入門
グラフデータベース入門グラフデータベース入門
グラフデータベース入門Masaya Dake
 
思ったほど怖くない! Haskell on JVM 超入門 #jjug_ccc #ccc_l8
思ったほど怖くない! Haskell on JVM 超入門 #jjug_ccc #ccc_l8思ったほど怖くない! Haskell on JVM 超入門 #jjug_ccc #ccc_l8
思ったほど怖くない! Haskell on JVM 超入門 #jjug_ccc #ccc_l8y_taka_23
 
ヤフーの広告レポートシステムをSpring Cloud Stream化するまで #jjug_ccc #ccc_a4
ヤフーの広告レポートシステムをSpring Cloud Stream化するまで #jjug_ccc #ccc_a4ヤフーの広告レポートシステムをSpring Cloud Stream化するまで #jjug_ccc #ccc_a4
ヤフーの広告レポートシステムをSpring Cloud Stream化するまで #jjug_ccc #ccc_a4Yahoo!デベロッパーネットワーク
 

Viewers also liked (20)

2017spring jjug ccc_f2
2017spring jjug ccc_f22017spring jjug ccc_f2
2017spring jjug ccc_f2
 
Jjug ccc
Jjug cccJjug ccc
Jjug ccc
 
VMの歩む道。 Dalvik、ART、そしてJava VM
VMの歩む道。 Dalvik、ART、そしてJava VMVMの歩む道。 Dalvik、ART、そしてJava VM
VMの歩む道。 Dalvik、ART、そしてJava VM
 
U-NEXT学生インターン、過激なJavaの学び方と過激な要求
U-NEXT学生インターン、過激なJavaの学び方と過激な要求U-NEXT学生インターン、過激なJavaの学び方と過激な要求
U-NEXT学生インターン、過激なJavaの学び方と過激な要求
 
Arachne Unweaved (JP)
Arachne Unweaved (JP)Arachne Unweaved (JP)
Arachne Unweaved (JP)
 
Jjugccc2017spring-postgres-ccc_m1
Jjugccc2017spring-postgres-ccc_m1Jjugccc2017spring-postgres-ccc_m1
Jjugccc2017spring-postgres-ccc_m1
 
SpotBugs(FindBugs)による 大規模ERPのコード品質改善
SpotBugs(FindBugs)による 大規模ERPのコード品質改善SpotBugs(FindBugs)による 大規模ERPのコード品質改善
SpotBugs(FindBugs)による 大規模ERPのコード品質改善
 
Polyglot on the JVM with Graal (English)
Polyglot on the JVM with Graal (English)Polyglot on the JVM with Graal (English)
Polyglot on the JVM with Graal (English)
 
Java Clientで入門する Apache Kafka #jjug_ccc #ccc_e2
Java Clientで入門する Apache Kafka #jjug_ccc #ccc_e2Java Clientで入門する Apache Kafka #jjug_ccc #ccc_e2
Java Clientで入門する Apache Kafka #jjug_ccc #ccc_e2
 
新卒2年目から始めるOSSのススメ~明日からできるコミットデビュー~
新卒2年目から始めるOSSのススメ~明日からできるコミットデビュー~新卒2年目から始めるOSSのススメ~明日からできるコミットデビュー~
新卒2年目から始めるOSSのススメ~明日からできるコミットデビュー~
 
Javaチョットデキルへの道〜JavaコアSDKに見る真似したいコード10選〜
Javaチョットデキルへの道〜JavaコアSDKに見る真似したいコード10選〜Javaチョットデキルへの道〜JavaコアSDKに見る真似したいコード10選〜
Javaチョットデキルへの道〜JavaコアSDKに見る真似したいコード10選〜
 
Java8 コーディングベストプラクティス and NetBeansのメモリログから...
Java8 コーディングベストプラクティス and NetBeansのメモリログから...Java8 コーディングベストプラクティス and NetBeansのメモリログから...
Java8 コーディングベストプラクティス and NetBeansのメモリログから...
 
日本Javaグループ2017年定期総会 #jjug
日本Javaグループ2017年定期総会 #jjug 日本Javaグループ2017年定期総会 #jjug
日本Javaグループ2017年定期総会 #jjug
 
JJUG CCC 2017 Spring Seasar2からSpringへ移行した俺たちのアプリケーションがマイクロサービスアーキテクチャへ歩み始めた
JJUG CCC 2017 Spring Seasar2からSpringへ移行した俺たちのアプリケーションがマイクロサービスアーキテクチャへ歩み始めたJJUG CCC 2017 Spring Seasar2からSpringへ移行した俺たちのアプリケーションがマイクロサービスアーキテクチャへ歩み始めた
JJUG CCC 2017 Spring Seasar2からSpringへ移行した俺たちのアプリケーションがマイクロサービスアーキテクチャへ歩み始めた
 
データ履歴管理のためのテンポラルデータモデルとReladomoの紹介 #jjug_ccc #ccc_g3
データ履歴管理のためのテンポラルデータモデルとReladomoの紹介 #jjug_ccc #ccc_g3 データ履歴管理のためのテンポラルデータモデルとReladomoの紹介 #jjug_ccc #ccc_g3
データ履歴管理のためのテンポラルデータモデルとReladomoの紹介 #jjug_ccc #ccc_g3
 
Java8移行は怖くない~エンタープライズ案件でのJava8移行事例~
Java8移行は怖くない~エンタープライズ案件でのJava8移行事例~Java8移行は怖くない~エンタープライズ案件でのJava8移行事例~
Java8移行は怖くない~エンタープライズ案件でのJava8移行事例~
 
Introduction of Project Jigsaw
Introduction of Project JigsawIntroduction of Project Jigsaw
Introduction of Project Jigsaw
 
グラフデータベース入門
グラフデータベース入門グラフデータベース入門
グラフデータベース入門
 
思ったほど怖くない! Haskell on JVM 超入門 #jjug_ccc #ccc_l8
思ったほど怖くない! Haskell on JVM 超入門 #jjug_ccc #ccc_l8思ったほど怖くない! Haskell on JVM 超入門 #jjug_ccc #ccc_l8
思ったほど怖くない! Haskell on JVM 超入門 #jjug_ccc #ccc_l8
 
ヤフーの広告レポートシステムをSpring Cloud Stream化するまで #jjug_ccc #ccc_a4
ヤフーの広告レポートシステムをSpring Cloud Stream化するまで #jjug_ccc #ccc_a4ヤフーの広告レポートシステムをSpring Cloud Stream化するまで #jjug_ccc #ccc_a4
ヤフーの広告レポートシステムをSpring Cloud Stream化するまで #jjug_ccc #ccc_a4
 

Similar to Kotlin is charming; The reasons Java engineers should start Kotlin.

Kotlin for Android Developers - Victor Kropp - Codemotion Rome 2018
Kotlin for Android Developers - Victor Kropp - Codemotion Rome 2018Kotlin for Android Developers - Victor Kropp - Codemotion Rome 2018
Kotlin for Android Developers - Victor Kropp - Codemotion Rome 2018Codemotion
 
Greach, GroovyFx Workshop
Greach, GroovyFx WorkshopGreach, GroovyFx Workshop
Greach, GroovyFx WorkshopDierk König
 
Develop your next app with kotlin @ AndroidMakersFr 2017
Develop your next app with kotlin @ AndroidMakersFr 2017Develop your next app with kotlin @ AndroidMakersFr 2017
Develop your next app with kotlin @ AndroidMakersFr 2017Arnaud Giuliani
 
Be More Productive with Kotlin
Be More Productive with KotlinBe More Productive with Kotlin
Be More Productive with KotlinBrandon Wever
 
Having Fun with Kotlin Android - DILo Surabaya
Having Fun with Kotlin Android - DILo SurabayaHaving Fun with Kotlin Android - DILo Surabaya
Having Fun with Kotlin Android - DILo SurabayaDILo Surabaya
 
The Future of JVM Languages
The Future of JVM Languages The Future of JVM Languages
The Future of JVM Languages VictorSzoltysek
 
4Developers: Michał Szczepanik- Kotlin - Let’s ketchup it
4Developers: Michał Szczepanik- Kotlin - Let’s ketchup it4Developers: Michał Szczepanik- Kotlin - Let’s ketchup it
4Developers: Michał Szczepanik- Kotlin - Let’s ketchup itPROIDEA
 
Kotlin – the future of android
Kotlin – the future of androidKotlin – the future of android
Kotlin – the future of androidDJ Rausch
 
Beautiful java script
Beautiful java scriptBeautiful java script
Beautiful java scriptÜrgo Ringo
 
An Introduction to Property Based Testing
An Introduction to Property Based TestingAn Introduction to Property Based Testing
An Introduction to Property Based TestingC4Media
 
Privet Kotlin (Windy City DevFest)
Privet Kotlin (Windy City DevFest)Privet Kotlin (Windy City DevFest)
Privet Kotlin (Windy City DevFest)Cody Engel
 
Introduction to Kotlin
Introduction to KotlinIntroduction to Kotlin
Introduction to KotlinShine Joseph
 
droidcon Transylvania - Kotlin Coroutines
droidcon Transylvania - Kotlin Coroutinesdroidcon Transylvania - Kotlin Coroutines
droidcon Transylvania - Kotlin CoroutinesArthur Nagy
 
Riga DevDays 2017 - The hitchhiker’s guide to Java class reloading
Riga DevDays 2017 - The hitchhiker’s guide to Java class reloadingRiga DevDays 2017 - The hitchhiker’s guide to Java class reloading
Riga DevDays 2017 - The hitchhiker’s guide to Java class reloadingAnton Arhipov
 

Similar to Kotlin is charming; The reasons Java engineers should start Kotlin. (20)

Kotlin for Android Developers - Victor Kropp - Codemotion Rome 2018
Kotlin for Android Developers - Victor Kropp - Codemotion Rome 2018Kotlin for Android Developers - Victor Kropp - Codemotion Rome 2018
Kotlin for Android Developers - Victor Kropp - Codemotion Rome 2018
 
Kotlin Generation
Kotlin GenerationKotlin Generation
Kotlin Generation
 
Greach, GroovyFx Workshop
Greach, GroovyFx WorkshopGreach, GroovyFx Workshop
Greach, GroovyFx Workshop
 
Develop your next app with kotlin @ AndroidMakersFr 2017
Develop your next app with kotlin @ AndroidMakersFr 2017Develop your next app with kotlin @ AndroidMakersFr 2017
Develop your next app with kotlin @ AndroidMakersFr 2017
 
Be More Productive with Kotlin
Be More Productive with KotlinBe More Productive with Kotlin
Be More Productive with Kotlin
 
Having Fun with Kotlin Android - DILo Surabaya
Having Fun with Kotlin Android - DILo SurabayaHaving Fun with Kotlin Android - DILo Surabaya
Having Fun with Kotlin Android - DILo Surabaya
 
Treinamento Qt básico - aula II
Treinamento Qt básico - aula IITreinamento Qt básico - aula II
Treinamento Qt básico - aula II
 
Kotlin on android
Kotlin on androidKotlin on android
Kotlin on android
 
Exploring Kotlin
Exploring KotlinExploring Kotlin
Exploring Kotlin
 
The Future of JVM Languages
The Future of JVM Languages The Future of JVM Languages
The Future of JVM Languages
 
4Developers: Michał Szczepanik- Kotlin - Let’s ketchup it
4Developers: Michał Szczepanik- Kotlin - Let’s ketchup it4Developers: Michał Szczepanik- Kotlin - Let’s ketchup it
4Developers: Michał Szczepanik- Kotlin - Let’s ketchup it
 
Kotlin – the future of android
Kotlin – the future of androidKotlin – the future of android
Kotlin – the future of android
 
Beautiful java script
Beautiful java scriptBeautiful java script
Beautiful java script
 
An Introduction to Property Based Testing
An Introduction to Property Based TestingAn Introduction to Property Based Testing
An Introduction to Property Based Testing
 
Introduction kot iin
Introduction kot iinIntroduction kot iin
Introduction kot iin
 
Privet Kotlin (Windy City DevFest)
Privet Kotlin (Windy City DevFest)Privet Kotlin (Windy City DevFest)
Privet Kotlin (Windy City DevFest)
 
Kotlin wonderland
Kotlin wonderlandKotlin wonderland
Kotlin wonderland
 
Introduction to Kotlin
Introduction to KotlinIntroduction to Kotlin
Introduction to Kotlin
 
droidcon Transylvania - Kotlin Coroutines
droidcon Transylvania - Kotlin Coroutinesdroidcon Transylvania - Kotlin Coroutines
droidcon Transylvania - Kotlin Coroutines
 
Riga DevDays 2017 - The hitchhiker’s guide to Java class reloading
Riga DevDays 2017 - The hitchhiker’s guide to Java class reloadingRiga DevDays 2017 - The hitchhiker’s guide to Java class reloading
Riga DevDays 2017 - The hitchhiker’s guide to Java class reloading
 

More from JustSystems Corporation

Spring Boot の Web アプリケーションを Docker に載せて AWS ECS で動かしている話
Spring Boot の Web アプリケーションを Docker に載せて AWS ECS で動かしている話Spring Boot の Web アプリケーションを Docker に載せて AWS ECS で動かしている話
Spring Boot の Web アプリケーションを Docker に載せて AWS ECS で動かしている話JustSystems Corporation
 
「技術内閣制度」〜2年間やってきて得られた事とこれから〜 #devsumi
「技術内閣制度」〜2年間やってきて得られた事とこれから〜 #devsumi「技術内閣制度」〜2年間やってきて得られた事とこれから〜 #devsumi
「技術内閣制度」〜2年間やってきて得られた事とこれから〜 #devsumiJustSystems Corporation
 
事業に貢献する商品開発と その成長の仕組み作り ~これからのエンジニアに必要とされるスキルとは~
事業に貢献する商品開発と その成長の仕組み作り ~これからのエンジニアに必要とされるスキルとは~事業に貢献する商品開発と その成長の仕組み作り ~これからのエンジニアに必要とされるスキルとは~
事業に貢献する商品開発と その成長の仕組み作り ~これからのエンジニアに必要とされるスキルとは~JustSystems Corporation
 
現役23名のPM:タイプ別マネジメントパターン
現役23名のPM:タイプ別マネジメントパターン現役23名のPM:タイプ別マネジメントパターン
現役23名のPM:タイプ別マネジメントパターンJustSystems Corporation
 
JavaでインメモリSQLエンジンを作ってみた
JavaでインメモリSQLエンジンを作ってみたJavaでインメモリSQLエンジンを作ってみた
JavaでインメモリSQLエンジンを作ってみたJustSystems Corporation
 
DDDとクリーンアーキテクチャでサーバーアプリケーションを作っている話
DDDとクリーンアーキテクチャでサーバーアプリケーションを作っている話DDDとクリーンアーキテクチャでサーバーアプリケーションを作っている話
DDDとクリーンアーキテクチャでサーバーアプリケーションを作っている話JustSystems Corporation
 
JustTechTalk#11_スマイルゼミ顧客満足度への貢献
JustTechTalk#11_スマイルゼミ顧客満足度への貢献JustTechTalk#11_スマイルゼミ顧客満足度への貢献
JustTechTalk#11_スマイルゼミ顧客満足度への貢献JustSystems Corporation
 
ピュアJavaだと思った?残念androidでした~いつからAndroidをJavaだと錯覚していた?~
ピュアJavaだと思った?残念androidでした~いつからAndroidをJavaだと錯覚していた?~ピュアJavaだと思った?残念androidでした~いつからAndroidをJavaだと錯覚していた?~
ピュアJavaだと思った?残念androidでした~いつからAndroidをJavaだと錯覚していた?~JustSystems Corporation
 
最新のJava言語仕様で見るモジュールシステム #jjug
最新のJava言語仕様で見るモジュールシステム #jjug最新のJava言語仕様で見るモジュールシステム #jjug
最新のJava言語仕様で見るモジュールシステム #jjugJustSystems Corporation
 
「書ける」から「できる」になれる! ~Javaメモリ節約ノウハウ話~
「書ける」から「できる」になれる! ~Javaメモリ節約ノウハウ話~「書ける」から「できる」になれる! ~Javaメモリ節約ノウハウ話~
「書ける」から「できる」になれる! ~Javaメモリ節約ノウハウ話~JustSystems Corporation
 
JustTechTalk#10 React開発における自動テスト実践
JustTechTalk#10 React開発における自動テスト実践JustTechTalk#10 React開発における自動テスト実践
JustTechTalk#10 React開発における自動テスト実践JustSystems Corporation
 
JustTechTalk#10windowsアプリでのテスト自動化事例
JustTechTalk#10windowsアプリでのテスト自動化事例JustTechTalk#10windowsアプリでのテスト自動化事例
JustTechTalk#10windowsアプリでのテスト自動化事例JustSystems Corporation
 
インパス! あのこれダメッス! ~Javaコードレビューの指摘ポイント10選~
インパス! あのこれダメッス! ~Javaコードレビューの指摘ポイント10選~インパス! あのこれダメッス! ~Javaコードレビューの指摘ポイント10選~
インパス! あのこれダメッス! ~Javaコードレビューの指摘ポイント10選~JustSystems Corporation
 
AWS運用における最適パターンの徹底活用
AWS運用における最適パターンの徹底活用AWS運用における最適パターンの徹底活用
AWS運用における最適パターンの徹底活用JustSystems Corporation
 
ジャストシステムのDevOps実例 今後の取り組み
ジャストシステムのDevOps実例 今後の取り組みジャストシステムのDevOps実例 今後の取り組み
ジャストシステムのDevOps実例 今後の取り組みJustSystems Corporation
 
CSSレイアウトでなぜ失敗するか?
CSSレイアウトでなぜ失敗するか?CSSレイアウトでなぜ失敗するか?
CSSレイアウトでなぜ失敗するか?JustSystems Corporation
 
Selenium WebDriver + python で E2Eテスト自動化
Selenium WebDriver + python で E2Eテスト自動化Selenium WebDriver + python で E2Eテスト自動化
Selenium WebDriver + python で E2Eテスト自動化JustSystems Corporation
 
TypeScriptの大規模開発への適用
TypeScriptの大規模開発への適用TypeScriptの大規模開発への適用
TypeScriptの大規模開発への適用JustSystems Corporation
 
UX実現に向けた社内の取り組みについて-訴求ファーストによる商品開発-
UX実現に向けた社内の取り組みについて-訴求ファーストによる商品開発-UX実現に向けた社内の取り組みについて-訴求ファーストによる商品開発-
UX実現に向けた社内の取り組みについて-訴求ファーストによる商品開発-JustSystems Corporation
 
「訴求ファースト」と「こだわり駆動開発」~教育、医療、もの書き市場で戦うプロダクトマネージャーの考え方~
「訴求ファースト」と「こだわり駆動開発」~教育、医療、もの書き市場で戦うプロダクトマネージャーの考え方~「訴求ファースト」と「こだわり駆動開発」~教育、医療、もの書き市場で戦うプロダクトマネージャーの考え方~
「訴求ファースト」と「こだわり駆動開発」~教育、医療、もの書き市場で戦うプロダクトマネージャーの考え方~JustSystems Corporation
 

More from JustSystems Corporation (20)

Spring Boot の Web アプリケーションを Docker に載せて AWS ECS で動かしている話
Spring Boot の Web アプリケーションを Docker に載せて AWS ECS で動かしている話Spring Boot の Web アプリケーションを Docker に載せて AWS ECS で動かしている話
Spring Boot の Web アプリケーションを Docker に載せて AWS ECS で動かしている話
 
「技術内閣制度」〜2年間やってきて得られた事とこれから〜 #devsumi
「技術内閣制度」〜2年間やってきて得られた事とこれから〜 #devsumi「技術内閣制度」〜2年間やってきて得られた事とこれから〜 #devsumi
「技術内閣制度」〜2年間やってきて得られた事とこれから〜 #devsumi
 
事業に貢献する商品開発と その成長の仕組み作り ~これからのエンジニアに必要とされるスキルとは~
事業に貢献する商品開発と その成長の仕組み作り ~これからのエンジニアに必要とされるスキルとは~事業に貢献する商品開発と その成長の仕組み作り ~これからのエンジニアに必要とされるスキルとは~
事業に貢献する商品開発と その成長の仕組み作り ~これからのエンジニアに必要とされるスキルとは~
 
現役23名のPM:タイプ別マネジメントパターン
現役23名のPM:タイプ別マネジメントパターン現役23名のPM:タイプ別マネジメントパターン
現役23名のPM:タイプ別マネジメントパターン
 
JavaでインメモリSQLエンジンを作ってみた
JavaでインメモリSQLエンジンを作ってみたJavaでインメモリSQLエンジンを作ってみた
JavaでインメモリSQLエンジンを作ってみた
 
DDDとクリーンアーキテクチャでサーバーアプリケーションを作っている話
DDDとクリーンアーキテクチャでサーバーアプリケーションを作っている話DDDとクリーンアーキテクチャでサーバーアプリケーションを作っている話
DDDとクリーンアーキテクチャでサーバーアプリケーションを作っている話
 
JustTechTalk#11_スマイルゼミ顧客満足度への貢献
JustTechTalk#11_スマイルゼミ顧客満足度への貢献JustTechTalk#11_スマイルゼミ顧客満足度への貢献
JustTechTalk#11_スマイルゼミ顧客満足度への貢献
 
ピュアJavaだと思った?残念androidでした~いつからAndroidをJavaだと錯覚していた?~
ピュアJavaだと思った?残念androidでした~いつからAndroidをJavaだと錯覚していた?~ピュアJavaだと思った?残念androidでした~いつからAndroidをJavaだと錯覚していた?~
ピュアJavaだと思った?残念androidでした~いつからAndroidをJavaだと錯覚していた?~
 
最新のJava言語仕様で見るモジュールシステム #jjug
最新のJava言語仕様で見るモジュールシステム #jjug最新のJava言語仕様で見るモジュールシステム #jjug
最新のJava言語仕様で見るモジュールシステム #jjug
 
「書ける」から「できる」になれる! ~Javaメモリ節約ノウハウ話~
「書ける」から「できる」になれる! ~Javaメモリ節約ノウハウ話~「書ける」から「できる」になれる! ~Javaメモリ節約ノウハウ話~
「書ける」から「できる」になれる! ~Javaメモリ節約ノウハウ話~
 
JustTechTalk#10 React開発における自動テスト実践
JustTechTalk#10 React開発における自動テスト実践JustTechTalk#10 React開発における自動テスト実践
JustTechTalk#10 React開発における自動テスト実践
 
JustTechTalk#10windowsアプリでのテスト自動化事例
JustTechTalk#10windowsアプリでのテスト自動化事例JustTechTalk#10windowsアプリでのテスト自動化事例
JustTechTalk#10windowsアプリでのテスト自動化事例
 
インパス! あのこれダメッス! ~Javaコードレビューの指摘ポイント10選~
インパス! あのこれダメッス! ~Javaコードレビューの指摘ポイント10選~インパス! あのこれダメッス! ~Javaコードレビューの指摘ポイント10選~
インパス! あのこれダメッス! ~Javaコードレビューの指摘ポイント10選~
 
AWS運用における最適パターンの徹底活用
AWS運用における最適パターンの徹底活用AWS運用における最適パターンの徹底活用
AWS運用における最適パターンの徹底活用
 
ジャストシステムのDevOps実例 今後の取り組み
ジャストシステムのDevOps実例 今後の取り組みジャストシステムのDevOps実例 今後の取り組み
ジャストシステムのDevOps実例 今後の取り組み
 
CSSレイアウトでなぜ失敗するか?
CSSレイアウトでなぜ失敗するか?CSSレイアウトでなぜ失敗するか?
CSSレイアウトでなぜ失敗するか?
 
Selenium WebDriver + python で E2Eテスト自動化
Selenium WebDriver + python で E2Eテスト自動化Selenium WebDriver + python で E2Eテスト自動化
Selenium WebDriver + python で E2Eテスト自動化
 
TypeScriptの大規模開発への適用
TypeScriptの大規模開発への適用TypeScriptの大規模開発への適用
TypeScriptの大規模開発への適用
 
UX実現に向けた社内の取り組みについて-訴求ファーストによる商品開発-
UX実現に向けた社内の取り組みについて-訴求ファーストによる商品開発-UX実現に向けた社内の取り組みについて-訴求ファーストによる商品開発-
UX実現に向けた社内の取り組みについて-訴求ファーストによる商品開発-
 
「訴求ファースト」と「こだわり駆動開発」~教育、医療、もの書き市場で戦うプロダクトマネージャーの考え方~
「訴求ファースト」と「こだわり駆動開発」~教育、医療、もの書き市場で戦うプロダクトマネージャーの考え方~「訴求ファースト」と「こだわり駆動開発」~教育、医療、もの書き市場で戦うプロダクトマネージャーの考え方~
「訴求ファースト」と「こだわり駆動開発」~教育、医療、もの書き市場で戦うプロダクトマネージャーの考え方~
 

Recently uploaded

Katarzyna Lipka-Sidor - BIM School Course
Katarzyna Lipka-Sidor - BIM School CourseKatarzyna Lipka-Sidor - BIM School Course
Katarzyna Lipka-Sidor - BIM School Coursebim.edu.pl
 
『澳洲文凭』买麦考瑞大学毕业证书成绩单办理澳洲Macquarie文凭学位证书
『澳洲文凭』买麦考瑞大学毕业证书成绩单办理澳洲Macquarie文凭学位证书『澳洲文凭』买麦考瑞大学毕业证书成绩单办理澳洲Macquarie文凭学位证书
『澳洲文凭』买麦考瑞大学毕业证书成绩单办理澳洲Macquarie文凭学位证书rnrncn29
 
Main Memory Management in Operating System
Main Memory Management in Operating SystemMain Memory Management in Operating System
Main Memory Management in Operating SystemRashmi Bhat
 
Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...
Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...
Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...Erbil Polytechnic University
 
Robotics-Asimov's Laws, Mechanical Subsystems, Robot Kinematics, Robot Dynami...
Robotics-Asimov's Laws, Mechanical Subsystems, Robot Kinematics, Robot Dynami...Robotics-Asimov's Laws, Mechanical Subsystems, Robot Kinematics, Robot Dynami...
Robotics-Asimov's Laws, Mechanical Subsystems, Robot Kinematics, Robot Dynami...Sumanth A
 
Comprehensive energy systems.pdf Comprehensive energy systems.pdf
Comprehensive energy systems.pdf Comprehensive energy systems.pdfComprehensive energy systems.pdf Comprehensive energy systems.pdf
Comprehensive energy systems.pdf Comprehensive energy systems.pdfalene1
 
multiple access in wireless communication
multiple access in wireless communicationmultiple access in wireless communication
multiple access in wireless communicationpanditadesh123
 
Engineering Drawing section of solid
Engineering Drawing     section of solidEngineering Drawing     section of solid
Engineering Drawing section of solidnamansinghjarodiya
 
"Exploring the Essential Functions and Design Considerations of Spillways in ...
"Exploring the Essential Functions and Design Considerations of Spillways in ..."Exploring the Essential Functions and Design Considerations of Spillways in ...
"Exploring the Essential Functions and Design Considerations of Spillways in ...Erbil Polytechnic University
 
Ch10-Global Supply Chain - Cadena de Suministro.pdf
Ch10-Global Supply Chain - Cadena de Suministro.pdfCh10-Global Supply Chain - Cadena de Suministro.pdf
Ch10-Global Supply Chain - Cadena de Suministro.pdfChristianCDAM
 
2022 AWS DNA Hackathon 장애 대응 솔루션 jarvis.
2022 AWS DNA Hackathon 장애 대응 솔루션 jarvis.2022 AWS DNA Hackathon 장애 대응 솔루션 jarvis.
2022 AWS DNA Hackathon 장애 대응 솔루션 jarvis.elesangwon
 
DEVICE DRIVERS AND INTERRUPTS SERVICE MECHANISM.pdf
DEVICE DRIVERS AND INTERRUPTS  SERVICE MECHANISM.pdfDEVICE DRIVERS AND INTERRUPTS  SERVICE MECHANISM.pdf
DEVICE DRIVERS AND INTERRUPTS SERVICE MECHANISM.pdfAkritiPradhan2
 
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor CatchersTechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catcherssdickerson1
 
Stork Webinar | APM Transformational planning, Tool Selection & Performance T...
Stork Webinar | APM Transformational planning, Tool Selection & Performance T...Stork Webinar | APM Transformational planning, Tool Selection & Performance T...
Stork Webinar | APM Transformational planning, Tool Selection & Performance T...Stork
 
Cost estimation approach: FP to COCOMO scenario based question
Cost estimation approach: FP to COCOMO scenario based questionCost estimation approach: FP to COCOMO scenario based question
Cost estimation approach: FP to COCOMO scenario based questionSneha Padhiar
 
High Voltage Engineering- OVER VOLTAGES IN ELECTRICAL POWER SYSTEMS
High Voltage Engineering- OVER VOLTAGES IN ELECTRICAL POWER SYSTEMSHigh Voltage Engineering- OVER VOLTAGES IN ELECTRICAL POWER SYSTEMS
High Voltage Engineering- OVER VOLTAGES IN ELECTRICAL POWER SYSTEMSsandhya757531
 
Novel 3D-Printed Soft Linear and Bending Actuators
Novel 3D-Printed Soft Linear and Bending ActuatorsNovel 3D-Printed Soft Linear and Bending Actuators
Novel 3D-Printed Soft Linear and Bending ActuatorsResearcher Researcher
 
TEST CASE GENERATION GENERATION BLOCK BOX APPROACH
TEST CASE GENERATION GENERATION BLOCK BOX APPROACHTEST CASE GENERATION GENERATION BLOCK BOX APPROACH
TEST CASE GENERATION GENERATION BLOCK BOX APPROACHSneha Padhiar
 
Energy Awareness training ppt for manufacturing process.pptx
Energy Awareness training ppt for manufacturing process.pptxEnergy Awareness training ppt for manufacturing process.pptx
Energy Awareness training ppt for manufacturing process.pptxsiddharthjain2303
 

Recently uploaded (20)

Katarzyna Lipka-Sidor - BIM School Course
Katarzyna Lipka-Sidor - BIM School CourseKatarzyna Lipka-Sidor - BIM School Course
Katarzyna Lipka-Sidor - BIM School Course
 
『澳洲文凭』买麦考瑞大学毕业证书成绩单办理澳洲Macquarie文凭学位证书
『澳洲文凭』买麦考瑞大学毕业证书成绩单办理澳洲Macquarie文凭学位证书『澳洲文凭』买麦考瑞大学毕业证书成绩单办理澳洲Macquarie文凭学位证书
『澳洲文凭』买麦考瑞大学毕业证书成绩单办理澳洲Macquarie文凭学位证书
 
Main Memory Management in Operating System
Main Memory Management in Operating SystemMain Memory Management in Operating System
Main Memory Management in Operating System
 
Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...
Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...
Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...
 
Robotics-Asimov's Laws, Mechanical Subsystems, Robot Kinematics, Robot Dynami...
Robotics-Asimov's Laws, Mechanical Subsystems, Robot Kinematics, Robot Dynami...Robotics-Asimov's Laws, Mechanical Subsystems, Robot Kinematics, Robot Dynami...
Robotics-Asimov's Laws, Mechanical Subsystems, Robot Kinematics, Robot Dynami...
 
Comprehensive energy systems.pdf Comprehensive energy systems.pdf
Comprehensive energy systems.pdf Comprehensive energy systems.pdfComprehensive energy systems.pdf Comprehensive energy systems.pdf
Comprehensive energy systems.pdf Comprehensive energy systems.pdf
 
multiple access in wireless communication
multiple access in wireless communicationmultiple access in wireless communication
multiple access in wireless communication
 
Engineering Drawing section of solid
Engineering Drawing     section of solidEngineering Drawing     section of solid
Engineering Drawing section of solid
 
"Exploring the Essential Functions and Design Considerations of Spillways in ...
"Exploring the Essential Functions and Design Considerations of Spillways in ..."Exploring the Essential Functions and Design Considerations of Spillways in ...
"Exploring the Essential Functions and Design Considerations of Spillways in ...
 
Ch10-Global Supply Chain - Cadena de Suministro.pdf
Ch10-Global Supply Chain - Cadena de Suministro.pdfCh10-Global Supply Chain - Cadena de Suministro.pdf
Ch10-Global Supply Chain - Cadena de Suministro.pdf
 
2022 AWS DNA Hackathon 장애 대응 솔루션 jarvis.
2022 AWS DNA Hackathon 장애 대응 솔루션 jarvis.2022 AWS DNA Hackathon 장애 대응 솔루션 jarvis.
2022 AWS DNA Hackathon 장애 대응 솔루션 jarvis.
 
DEVICE DRIVERS AND INTERRUPTS SERVICE MECHANISM.pdf
DEVICE DRIVERS AND INTERRUPTS  SERVICE MECHANISM.pdfDEVICE DRIVERS AND INTERRUPTS  SERVICE MECHANISM.pdf
DEVICE DRIVERS AND INTERRUPTS SERVICE MECHANISM.pdf
 
Designing pile caps according to ACI 318-19.pptx
Designing pile caps according to ACI 318-19.pptxDesigning pile caps according to ACI 318-19.pptx
Designing pile caps according to ACI 318-19.pptx
 
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor CatchersTechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
 
Stork Webinar | APM Transformational planning, Tool Selection & Performance T...
Stork Webinar | APM Transformational planning, Tool Selection & Performance T...Stork Webinar | APM Transformational planning, Tool Selection & Performance T...
Stork Webinar | APM Transformational planning, Tool Selection & Performance T...
 
Cost estimation approach: FP to COCOMO scenario based question
Cost estimation approach: FP to COCOMO scenario based questionCost estimation approach: FP to COCOMO scenario based question
Cost estimation approach: FP to COCOMO scenario based question
 
High Voltage Engineering- OVER VOLTAGES IN ELECTRICAL POWER SYSTEMS
High Voltage Engineering- OVER VOLTAGES IN ELECTRICAL POWER SYSTEMSHigh Voltage Engineering- OVER VOLTAGES IN ELECTRICAL POWER SYSTEMS
High Voltage Engineering- OVER VOLTAGES IN ELECTRICAL POWER SYSTEMS
 
Novel 3D-Printed Soft Linear and Bending Actuators
Novel 3D-Printed Soft Linear and Bending ActuatorsNovel 3D-Printed Soft Linear and Bending Actuators
Novel 3D-Printed Soft Linear and Bending Actuators
 
TEST CASE GENERATION GENERATION BLOCK BOX APPROACH
TEST CASE GENERATION GENERATION BLOCK BOX APPROACHTEST CASE GENERATION GENERATION BLOCK BOX APPROACH
TEST CASE GENERATION GENERATION BLOCK BOX APPROACH
 
Energy Awareness training ppt for manufacturing process.pptx
Energy Awareness training ppt for manufacturing process.pptxEnergy Awareness training ppt for manufacturing process.pptx
Energy Awareness training ppt for manufacturing process.pptx
 

Kotlin is charming; The reasons Java engineers should start Kotlin.

  • 1. Kotlin is charming; The reasons Java engineers should start Kotlin. By Kiyotaka Soranaka:空中清高
  • 2. About me Name:空中 清高(Kiyotaka Soranaka) Work:株式会社ジャストシステム
  • 5. Agenda ・What is Kotlin? ・Why Kotlin? ・Kotlin VS Java ・Kotlin AND Java
  • 7. Statically typed programming language for the JVM, Android and the browser https://kotlinlang.org/
  • 8. Google is adding Kotlin as an official programming language for Android development https://android-developers.googleblog.com/2017/05/android- announces-support-for-kotlin.html
  • 12. // Create a POJO in a single line data class Person(val name: String, val age: Int) // No need "new" keyword and Semicolons are optional. val person = Person("Kiyotaka Soranaka", 29) // String Templates println("My name is ${person.name}.") // > My name is Kiyotaka Soranaka. Concise
  • 14. // Null Safe: These codes cause error at compile time. val str: String = null // compile error:String is non-null. val nullable: String? = null // String? is nullable. val length:Int = nullable.length // compile error:String? is nullable. // Below codes don't cause error. val length:Int = nullable!!.length // But this cause error at runtime if ‘nullable’ is null. val length:Int = if (nullable != null) { nullable.length } else { 0 } // Smart-cast val length:Int = nullable?.length ?: 0 // "?." is Safe Calls and "?:" is Elvis Operator. Safe
  • 16. Versatile ・Android Development. ・Write code in Kotlin and target JavaScript. ・Application Server. ・Spring Framework support Kotlin. ・Enterprise Java EE.
  • 18. Interoperable Kotlin is of 100% Java compatibility. You can use any existing library on the JVM.
  • 20. Tooling IntelliJ IDEA is very powerful! It is developed by JetBrains, where the team that created Kotlin itself belongs.
  • 21. Tooling (Win)Alt + Enter, (Mac) ⌥Enter
  • 22. Tooling (Win)Ctrl + Alt + Shift + K (Mac) ⌥⇧⌘K Convert Java to Kotlin.
  • 24. public final class Person { public Person(String name, int age) { this.name = name; this.age = age; } private final String name; private int age; public String getName() { return name; } public int getAge() { return age; } public void setAge(int age) { this.age = age; } } Kotlin JavaKotlin VS Java
  • 25. class Person(name: String, age: Int) { val name: String = name var age: Int = age } 'val' and 'var' mean read-only and mutable, respectively. getter/setter are automatically generated. public final class Person { public Person(String name, int age) { this.name = name; this.age = age; } private final String name; private int age; public String getName() { return name; } public int getAge() { return age; } public void setAge(int age) { this.age = age; } } Kotlin: Level 1 JavaKotlin VS Java
  • 26. Kotlin: Level 2 JavaKotlin VS Java class Person(val name: String, var age: Int) Properties are automatically generated. public final class Person { public Person(String name, int age) { this.name = name; this.age = age; } private final String name; private int age; public String getName() { return name; } public int getAge() { return age; } public void setAge(int age) { this.age = age; } }
  • 27. Kotlin: Level 3 JavaKotlin VS Java data class Person(val name: String, var age: Int) Several members are automatically generated; e.g., getter/setter, equals(), hashCode(), toString(), copy(), etc.. val person = Person("Bob", 5) println("$person") // > Person(name=Bob, age=5) https://kotlinlang.org/docs/reference/dat a-classes.html public final class Person { public Person(String name, int age) { this.name = name; this.age = age; } private final String name; private int age; public String getName() { return name; } public int getAge() { return age; } public void setAge(int age) { this.age = age; } @Override public boolean equals(Object obj) { ...
  • 28. Kotlin JavaKotlin VS Java data class Person(val name: String = "", var age: Int = 0) You can use default values. 'Telescoping' is not needed. 'Telescoping' is as follows. public Person() { this(""); } public Person(String name) { this(name, 0); } public Person(String name, int age) { this.name = name; this.age = age; }
  • 29. Kotlin JavaKotlin VS Java data class Person(var height: Int = 155, var weight: Int = 50) By using 'Named Arguments', you don't have to care the order of the arguments. val p1 = Person(height = 170, weight = 60) val p2= Person(weight = 60, height = 170) val p3= Person(height = 170) val p4= Person(weight = 60) https://kotlinlang.org/docs/reference/fun ctions.html public Person() { this(155); } public Person(int height) { this(height, 50); } public Person(int height, int weight) { this.height = height;// cm this.weight = weight;// kg } Person p1 = new Person(170, 60); Person p2 = new Person(60, 170);
  • 30. Kotlin: Level 1 JavaKotlin VS Java val cache = HashMap<String, Calendar>() fun getJJUGDate(): Date { var jjugCal = cache["JJUG"] if (jjugCal == null) { jjugCal = Calendar.getInstance() jjugCal.set(2017, Calendar.MAY, 20) cache.put("JJUG", jjugCal) } return jjugCal!!.time } Map<String, Calendar> cache = new HashMap<>(); public Date getJJUGDate() { Calendar jjugCal = cache.get("JJUG"); if (jjugCal == null) { jjugCal = Calendar.getInstance(); jjugCal.set(2017, Calendar.MAY, 20); cache.put("JJUG", jjugCal); } return jjugCal.getTime(); }
  • 31. Kotlin: Level 1 JavaKotlin VS Java val cache = HashMap<String, Calendar>() fun getJJUGDate(): Date { var jjugCal = cache["JJUG"] if (jjugCal == null) { jjugCal = Calendar.getInstance() jjugCal.set(2017, Calendar.MAY, 20) cache.put("JJUG", jjugCal) } return jjugCal!!.time } Map<String, Calendar> cache = new HashMap<>(); public Date getJJUGDate() { Calendar jjugCal = cache.get("JJUG"); if (jjugCal == null) { jjugCal = Calendar.getInstance(); jjugCal.set(2017, Calendar.MAY, 20); cache.put("JJUG", jjugCal); } return jjugCal.getTime(); } This code almost the same as Java. But you can modify more concise.
  • 32. Kotlin: Level 1 JavaKotlin VS Java val cache = HashMap<String, Calendar>() fun getJJUGDate(): Date { var jjugCal = cache["JJUG"] if (jjugCal == null) { jjugCal = Calendar.getInstance() jjugCal.set(2017, Calendar.MAY, 20) cache.put("JJUG", jjugCal) } return jjugCal!!.time } Map<String, Calendar> cache = new HashMap<>(); public Date getJJUGDate() { Calendar jjugCal = cache.get("JJUG"); if (jjugCal == null) { jjugCal = Calendar.getInstance(); jjugCal.set(2017, Calendar.MAY, 20); cache.put("JJUG", jjugCal); } return jjugCal.getTime(); } To be more concise. ・Simplify the code to initialize the calendar. ・Change the type of "jjugCal" to read-only Calendar.
  • 33. Kotlin: Level 2 JavaKotlin VS Java val cache = HashMap<String, Calendar>() fun getJJUGDate(): Date { val jjugCal = cache["JJUG"] ?: Calendar.getInstance().apply { set(2017, Calendar.MAY, 20) cache.put("JJUG", this) } return jjugCal.time } Map<String, Calendar> cache = new HashMap<>(); public Date getJJUGDate() { Calendar jjugCal = cache.get("JJUG"); if (jjugCal == null) { jjugCal = Calendar.getInstance(); jjugCal.set(2017, Calendar.MAY, 20); cache.put("JJUG", jjugCal); } return jjugCal.getTime(); }
  • 34. Kotlin: Level 2 JavaKotlin VS Java val cache = HashMap<String, Calendar>() fun getJJUGDate(): Date { val jjugCal = cache["JJUG"] ?: Calendar.getInstance().apply { set(2017, Calendar.MAY, 20) cache.put("JJUG", this) } return jjugCal.time } Map<String, Calendar> cache = new HashMap<>(); public Date getJJUGDate() { Calendar jjugCal = cache.get("JJUG"); if (jjugCal == null) { jjugCal = Calendar.getInstance(); jjugCal.set(2017, Calendar.MAY, 20); cache.put("JJUG", jjugCal); } return jjugCal.getTime(); } Use "?:"(Elvis Operator). Use "apply"(scoping function). Type of "jjugCal" is read-only Calendar.
  • 35. Kotlin: Level 2 JavaKotlin VS Java val cache = HashMap<String, Calendar>() fun getJJUGDate(): Date { val jjugCal = cache["JJUG"] ?: Calendar.getInstance().apply { set(2017, Calendar.MAY, 20) cache.put("JJUG", this) } return jjugCal.time } Map<String, Calendar> cache = new HashMap<>(); public Date getJJUGDate() { Calendar jjugCal = cache.get("JJUG"); if (jjugCal == null) { jjugCal = Calendar.getInstance(); jjugCal.set(2017, Calendar.MAY, 20); cache.put("JJUG", jjugCal); } return jjugCal.getTime(); } To be more concise. ・Delete local variable "jjugCal". ・Use kotlin stdlib function.
  • 36. Kotlin: Level 3 JavaKotlin VS Java val cache = HashMap<String, Calendar>() fun getJJUGDate(): Date { return cache.getOrPut("JJUG", { Calendar.getInstance().apply { set(2017, Calendar.MAY, 20) } }).time } Map<String, Calendar> cache = new HashMap<>(); public Date getJJUGDate() { Calendar jjugCal = cache.get("JJUG"); if (jjugCal == null) { jjugCal = Calendar.getInstance(); jjugCal.set(2017, Calendar.MAY, 20); cache.put("JJUG", jjugCal); } return jjugCal.getTime(); }
  • 37. Kotlin: Level 3 JavaKotlin VS Java val cache = HashMap<String, Calendar>() fun getJJUGDate(): Date { return cache.getOrPut("JJUG", { Calendar.getInstance().apply { set(2017, Calendar.MAY, 20) } }).time } Map<String, Calendar> cache = new HashMap<>(); public Date getJJUGDate() { Calendar jjugCal = cache.get("JJUG"); if (jjugCal == null) { jjugCal = Calendar.getInstance(); jjugCal.set(2017, Calendar.MAY, 20); cache.put("JJUG", jjugCal); } return jjugCal.getTime(); } Use kotlin.stdlib function. Delete the local variable "jjugCal".
  • 38. Kotlin: Level 3 JavaKotlin VS Java val cache = HashMap<String, Calendar>() fun getJJUGDate(): Date { return cache.getOrPut("JJUG", { Calendar.getInstance().apply { set(2017, Calendar.MAY, 20) } }).time } Map<String, Calendar> cache = new HashMap<>(); public Date getJJUGDate() { Calendar jjugCal = cache.get("JJUG"); if (jjugCal == null) { jjugCal = Calendar.getInstance(); jjugCal.set(2017, Calendar.MAY, 20); cache.put("JJUG", jjugCal); } return jjugCal.getTime(); } To be more concise. ・"return" and return type is optional.
  • 39. Kotlin: Level 4 JavaKotlin VS Java val cache = HashMap<String, Calendar>() fun getJJUGDate() = cache .getOrPut("JJUG", { Calendar.getInstance().apply { set(2017, Calendar.MAY, 20) } }).time Map<String, Calendar> cache = new HashMap<>(); public Date getJJUGDate() { Calendar jjugCal = cache.get("JJUG"); if (jjugCal == null) { jjugCal = Calendar.getInstance(); jjugCal.set(2017, Calendar.MAY, 20); cache.put("JJUG", jjugCal); } return jjugCal.getTime(); }
  • 40. Kotlin: Level 4 JavaKotlin VS Java val cache = HashMap<String, Calendar>() fun getJJUGDate() = cache .getOrPut("JJUG", { Calendar.getInstance().apply { set(2017, Calendar.MAY, 20) } }).time Map<String, Calendar> cache = new HashMap<>(); public Date getJJUGDate() { Calendar jjugCal = cache.get("JJUG"); if (jjugCal == null) { jjugCal = Calendar.getInstance(); jjugCal.set(2017, Calendar.MAY, 20); cache.put("JJUG", jjugCal); } return jjugCal.getTime(); } "return" is omitted.
  • 42. Kotlin JavaKotlin AND Java package example.kotlin Import example.java.Person fun example() { val p = Person("Bob", 5) p.age = p.age + 1 } package example.java; public class Person { public Person(String name, int age) { this.name = name; this.age = age; } private final String name; private int age; public String getName() { return name; } public int getAge() { return age; } public void setAge(int age) { this.age = age; } }
  • 43. Kotlin JavaKotlin AND Java You can use any existing library on JVM. Jackson, for example, data class Data(val id:Int = 0, val name:String = "") val mapper = ObjectMapper() val data = Data(10, "Soranaka") val json = mapper .writeValueAsString(data) println(json) // > {"id":10,"name":"Soranaka"} val data2 = mapper .readValue(json, Data::class.java) println(data2) // > Data(id=10, name=Soranaka)
  • 44. Kotlin JavaKotlin AND Java data class Data(val id:Int,var name:String) Data data = new Data(10, "J"); data.setName(data.getName() + "JUG"); System.out.println(data); // > Data(id=10, name=JJUG)
  • 45. Kotlin JavaKotlin AND Java class KotlinUtil { val cache = HashMap<String, Calendar>() fun getJJUGDate() = cache .getOrPut("JJUG", { Calendar.getInstance().apply { set(2017, Calendar.MAY, 20) } }).time } KotlinUtil kotlinUtil = new KotlinUtil(); Date jjugDate = kotlinUtil.getJJUGDate();
  • 46. Kotlin JavaKotlin AND Java class KotlinUtil { val cache = HashMap<String, Calendar>() fun getJJUGDate() = cache .getOrPut("JJUG", { Calendar.getInstance().apply { set(2017, Calendar.MAY, 20) } }).time } KotlinUtil kotlinUtil = new KotlinUtil(); Date jjugDate = kotlinUtil.getJJUGDate(); Do you want it to be singleton?
  • 47. Kotlin JavaKotlin AND Java object KotlinUtil { val cache = HashMap<String, Calendar>() fun getJJUGDate() = cache .getOrPut("JJUG", { Calendar.getInstance().apply { set(2017, Calendar.MAY, 20) } }).time } Date jjugDate = KotlinUtil.INSTANCE.getJJUGDate();
  • 48. Kotlin JavaKotlin AND Java object KotlinUtil { val cache = HashMap<String, Calendar>() fun getJJUGDate() = cache .getOrPut("JJUG", { Calendar.getInstance().apply { set(2017, Calendar.MAY, 20) } }).time } Date jjugDate = KotlinUtil.INSTANCE.getJJUGDate(); Do you want it to be static?
  • 49. Kotlin JavaKotlin AND Java class KotlinUtil { companion object { private val cache = HashMap<String, Calendar>() @JvmStatic fun getJJUGDate() = cache.getOrPut("JJUG", { Calendar.getInstance().apply { set(2017, Calendar.MAY, 20) } }).time } } Date jjugDate = KotlinUtil.getJJUGDate();

Editor's Notes

  1. 簡潔な記述が可能
  2. POJOクラスはKotlinではワンライナーで書けます。 “data”というキーワードを付けたクラスはgetter/setterやequals(),hashCode(),toString(),copy()といったメソッドが自動的に生成されます。 オブジェクトを生成するとき、”new”キーワードは必要ありません。 また「;」は省略可能です。(普通、省略します。) さらに、文字列テンプレートが言語機能として実装されていて、文字列中の$マークの直後はプログラムの変数を直接記載できます。これはすごく読みやすいです。
  3. Kotlinの大きな特徴の一つはNull Safeな言語であることです。 普通の型はnon-nullな型なのでnullを代入することができません。 代入しようとするとコンパイルエラーになります。 Nullが代入可能な型は、型名のあとに「?」を付けることで宣言できます。 ただし、nullableな型の変数にアクセスするときはnullチェックが必須で、これを怠るとコンパイルエラーが発生します。 Nullableな変数にアクセスする方法は以下のようなものがあります。 「!!」という、いかにも注意を引きそうな書き方は、「これはnullではない、ワシが保証する」という意味です。 !!を書いたプログラマが「絶対いけるから、nullじゃないから!!」ってことをコンパイラーに伝える仕組みです。 コンパイラーは素直なのでこれを受け入れてしまいますが、このケースでは見事に実行時エラーが、悪名高いNullPointerExceptionが発生します。 つまり、普通のプログラマーならめったに「!!」は使わないので、これが乱用されているコードを見かけたらお察しです。 nullableな変数は一度nullチェックを行えば、以降のコードではSmart-castによって、自動的に?無しの型に変換してくれます。 また、「?.」でアクセスすれば、nullじゃないときに続きを実行、nullのときはnullを返す、という動きになります。 この例では、続く「?:」という演算子を使っています。 これは「?:」の前がnullのときは「?:」の後を返す、という演算子です。 なので、if文でチェックしたコードと?.でアクセスして、?:を使ってデフォルト値を設定しているコードは等価です。
  4. Kotlinはさまざまな用途で利用できます。 Androidはもちろんですが、JavaScriptやサーバーアプリケーションなどもKotlinで書くことが可能です。 後述しますが、Javeのプロジェクトと共存可能なので、既存のJavaプロジェクトに組み込むことも容易です。 また、Spring FrameworkもKotlinを公式サポートしています。(Spring Framework 5.0+)
  5. KotlinはJavaと共存可能です。 なぜか? KotlinをJVMで使う場合、KotlinのコードはJavaの.class形式にコンパイルされます。 つまり、JVMで使う場合はKotlinはJavaです。