목록Kotlin (14)
시배's Android
KSP (Kotlin Symbol Processing) Kotlin 심볼 처리의 줄임말인 KSP는 Kotlin 에코시스템에 도입된 비교적 새로운 어노테이션 처리 프레임워크입니다. 이 프레임워크는 Java 및 Kotlin 개발에 사용되는 기존 어노테이션 처리 방식의 몇 가지 한계를 해결하기 위해 설계되었습니다. KSP는 몇 가지 고유한 기능을 제공합니다: Strong Typing : KSP는 강력한 타이핑 기능을 제공하므로 코드 생성 로직에서 직접 Kotlin 유형으로 작업할 수 있습니다. 따라서 복잡한 유형 변환이 필요하지 않으며 코드 생성의 전반적인 안전성이 향상됩니다. Improved Performance : 기존 어노테이션 처리와 비교하여 KSP는 Kotlin의 컴파일러 인프라를 활용하여 향상된 성..
Kotlin Sealed Interfaces: A Deep Dive into a Powerful New Feature When Kotlin was first introduced, developers quickly fell in love with its powerful language features, including sealed classes. However… blog.devgenius.io Kotlin이 처음 소개되었을 때 개발자들은 sealed class를 비롯한 강력한 언어 기능에 빠르게 빠져들었습니다. 하지만 한 가지 아쉬운 점이 있었는데, 바로 sealed interface였습니다. 당시에는 Kotlin 컴파일러가 Java 코드로 인터페이스를 구현할 수 없다는 것을 보장할 수 없었기 때문에 K..
Kotlin Generic Generic What is Generic in Java or Kotlin? What is Invariance, Convariance, and Contravariance? I have been asking those things for a long day. So, we’re gonna dive into “Generic” in Kotlin. There are a lot of concepts that we have to know. We’re g tmdgusya.github.io Derived Type 첫 번째 내용은 파생 타입(Derived Type)입니다. 이것은 슈퍼클래스로부터 속성을 상속받는 클래스를 말합니다. open class OriginalClass( val name: ..
Singleton "싱글톤 패턴"은 클래스가 하나의 인스턴스만 가지고 있도록 보장하며, 그 인스턴스에 대한 전역 접근점을 제공합니다. object SingletonExample { fun doSomething() { println("Singleton : Doing something") } } // Usage SingletonExample.doSomething() Decorator "데코레이터 패턴"은 동일한 클래스에서 다른 객체의 동작을 동적으로 추가할 수 있게 해줍니다. 이 때 다른 객체들의 동작에 영향을 주지 않고 개별 객체에 동작을 추가할 수 있습니다. interface ChrismasTree { fun decorate() : String } class PineChrismasTree : Chrism..
Mastering Flow: Seamless Asynchronous Programming in Kotlin As software development continues to evolve, the need for efficient and elegant solutions to handle asynchronous operations becomes… medium.com 소프트웨어 개발이 계속 발전함에 따라 비동기 작업을 처리하는 효율적이고 우아한 솔루션이 점점 더 중요해지고 있습니다. Kotlin의 세계에서 하나의 특별한 솔루션은 Flow API입니다. Flow는 비동기 작업에 새로운 패러다임을 제공하여 개발자들에게 데이터 스트림을 다루는 간결하고 직관적인 방법을 제공합니다. 이 포괄적인 탐구에서 우리는 Kot..
Kotlin Coroutine과 스레드 활성화 Kotlin의 강력한 비동기 프로그래밍 도구인 Coroutine은 스레드를 효율적으로 관리하여 비동기 작업을 수행할 수 있도록 돕습니다. 이번 포스트에서는 10,000개의 Coroutine을 실행했을 때 활성화된 스레드 수를 알아보도록 하겠습니다. import kotlinx.coroutines.* import kotlin.system.measureTimeMillis suspend fun createCoroutines(amount: Int) { val jobs = ArrayList() for (i in 1..amount) { jobs += GlobalScope.launch { delay(1000) } } jobs.forEach { it.join() } } fu..