Familiar Syntax (like Scala, C#, Groovy, Swift …) • Type Inference (like Scala, C#) • Smart Casts (`is`, `as`) • Data Class (Scala case class, POJO with @Data)
-> print(x + 1) is String -> print(x.length + 1) is IntArray -> print(x.sum()) !is BigDecimal -> print(x) 1L..10L -> print(x) } val x: String? = y as String (Unsafe) val x: String? = y as String? (Unsafe) val x: String? = y as? String (Safe) is / !is as / as?
query = """ | CREATE KEYSPACE IF NOT EXISTS $keyspaceName | WITH replication = { 'class': '$replicationStrategy', | 'replication_factor':$replicationFactor } """.trimMargin() val s = "abc" val str = "$s.length is ${s.length}" // prints "abc.length is 3" Kotlin - The Good (2/3) fun read(b:ByteArray, offset:Int = 0, length:Int = b.size) { TODO(”Not Implemented”) }
query = """ | CREATE KEYSPACE IF NOT EXISTS $keyspaceName | WITH replication = { 'class': '$replicationStrategy', | 'replication_factor':$replicationFactor } """.trimMargin() val s = "abc" val str = "$s.length is ${s.length}" // prints "abc.length is 3" Kotlin - The Good (2/3) fun read(b:ByteArray, offset:Int = 0, length:Int = b.size) { TODO(”Not Implemented”) }
query = """ | CREATE KEYSPACE IF NOT EXISTS $keyspaceName | WITH replication = { 'class': '$replicationStrategy', | 'replication_factor':$replicationFactor } """.trimMargin() val s = "abc" val str = "$s.length is ${s.length}" // prints "abc.length is 3" Kotlin - The Good (2/3) fun read(b:ByteArray, offset:Int = 0, length:Int = b.size) { TODO(”Not Implemented”) }
query = """ | CREATE KEYSPACE IF NOT EXISTS $keyspaceName | WITH replication = { 'class': '$replicationStrategy', | 'replication_factor':$replicationFactor } """.trimMargin() val s = "abc" val str = "$s.length is ${s.length}" // prints "abc.length is 3" Kotlin - The Good (2/3) fun read(b:ByteArray, offset:Int = 0, length:Int = b.size) { TODO(”Not Implemented”) }
lambdas (Use in java) • Final by default (안정성? 성능? A bit about picking defaults) • Open: 50%, Final : 50% registerCallback(() -> { /** do stuff */ return Unit.INSTANCE; })
위주) • Twitter 에서 개발한 open-korean-text 를 Customizing • Scala vs Kotlin 성능 비교 • Kotlin version is 1.5 ~ 3X faster with Coroutines • 효과 • Full Indexing per Day 부하 감소 : 30% • Elastic Search 질의 부하 : 80%
사용을 위해 Offset 관리가 필수 • 각 팀별 중복된 Client 구현 및 삽질 • 효과 • Message 중복 / 유실 없음 (Latest strategy) • Retry / Circuit breaker 지원 • Metrics 를 활용한 Ack 지원 • 전사 확대 적용 중
: 1 senior, 2 junior developer • Software stack • React • Spring Boot 1.5 on Vitamin Framework • jOOQ (향후 requery로 변환 예정) • Pilot 로 시작, 개발자들의 노력으로 정식 시스템으로 승격
• Java와 차이점 및 Kotlin best practices 검토 필요 • 첫 술에 배부를 수 없다 • 실망하지 말라, Refactoring 은 필수다 • Coroutines 에 대한 학습 및 테스트 • 어차피 비동기는 어렵다. • Coroutines는 하나의 방법일 뿐이다