# programming-tips

Published articles for programming-tips.

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

## 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 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.

## 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.