# kotlin-beginner

Published articles for kotlin-beginner.

This is one page of public article previews, not the complete archive. Follow Next page to continue. Summaries are not the original full articles.

## Understanding Dispatchers: Main and Main.immediate

DevFeed: [Understanding Dispatchers: Main and Main.immediate](<https://devfeed.tech/articles/understanding-dispatchers-main-and-main-immediate-25756.md>)

Original publisher: [Read original article](<https://blog.shreyaspatil.dev/understanding-dispatchers-main-and-mainimmediate/>)

Author: Shreyas Patil

Published: 2025-04-02T12:22:06Z

Content type: tutorial

Language: en

Sources: [Shreyas Patil's Blog](<https://devfeed.tech/sources/shreyas-patil-s-blog.md>)

Topics: [Coroutines](<https://devfeed.tech/topics/coroutines.md>), [kotlin-coroutines](<https://devfeed.tech/topics/kotlin-coroutines.md>), [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [Android](<https://devfeed.tech/topics/android.md>), [Programming](<https://devfeed.tech/topics/programming.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [android-app-development](<https://devfeed.tech/tags/android-app-development.md>), [android-apps](<https://devfeed.tech/tags/android-apps.md>), [android-studio](<https://devfeed.tech/tags/android-studio.md>), [coroutine](<https://devfeed.tech/tags/coroutine.md>), [coroutines](<https://devfeed.tech/tags/coroutines.md>), [coroutines-flow](<https://devfeed.tech/tags/coroutines-flow.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [kotlin-beginner](<https://devfeed.tech/tags/kotlin-beginner.md>), [kotlin-coroutines](<https://devfeed.tech/tags/kotlin-coroutines.md>), [kotlin-multiplatform](<https://devfeed.tech/tags/kotlin-multiplatform.md>), [main-thread](<https://devfeed.tech/tags/main-thread.md>), [multithreading](<https://devfeed.tech/tags/multithreading.md>), [reactive-programming](<https://devfeed.tech/tags/reactive-programming.md>), [threadpools](<https://devfeed.tech/tags/threadpools.md>), [threads](<https://devfeed.tech/tags/threads.md>)

### AI overview

A deep dive into Kotlin coroutine dispatchers on Android, explaining the difference between Dispatchers.Main and Dispatchers.Main.immediate. It describes how HandlerContext dispatches work and when execution is posted to the main thread or performed synchronously on the current thread.

### Source excerpt

A deep dive into Kotlin Coroutine Dispatchers. Understand the subtle but important difference between Dispatchers.Main and Dispatchers.Main.immediate in Android.

## Kotlin Exception Handling: Why Singleton Exceptions are a bad idea

DevFeed: [Kotlin Exception Handling: Why Singleton Exceptions are a bad idea](<https://devfeed.tech/articles/kotlin-exception-handling-why-singleton-exceptions-are-a-bad-idea-25732.md>)

Original publisher: [Read original article](<https://blog.shreyaspatil.dev/kotlin-exception-handling-why-singleton-exceptions-are-a-bad-idea/>)

Author: Shreyas Patil

Published: 2024-09-18T12:56:49Z

Content type: tutorial

Language: en

Sources: [Shreyas Patil's Blog](<https://devfeed.tech/sources/shreyas-patil-s-blog.md>)

Topics: [Exception](<https://devfeed.tech/topics/exception.md>), [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [debugging](<https://devfeed.tech/topics/debugging.md>), [App](<https://devfeed.tech/topics/app.md>), [Crashlytics](<https://devfeed.tech/topics/crashlytics.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [best-practices](<https://devfeed.tech/tags/best-practices.md>), [coding](<https://devfeed.tech/tags/coding.md>), [crashlytics](<https://devfeed.tech/tags/crashlytics.md>), [debugging](<https://devfeed.tech/tags/debugging.md>), [errors](<https://devfeed.tech/tags/errors.md>), [exception-handling](<https://devfeed.tech/tags/exception-handling.md>), [exceptionhandling](<https://devfeed.tech/tags/exceptionhandling.md>), [exceptions](<https://devfeed.tech/tags/exceptions.md>), [java](<https://devfeed.tech/tags/java.md>), [jvm](<https://devfeed.tech/tags/jvm.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [kotlin-beginner](<https://devfeed.tech/tags/kotlin-beginner.md>), [kotlin-multiplatform](<https://devfeed.tech/tags/kotlin-multiplatform.md>), [mistakes](<https://devfeed.tech/tags/mistakes.md>), [programming-blogs](<https://devfeed.tech/tags/programming-blogs.md>), [programming-tips](<https://devfeed.tech/tags/programming-tips.md>)

### AI overview

This Kotlin micro-blog explains why singleton exception instances can produce incorrect stack traces and mislead debugging. It recommends avoiding singleton exceptions when stack traces matter, while noting they may be acceptable for internal state or informational exceptions that are not monitored at scale.

### Source excerpt

Understand why using singleton exceptions in Kotlin can be a bad practice and how it affects stack traces and debugging in your applications.

## How Compose Compiler Stability Annotations Affect Recomposition and UI Performance

DevFeed: [How Compose Compiler Stability Annotations Affect Recomposition and UI Performance](<https://devfeed.tech/articles/promise-compose-compiler-and-imply-when-you-ll-change-25741.md>)

Original publisher: [Read original article](<https://blog.shreyaspatil.dev/promise-compose-compiler-and-imply-when-youll-change/>)

Author: Shreyas Patil

Published: 2022-03-10T12:42:38Z

Content type: tutorial

Language: en

Sources: [Shreyas Patil's Blog](<https://devfeed.tech/sources/shreyas-patil-s-blog.md>)

Topics: [Compose](<https://devfeed.tech/topics/compose.md>), [ui](<https://devfeed.tech/topics/ui.md>), [Compiler](<https://devfeed.tech/topics/compiler.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [android-app-development](<https://devfeed.tech/tags/android-app-development.md>), [compatibility](<https://devfeed.tech/tags/compatibility.md>), [compose](<https://devfeed.tech/tags/compose.md>), [compose-compiler](<https://devfeed.tech/tags/compose-compiler.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [kotlin-beginner](<https://devfeed.tech/tags/kotlin-beginner.md>), [performance](<https://devfeed.tech/tags/performance.md>), [recomposition](<https://devfeed.tech/tags/recomposition.md>), [ui](<https://devfeed.tech/tags/ui.md>)

### AI overview

This tutorial explains how Compose Compiler stability annotations, including @Stable and @Immutable, communicate guarantees about models and functions. These guarantees can help the compiler optimize recomposition and may improve UI performance, but violating them can cause undefined behavior.

### Source excerpt

Understand the Compose compiler's stability promises. Learn how @Stable and @Immutable impact recomposition and how to help the compiler optimize your UI.

## How Kotlin Single-Expression Functions Can Cause Subtle Business Logic Bugs

DevFeed: [How Kotlin Single-Expression Functions Can Cause Subtle Business Logic Bugs](<https://devfeed.tech/articles/don-t-let-kotlin-s-single-expression-function-ruin-your-business-25713.md>)

Original publisher: [Read original article](<https://blog.shreyaspatil.dev/dont-let-kotlins-single-expression-function-ruin-your-business/>)

Author: Shreyas Patil

Published: 2021-05-24T14:42:29Z

Content type: tutorial

Language: en

Sources: [Shreyas Patil's Blog](<https://devfeed.tech/sources/shreyas-patil-s-blog.md>)

Topics: [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [Compiler](<https://devfeed.tech/topics/compiler.md>), [Android Studio](<https://devfeed.tech/topics/android-studio.md>), [IntelliJ IDEA](<https://devfeed.tech/topics/intellij-idea.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [android-studio](<https://devfeed.tech/tags/android-studio.md>), [bugs](<https://devfeed.tech/tags/bugs.md>), [business-logic](<https://devfeed.tech/tags/business-logic.md>), [code](<https://devfeed.tech/tags/code.md>), [compiler](<https://devfeed.tech/tags/compiler.md>), [developer](<https://devfeed.tech/tags/developer.md>), [developers](<https://devfeed.tech/tags/developers.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [kotlin-beginner](<https://devfeed.tech/tags/kotlin-beginner.md>), [programming-tips](<https://devfeed.tech/tags/programming-tips.md>), [studio](<https://devfeed.tech/tags/studio.md>)

### AI overview

This tutorial explains how Kotlin's automatic return-type inference in single-expression functions can cause a function to return a lambda unexpectedly. It recommends specifying return types explicitly to catch related mistakes at compile time and improve code readability.

### Source excerpt

Understand why relying on Kotlin's automatic type inference in single-expression functions can lead to subtle bugs and business logic failures.

## Hide internal members of Kotlin Module from JVM 🔐

DevFeed: [Hide internal members of Kotlin Module from JVM 🔐](<https://devfeed.tech/articles/hide-internal-members-of-kotlin-module-from-jvm-25727.md>)

Original publisher: [Read original article](<https://blog.shreyaspatil.dev/hide-internal-members-of-kotlin-module-from-jvm/>)

Author: Shreyas Patil

Published: 2021-05-17T04:23:42Z

Content type: tutorial

Language: en

Sources: [Shreyas Patil's Blog](<https://devfeed.tech/sources/shreyas-patil-s-blog.md>)

Topics: [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [Java](<https://devfeed.tech/topics/java.md>), [modules](<https://devfeed.tech/topics/modules.md>), [IntelliJ IDEA](<https://devfeed.tech/topics/intellij-idea.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [api](<https://devfeed.tech/tags/api.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [java](<https://devfeed.tech/tags/java.md>), [jvm](<https://devfeed.tech/tags/jvm.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [kotlin-beginner](<https://devfeed.tech/tags/kotlin-beginner.md>), [libraries](<https://devfeed.tech/tags/libraries.md>), [library](<https://devfeed.tech/tags/library.md>), [module](<https://devfeed.tech/tags/module.md>), [sdk](<https://devfeed.tech/tags/sdk.md>)

### AI overview

A tutorial on Kotlin's internal visibility modifier and its limitations for Java consumers. It explains that Java code can access internal members of Kotlin classes and presents the need for additional measures when building Kotlin libraries or SDKs for the JVM.

### Source excerpt

Learn how to properly hide internal Kotlin members from JVM to maintain a clean API for Java consumers when developing libraries.

## Using Kotlin Delegated Properties to Nullify Android References and Reduce Memory Leaks

DevFeed: [Using Kotlin Delegated Properties to Nullify Android References and Reduce Memory Leaks](<https://devfeed.tech/articles/let-your-delegates-auto-nullify-references-25733.md>)

Original publisher: [Read original article](<https://blog.shreyaspatil.dev/let-your-delegates-auto-nullify-references/>)

Author: Shreyas Patil

Published: 2021-03-12T13:39:24Z

Content type: tutorial

Language: en

Sources: [Shreyas Patil's Blog](<https://devfeed.tech/sources/shreyas-patil-s-blog.md>)

Topics: [Memory Leaks](<https://devfeed.tech/topics/memory-leaks.md>), [Android](<https://devfeed.tech/topics/android.md>), [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [Jetpack](<https://devfeed.tech/topics/jetpack.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [android-app-development](<https://devfeed.tech/tags/android-app-development.md>), [delegates](<https://devfeed.tech/tags/delegates.md>), [fragments](<https://devfeed.tech/tags/fragments.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [kotlin-beginner](<https://devfeed.tech/tags/kotlin-beginner.md>), [lifecycle](<https://devfeed.tech/tags/lifecycle.md>), [memory-leaks](<https://devfeed.tech/tags/memory-leaks.md>), [mobile-development](<https://devfeed.tech/tags/mobile-development.md>), [properties](<https://devfeed.tech/tags/properties.md>)

### AI overview

This tutorial explains how Kotlin property delegates can automatically nullify references in Android components. It focuses on clearing Fragment and RecyclerView.Adapter references according to lifecycle events to reduce memory leaks and boilerplate.

### Source excerpt

Learn how to use Kotlin property delegates to automatically nullify references in Android, preventing memory leaks in Fragments and Activities.

## Kotlin string templates, destructuring declarations, and sealed classes

DevFeed: [Kotlin string templates, destructuring declarations, and sealed classes](<https://devfeed.tech/articles/cooking-tasty-code-in-kotlin-part-2-25710.md>)

Original publisher: [Read original article](<https://blog.shreyaspatil.dev/cooking-tasty-code-in-kotlin-part-2/>)

Author: Shreyas Patil

Published: 2021-01-01T09:23:42Z

Content type: tutorial

Language: en

Sources: [Shreyas Patil's Blog](<https://devfeed.tech/sources/shreyas-patil-s-blog.md>)

Topics: [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [coding](<https://devfeed.tech/topics/coding.md>), [coding style](<https://devfeed.tech/topics/coding-style.md>)

Tags: [coding](<https://devfeed.tech/tags/coding.md>), [coding-style](<https://devfeed.tech/tags/coding-style.md>), [destructuring](<https://devfeed.tech/tags/destructuring.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [kotlin-beginner](<https://devfeed.tech/tags/kotlin-beginner.md>), [programming-languages](<https://devfeed.tech/tags/programming-languages.md>), [programming-tips](<https://devfeed.tech/tags/programming-tips.md>), [sealed-class](<https://devfeed.tech/tags/sealed-class.md>)

### AI overview

A Kotlin tutorial covering string templates, raw multiline strings, destructuring declarations, and sealed classes. It notes that destructuring can be risky when a class member order changes.

### Source excerpt

Part 2 of 'Cooking Tasty Code'. Dive deeper into Kotlin features like delegation, operator overloading, and more to enhance your coding style.

## Kotlin Features for Writing Cleaner, More Idiomatic Code -- Part 1

DevFeed: [Kotlin Features for Writing Cleaner, More Idiomatic Code -- Part 1](<https://devfeed.tech/articles/cooking-tasty-code-in-kotlin-part-1-25709.md>)

Original publisher: [Read original article](<https://blog.shreyaspatil.dev/cooking-tasty-code-in-kotlin-part-1/>)

Author: Shreyas Patil

Published: 2020-12-24T14:37:40Z

Content type: tutorial

Language: en

Sources: [Shreyas Patil's Blog](<https://devfeed.tech/sources/shreyas-patil-s-blog.md>)

Topics: [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [Programming](<https://devfeed.tech/topics/programming.md>), [Functional programming](<https://devfeed.tech/topics/functional-programming.md>), [Refactoring](<https://devfeed.tech/topics/refactoring.md>), [Boilerplate](<https://devfeed.tech/topics/boilerplate.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [article](<https://devfeed.tech/tags/article.md>), [beginner](<https://devfeed.tech/tags/beginner.md>), [code](<https://devfeed.tech/tags/code.md>), [coding](<https://devfeed.tech/tags/coding.md>), [development](<https://devfeed.tech/tags/development.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [kotlin-beginner](<https://devfeed.tech/tags/kotlin-beginner.md>), [programming](<https://devfeed.tech/tags/programming.md>), [programming-language](<https://devfeed.tech/tags/programming-language.md>)

### AI overview

A beginner-oriented Kotlin tutorial covering functions, single-expression functions, default arguments, and the use of object-oriented and functional programming styles to write more concise, readable code.

### Source excerpt

Part 1 of the 'Cooking Tasty Code' series. Explore Kotlin's syntactic sugar and features that help write cleaner, more readable, and idiomatic code.