Fullstack Kotlin, founder of @KtDotAcademy, JetBrains partner, GDE in Kotlin, author of Effective Kotlin and Kotlin Coroutines. Workshops: bit.ly/3WtTH

Joined January 2025
121 Photos and videos
Marcin Moskala Android retweeted
This is an everyday companion that helps with Compose development: Compose Advanced Cheat Sheet (10 pages) — modifiers, theming (MaterialTheme CompositionLocals), stability rules, and recomposition-safe patterns. Free upon registration: cheat-sheet.kt.academy/advan… Compose becomes much less mysterious once you have a few rules you trust. This sheet keeps those rules close.
4
7
405
Marcin Moskala Android retweeted
Why is Kotlin hesitating to introduce union types? They are not that good, even though they can help us model some types better, they introduce many surprising problems. In this article, you will discover that: 💡 It is no coincidence that languages like Swift or Scala, with type inference and union types, have such a slow compilation and suggestions. 💡 Why their subtyping must be undecidable, 💡 What unpleasant surprises union-type has for developers. kt.academy/article/union-typ…
5
8
348
Marcin Moskala Android retweeted
You cannot start new coroutines on a cancelled scope. Such coroutines never start, without any exception or even an exception raport in logs. That is why a cancelled scope is a dangerous thing, and I prefer cancelling only its children.
1
6
25
1,517
Marcin Moskala Android retweeted
Conventions are not optimal in every case, but they are optimal for a project or a community when we all follow the same conventions. Compose provides a set of strict conventions that specify how to correctly define components, how to name them, and how to organize their parameters. You can find all those conventions in the Compose Advanced Cheat Sheet. 👉 Free upon registration: cheat-sheet.kt.academy/advan… If your goal is “less magic, more mechanics” in Compose, this is the kind of reference you’ll actually use.
4
6
273
Marcin Moskala Android retweeted
When a coroutine is cancelled, it cannot start children or make suspending calls. That means suspending cleanup functions need some special attention. Let me explain.
1
8
32
1,411
Marcin Moskala Android retweeted
🚨 Mutable state in Kotlin: Should you use var or mutable val? 🤔 Each has its perks! One boosts the efficiency of adding elements; the other simplifies observability. Beware of pitfalls like defensive copying and thread safety! 🛠️ Master the trade-offs to avoid common mistakes with this article 👇kt.academy/article/var_reado… For teams that already use Kotlin in production, we recommend pairing the Kotlin Mastery workshop with Effective Kotlin, so developers get both hands-on practice and a structured reference to best practices.
4
5
313
Marcin Moskala Android retweeted
One of the most important Compose skills is not “knowing the API”. It is being able to look at a modifier chain and say, with confidence, what the UI will actually look like. That sounds simple, but in practice it is where many developers struggle. Modifier order affects layout, drawing, clipping, interaction, and positioning in ways that are easy to underestimate. A chain that looks obvious at first glance can produce a result very different from what you expected. That is why I created this Modifier Guesser Game. The idea is straightforward: read the modifier chain, inspect the component, and choose the correct visual outcome. With higher levels, the challenge becomes less about remembering examples and more about building a reliable mental model of how Compose behaves. If Compose ever surprised you, this game is a good way to train the part that matters most: prediction. Play here: game.kt.academy/?game=modifi…
1
4
7
327
Marcin Moskala Android retweeted
CancellationException is part of coroutines cancellation mechanics, and stopping it is a mistake. People most often do that accidentally, when they catch all exceptions. That is not acceptable❗Let me explain why, and what to do instead.
1
5
24
1,990
Marcin Moskala Android retweeted
💼 Want Your Company to Pay for Kotlin Training? Here's How! 👇 kt.academy/article/finance-b…
4
5
298
Marcin Moskala Android retweeted
You can finally see a warning when you use suspendCoroutine. This is good, because the right way to suspend a coroutine is to use suspendCancellableCoroutine. suspendCoroutine should be forgotten, as it does not support cancellation. suspendCancellableCoroutine is a low-level API rarely used in application code, but often used by libraries that support suspending calls.  These “recipes” are a taste of what we do in Coroutines Mastery. coroutinesmastery.com
4
24
1,243
Marcin Moskala Android retweeted
The synchronized block is popular for synchronizing non-suspending functions, but it can also be tricky. Without proper understanding, developers make mistakes, which leads to mistakes that are hard to find.
1
3
11
1,224
Marcin Moskala Android retweeted
🚨 Is Your Network Client Sabotaging Performance? 🚨 Coroutines promise fewer threads and better efficiency—but are your libraries secretly blocking threads? 🤔 Discover how popular Kotlin network clients like Retrofit, Ktor, and Fuel really manage threads. Your app’s performance might depend on it! 💥kt.academy/article/network_c… If this kind of deep dive helps, we cover it end-to-end in Coroutines Mastery. coroutinesmastery.com
4
4
384
Marcin Moskala Android retweeted
Make Compose UI consistent, modern, refined. Join Polished Compose to learn how strong Android products improve visual quality through better theming, cleaner layouts, motion, and polish. Lats moment to join! Enroll now -> polishedcompose.com
4
7
493
Marcin Moskala Android retweeted
Kotlin Coroutines are simple only until you need to clearly remember what launch, async, runBlocking, runTest, coroutineScope, or withTimeoutOrNull actually do. That is exactly why I prepared this cheat sheet. Leave your email and download it. Good baseline for team standards: where scopes live, what dispatchers mean, what to avoid. Download Kotlin Coroutines Cheat Sheet here 👇
1
4
10
869
Marcin Moskala Android retweeted
You probably know already that the first programmer was a woman, but did you know she was the daughter of a mad poet? This is a story of Ada Lovelace, who presented a sequence of instructions to calculate Bernoulli numbers on the difference engine. This is considered the first computer program, and also the first computer algorithm. Ada’s father was Lord Byron, a famous romantic poet with a notable history, numerous publications, and a rich legacy. Was he really mad? Historians suspect bipolar affective disorder, but it you know his history, that seems like the tip of an iceberg 😉
5
6
494
Marcin Moskala Android retweeted
Modifier builders or resources that are used for many composables can be extracted for better performance. Why making something many times, if you can create it only once 😎
1
5
38
2,784
Marcin Moskala Android retweeted
A practical Flow reference, made for Kotlin developers. This cheat sheet by Marcin Moskala covers flow, callbackFlow, collectLatest, debounce, combine, stateIn, shareIn, and the key differences between SharedFlow and StateFlow. Download it here: [link] If Flow is part of your daily toolkit, this is the kind of reference that pays back every week.
4
12
612
Marcin Moskala Android retweeted
One of the greatest possible sins in Compose is reading and writing to a state in a composable. ☠️ Just writing is already problematic, but reading and writing lead to an endless recomposition circle - read sets the listener to recompose on value change, write triggers value.
1
6
12
1,127
Marcin Moskala Android retweeted
Dropwizard is a Java framework for developing ops-friendly, high-performance, RESTful web services. Apparently, there was no project showing how to use it together with Kotlin coroutines. This has changed thanks to Rui Pinto, who implemented a simple demo application that showcases how to use coroutines in Dropwizard. It even includes performance benchmarks. 👉 github.com/rp199/dropwizard-… #coroutinesmasteryproject
4
16
948
Marcin Moskala Android retweeted
If you want more deep-dive explanations like this (with exercises and real-world examples), join the Advanced Compose: advancedcompose.com
1
5
23
1,318