<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Coding Kinetics - Medium]]></title>
        <description><![CDATA[Master Kotlin without the overwhelm. Cut through the noise. Learn your way — alone or in good company. - Medium]]></description>
        <link>https://medium.com/coding-kinetics?source=rss----8e8c18dd036b---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Coding Kinetics - Medium</title>
            <link>https://medium.com/coding-kinetics?source=rss----8e8c18dd036b---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 14:56:00 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/coding-kinetics" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Reverse-Engineering the Compose Compiler Plugin: Intercepting the Frontend]]></title>
            <link>https://medium.com/coding-kinetics/reverse-engineering-the-compose-compiler-plugin-intercepting-the-frontend-657162893b11?source=rss----8e8c18dd036b---4</link>
            <guid isPermaLink="false">https://medium.com/p/657162893b11</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[compilers]]></category>
            <category><![CDATA[kotlin]]></category>
            <category><![CDATA[tech]]></category>
            <category><![CDATA[coding]]></category>
            <dc:creator><![CDATA[Amanda Hinchman]]></dc:creator>
            <pubDate>Tue, 05 May 2026 23:26:19 GMT</pubDate>
            <atom:updated>2026-05-05T23:26:20.334Z</atom:updated>
            <content:encoded><![CDATA[<h4>How Jetpack Compose compiler plugin bends the rules of the Kotlin compiler</h4><p>Have you ever wondered why error messaging appears in your IDE when writing Composables without the Jetpack Compose dependency?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3asboGirD8HZFbzO9JXRrQ.png" /><figcaption>Without the Jetpack Compose dependency configured in, your IDE will not be able to recognize a @Composable reference</figcaption></figure><p>And why a @Composable annotated function is turned into a Composable type when you import the necessary Compose dependencies?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/872/1*LLCwRJ4ruMsB0ghooeYbVg.png" /><figcaption>HelloWorld function is recognized as a composable type</figcaption></figure><p>This is due to Jetpack Compose compiler plugins, which send diagnostics to the IDE for user feedback. Today, we’ll focus on how these diagnostics are retrieved by the Kotlin compiler, as compiler plugins can intercept code compilation and runtime behavior.</p><p>What better way to learn about the Kotlin compiler than doing a little reverse engineering? We’ll need two different “maps”: a map of the Kotlin compiler and a map of compiler plugin architecture.</p><p><strong>Note: </strong>This may mix up parts of the compiler phases with the Analysis API, which is related but not exactly the same as the compiler pipeline. I’m still working through this, especially with the resolution phase. However, compiler testing offers a good look into how it works, even if the Analysis API concepts are more advanced. Find the Analysis API documentation <a href="https://github.com/JetBrains/kotlin/blob/master/docs/analysis/analysis-api/analysis-api.md">here</a>.</p><p>Further insights on Analysis API or corrections would be greatly welcomed— DM me on the KotlinLang Slack! I expect further explanations and clarifications in the future as my understanding solidifies.</p><p><em>Dec. 19, 2024 Note: Roles performed at different phases for the Compose compiler plugin are subject to changes. The functionality of the compiler may also change over time.</em></p><h4>The Kotlin compiler</h4><p>Discussions on compiler plugins are best understood within the context of the compiler itself. It’s dangerous to go alone! It may be helpful to open these resources on the side while navigating this article.</p><ul><li><a href="https://github.com/ahinchman1/Kotlin-Compiler-Crash-Course">GitHub - ahinchman1/Kotlin-Compiler-Crash-Course: A repository of helpful sources to figure out what the Kotlin compiler really is</a></li><li><a href="https://medium.com/google-developer-experts/crash-course-on-the-kotlin-compiler-k1-k2-frontends-backends-fe2238790bd8">Crash Course on the Kotlin Compiler | K1 + K2 Frontends, Backends</a></li><li><a href="https://kotlinlang.org/docs/k2-compiler-migration-guide.html">K2 compiler migration guide | Kotlin</a></li></ul><p>It’s helpful to know the general overall architecture of the Kotlin compiler. For this article, we will deep-dive into the compiler frontend.</p><p>The Kotlin compiler frontend has 2 current versions: a newer and older frontend. We will work with the newer frontend, referenced as the FIR frontend (or <a href="https://kotlinlang.org/docs/k2-compiler-migration-guide.html">k2 compiler</a>). Based on my notes, this is my latest rendering of the k2 compiler:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*HRzgjyMFTYWPCDK6.png" /><figcaption>Kotlin Compiler — FIR Frontend (2023). For more see <a href="https://github.com/ahinchman1/Kotlin-Compiler-Crash-Course">here</a></figcaption></figure><p>In terms of oversimplification: the compiler scans the code repeatedly to create new data formats and continues to augment itself to create a more complete picture.</p><p>In a grosser oversimplification- the compiler repeatedly completes these two actions:</p><ul><li><strong>compiles: </strong>compiles data into a new format</li><li><strong>lowers:</strong> Sometimes simplifies and optimizes an existing data format. Sometimes, data is added to the existing structure to calculate compiler analysis.</li></ul><p>Now that we have a basic, general idea and map of the Kotlin compiler, let’s look at how compiler plugins fit into a compiler. Then, we can lift the hood under the Compose compiler plugin to see what we’re working with.</p><h4>Compiler Plugin Architecture</h4><p>One of the most straightforward explanations of compiler plugin architecture is best summarized by <a href="https://www.youtube.com/watch?v=w-GMlaziIyo&amp;ab_channel=JetBrains">Kevin Most</a> in his 2018 talk on Kotlin compiler plugins:</p><figure><img alt="Plugin Architecture -&gt; encapsulated on top by Gradle is “Plugin” and “Subplugin”. Encapsulated underneath under the Kotlin logo is “CommandLineProcessor” followed by “Component Registrar” followed by a set of “Extensions” underneath." src="https://cdn-images-1.medium.com/max/1024/1*yt8ZTyyY9qXtyabBeqnk5Q.png" /><figcaption>KotlinConf 2018 — Writing Your First Compiler Plugin by Kevin Most. Watch the full talk <a href="https://www.youtube.com/watch?v=w-GMlaziIyo&amp;ab_channel=JetBrains">here</a>.</figcaption></figure><p>But if you don’t have time to watch a 45-minute talk, I wrote down a quick summary here to help us create a “mental map” of how to navigate our compiler plugin:</p><pre><strong>Plugin</strong><br>- Gradle API (totally unrelated to Kotlin)<br>- Provides an entry point from build.gradle script<br>- Allows configuration via Gradle extensions<br><br><strong>Subplugin</strong><br>- Interface between Gradle and Kotlin API<br>- Read Gradle extension options<br>- Write out Kotlin SubpluginOptions<br>- Define the compiler plugin&#39;s ID (internal unique key)<br>- Define the Kotlin plugin&#39;s Maven coordinates so the compiler can download it<br><br><strong>CommandLineProcessor</strong><br>- Reads kotlinc -Xplugin args<br>- Subplugin options actually get passed through this pipeline<br>- Write CompilerConfigurationKeys<br><br><strong>ComponentRegistrar</strong><br>- Read CompilerConfigurationKeys<br><br><strong>Extensions</strong><br><strong>- Hooks in to phases of the compiler to intercept default behavior i.e.</strong><br>    - ExpressionCodegenExpression<br>    - ClassBuilderInterceptorExtension<br>    - StorageComponentContainerContribtor<br>    - IrGenerationExtension</pre><p>Using these “maps” of a compiler plugin architecture and the Kotlin compiler, we are ready to venture into the Compose compiler plugin code.</p><h3>Lifting the hood the Compose compiler plugin</h3><p>The <a href="https://github.com/JetBrains/kotlin/tree/b83d5a465e394ba134e0de1e994d005c54da4fe4/plugins/compose">Compose compiler plugin</a> has moved from Androidx over to the Kotlin repository. If we open up the file system and drill down to the source code, we can see the following files and folders:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/305/1*gynlPz5kD_WLdys1Awxubg.png" /></figure><p>The quickest way to figure out where we should break down these parts into frontend/backend responsibilities.</p><ul><li><a href="https://github.com/JetBrains/kotlin/tree/b83d5a465e394ba134e0de1e994d005c54da4fe4/plugins/compose/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/analysis">/analysis</a> — Despite the confusing naming, this kind of analysis is reserved for the <strong>backend</strong>, since analysis is done on IR data. Classes stored in this folder appear to determine stability for Compose performance. Documentation of this feature is found <a href="https://developer.android.com/develop/ui/compose/performance/stability">here</a>.</li><li><a href="https://github.com/JetBrains/kotlin/tree/b83d5a465e394ba134e0de1e994d005c54da4fe4/plugins/compose/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/inference">/inference</a> — Used for both <strong>frontend</strong> and <strong>backend, </strong>related to Applier inferencing. Remember, an Applier in Compose applies tree-based operations that emit during a Composition. <a href="https://github.com/JetBrains/kotlin/blob/b83d5a465e394ba134e0de1e994d005c54da4fe4/plugins/compose/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/inference/ApplierInferencer.kt">ApplierInference</a> can be used with frontend AST or backend IR. This package also contains Schemes and Bindings/CallBindings, which help to create rules around how to bind tokens together.</li><li><a href="https://github.com/JetBrains/kotlin/tree/b83d5a465e394ba134e0de1e994d005c54da4fe4/plugins/compose/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/k1">/k1</a> — classes intended to intercept the original K1 <strong>frontend</strong> compiler</li><li><a href="https://github.com/JetBrains/kotlin/tree/b83d5a465e394ba134e0de1e994d005c54da4fe4/plugins/compose/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/k2">/k2</a> — classes intended to intercept the new K2 (FIR) <strong>frontend</strong> compiler</li><li><a href="https://github.com/JetBrains/kotlin/tree/b83d5a465e394ba134e0de1e994d005c54da4fe4/plugins/compose/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/lower">/lower </a>— backend portion to lower IR data, not covered in this article</li></ul><p>We also have a list of classes located at the top level:</p><ul><li><a href="https://github.com/JetBrains/kotlin/blob/b83d5a465e394ba134e0de1e994d005c54da4fe4/plugins/compose/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/BuildMetrics.kt">BuildMetrics.kt</a> — Metrics and logging for Compose plugin reports</li><li><a href="https://github.com/JetBrains/kotlin/blob/b83d5a465e394ba134e0de1e994d005c54da4fe4/plugins/compose/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/ComposeFqNames.kt">ComposeFqNames.kt</a> — Fully qualified names for Composable classes along with some extension IR functions</li><li><a href="https://github.com/JetBrains/kotlin/blob/b83d5a465e394ba134e0de1e994d005c54da4fe4/plugins/compose/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/ComposeIrGenerationExtension.kt">ComposeIrGenerationExtension.kt</a> — Intercepts IR generation in the backend for Compose-specific behaviors.</li><li><a href="https://github.com/JetBrains/kotlin/blob/b83d5a465e394ba134e0de1e994d005c54da4fe4/plugins/compose/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/ComposeIrGenerationExtension.kt">ComposeNames.kt </a>— A dictionary of names for checking IR values in the backend.</li><li><a href="https://github.com/JetBrains/kotlin/blob/b83d5a465e394ba134e0de1e994d005c54da4fe4/plugins/compose/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/ComposePlugin.kt">ComposePlugin.kt</a> — the entry point for the Compose compiler plugin. Check your compose compiler architecture map with this, you may be able to line a few things up here.</li><li><a href="https://github.com/JetBrains/kotlin/blob/b83d5a465e394ba134e0de1e994d005c54da4fe4/plugins/compose/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/WeakBindingTrace.kt">WeakBindingTrace.kt</a> — According to class documentation: “This class is meant to have the shape of a BindingTrace object that could exist and flow through the Psi2Ir -&gt; Ir phase, but doesn’t currently exist”. PSI → IR transformation implies this class relates to K1 compiler functions.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*O4iDiyY8qgvmbWyd.png" /><figcaption>Read more on K1 v. K2 compilers <a href="https://medium.com/google-developer-experts/crash-course-on-the-kotlin-compiler-k1-k2-frontends-backends-fe2238790bd8">here</a></figcaption></figure><h3>What does the Compose compiler plugin intercept?</h3><p>Like other compiler plugins, the Jetpack Compose plugin can and does intercept compilation behavior both frontend and backend of the Kotlin compiler(s).</p><p>If we look at the main entry class <a href="https://github.com/JetBrains/kotlin/blob/b83d5a465e394ba134e0de1e994d005c54da4fe4/plugins/compose/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/ComposePlugin.kt">ComposePlugin.kt</a>, and scroll down to the registered extension functions where the ComposePluginRegistrar is located, we see the following</p><pre>    override fun ExtensionStorage.registerExtensions(configuration: CompilerConfiguration) {<br>        if (checkCompilerConfiguration(configuration)) {<br>            val usesK2 = configuration.languageVersionSettings.languageVersion.usesK2<br>            val descriptorSerializerContext =<br>                if (usesK2) null<br>                else ComposeDescriptorSerializerContext()<br><br>            registerCommonExtensions(descriptorSerializerContext) &lt;---<br><br>            IrGenerationExtension.registerExtension(<br>                createComposeIrExtension(<br>                    configuration,<br>                    descriptorSerializerContext<br>                )<br>            )<br><br>            if (!usesK2) {<br>                registerNativeExtensions(descriptorSerializerContext!!)<br>            }<br>        }<br>    }</pre><p>Remember, we’re interested in looking at the frontend. IR implies the backend, so if we scroll down to registerCommonExtensions(...), we see the following code:</p><pre>    fun ExtensionStorage.registerCommonExtensions(<br>            composeDescriptorSerializerContext: ComposeDescriptorSerializerContext? = null,<br>        ) {<br>            StorageComponentContainerContributor.registerExtension(<br>                ComposableCallChecker()<br>            )<br>            StorageComponentContainerContributor.registerExtension(<br>                ComposableDeclarationChecker()<br>            )<br>            StorageComponentContainerContributor.registerExtension(<br>                ComposableTargetChecker()<br>            )<br>            DiagnosticSuppressor.registerExtension(ComposeDiagnosticSuppressor())<br>            @Suppress(&quot;OPT_IN_USAGE_ERROR&quot;)<br>            TypeResolutionInterceptor.registerExtension(<br>                ComposeTypeResolutionInterceptorExtension()<br>            )<br>            DescriptorSerializerPlugin.registerExtension(<br>                ClassStabilityFieldSerializationPlugin(<br>                    composeDescriptorSerializerContext?.classStabilityInferredCollection<br>                )<br>            )<br>            FirExtensionRegistrarAdapter.registerExtension(ComposeFirExtensionRegistrar())<br>        }</pre><p>The following classes have been registered extensions as common extensions in the frontend. Checking what these classes extend can give us some hints on where in the compiling process these steps may reside:</p><ul><li><a href="https://github.com/JetBrains/kotlin/blob/b83d5a465e394ba134e0de1e994d005c54da4fe4/plugins/compose/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/k2/ComposableCallChecker.kt">ComposableCallChecker.kt</a> — extends FirExpressionChecker in package org.jetbrains.kotlin.fir.analysis.checkers.expression</li><li><a href="https://github.com/JetBrains/kotlin/blob/b83d5a465e394ba134e0de1e994d005c54da4fe4/plugins/compose/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/k1/ComposableDeclarationChecker.kt">ComposableDeclarationChecker.kt</a> — extends DeclarationChecker in package org.jetbrains.kotlin.resolve.checkers</li><li><a href="https://github.com/JetBrains/kotlin/blob/b83d5a465e394ba134e0de1e994d005c54da4fe4/plugins/compose/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/k1/ComposableTargetChecker.kt">ComposableTargetChecker.kt</a> — extends CallChecker in package org.jetbrains.kotlin.resolve.calls.checkers</li><li><a href="https://github.com/JetBrains/kotlin/blob/b83d5a465e394ba134e0de1e994d005c54da4fe4/plugins/compose/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/k1/ComposeDiagnosticSuppressor.kt">ComposableDiagnosticSupressor.kt</a> —</li><li><a href="https://github.com/JetBrains/kotlin/blob/7b6219e875ee553b9860afc1e6d07b097dd59841/plugins/compose/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/k2/ComposeFirExtensions.kt#L35">ComposeFirExtensions.kt</a>— Intended for K2 serialization formats needed to turn a KComposable type for FIR data format type.</li></ul><p>Conveniently, we can spot these particular classes in both the k1 and k2 packages. I’m assuming we still use some of the registered extensions found in k1 for k2.</p><figure><img alt="K1: [AnnotationUtils.kt, ComposableCallChecker.kt, ComposableDeclaration.kt, ComposableTargetChecker.kt, ComposeDescriptorSerializerContext.kt, ComposeDiagnosticSupressor.kt, ComposeErrorMessages.kt, ComposeTypeResolutionInterceptorExtension.kt, FrontendWritableSlices.kt]. K2 [ComposableCallChecker.kt, ComposableCallableReferenceChecker.kt, ComposableFunctionChecker.kt, ComposablePropertyChecker.kt, ComposeErrorMessages.kt, ComposeErrors.kt, ComposeFirExtensions.kt, FirUtils.kt]" src="https://cdn-images-1.medium.com/max/410/1*i5uk_4VYsuGYNtGZTz2JVQ.png" /><figcaption>Screenshot of k1 and k2 from the compose compiler plugin.</figcaption></figure><p>Now that we have reviewed the contents of the Compose compiler plugin itself, we can use the compiler plugin to figure out what intercepts where when running through portions of the Compiler phases.</p><p>Remember, compiler plugins can hook into any part of the Kotlin compiler. If we run code through the compiler which configures the Gradle plugin, we can simultaneously see:</p><ul><li>How the code moves through the compiler as it compiles and lowers the data</li><li>How the Compose compiler plugin intercepts and extends certain phases of the Kotlin compiler to modify compiling behavior</li></ul><p>Let us revisit our original question. Suppose we write the following code in our IDE, and we have configured the Compose dependency into our project:</p><pre>@Composable fun HelloWorld() { Text(&quot;Hello!&quot;) }</pre><p>Let’s trace this code mentally through our map of the Kotlin compiler. I did this through Kotlin compiler FIR testing. We leave debugging points in the intercepting compiler plugin classes and trace back in the call stack to where the original phases lie in the compiler. A forensics expedition, if you will.</p><h3>Parsing Phase</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/470/1*z7yRVhU09QWRulPS2Y7hHA.png" /><figcaption>Parsing is responsible for the checking of syntactic correctness in PSI trees.</figcaption></figure><p>First, your source code is broken down into lexical tokens and turned into PSI trees after.</p><p>During Lexer Analysis, the Compose plugin adds to the definition of tokens telling the compiler to “look out for these additional keywords” like @Composable. These tokens are broken down and then assembled in PSI trees.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZKTMMUzgAq15R7yCu3oXGA.png" /><figcaption>The PSI Viewer Plugin is available on Android Studio and IntelliJ to view how code translates into PSI trees.</figcaption></figure><p>PSI tells us what code has been written by the end user, and whether the syntax is grammatically correct: but it cannot tell whether the code compiles, what tokens are types, what tokens are arguments, etc.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Z5E09cTDS5iMn5Wx-NApwQ.png" /></figure><h3>Codegen PSI → FIR</h3><p>In the K2 compiler, code generation takes the PSI trees to create RawFIR. FIR stands for <em>Frontend Intermediate Representation: </em>the initial version created is the raw version.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/489/1*2GPYZxrKZkscYkXU5DZEXA.png" /><figcaption>After PSI trees are created, the compiler compiles the data into a RawFIR format.</figcaption></figure><p>The PSITree created from</p><pre>@Composable fun HelloWorld() { Text(&quot;Hello!&quot;) }</pre><p>now becomes a different data format:</p><pre><br>RAW_FIR:<br>FILE: [ResolvedTo(RAW_FIR)] typeParameterOfClass2.kt<br>    @Composable[ResolvedTo(RAW_FIR)]() public? final? [ResolvedTo(RAW_FIR)] fun HelloWorld(): R|kotlin/Unit| { LAZY_BLOCK }</pre><p>Remember how I mentioned that the compiler will scan itself repeatedly to keep building on itself? The same is also true for RawFIR in order for it to become FIR.</p><p>When the RawFIR runs through the resolution phase, the analysis it creates augments the existing structure with semantic information to create a more complete picture.</p><h3>Resolution Phase</h3><p>In resolution, the heaviest work lies in creating relationships for these FIR elements: static analysis, type verification, diagnostics, IDE warning messages, etc. The Compose plugin performs some of its heavier function interceptions here, particularly in diagnostics (checkers).</p><p>The first phase in resolution is <em>semantic analysis </em>on the RawFIR to generate additional relational data.<em> </em>RawFIR is augmented with this information, and then analysis is conducted for checks for verification and type-checking and more.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/766/1*FiHoFZO9hw0lA_rq5qsB6w.png" /><figcaption>RawFIR runs through the Resolution phase: first in the analysis phase to augment the RawFIR with additional information, then runs through the <em>resolve phase to ensure the code will compile.</em></figcaption></figure><p><a href="https://github.com/JetBrains/kotlin/blob/b83d5a465e394ba134e0de1e994d005c54da4fe4/plugins/compose/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/k1/ComposeTypeResolutionInterceptorExtension.kt">ComposableTypeResolutionInterceptorExtension</a> intercepts type resolution to infer Composable types by examining PSI and their descriptors and adding on to the descriptors. If lambda is marked as a @Composable, then the inferred type for the literal function should become a Kotlin @Composable type.</p><pre>import androidx.compose.runtime.Composable<br><br>val lambda: @Composable() -&gt; Unit? = { }<br><br>@Composable<br>fun HelloWorld(content: @Composable () -&gt; Unit) {<br>   content<br>}</pre><p>This phase also generates <em>descriptors,</em> containing useful information like type resolution, modifiers, and control flow. Descriptors can be used for more complicated evaluations that require more information about their relationships (other files, imports, declarations, diagnostics, etc. later on while checking compiler findings). With the augmented information created during resolution, previously generated RawFIR:</p><pre>RAW_FIR:<br>FILE: [ResolvedTo(RAW_FIR)] typeParameterOfClass2.kt<br>    @Composable[ResolvedTo(RAW_FIR)]() public? final? [ResolvedTo(RAW_FIR)] fun HelloWorld(): R|kotlin/Unit| { LAZY_BLOCK }</pre><p>Now becomes:</p><pre>FUN name:HelloWorld visibility:public modality:FINAL &lt;&gt; ($composer:androidx.compose.runtime.Composer?, $changed:kotlin.Int) returnType:kotlin.Unit<br>      annotations:<br>        Composable<br>        ComposableTarget(applier = &quot;androidx.compose.ui.UiComposable&quot;)<br>      VALUE_PARAMETER name:$composer index:0 type:androidx.compose.runtime.Composer? [assignable]<br>      VALUE_PARAMETER name:$changed index:1 type:kotlin.Int<br>      BLOCK_BODY<br>        BLOCK type=kotlin.Unit origin=null<br>          SET_VAR &#39;$composer: androidx.compose.runtime.Composer? [assignable] declared in home.HelloWorld&#39; type=kotlin.Unit origin=null<br>            CALL &#39;public abstract fun startRestartGroup (key: kotlin.Int): androidx.compose.runtime.Composer declared in androidx.compose.runtime.Composer&#39; type=androidx.compose.runtime.Composer origin=null<br>              $this: GET_VAR &#39;$composer: androidx.compose.runtime.Composer? [assignable] declared in home.HelloWorld&#39; type=androidx.compose.runtime.Composer? origin=null<br>              key: CONST Int type=kotlin.Int value=-4391552<br>          CALL &#39;public final fun sourceInformation (composer: androidx.compose.runtime.Composer, sourceInformation: kotlin.String): kotlin.Unit declared in androidx.compose.runtime&#39; type=kotlin.Unit origin=null<br>            composer: GET_VAR &#39;$composer: androidx.compose.runtime.Composer? [assignable] declared in home.HelloWorld&#39; type=androidx.compose.runtime.Composer? origin=null<br>            sourceInformation: CONST String type=kotlin.String value=&quot;C(HelloWorld)105@511L19:main.kt#1wrmn&quot;<br>        WHEN type=kotlin.Unit origin=IF<br>          BRANCH<br>            if: WHEN type=kotlin.Boolean origin=OROR<br>              BRANCH<br>                if: CALL &#39;public final fun not (): kotlin.Boolean [operator] declared in kotlin.Boolean&#39; type=kotlin.Boolean origin=null<br>                  $this: CALL &#39;public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir&#39; type=kotlin.Boolean origin=null<br>                    arg0: GET_VAR &#39;$changed: kotlin.Int declared in home.HelloWorld&#39; type=kotlin.Int origin=null<br>                    arg1: CONST Int type=kotlin.Int value=0<br>                then: CONST Boolean type=kotlin.Boolean value=true<br>              BRANCH<br>                if: CONST Boolean type=kotlin.Boolean value=true<br>                then: CALL &#39;public final fun not (): kotlin.Boolean [operator] declared in kotlin.Boolean&#39; type=kotlin.Boolean origin=null<br>                  $this: CALL &#39;public abstract fun &lt;get-skipping&gt; (): kotlin.Boolean declared in androidx.compose.runtime.Composer&#39; type=kotlin.Boolean origin=null<br>                    $this: GET_VAR &#39;$composer: androidx.compose.runtime.Composer? [assignable] declared in home.HelloWorld&#39; type=androidx.compose.runtime.Composer? origin=null<br>            then: BLOCK type=kotlin.Unit origin=null<br>              WHEN type=kotlin.Unit origin=IF<br>                BRANCH<br>                  if: CALL &#39;public final fun isTraceInProgress (): kotlin.Boolean declared in androidx.compose.runtime&#39; type=kotlin.Boolean origin=null<br>                  then: CALL &#39;public final fun traceEventStart (key: kotlin.Int, dirty1: kotlin.Int, dirty2: kotlin.Int, info: kotlin.String): kotlin.Unit declared in androidx.compose.runtime&#39; type=kotlin.Unit origin=null<br>                    key: CONST Int type=kotlin.Int value=-4391552<br>                    dirty1: GET_VAR &#39;$changed: kotlin.Int declared in home.HelloWorld&#39; type=kotlin.Int origin=null<br>                    dirty2: CONST Int type=kotlin.Int value=-1<br>                    info: CONST String type=kotlin.String value=&quot;home.HelloWorld (main.kt:104)&quot;<br>              CALL &#39;public final fun BasicText (text: kotlin.String, modifier: androidx.compose.ui.Modifier?, style: androidx.compose.ui.text.TextStyle?, onTextLayout: kotlin.Function1&lt;androidx.compose.ui.text.TextLayoutResult, kotlin.Unit&gt;?, overflow: androidx.compose.ui.text.style.TextOverflow, softWrap: kotlin.Boolean, maxLines: kotlin.Int, minLines: kotlin.Int, color: androidx.compose.ui.graphics.ColorProducer?, $composer: androidx.compose.runtime.Composer?, $changed: kotlin.Int, $default: kotlin.Int): kotlin.Unit declared in androidx.compose.foundation.text&#39; type=kotlin.Unit origin=null<br>                text: CONST String type=kotlin.String value=&quot;Hello!&quot;<br>                modifier: COMPOSITE type=kotlin.Nothing? origin=DEFAULT_VALUE<br>                  CONST Null type=kotlin.Nothing? value=null<br>                style: COMPOSITE type=kotlin.Nothing? origin=DEFAULT_VALUE<br>                  CONST Null type=kotlin.Nothing? value=null<br>                onTextLayout: COMPOSITE type=kotlin.Nothing? origin=DEFAULT_VALUE<br>                  CONST Null type=kotlin.Nothing? value=null<br>                overflow: COMPOSITE type=androidx.compose.ui.text.style.TextOverflow origin=DEFAULT_VALUE<br>                  CALL &#39;public final fun &lt;unsafe-coerce&gt; &lt;T, R&gt; (v: T of kotlin.jvm.internal.&lt;unsafe-coerce&gt;): R of kotlin.jvm.internal.&lt;unsafe-coerce&gt; declared in kotlin.jvm.internal&#39; type=androidx.compose.ui.text.style.TextOverflow origin=null<br>                    &lt;T&gt;: kotlin.Int<br>                    &lt;R&gt;: androidx.compose.ui.text.style.TextOverflow<br>                    v: CONST Int type=kotlin.Int value=0<br>                softWrap: COMPOSITE type=kotlin.Boolean origin=DEFAULT_VALUE<br>                  CONST Boolean type=kotlin.Boolean value=false<br>                maxLines: COMPOSITE type=kotlin.Int origin=DEFAULT_VALUE<br>                  CONST Int type=kotlin.Int value=0<br>                minLines: COMPOSITE type=kotlin.Int origin=DEFAULT_VALUE<br>                  CONST Int type=kotlin.Int value=0<br>                color: COMPOSITE type=kotlin.Nothing? origin=DEFAULT_VALUE<br>                  CONST Null type=kotlin.Nothing? value=null<br>                $composer: GET_VAR &#39;$composer: androidx.compose.runtime.Composer? [assignable] declared in home.HelloWorld&#39; type=androidx.compose.runtime.Composer? origin=null<br>                $changed: CONST Int type=kotlin.Int value=6<br>                $default: CONST Int type=kotlin.Int value=510<br>              WHEN type=kotlin.Unit origin=IF<br>                BRANCH<br>                  if: CALL &#39;public final fun isTraceInProgress (): kotlin.Boolean declared in androidx.compose.runtime&#39; type=kotlin.Boolean origin=null<br>                  then: CALL &#39;public final fun traceEventEnd (): kotlin.Unit declared in androidx.compose.runtime&#39; type=kotlin.Unit origin=null<br>          BRANCH<br>            if: CONST Boolean type=kotlin.Boolean value=true<br>            then: CALL &#39;public abstract fun skipToGroupEnd (): kotlin.Unit declared in androidx.compose.runtime.Composer&#39; type=kotlin.Unit origin=null<br>              $this: GET_VAR &#39;$composer: androidx.compose.runtime.Composer? [assignable] declared in home.HelloWorld&#39; type=androidx.compose.runtime.Composer? origin=null<br>        BLOCK type=kotlin.Unit origin=null<br>          BLOCK type=kotlin.Unit origin=SAFE_CALL<br>            VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:androidx.compose.runtime.ScopeUpdateScope? [val]<br>              CALL &#39;public abstract fun endRestartGroup (): androidx.compose.runtime.ScopeUpdateScope? declared in androidx.compose.runtime.Composer&#39; type=androidx.compose.runtime.ScopeUpdateScope? origin=null<br>                $this: GET_VAR &#39;$composer: androidx.compose.runtime.Composer? [assignable] declared in home.HelloWorld&#39; type=androidx.compose.runtime.Composer? origin=null<br>            WHEN type=kotlin.Unit origin=IF<br>              BRANCH<br>                if: CALL &#39;public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir&#39; type=kotlin.Boolean origin=null<br>                  arg0: GET_VAR &#39;val tmp_0: androidx.compose.runtime.ScopeUpdateScope? [val] declared in home.HelloWorld&#39; type=androidx.compose.runtime.ScopeUpdateScope? origin=null<br>                  arg1: CONST Null type=kotlin.Any? value=null<br>                then: CONST Null type=kotlin.Any? value=null<br>              BRANCH<br>                if: CONST Boolean type=kotlin.Boolean value=true<br>                then: CALL &#39;public abstract fun updateScope (block: kotlin.Function2&lt;androidx.compose.runtime.Composer, kotlin.Int, kotlin.Unit&gt;): kotlin.Unit declared in androidx.compose.runtime.ScopeUpdateScope&#39; type=kotlin.Unit origin=null<br>                  $this: GET_VAR &#39;val tmp_0: androidx.compose.runtime.ScopeUpdateScope? [val] declared in home.HelloWorld&#39; type=androidx.compose.runtime.ScopeUpdateScope? origin=null<br>                  block: FUN_EXPR type=kotlin.Function2&lt;androidx.compose.runtime.Composer?, kotlin.Int, kotlin.Unit&gt; origin=LAMBDA<br>                    FUN LOCAL_FUNCTION_FOR_LAMBDA name:&lt;anonymous&gt; visibility:local modality:FINAL &lt;&gt; ($composer:androidx.compose.runtime.Composer?, $force:kotlin.Int) returnType:kotlin.Unit<br>                      VALUE_PARAMETER name:$composer index:0 type:androidx.compose.runtime.Composer?<br>                      VALUE_PARAMETER name:$force index:1 type:kotlin.Int<br>                      BLOCK_BODY<br>                        RETURN type=kotlin.Nothing from=&#39;local final fun &lt;anonymous&gt; ($composer: androidx.compose.runtime.Composer?, $force: kotlin.Int): kotlin.Unit declared in home.HelloWorld&#39;<br>                          CALL &#39;public final fun HelloWorld ($composer: androidx.compose.runtime.Composer?, $changed: kotlin.Int): kotlin.Unit declared in home&#39; type=kotlin.Unit origin=null<br>                            $composer: GET_VAR &#39;$composer: androidx.compose.runtime.Composer? declared in home.HelloWorld.&lt;anonymous&gt;&#39; type=androidx.compose.runtime.Composer? origin=null<br>                            $changed: CALL &#39;internal final fun updateChangedFlags (flags: kotlin.Int): kotlin.Int declared in androidx.compose.runtime&#39; type=kotlin.Int origin=null<br>                              flags: CALL &#39;public final fun or (other: kotlin.Int): kotlin.Int [infix] declared in kotlin.Int&#39; type=kotlin.Int origin=null<br>                                $this: GET_VAR &#39;$changed: kotlin.Int declared in home.HelloWorld&#39; type=kotlin.Int origin=null<br>                                other: CONST Int type=kotlin.Int value=1</pre><p>We now have enough information to infer diagnostic compiler findings. This is where checkers come in. In the Compose compiler plugin, <a href="https://github.com/JetBrains/kotlin/blob/7b6219e875ee553b9860afc1e6d07b097dd59841/plugins/compose/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/k2/ComposableCallChecker.kt">ComposableCallChecker</a> and <a href="https://github.com/JetBrains/kotlin/blob/7b6219e875ee553b9860afc1e6d07b097dd59841/plugins/compose/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/k1/ComposableDeclarationChecker.kt">ComposableDeclarationChecker</a> will be added to the “correct syntax definitions” as defined by FIR elements.</p><p><a href="https://github.com/JetBrains/kotlin/blob/7b6219e875ee553b9860afc1e6d07b097dd59841/plugins/compose/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/k1/ComposableCallChecker.kt">ComposableCallChecker</a> sets the rules for what functions can legally call other Composable functions. It analyzes the augmented FIR for lambda expression types to validate if a certain call fits the constraints of the contracts defined in Compose. This call checker extension can validate that Composable types may only be called from other Composable types.</p><p>The resolution phase determines control flow and type refinement, type inferencing, and so on. So for example, resolving can tell us which of the following compiles (in human-readable format):</p><pre>import androidx.compose.material.Text<br>import androidx.compose.runtime.Composable</pre><pre><strong>// compiles</strong><br>@Composable fun HelloWorld() { Text(&quot;Hello!&quot;) }</pre><pre><strong>// compiles</strong><br>val lambdaInvo1 = <strong>@Composable</strong> { HelloWorld() }</pre><pre><strong>// compiles</strong><br>val lambdaInvo2: <strong>@Composable (()-&gt;Unit)</strong> = { HelloWorld() }</pre><p>The compiler plugin forces the Kotlin compiler to now ask “Is the lambda invocation marked Composable?”. If not, then the contract defined by the Compose compiler plugin has been violated, and the resolution phase calculates error messages for diagnostics to show.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9o_47H9NljJrE-OnTKsK3w.png" /><figcaption>Error messaging shows up that @Composable innovations can only happen from the context of a Composable function</figcaption></figure><p><a href="https://github.com/JetBrains/kotlin/blob/7b6219e875ee553b9860afc1e6d07b097dd59841/plugins/compose/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/k1/ComposableDeclarationChecker.kt">ComposableDeclarationChecker</a> takes a similar approach looking at the PSI and its properties to determine proper rules for Compose around top-level declarations, class members, and local declarations within (functions, values, etc). For example, Compose wants to ensure that main functions are not accidentally marked as a Composable type!</p><pre>import androidx.compose.runtime.Composable</pre><pre><strong>@Composable<br>fun main(args: Array&lt;String&gt;)</strong> {<strong> // does <em>not</em> compile! </strong><br>    print(args)<br>}</pre><p>After RawFIR runs through the Resolution phase, the FIR is transformed to backend IR, which becomes input for the backend.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/414/1*bKCRpD4U-4R4XrrIeHAXzg.png" /><figcaption>After analysis completes to create a complete FIR, FIR is generated and compiled into IR data format for the backend or for IDE plugins.</figcaption></figure><h4>Diagnostics after Resolution sent to the IDE</h4><p>After the Resolution phase, FIR can be sent to the IDE plugin to give you immediate feedback in the IDE, and/or the backend of the Kotlin compiler. IDE plugins are out of the scope for today, as those are different from compiler plugins.</p><p>The resulting FIR sends information to the corresponding IDE plugin so that we can see the error in real-time— but the most important thing to understand is that your IDE reacting to the code you write in real time is repetitively running the analysis/resolution to be able to produce these results.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lPvr3ZBFXn_K2tAgipt4Qw.png" /><figcaption>Screenshot of Android Studio showing the IDE Plugin counterpart for the same exact main function. The “main” keyword has a red squiggly line and a modal pops up saying “Composable main functions are not currently supported.”</figcaption></figure><p>Additionally, it’s worth noting<a href="https://github.com/JetBrains/kotlin/blob/b83d5a465e394ba134e0de1e994d005c54da4fe4/plugins/compose/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/k1/ComposeDiagnosticSuppressor.kt">ComposeDiagnosticSupressor</a> adds to the list of diagnostic warnings/errors to bypass certain language restrictions that would otherwise cause compilation to fail in Kotlin: namely, being able to annotate @Composable for higher-order functions to call another composable:</p><pre>@Composable<br>fun HelloWorld(content: <strong>@Composable (()-&gt;Unit)</strong>) { // compiles <br>   content<br>}</pre><p>Dense article, thanks for sticking with me through it! If you liked this article, let me know. With enough traction, I’ll add a blurb on running compiler FIR tests.</p><h3>Watch talks directly on this topic:</h3><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FwUGfuWHCqrc%3Fstart%3D2%26feature%3Doembed%26start%3D2&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DwUGfuWHCqrc&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FwUGfuWHCqrc%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/d1f24046ba02da10b79fa8abed7a9d0c/href">https://medium.com/media/d1f24046ba02da10b79fa8abed7a9d0c/href</a></iframe><p>Droidcon 2022 SF — Hitchiker’s Guide to Compose: Compilers, Composers, and Compiler Plugins: <a href="https://www.droidcon.com/2022/06/28/ha-hitchhikers-guide-to-compose-compiler-composers-compiler-plugins-and-snapshots/">https://www.droidcon.com/2022/06/28/ha-hitchhikers-guide-to-compose-compiler-composers-compiler-plugins-and-snapshots/</a></p><h3>Additional resources</h3><ul><li>Access additional compiler scratch notes on <a href="https://patreon.com/AmandaHinchman?utm_medium=clipboard_copy&amp;utm_source=copyLink&amp;utm_campaign=creatorshare_creator&amp;utm_content=join_link">Patreon</a></li><li>Jetpack Compose source code — <a href="https://github.com/androidx/androidx/tree/androidx-main/compose">https://github.com/androidx/androidx/tree/androidx-main/compose</a></li><li><a href="https://github.com/androidx/androidx/tree/84d876fe251dcb7bb34a8dd0023f6fe59154d497/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/analysis">Frontend testing</a> for Compose</li><li><em>Jetpack Compose Internals </em>by Jorge Castillo — <a href="https://jorgecastillo.dev/book/">https://jorgecastillo.dev/book/</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=657162893b11" width="1" height="1" alt=""><hr><p><a href="https://medium.com/coding-kinetics/reverse-engineering-the-compose-compiler-plugin-intercepting-the-frontend-657162893b11">Reverse-Engineering the Compose Compiler Plugin: Intercepting the Frontend</a> was originally published in <a href="https://medium.com/coding-kinetics">Coding Kinetics</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Split Apart a Larger PR into Smaller Ones with Git]]></title>
            <link>https://medium.com/coding-kinetics/how-to-split-apart-a-larger-pr-into-smaller-ones-with-git-9d592a9a6bb1?source=rss----8e8c18dd036b---4</link>
            <guid isPermaLink="false">https://medium.com/p/9d592a9a6bb1</guid>
            <category><![CDATA[git]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[engineering]]></category>
            <dc:creator><![CDATA[Amanda Hinchman]]></dc:creator>
            <pubDate>Wed, 08 Apr 2026 01:17:42 GMT</pubDate>
            <atom:updated>2026-04-08T01:22:29.056Z</atom:updated>
            <content:encoded><![CDATA[<h4>The surgical method: Splitting PRs by file names</h4><p>So, you’ve let your PR get a little too big to review. Large PRs usually translate to longer review times, and teams usually dread looking at a PR with 50 review changes.</p><p>Maybe planning wasn’t so thorough, maybe the scope was larger than estimated. We’ve all been there! This is why I’ve written up a short guide on how to split PRs by the file.</p><p>This is especially helpful when you want to split apart refactors from your feature work to help get those reviews in faster.</p><h3>Move files to a new branch and PR</h3><ol><li>Go to your main development branch, pull, and check out a new branch</li></ol><pre>git checkout development<br><br>git pull<br><br>git checkout -b new_branch</pre><p>2. Find Github PR number you want to pull from (i.e. in the case of the screenshot below, that would be #48)</p><figure><img alt="screenshot of GitHub PR that says WIP: AST Parsing Diagrams #48" src="https://cdn-images-1.medium.com/max/820/0*OiU9dKZ2lP8Uf6Fk" /><figcaption>Look for the number on the PR next to the title. In this case, it’s pr #48</figcaption></figure><p>3. Fetch the source of the PR .</p><pre>git fetch origin pull/48/head:pr-48 </pre><p>4. Navigate to new branch and copy files from PR. Don’t forget which files you moved, you’ll also need it to clean up later on the original branch</p><pre>git checkout new_branch<br><br>#list as many files as you want<br><br>git checkout pr-48 -- path/to/file1.kt  path/to/file2.kt path/to/file3.kt</pre><p>5. Make sure to add, commit, and push!</p><pre>git ls<br><br>git add .<br><br>git commit -m “insert message”<br><br>git push --set-upstream origin new_branch</pre><h3>Clean up your original branch by resetting the files you’ve moved</h3><p>6. Finally, you’ll want to reset your files back to your develop branch so you can shrink the number of files from your original PR</p><pre>git checkout old_branch<br><br># List all the files you just moved to the small PR<br><br>git checkout dev -- path/to/file1.kt  path/to/file2.kt path/to/file3.kt<br><br>git add .<br><br>git commit -m “reset files to dev since the following files have been moved to new_branch”<br><br>git push origin old_branch</pre><p>And that’s it! No more monster PRs, no more forever-running reviews. Happy coding!</p><h3>Looking for more content?</h3><p>This post was originally posted my <a href="https://www.patreon.com/cw/AmandaHinchman">Patreon</a> on in the form of a notecard:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*UBqkjmU6YmcgH5wD" /><figcaption>Notecard showing how to split apart a PR with doodles and similar instructions. See original post <a href="http://patreon.com/posts/138007920">here</a>.</figcaption></figure><p>To be the first to keep up with the latest field notes and research, join me on Patreon on <a href="https://www.patreon.com/cw/AmandaHinchman/membership">the Engineering Commons tier</a> for weekly updates.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9d592a9a6bb1" width="1" height="1" alt=""><hr><p><a href="https://medium.com/coding-kinetics/how-to-split-apart-a-larger-pr-into-smaller-ones-with-git-9d592a9a6bb1">How to Split Apart a Larger PR into Smaller Ones with Git</a> was originally published in <a href="https://medium.com/coding-kinetics">Coding Kinetics</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Lab Setup: Build & Publish Your First Web Page]]></title>
            <link>https://medium.com/coding-kinetics/lab-setup-build-publish-your-first-web-page-a16148fa21cb?source=rss----8e8c18dd036b---4</link>
            <guid isPermaLink="false">https://medium.com/p/a16148fa21cb</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[learning-to-code]]></category>
            <category><![CDATA[github]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[coding]]></category>
            <dc:creator><![CDATA[Amanda Hinchman]]></dc:creator>
            <pubDate>Tue, 11 Nov 2025 05:20:22 GMT</pubDate>
            <atom:updated>2026-04-06T02:16:19.612Z</atom:updated>
            <content:encoded><![CDATA[<h4>Beginner-Friendly Instructions: Lab Setup and Explanation on How Web Development Works</h4><p>Hello! Welcome to the Coding Kinetics <strong>HTML Workshop</strong>. In this blurb, you’ll learn how to set up your computer to follow along with upcoming Chicago Public Library workshops.</p><p>Looking to showcase your work? Instead of spending thousands to hire someone to build your site, why not learn to build it yourself? Trying to find ways to cut costs? New to programming and want to get a kickstart into tech? This workshop is the perfect opportunity to kickstart your tech career, cut costs, and gain new marketable skills.</p><ol><li>Understand how HTML &amp; CSS work together</li><li>Build a basic webpage from scratch.</li><li>Publish a webpage on GitHub to start your online code portfolio</li><li>Leave with confidence to continue their coding journey</li></ol><h4><strong>Who is this workshop for?</strong></h4><p>This workshop is open to all. No experience coding ever? Then this workshop is for you. Some common use-cases:</p><ul><li>Freelancers or entrepreneur building their own website</li><li>Creatives/nonprofit organizations looking to showcase work</li><li>Prospective programmers looking to get their foot in the door</li></ul><p>Use this article to complete your setup. However, be aware that the live workshop will delve into further topics not covered here.</p><h4>What is development?</h4><p>Development is the process of telling computers what to do using code. Code can be written in a single programming language or a combination of languages that work together.</p><p>For example, to create a website:</p><ol><li>Someone writes the code.</li><li>The code is deployed, so the website is visible online.</li></ol><p>And that is what we will be doing today!</p><h3><strong>Materials Needed</strong></h3><p>Workshop attendees will need access to a computer or to bring their own laptops. For web development, you need the following tools (all of which are free to use):</p><ul><li>Google Chrome or Microsoft Edge</li><li><a href="https://onecompiler.com/html">OneCompiler</a> — This allows you to write HTML and CSS files online. No account needed</li><li><a href="https://github.com/">GitHub</a> — You will need to create an account. This is where you can store code, documents, images, and create an online profile for your projects. This is what we will use to deploy</li><li><a href="https://github.com/Coding-Kinetics/html-workshop">GitHub Project</a> — Download a zip of the skeleton project using the Green “Code” Button on the page</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BOv5pEj89QCmbzQnm1sAdw.png" /><figcaption>Don’t worry about all the HTTPS/SSH/Github CLI stuff. That is for the terminal! Out of scope for this lesson, but if you’re interested in learning more, let me know in the comments.</figcaption></figure><h3>Lesson: Building a webpage, as an analogy</h3><p>Let’s take a moment to understand the ecosystem in web development via an analogy. Building a web page is much like building a house:</p><ul><li><strong>HTML </strong>— the foundation &amp; structure, the skeleton of the house.</li><li><strong>CSS </strong>— paints and decorates the house.</li><li><strong>JavaScript </strong>— plugs in the electricity &amp; plumbing for the house.</li><li><strong>Files and folders </strong>— rooms &amp; storage</li><li><strong>Web browsers/IDE</strong> — your window to the world</li></ul><p><strong>HTML </strong>stands for <strong>Hypertext Markup Language</strong>, the standard language used to create and structure pages. You can read more about HTML <a href="https://www.w3schools.com/html/html_intro.asp">here</a>.</p><p><strong>CSS </strong>is a different programming language, short for <strong>Cascading Style Sheets. </strong>One or more <a href="https://www.w3schools.com/css/css_intro.asp">CSS sheets</a> can be linked to the top of an HTML page, and you can use the same CSS sheet across multiple sheets. Then, you can style elements by type or individually, which we will cover later.</p><p><strong>JavaScript</strong> is a dynamically typed programming language that makes web pages more interactive via small scripts. A <strong>.JS </strong>file can also be linked in an HTML page. You will not learn JavaScript for the scope of this article, but if you’re interested in learning more, read more <a href="https://www.w3schools.com/whatis/whatis_js.asp">here</a>.</p><p>In a web dev project, <strong>Files and Folders</strong> refer to the structure in which you store your project. For a basic web page, you’ll need an <strong>index.html</strong> page at a bare minimum.</p><p>For this lab, you’ll be using a basic structure, where all stylesheets are stored in an <strong>/assets</strong> file. A single styles.css file sits there, but we can place other .css files or images to keep the project organized as it grows.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/632/1*AEJSRsZpBq8iOsCbBLT_Xg.png" /><figcaption>A README.md is the documentation that shows when you navigate to <a href="https://github.com/Coding-Kinetics/html-workshop/tree/main">https://github.com/Coding-Kinetics/html-workshop/</a>. Give it a try!</figcaption></figure><p>If you haven’t already, go ahead and download/fork a copy of the skeleton project from <a href="https://github.com/Coding-Kinetics/html-workshop/tree/main">https://github.com/Coding-Kinetics/html-workshop/</a>. You’ll want to create an account as well to upload and publish your own on your very own URL!</p><p>You will need an <strong>Integrated Development Environment (IDE) </strong>to build your webpage.<strong> </strong>This is a workspace that often offers an isolated workspace for viewing multiple files at once, and helps you write quality code.</p><h3>Workshop Slides</h3><ul><li>2-hour workshop: <a href="https://docs.google.com/presentation/d/145VWXtlVRgR2XeFCGq4OO3yuvNPpvRwIrbHhcMZam_8/edit?usp=sharing"><strong>https://docs.google.com/presentation/d/145VWXtlVRgR2XeFCGq4OO3yuvNPpvRwIrbHhcMZam_8/edit?usp=sharing</strong></a></li><li>4–8 hour workshop: <a href="https://docs.google.com/presentation/d/1jlAtRaqKXzFXLRStrTlqj1sWopml1N-lBtmmtT4O9n4/edit?usp=sharing"><strong>https://docs.google.com/presentation/d/1jlAtRaqKXzFXLRStrTlqj1sWopml1N-lBtmmtT4O9n4/edit?usp=sharing</strong></a></li></ul><h3>Lab Setup</h3><p>There are great programs you can download, like IntelliJ Community Edition or Sublime, which offer features like highlighting text and giving suggestions on how to fix your code.</p><p>Another option is to use this website to render your work: <a href="https://onecompiler.com/html">https://onecompiler.com/html</a>. It works great for writing a few files, and for the scope of this article.</p><h4>Choose your Path!</h4><ul><li><strong>Can you download programs on your computer?</strong> Download a free IDE like <a href="https://www.sublimetext.com/">https://www.sublimetext.com/</a>. Once downloaded, you’ll want to set up your screen in a half-and-half layout. The program takes one half, and your internet browser on the other. Just make sure to save your files before hitting the <strong>Refresh button </strong>on your web app.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EFaxCJtgEnDXQI39B_oCWA.png" /><figcaption>Any type of web application works!</figcaption></figure><ul><li><strong>Are you not able to download programs on your computer? Short on time? </strong>Use a web editor like <a href="https://onecompiler.com/html">https://onecompiler.com/html</a>.<strong> </strong>Copy and paste the code online, and you’ll do the same in GitHub when you’re ready to deploy your work. Set up your screen with the web editor on one side and GitHub open on the other. You’ll need the setup when you’re ready to commit your work!</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dkqHooAzLN0KDwcf-FJ1sw.png" /></figure><h3>Lab Part 1: Write Your First HTML Page</h3><p>We cover the basics of HTML as attendees start building the look of their website — the skeleton of the site. HTML elements are element wrappers, which present as a pattern of &lt;elem&gt;content here &lt;/elem&gt; where the closing tag &lt;/elem&gt; signifies the end of the element type.</p><h4>Headers, paragraphs, links</h4><p>Headers are represented by h1 , and are written in HTML like so:</p><pre>&lt;h1&gt;I am a header&lt;/h1&gt;</pre><p>Likewise, a paragraph can be represented with a &lt;p&gt;</p><pre>&lt;p&gt;I am a paragraph&lt;/p&gt;</pre><p>There are also clickable links you can create with &lt;a href=&quot;url.com&quot;&gt;&lt;/a&gt;. The tag href must always be included if you want the clickable link to go somewhere.</p><pre>&lt;a href=&quot;https://codingkinetics.com&quot;&gt;I am a clickable link&lt;/a&gt;</pre><h3>3. The Next Essential Step: Grouping Elements with &lt;div&gt;</h3><p>To build truly functional web pages, you must master the &lt;div&gt; tag, which allows you to group related content together. This skill is the foundation for creating complex layouts and applying styling consistently.</p><p>The full Coding Kinetics workshop provides a deep dive into this, where you will learn exactly how to use:</p><ul><li><strong>Grouping elements with </strong><strong>&lt;div&gt;</strong></li><li><strong>HTML Tags and Attributes</strong> for advanced control</li><li><strong>Assigning elements</strong> using id and class</li><li>The full, hands-on <strong>Challenge: Write your first web page!</strong></li></ul><p>The next part — getting your page published — isn’t as straightforward, but we’ve broken down the process into simple, beginner-friendly steps to make it accessible for you right now.</p><h3>Lab Part 2: <strong>Publish Your Web Page on GitHub</strong></h3><p>We now have enough to publish your work! We’ll do this by making a <em>commit</em>, or a save point, to an online project.</p><p>You will upload your project to your GitHub account and set it up to appear as a public-facing web page.</p><h4><em>What is GitHub?</em></h4><p>GitHub is an online platform that lets you save versions of your work for free using Git version control. This means developers can revert to previous versions, manage changes in parallel, and work together on code.</p><p>This lab does not cover how to use git extensively; to keep our scope smaller, we use the file uploads available on GitHub to manage our changes.</p><p>While we won’t really cover git, you can learn more about it here: <a href="https://git-scm.com/">https://git-scm.com/</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/618/1*kaxmfdVI42U3wzADelp9UQ.png" /></figure><h3>How to Create a New Repository for Your Website</h3><p>The next part — getting your page published — can seem non-straightforward, but we’ve broken down the process into simple, beginner-friendly steps to make it accessible for you right now. This is how the pros get their work online!</p><h4>Create a New Repository for Your Website</h4><p>To host your website on GitHub, you need to create a dedicated space called a “repository” (repo).</p><p>First, head over to <a href="https://github.com/">https://github.com</a>. If you don&#39;t have an account, click <strong>Sign Up</strong> and follow the prompts.</p><p>Once logged in, click on the <strong>‘+’ icon</strong> located in the upper right corner of the page and select the <strong>New repository</strong> option.</p><figure><img alt="Screenshot of homepage for Github after signing up. At the top right is a list of options, where going to the plus button allows you to create a new project via “New Repository”" src="https://cdn-images-1.medium.com/max/1024/1*SGzu77TOeRXNSkUX75SRXw.png" /><figcaption>Navigate to the top-left screen to find the plus button.</figcaption></figure><blockquote>Note: You must name your repository using the specific format: &lt;your_username&gt;.github.io (for example, <em>ahinchman1.github.io</em>). This tells GitHub to treat it as a live website!</blockquote><figure><img alt="This screenshot of Github shows a form to create a new Repository. Under repository name is ahinchman1.github.io, which matches the owner name. Add README.md is also checked." src="https://cdn-images-1.medium.com/max/1024/1*kQTe1vdeWq-PFe40MKAHqA.png" /><figcaption>For a personal website, you must name it exactly as your username. Like ahinchman1.github.io</figcaption></figure><p>Finally, choose the option to <strong>Add a README file</strong>. This document describes your project and is considered a best practice.</p><h4>Create Project Files</h4><p>If you’ve been working on <a href="https://onecompiler.com/html">onecompiler.com</a>, you will need to create files manually on GitHub. In your new repository, click on the +option. From the drop-down menu, choose <strong>Create File</strong>.</p><figure><img alt="to the left is HTML code from the web editor. To the right is a copy-and-paste of the same cod ewhile creating a new file in GitHub." src="https://cdn-images-1.medium.com/max/1024/1*XPXjUNRyPAzvJEpfdVtRLw.png" /><figcaption>+ &gt; Create new files</figcaption></figure><p>From there, you will copy-and-paste the file you wrote in <a href="https://onecompiler.com/html">https://onecompiler.com/html</a> and create the file that way. Once you’ve finished, you can hit “commit” and optionally add a message like “Created index.html file”.</p><p>You will need to do this every time you are ready to “save” your changes online. This will act as a deployment, which updates the application for others to see.</p><h4>Upload Your Project Files</h4><p>If you’re working with Sublime, you will need to upload your files. In your new repository, click on the +option. From the drop-down menu, choose <strong>Upload files</strong>.</p><figure><img alt="ahinchman1.github.io shows a single README.md" src="https://cdn-images-1.medium.com/max/1024/1*Op7BInbvaYwByColrLtLJQ.png" /><figcaption>+ &gt; Upload files</figcaption></figure><p>Follow the prompts to select your HTML file (and any other project files) from your computer. If you are uploading files from your computer, make sure to drag and drop <strong>the entire project structure.</strong></p><figure><img alt="There is an option to upload photos on GithHub for the project. A whole project is dragged in which uploads 3 files" src="https://cdn-images-1.medium.com/max/1024/1*zbIv7XB8_6q-O5R7fWGxfg.png" /></figure><p>You should always write a message in your commits. That way, you’ll know what changes are what if you ever need to roll back. An example message could be: “First commit, wrote HTML skeleton, header, and Hello World”.</p><p>When you’ve finished describing your commit, scroll down and click the <strong>“Commit Changes” </strong>button to finalize the upload.</p><h4>Publishing Your HTML Page</h4><p>The site is uploaded, but GitHub needs a final instruction to launch it:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ou9MTfPsP3LBgyPQOTOjyw.png" /></figure><p>Navigate to the <strong>Settings</strong> tab at the top of your repository page. Look on the left-hand menu and click on the <strong>Pages</strong> section.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5TsAe8UD0ZqWBlfwNWd58Q.png" /></figure><p>Under the <strong>Branch</strong> section, use the drop-down menu to select the <strong>main</strong> branch and be sure to hit <strong>Save</strong>.</p><h4>Project is Now Live Online!</h4><p>Give GitHub a moment (sometimes 1–2 minutes) to build the site from your file. Open a new tab and visit your new URL: https://&lt;username&gt;.github.io</p><p><strong>Congratulations! You are now a published web developer!</strong></p><h3>Ready to Build a Full Website?</h3><p>You’ve learned the fundamentals of HTML tags, grouping elements, and publishing your first site!</p><p>To truly master web structure, you need the full lesson on <strong>Advanced Element Assignment</strong> and to complete the <strong>full, hands-on coding challenge</strong> to build a complete project.</p><p>These full, hands-on lessons are only available in the live session!</p><h3>Join the Full Coding Kinetics HTML Workshop!</h3><p>While the current session is full, these periodic community workshops are a core pillar, helping us cover monthly business costs while providing high-quality, in-person instruction.</p><p>We are excited to be partnering with the <strong>Chicago Public Library (CPL)</strong> to bring these workshops to you!</p><h3>Additional Resources</h3><ul><li>HTML: <a href="https://www.w3schools.com/html/html_intro.asp"><strong>https://www.w3schools.com/html/html_intro.asp</strong></a></li><li>CSS: <a href="https://www.w3schools.com/css/css_intro.asp"><strong>https://www.w3schools.com/css/css_intro.asp</strong></a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a16148fa21cb" width="1" height="1" alt=""><hr><p><a href="https://medium.com/coding-kinetics/lab-setup-build-publish-your-first-web-page-a16148fa21cb">Lab Setup: Build &amp; Publish Your First Web Page</a> was originally published in <a href="https://medium.com/coding-kinetics">Coding Kinetics</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[House Rules for VCs Entering the Open Source Community]]></title>
            <link>https://medium.com/coding-kinetics/house-rules-for-vcs-entering-the-open-source-community-1e2e55f15f37?source=rss----8e8c18dd036b---4</link>
            <guid isPermaLink="false">https://medium.com/p/1e2e55f15f37</guid>
            <category><![CDATA[kotlin]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[vc]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[open-source]]></category>
            <dc:creator><![CDATA[Amanda Hinchman]]></dc:creator>
            <pubDate>Sat, 18 Oct 2025 19:27:47 GMT</pubDate>
            <atom:updated>2025-10-18T19:27:43.845Z</atom:updated>
            <content:encoded><![CDATA[<h4>A No Bull**** Guide On How to Interact with Open Source Communities</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TYAkAcIztm62KC7f8YuL0g.png" /></figure><p>Hey VCs, entering open source communities. First of all, welcome to the community! We’re happy to have you here.</p><p>We create open source software that is free to use and benefits everyone. We do this in our spare time because it brings us joy and purpose. We hope you feel the same way, too.</p><p>Most open source communities share the same principles:</p><ul><li>A project is not a startup.</li><li>A maintainer is not a founder seeking funding.</li><li>Participation is rooted in respect, collaboration, and generosity.</li></ul><p>Please take the time to read these values and take them to heart. If they are disregarded, you may accidentally shut yourself out from crucial parts of the community.</p><h4><strong>1. You Are a Guest</strong></h4><p>You’re here to listen, learn, and <strong>earn your place in the community</strong>. Before speaking, take the time to read the documentation, follow the discussions, and understand the community/project culture before you ask for anything. Every community is different.</p><h4>2. Read the Rules of Conduct in Every Space. Respect the Mods.</h4><p>Every space has <strong>Rules of Conduct</strong>. Please read them before participating in chats. Do it right now.</p><p>The moderators are volunteers who work hard to make the community inclusive for all. They’ve been doing this for years and don’t get paid enough for it.</p><p>So please:</p><ul><li><strong>Read the Rules of Conduct.</strong></li><li><strong>Follow them.</strong> (If it says <em>no sales</em>, it means <em>no sales</em>.)</li><li><strong>Respect the mods.</strong> They are here to help everyone have a good experience.</li></ul><h4>3. Contribute First, Invest Later</h4><p>The most valuable thing you can offer is your time and effort. File a bug report, fix a typo in the docs, or help fix a Github issue. Show us that you’re a builder, not just a buyer. Make your creations accessible to others. Have technical (and respectful) discussions. We are all here to learn and be fascinated by cool things.</p><p>Only after you’ve shown you understand the culture, financial contributions <em>may </em>be welcome down the road. But remember, money does not determine influence here.</p><h4>4. Respect the Maintainers</h4><p>Maintainers are the stewards of the project (and often the community). They volunteer their time and energy to a vision they believe in.</p><p>They are not your employees, and they don’t owe you anything. Approach them with respect. If you have an idea, present it as a suggestion, not a directive.</p><p>Don’t spam them with issues, and never use a project function on GitHub for anything other than as described in guidelines. Many of these projects contain guidelines for contribution. <strong>Read them.</strong></p><h4>5. Be Transparent</h4><p>Authenticity is a non-negotiable part of open source culture. Don’t pretend to be something you’re not.</p><p>If you’re here to explore investment opportunities, say so openly. Hiding your intentions is the fastest way to lose trust.</p><h3>Final Words</h3><p>The open source community is nothing like anything you’ve seen before. The open source model is not a profitable one. If you’re coming in for sales, you’re barking up the wrong tree, and you’re here for the wrong reasons.</p><p>Join us to teach, to learn, and to grow as a <em>coding enthusiast</em>. Take time to truly listen, to learn from others, and to form genuine relationships and friendships.</p><p>These are the people that will give you honest life advice when no one else will. They will show you cutting edge tech in its baby stages. This is an area that thrives off mutual respect and discovery necesssary to evolve technology.</p><p>And with that, we welcome you with open arms. Are you ready to begin learning about our world?</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1e2e55f15f37" width="1" height="1" alt=""><hr><p><a href="https://medium.com/coding-kinetics/house-rules-for-vcs-entering-the-open-source-community-1e2e55f15f37">House Rules for VCs Entering the Open Source Community</a> was originally published in <a href="https://medium.com/coding-kinetics">Coding Kinetics</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Introduction to Structured Concurrency: Coroutine Exception & Cancellation Mechanisms]]></title>
            <link>https://medium.com/coding-kinetics/introduction-to-structured-concurrency-coroutine-exception-cancellation-mechanisms-b1f6b18ad8fc?source=rss----8e8c18dd036b---4</link>
            <guid isPermaLink="false">https://medium.com/p/b1f6b18ad8fc</guid>
            <category><![CDATA[android]]></category>
            <category><![CDATA[kotlin]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Amanda Hinchman]]></dc:creator>
            <pubDate>Mon, 18 Aug 2025 06:11:12 GMT</pubDate>
            <atom:updated>2025-08-18T06:12:18.197Z</atom:updated>
            <content:encoded><![CDATA[<h4>Part 2: How Cancellations and Exceptions Affect Job Hiearchies</h4><p><strong><em>Foreword: </em></strong><em>This article is made possible thanks to my Patreon supporters, who specifically requested a deeper dive into the topic of coroutine cancellations and exceptions. This is a follow-up to my </em><strong><em>Droidcon NYC 2025</em></strong><em> talk on Kotlin Coroutine Mechanisms — if you missed it, you can </em><a href="https://speakerdeck.com/amanda_hinchman/kotlin-coroutine-mechanisms-a-surprisingly-deep-rabbithole"><em>view the slides here</em></a><em>.</em></p><h3>Topic Navigation</h3><p>If you haven’t already read <strong>Part 1</strong>, be sure to take the time to do so. The previous article sets you up for understanding the nuances of scope and context needed for studying exceptions andcancellations.</p><ul><li><a href="https://medium.com/p/50103363c611">Part 1: CoroutineScope &amp; CoroutineContext</a></li><li><a href="https://medium.com/coding-kinetics/introduction-to-structured-concurrency-coroutine-exception-cancellation-mechanisms-b1f6b18ad8fc">Part 2: Exception &amp; Cancellation Mechanisms in Jobs</a></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*u3zRyEcVP_zpkS76.jpg" /></figure><p>In the world of Kotlin coroutines, cancellations are like kind of kitchen fires: a fire starts and can’t be contained until there are safety the “blast radius” of a cancellation can propagate upwards to the parent scope, when unhandled... But did you know that you can control the “blast radius” with structured concurrency?</p><h3>What is Structured Concurrency?</h3><p>Kotlin coroutines are designed for structured concurrency, but this can only be achieved with the intentional use of Kotlin coroutines. The <em>Structured Concurrency</em> paradigm can be boiled down to two general rules:</p><ol><li>A parent coroutine always waits for its children to complete.</li><li><strong>A child coroutine never gets lost.</strong></li></ol><p>When you follow these rules, you have structured concurrency.</p><p>Today, we focus on the second rule in particular: <strong>A child coroutine never gets lost.</strong></p><p>In structured concurrency, a child coroutine is always tracked by its parent. Unhandled failures or cancellations are propagated up to the parent.</p><h3>Coroutine Cancellations</h3><p>Cancellations in coroutines can come about in two ways: either called programmatically (by you), or they can happen as a result of an exception.</p><h4>Setup</h4><p>We’ll test out these cancellation concepts using the last segment we worked with in the previous article, <strong>Kitchen.kt: </strong>no kitchen fires, and no explosions. Not yet, anyway.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a5049e92a4ccca8ea2595ab7fad94796/href">https://medium.com/media/a5049e92a4ccca8ea2595ab7fad94796/href</a></iframe><p>If you run the code as-is, you’ll see the following output in it’s entirety:</p><pre>Making salad                | current thread: DefaultDispatcher-worker-1 @coroutine#2<br>Making pasta                | current thread: DefaultDispatcher-worker-2 @coroutine#3<br>    Cooking pasta...        | current thread: DefaultDispatcher-worker-2 @coroutine#5<br>    Boiling water...        | current thread: DefaultDispatcher-worker-2 @coroutine#4<br>Salad is ready!             | current thread: DefaultDispatcher-worker-1 @coroutine#2<br>    Pasta is cooked.        | current thread: DefaultDispatcher-worker-1 @coroutine#5<br>    Water is hot!     | current thread: DefaultDispatcher-worker-1 @coroutine#4<br>Pasta is ready!             | current thread: main @coroutine#1<br>All dishes are prepared!</pre><p>The salad and pasta orders run simultaneously, TPDP</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IPIH4zv9HpxkvsVF-7_aUw.png" /></figure><p>Alright! Let’s start messing with this code via cancellations. We’ll be using just the cancel() API to demonstrate what happens when cancel() is placed in different areas of <strong>Kitchen.kt</strong>.</p><h4>Canceling a Job</h4><p>Canceling a job will cancel the job and the children itself, but the scope will not be canceled. In <strong>Kitchen.kt</strong>, add a cancel() statement <em>before</em> delay:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/64783e42fae3711a54a6300b1e0bfc47/href">https://medium.com/media/64783e42fae3711a54a6300b1e0bfc47/href</a></iframe><p>Running this code reveals that “Salad is ready!” never prints, but we can still launch other jobs on the scope.</p><pre>Making salad                | current thread: DefaultDispatcher-worker-1<br>Making pasta                | current thread: DefaultDispatcher-worker-2<br>    Boiling water...        | current thread: DefaultDispatcher-worker-3<br>    Cooking pasta...        | current thread: DefaultDispatcher-worker-4<br>    Pasta is cooked.        | current thread: DefaultDispatcher-worker-1<br>    Water is hot!     | current thread: DefaultDispatcher-worker-1<br>Pasta is ready!             | current thread: main<br>All dishes are prepared!    | current thread: main</pre><p>saladOrder is canceled, yet the kitchenScope remains active. That is why we see pastaOrder able to start and finish the work. pastaOrder is unaffected, since it exists as a sibling coroutine.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WWN4IwK14jW9lvbc3xue6g.png" /></figure><p>Because cancel() is actually an extension function of CoroutineScope, calling cancel cancels the current coroutine, but not the kitchenScope or the parentJob.</p><p>There are some conclusions that can be drawn from coroutine cancellation:</p><ul><li>By default, <strong>canceling a child job</strong> propagates cancellation downwards to all child jobs.</li><li><strong>Canceling a child job does not cancel the sibling or the parent.</strong></li></ul><p>While <em>coroutine cancellations</em> can be clean enough, the same is not true for coroutine exceptions. Coroutine cancellations is like cancelling the order. We don’t need it anymore, but the other orders can go through.</p><h3>Coroutine Exceptions</h3><p>If a coroutine cancellation is like order cancellation, then <em>coroutine exception</em> is more like a kitchen fire (blast radius and all). In other words, something unexpected happened.</p><p>In <strong>Kitchen.kt</strong>, replace the cancel() call in saladOrder with throw Exception(“Ack! Kitchen fire”):</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8d2df5261a36008053ddafcf58cb2bbe/href">https://medium.com/media/8d2df5261a36008053ddafcf58cb2bbe/href</a></iframe><p>If a cancel() affects the current coroutine, we know that boilWater will be affected by an exception. But what about the parent job and parent scope?</p><p>Let’s run the problem to find out:</p><pre>Making pasta                | current thread: DefaultDispatcher-worker-2<br>Making salad                | current thread: DefaultDispatcher-worker-1<br>Exception in thread &quot;DefaultDispatcher-worker-1&quot; java.lang.RuntimeException: Exception while trying to handle coroutine exception<br> at kotlinx.coroutines.CoroutineExceptionHandlerKt.handlerException(CoroutineExceptionHandler.kt:36)<br> ...<br> ... 15 more<br>Exception in thread &quot;DefaultDispatcher-worker-1&quot; java.lang.Exception: Ack! Kitchen fire<br> at org.example.KitchenKt$main$1$saladOrder$1.invokeSuspend(Kitchen.kt:11)<br> at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)<br> at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:100)<br> at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:586)<br> at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:829)<br> at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:717)<br> at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:704)<br> Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelling}@55506de, Dispatchers.Default]<br>Exception in thread &quot;main&quot; kotlinx.coroutines.JobCancellationException: Parent job is Cancelling; job=JobImpl{Cancelled}@23e028a9<br>Caused by: java.lang.Exception: Ack! Kitchen fire<br> at org.example.KitchenKt$main$1$saladOrder$1.invokeSuspend(Kitchen.kt:11)<br> at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)<br> at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:100)<br> at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:586)<br> at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:829)<br> at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:717)<br> at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:704)<br> Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelled}@55506de, Dispatchers.Default]<br><br>Process finished with exit code 1</pre><p>And there it is: a “kitchen fire” starts at the salad order. Because the exception is unhandled in launch, there are no safety measures in place to handle the exception. As a result, a thrown exception in launch propagates up to the parent coroutine.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3OIb1Ie5mpxI3IhslPH17w.png" /></figure><p>When the exception bubbles up to the parent coroutine, the exception immediately cancels the parent job. As a result, the remainder of existing child coroutines are also canceled.</p><p>When an exception is unhandled, it will propagate upwards, causing siblings to cancel as well.</p><h4>Handle an Exception with try/catch</h4><p>One way to handle coroutine exceptions is to wrap them in a try/catch statement. In <strong>Kitchen.kt</strong>, wrap the inside of the saladOrder with a try/catch statement like so:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8985aecbcf4309e3f1658e2655d5fe49/href">https://medium.com/media/8985aecbcf4309e3f1658e2655d5fe49/href</a></iframe><p>Now, the try/catch statement can catch and handle the exception that occurs in saladOrder. Although saladOrder is not able to complete, we can see the exception handled in logging, and pastaOrder is able to continue to execute.</p><pre>Making pasta                | current thread: DefaultDispatcher-worker-2<br>Making salad                | current thread: DefaultDispatcher-worker-1<br>Unable to create salad order. Cause: Ack! Kitchen fire    | current thread: DefaultDispatcher-worker-1<br>    Boiling water...        | current thread: DefaultDispatcher-worker-1<br>    Cooking pasta...        | current thread: DefaultDispatcher-worker-3<br>    Pasta is cooked.        | current thread: DefaultDispatcher-worker-1<br>    Water is hot!     | current thread: DefaultDispatcher-worker-1<br>Pasta is ready!             | current thread: main<br>All dishes are prepared!    | current thread: main</pre><p>The problem with try/catch is that a try/catch must be created for every coroutine. This quickly makes it hard to maintain code in a scalable manner.</p><h4>Using SupervisorJob to isolate the failure</h4><p>There is another way to catch exceptions at a more generic root level: by replacing the parent job with a SupervisorJob type.</p><p>In <strong>Kitchen.kt</strong>, replace the parent Job with a SupervisorJob type and remove the try/catch statement from earlier to better understand what SupervisorJob really does on its own:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/57497dbfe6233cb4723125b070b9b65b/href">https://medium.com/media/57497dbfe6233cb4723125b070b9b65b/href</a></iframe><p>Running the program once more, even though a kitchen fire starts with the saladOrder, the failure is contained using SupervisorJob.</p><pre>Making salad                | current thread: DefaultDispatcher-worker-1<br>Making pasta                | current thread: DefaultDispatcher-worker-2<br>    Boiling water...        | current thread: DefaultDispatcher-worker-3<br>    Cooking pasta...        | current thread: DefaultDispatcher-worker-4<br>Exception in thread &quot;DefaultDispatcher-worker-1&quot; java.lang.RuntimeException: Exception while trying to handle coroutine exception<br> at kotlinx.coroutines.CoroutineExceptionHandlerKt.handlerException(CoroutineExceptionHandler.kt:36)<br> at kotlinx.coroutines.internal.CoroutineExceptionHandlerImpl_commonKt.handleUncaughtCoroutineException(CoroutineExceptionHandlerImpl.common.kt:38)<br> at kotlinx.coroutines.CoroutineExceptionHandlerKt.handleCoroutineException(CoroutineExceptionHandler.kt:31)<br> at ...<br> at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:704)<br> Suppressed: java.lang.Exception: Ack! Kitchen fire<br>  at org.example.KitchenKt$main$1$saladOrder$1.invokeSuspend(Kitchen.kt:11)<br>  at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)<br>  ... 5 more<br>Exception in thread &quot;DefaultDispatcher-worker-1&quot; java.lang.Exception: Ack! Kitchen fire<br> at org.example.KitchenKt$main$1$saladOrder$1.invokeSuspend(Kitchen.kt:11)<br> at kotlin.coroutines.jvm.internal...<br> Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelling}@3399b913, Dispatchers.Default]<br>    Pasta is cooked.        | current thread: DefaultDispatcher-worker-1<br>    Water is hot!     | current thread: DefaultDispatcher-worker-1<br>Pasta is ready!             | current thread: main<br>All dishes are prepared!    | current thread: main<br><br>Process finished with exit code 0</pre><p>Normally, if. a child coroutine fails, the exception is propated up to the parent. But now, that parent job is a SupervisorJob, which acts as a container for the kitchen fire. In effect the Supervisor job does not cancel the parent or a coroutine’s siblings.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fWztZSH4_sBqgnaNrgQEoQ.png" /></figure><p>With the saladOrder blast radius is contained, the rest of the kitchen can keep running. A you can see from the output, using a SupervisorJob does not mean that the exception is automatically suppressed or auto-handled. The scope of this article does not cover a lot of exception handling, but if you’re looking for more, your next topic should be on <em>CoroutineExceptionHandler.</em></p><p>That’s all there is for today. Thanks for reading this work, and thanks to the patrons who voted for this topic.</p><h3>Topic Navigation</h3><ul><li><a href="https://medium.com/coding-kinetics/introduction-to-structured-concurrency-coroutinescope-coroutinecontext-50103363c611">Part 1: CoroutineScope &amp; CoroutineContext</a></li><li><a href="https://medium.com/coding-kinetics/introduction-to-structured-concurrency-coroutine-exception-cancellation-mechanisms-b1f6b18ad8fc">Part 2: Coroutine Exception &amp; Cancellations for Jobs</a></li></ul><h3>Looking for more on Structured Concurrency?</h3><p>Coroutines can feel tricky, and structured concurrency feels elusive at times. I’ll keep sharing insights like this each week, so if you want to keep learning alongside me, join us over on Patreon. I’ve linked additional resources I’ve written on this topic for a convenient nd impactful learning experience. Until next time!</p><ul><li>Droidcon ’25 NYC talk <a href="https://www.youtube.com/watch?v=7BVriPGoJxc&amp;ab_channel=droidcon%26fluttercon"><em>Kotlin Coroutine Mechanisms</em> now out on Youtube</a></li><li>O’Reilly ‘s <a href="https://www.amazon.com/Programming-Android-Kotlin-Structured-Concurrency/dp/1492063002"><em>Programming Android with Kotlin: Achieving Structured Concurrency with Coroutine</em></a></li><li>[COMING SOON] Droidcon Academy eBook <a href="https://academy.droidcon.com/course/setup-mastering-kotlin-coroutines-from-basics-to-advanced"><em>Mastering Kotlin Coroutines: From Basics to Advanced</em></a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b1f6b18ad8fc" width="1" height="1" alt=""><hr><p><a href="https://medium.com/coding-kinetics/introduction-to-structured-concurrency-coroutine-exception-cancellation-mechanisms-b1f6b18ad8fc">Introduction to Structured Concurrency: Coroutine Exception &amp; Cancellation Mechanisms</a> was originally published in <a href="https://medium.com/coding-kinetics">Coding Kinetics</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Introduction to Structured Concurrency: CoroutineScope & CoroutineContext]]></title>
            <link>https://medium.com/coding-kinetics/introduction-to-structured-concurrency-coroutinescope-coroutinecontext-50103363c611?source=rss----8e8c18dd036b---4</link>
            <guid isPermaLink="false">https://medium.com/p/50103363c611</guid>
            <category><![CDATA[concurrency]]></category>
            <category><![CDATA[kotlin-coroutines]]></category>
            <category><![CDATA[kotlin]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[android]]></category>
            <dc:creator><![CDATA[Amanda Hinchman]]></dc:creator>
            <pubDate>Mon, 28 Jul 2025 20:15:32 GMT</pubDate>
            <atom:updated>2025-08-18T06:12:56.238Z</atom:updated>
            <content:encoded><![CDATA[<h4>Part 1: Coroutine Scopes, Contexts, Job Hierarchy, and more</h4><p><strong><em>Foreword: </em></strong><em>This article is made possible thanks to my Patreon supporters, who specifically requested a deeper dive into the topic of coroutine cancellations and exceptions. This piece serves as a necessary prelude to understanding how to build automated control mechanisms using Kotlin coroutines.</em></p><p><em>This is a follow-up to my </em><strong><em>Droidcon NYC 2025</em></strong><em> talk on Kotlin Coroutine Mechanisms — if you missed it, you can </em><a href="https://speakerdeck.com/amanda_hinchman/kotlin-coroutine-mechanisms-a-surprisingly-deep-rabbithole"><em>view the slides here</em></a><em>. If you find this article useful, consider checking out my </em><a href="https://www.patreon.com/c/AmandaHinchman"><em>Patreon</em></a><em> for more.</em></p><h3>Topic Navigation</h3><ul><li><a href="https://medium.com/coding-kinetics/introduction-to-structured-concurrency-coroutinescope-coroutinecontext-50103363c611">Part 1: CoroutineScope &amp; CoroutineContext</a></li><li><a href="https://medium.com/coding-kinetics/introduction-to-structured-concurrency-coroutine-exception-cancellation-mechanisms-b1f6b18ad8fc">Part 2: Coroutine Exception &amp; Cancellations for Jobs</a></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*vUVm95CrfMMkQ5Rh.jpg" /></figure><p>Many of you have likely been using Kotlin coroutines for some time. Perhaps you could say you’ve grown comfortable with daily use. But for most developers, the practices of structured concurrency feel elusive at best.</p><p>Fortunately (or unfortunately), I’ve spent an unreasonable amount of time researching Kotlin coroutines in the last 6 months. After many late nights and too much caffeine, I’m here to share my knowledge on the cancellation and exception-handling mechanisms behind structured concurrency. However, before we can fully understand the value of automated mechanisms, it is essential to grasp what <strong>Structured Concurrency</strong> entails.</p><h3>What is Structured Concurrency?</h3><p>Kotlin coroutines are designed for structured concurrency, but it can only be achieved with the intentional use of Kotlin coroutines. The <strong>Structured Concurrency paradigm</strong> can be boiled down to two general rules:</p><ol><li><strong>A parent coroutine always waits for its children to complete.</strong></li><li>The parent coroutine never “loses” a coroutine.</li></ol><p>When you follow these rules, you have structured concurrency. Today, we start with the first rule: <strong>A parent coroutine always waits for its children to complete.</strong></p><p>This first rule can be achieved with the mindful use of <a href="https://github.com/Kotlin/kotlinx.coroutines/blob/master/kotlinx-coroutines-core/common/src/CoroutineScope.kt"><strong>CoroutineScope</strong></a> and <a href="https://github.com/Kotlin/kotlinx.coroutines/blob/master/kotlinx-coroutines-core/jvm/src/CoroutineContext.kt"><strong>CoroutineContext</strong></a>.</p><h3>CoroutineScope v. CoroutineContext</h3><p><strong>CoroutineScope</strong> and <strong>CoroutineContext</strong> are used together to tie lifecycles in a Job hierarchy.</p><p>Intentional use of scope and context can tie jobs together to create predictable, safe concurrency. I always love to lift the hood to check on the internals, so that is what we will do. If you look at the interface details of <a href="https://github.com/Kotlin/kotlinx.coroutines/blob/master/kotlinx-coroutines-core/common/src/CoroutineScope.kt">CoroutineScope.kt</a>, you’ll see that it contains only one element: the context of the scope.</p><pre>public interface CoroutineScope {<br><br>   public val coroutineContext: CoroutineContext<br>}</pre><p>Digging a little deeper into the implementation details of <a href="https://github.com/Kotlin/kotlinx.coroutines/blob/master/kotlinx-coroutines-core/jvm/src/CoroutineContext.kt">CoroutineContext.kt</a>, you’ll see that it’s created in a <a href="https://refactoring.guru/design-patterns/composite"><strong>Composite Design Pattern</strong></a>. A shortened version of the implementation details is provided below:</p><pre>@kotlin.SinceKotlin public interface CoroutineContext {<br><br>   public abstract operator fun &lt;E : CoroutineContext.Element&gt; get(key: CoroutineContext.Key&lt;E&gt;): E?<br><br>   public abstract fun &lt;R&gt; fold(<br>initial: R, <br>operation: (R, CoroutineContext.Element) -&gt; R<br>): R<br><br>    public open operator fun plus(<br>context: CoroutineContext<br>): CoroutineContext { /* compiled code */ }<br><br>   public abstract fun minusKey(key: CoroutineContext.Key&lt;*&gt;): CoroutineContext<br><br>   public interface Key&lt;E : CoroutineContext.Element&gt; { }<br><br>   public interface Element : CoroutineContext {<br>       public abstract val key: CoroutineContext.Key&lt;*<br>       public open operator fun &lt;E : CoroutineContext.Element&gt; get(...): E? { /* compiled code */ }<br>       public open fun &lt;R&gt; fold(initial: R, operation: (R, CoroutineContext.Element) -&gt; R): R { /* compiled code */ }<br>       public open fun minusKey(key: kotlin.coroutines.CoroutineContext.Key&lt;*&gt;): kotlin.coroutines.CoroutineContext { /* compiled code */ }<br>   }<br>}</pre><p>The <strong>Composite Design Pattern</strong> enables the ability to able to create unique and traceable tree structures, which allows for the ability to keep track of nested scopes and where execution takes place. In short:</p><ul><li>A <strong>CoroutineScope</strong> acts as a container for CoroutineContext. It defines a group of coroutine jobs working together.</li><li>A <strong>CoroutineContext</strong> is a set of mapped composite elements that is used to describe the coroutine behavior.</li></ul><p>Roman Elivaroz explores this concept in depth in his article <a href="https://elizarov.medium.com/coroutine-context-and-scope-c8b255d59055"><em>Coroutine Context and Scope</em></a>, where he introduces a visual model that illustrates the relationship between scope and context. I found his explanation particularly insightful while preparing for my Droidcon NYC ’25 presentation.</p><p>Below is a diagram I rendered for that talk, inspired by his original diagram:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9wGWOXpWdBazebijHVD_jA.png" /><figcaption>See the original diagram <a href="https://miro.medium.com/v2/resize:fit:1400/format:webp/1*zuX5Ozc2TwofXlmDajxpzg.png">here</a>, also found in the article article <a href="https://elizarov.medium.com/coroutine-context-and-scope-c8b255d59055"><em>Coroutine Context and Scope</em></a></figcaption></figure><p>Together, the composite structure of a <strong>CoroutineContext</strong> enables the tracking of a coroutine’s <strong>Job hierarchy</strong> within a given scope.</p><h3>Job Hierarchy vs. Scope Hierarchy</h3><p>In the context of structured concurrency, a job hierarchy generally respects the tenets of structured concurrency.</p><p>When a Job is launched in another Job, they create a child-parent hierarchy automatically. These jobs exist in the same scope.</p><p>However, the same is not true for a new CoroutineScope. A new CoroutineScope(…) does not inherit the parent scope just because it launches in another scope.</p><p>Not all coroutine scopes are created equally. In fact, there are only a few options when working with scope that respect the structured concurrency paradigm:</p><figure><img alt="table with different ways to launch coroutines. first column is how to launch, second column is respect structured concurrency? and third column is inherited or new scope? 1. CoroutineScope(…).launch { … } No New scope 2. coroutineScope { … } Yes Inherits parent 3. scope GlobalScope.launch { … } No Global scope 4. viewModelScope.launch { … } Yes Inherits from ViewModel 5. lifecycleScope.launch { … } Yes Inherits from lifecycle object" src="https://cdn-images-1.medium.com/max/1024/1*_1mE1msbkdE8Y9rd9qJzyA.png" /></figure><p>Finally, after digging into discussions, there are a few helpful tips to use CoroutineScope and Context, as eloquently explained by Roman Elizarov his comment on <a href="https://github.com/Kotlin/kotlinx.coroutines/issues/1001#issuecomment-814261687">https://github.com/Kotlin/kotlinx.coroutines/issues/1001#issuecomment-814261687</a></p><blockquote>The rule of thumb that is we use in API:</blockquote><blockquote>1. If it is using CoroutineContext then you should NOT have Job there.</blockquote><blockquote>2. If it is using CoroutineScope then the scope should have a Job.</blockquote><p>Now that we understand the basics of coroutine scope and context in the scope of structured concurrency, let’s play with these ideas in a short code example.</p><h3>Does this code example respect structured concurrency?</h3><p>For this series, we will work with a class named <strong>Kitchen.kt</strong>, which represents a kitchen taking orders defined in a kitchenScope. Each order is a Job type, and in the code, we input an order for salad and pasta.</p><p>Take a close look: <strong>does this code example respect structured concurrency?</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/afa7b7614a60fe49a3bfe95648003862/href">https://medium.com/media/afa7b7614a60fe49a3bfe95648003862/href</a></iframe><p>Running this default class gives us the following output.</p><pre>Making salad                | current thread: DefaultDispatcher-worker-1<br>Making pasta                | current thread: DefaultDispatcher-worker-2<br>    Boiling water...        | current thread: DefaultDispatcher-worker-3<br>    Cooking pasta...        | current thread: DefaultDispatcher-worker-4<br>Salad is ready!             | current thread: DefaultDispatcher-worker-4<br>    Pasta is cooked.        | current thread: DefaultDispatcher-worker-4<br>    Water is hot!     | current thread: DefaultDispatcher-worker-4<br>Pasta is ready!             | current thread: main<br>All dishes are prepared!    | current thread: main<br><br>Process finished with exit code 0</pre><p>It looks pretty close, but the answer is no.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k7LzdCwY_GxvWNi5BVY7UA.png" /></figure><h4><strong>saladOrder runs in parallel to </strong><strong>pastaOrder. Isn’t that a problem?</strong></h4><p>Structured concurrency doesn’t mean that tasks cannot run in parallel. Rather, structured concurrency is concerned with knowing what child jobs are running and <em>when </em>they complete.</p><p>We’ve indicated that at the bottom of the code by asking for a join statement. This ensures that the parent waits on saladOrder for completion.</p><pre>fun main() = runBlocking {<br>    val parentJob = Job()<br>    val kitchenScope = CoroutineScope(parentJob)<br><br>    val saladOrder: Job  = kitchenScope.launch {<br>        log(&quot;Making salad            &quot;)<br>        delay(400)<br>        log(&quot;Salad is ready!         &quot;)<br>    }<br><br>    val pastaOrder: Deferred&lt;String&gt; = kitchenScope.async {<br>        ...<br>    }<br><br>    saladOrder.join()                         //  &lt;-- forces parent to wait<br>    val pastaResult = pastaOrder.await()<br>    log(pastaResult)<br>    log(&quot;All dishes are prepared!&quot;)<br>}</pre><p>In short, it doesn’t matter the ordering of the coroutines or whether they run in parallel. It only matters that the parent knows when the child is supposed to finish.</p><h4>Why does saladOrder respect structured concurrency, but the child tasks of pastaOrder don’t?</h4><p>Inside the pastaOrder, the two child coroutines are launched, which inherit the current scope, but the pastaOrder coroutine does not wait on the child coroutines for completion.</p><p>That means it’s possible for pastaOrder to complete, even if something goes wrong with one of the child tasks.</p><h4><strong>But the code works out in the end… so no problems, right</strong>?</h4><p>Well, not for this article. In the next article, we will start adding cancellation mechanisms to expose where behaviors can become unpredictable and hard to track.</p><h3>Fixing Kitchen.kt for Structured Concurrency</h3><p>To fix the issue with pastaOrder, there are several ways to address it. One way is to utilize coroutineScope {…} which is one of the main ways to inherit the parent scope.</p><p>In essence, coroutineScope {…} draws a sub-scope that forces pastaOrder to wait on the completion of the sub-scope before continuing.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a5049e92a4ccca8ea2595ab7fad94796/href">https://medium.com/media/a5049e92a4ccca8ea2595ab7fad94796/href</a></iframe><p>The code above respects structured concurrency. We defined a root job and CoroutineScope, which is the root of all launched coroutines. Every child coroutine inside both orders is also tied to the parent job.</p><p>The pastaOrder child coroutines, boilWater and cookPasta, are wrapped in coroutineScope {…} which inherits from the parent context. This means that the parent scope is aware of the inner scope, and the two are tied together.</p><p>Additionally, coroutineScope {…} is a block-scope context, so all internal work within it must be complete before moving on. As a result:</p><ol><li>Child coroutines are bound to the lifecycle of the parent coroutine</li><li>No coroutine outlives the parent scope.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*z9e5LI3Gxo5E30U261XQjw.png" /></figure><p>And that’s it for today! You now have enough preparation to dive into the real subject of exploration — coroutine cancellations and mechanisms in part 2.</p><h3>Topic Navigation</h3><ul><li><a href="https://medium.com/coding-kinetics/introduction-to-structured-concurrency-coroutinescope-coroutinecontext-50103363c611">Part 1: CoroutineScope &amp; CoroutineContext</a></li><li><a href="https://medium.com/coding-kinetics/introduction-to-structured-concurrency-coroutine-exception-cancellation-mechanisms-b1f6b18ad8fc">Part 2: Coroutine Exception &amp; Cancellations for Jobs</a></li></ul><h3>Sources Cited</h3><ul><li>Antanas-Arvasevicius. “Structured Concurrency with Two Parent Jobs · Issue #1001 · Kotlin/Kotlinx.Coroutines.” <em>GitHub</em>, 20 Feb. 2019, <a href="https://github.com/Kotlin/kotlinx.coroutines/issues/1001">https://github.com/Kotlin/kotlinx.coroutines/issues/1001</a></li><li>Elizarov, Roman. “Coroutine Context and Scope.” <em>Medium</em>, 9 Mar. 2019, <a href="https://elizarov.medium.com/coroutine-context-and-scope-c8b255d59055">https://elizarov.medium.com/coroutine-context-and-scope-c8b255d59055</a></li><li>Hinchman-Dominguez, Amanda. “Kotlin Coroutine Mechanisms: A Surprisingly Deep Rabbithole.” <em>Speaker Deck</em>, 25 June 2025, <a href="https://speakerdeck.com/amanda_hinchman/kotlin-coroutine-mechanisms-a-surprisingly-deep-rabbithole">https://speakerdeck.com/amanda_hinchman/kotlin-coroutine-mechanisms-a-surprisingly-deep-rabbithole</a></li></ul><h3>Want more on Structured Concurrency?</h3><p>I’ve written a few books and done a few talks on this topic. Check them out!</p><ul><li>Droidcon NYC Talk is now out on Youtube — <a href="https://www.youtube.com/watch?v=7BVriPGoJxc&amp;ab_channel=droidcon%26fluttercon">https://www.youtube.com/watch?v=7BVriPGoJxc&amp;ab_channel=droidcon%26fluttercon</a></li><li>Programming Android with Kotlin: Achieving Structured Concurrency with Coroutine — <a href="https://www.amazon.com/Programming-Android-Kotlin-Structured-Concurrency/dp/1492063002">https://www.amazon.com/Programming-Android-Kotlin-Structured-Concurrency/dp/1492063002</a></li><li>[COMING OUT SOON] Droidcon Academy Master Codelabs: Mastering Kotlin Coroutines: From Basics to Advanced — <a href="https://academy.droidcon.com/course/setup-mastering-kotlin-coroutines-from-basics-to-advanced">https://academy.droidcon.com/course/setup-mastering-kotlin-coroutines-from-basics-to-advanced</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=50103363c611" width="1" height="1" alt=""><hr><p><a href="https://medium.com/coding-kinetics/introduction-to-structured-concurrency-coroutinescope-coroutinecontext-50103363c611">Introduction to Structured Concurrency: CoroutineScope &amp; CoroutineContext</a> was originally published in <a href="https://medium.com/coding-kinetics">Coding Kinetics</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Making learning Kotlin an atomic habit with Patreon]]></title>
            <link>https://medium.com/coding-kinetics/making-learning-kotlin-an-atomic-habit-with-patreon-596390a4c65b?source=rss----8e8c18dd036b---4</link>
            <guid isPermaLink="false">https://medium.com/p/596390a4c65b</guid>
            <category><![CDATA[android]]></category>
            <category><![CDATA[tech]]></category>
            <category><![CDATA[kotlin]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[coding]]></category>
            <dc:creator><![CDATA[Amanda Hinchman]]></dc:creator>
            <pubDate>Thu, 02 Jan 2025 15:16:03 GMT</pubDate>
            <atom:updated>2025-10-18T19:39:48.039Z</atom:updated>
            <content:encoded><![CDATA[<h3>Making learning code an atomic habit with Patreon</h3><h4>Not everything I research goes on Medium: how Patreon offers a new way to learn code in digestible snippets</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CPBE5Z3I0xS35OwsvIyP2Q.png" /><figcaption>Not everything I research goes on Medium, so I’ve created a <a href="https://patreon.com/AmandaHinchman?utm_medium=unknown&amp;utm_source=join_link&amp;utm_campaign=creatorshare_creator&amp;utm_content=copyLink">Patreon</a> page!</figcaption></figure><p>As a software engineer, I know firsthand how challenging it can be to stay on top of the latest research and advancements. With the fast-paced nature of tech, it often feels like there’s never enough time to cover everything — especially when life gets in the way. This is especially true when it comes to learning new coding topics, like Kotlin.</p><p>That’s why I’ve developed a solution to help you stay up to date with exclusive, cutting-edge content on Kotlin, Android, computational topics, and more — all in bite-sized, manageable chunks that fit into your busy schedule.</p><p><strong>The solution: I’ve created a </strong><a href="https://patreon.com/AmandaHinchman?utm_medium=unknown&amp;utm_source=join_link&amp;utm_campaign=creatorshare_creator&amp;utm_content=copyLink"><strong>Patreon</strong></a><strong> posting a medley of weekly notecards, deep dives, archived research, and more.</strong></p><p>Note: This article only discusses paid tiers — free members receive free content, which may not be as frequent.</p><h3>5 reasons to learn Kotlin/Android topics on Patreon</h3><ol><li><strong>Keep up with creator-exclusive content &amp; research</strong>: Not everything I research goes on Medium. I’ve had a growing stack of research over the years that I can’t seem to get published in time. The larger it grows, the more nervous I get.</li><li><strong>Easier to Digest: </strong>Small snippets allow us to break down complex ideas into manageable, bite-size pieces, which in turn, reduces cognitive load.</li><li><strong>Faster Learning &amp; Retention: </strong>Retention and consistency come from increased frequency of a habit. Learning in small pieces can give you a quick win and build confidence.</li><li><strong>Adaptable to Different Learning: </strong>Making concepts adaptable to different learning styles and preferences with visuals, writing, and small tidbits to try out.</li><li><strong>Better Problem-Solving Skills: </strong>By looking at small, manageable problems regularly, you develop better problem-solving skills through incremental growth and application.</li></ol><h3>Create your atomic habit of learning code in 2 steps</h3><h4>1. Download the Patreon app and take your learning on-the-go</h4><p>Download the Patreon mobile app on Google Play Store or the Apple Store. This way, you can receive notifications right from your phone every time there’s a new post.</p><p>I’m sure there are instructions as well when navigating to my creator page: <a href="http://patreon.com/AmandaHinchman">patreon.com/AmandaHinchman</a></p><h4>2. Select a Tier Offering</h4><p>I offer two paid tiers in a Patreon membership:</p><p><strong>Tier 1: Coding Cadet — $5/month</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/288/1*L9GN5hHsSwGWbu7sGn0IBw.png" /></figure><ul><li><strong>Invite to the Global KotlinLang Slack chat</strong></li><li><strong>Exclusive Monthly Notecards:</strong> Receive 2 beautifully designed digital notecard a month summarizing key concepts from my latest educational tech content. Cards may come delivered as part of a collection or as ongoing notes.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DEW60pJU5Y67hgUlPdLNXA.png" /></figure><p><strong>Tier 2: Coding Cowboy Researcher — $10/month</strong></p><p>Get everything offered in the first tier and in addition:</p><ul><li><strong>1 Deep Dive Notecard per month: </strong>Receive in-depth, detailed notecards that cover more advanced topics, giving you a stronger, more comprehensive understanding of each tech concept.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*W2hkYKkclFTmnjfmpBRy8w.png" /><figcaption>Sample Deep Dive Notecard</figcaption></figure><ul><li><strong>Archived Notes, Lectures, and Presentations given in the past</strong></li><li><strong>Ask Amanda: </strong>Ask Amanda a question about Kotlin or make a request for content</li><li><strong>Member-only voting: </strong>engage in feedback and voting for content</li></ul><h3>Ready to get started?</h3><p>Join me on <a href="http://patreon.com/AmandaHinchman">Patreon</a>, and let’s build a new atomic habit of consistently sharing and learning Kotlin together.</p><p>Your support makes this possible, and I’m excited to bring you the latest research and coding insights.</p><p>If you’ve found my content helpful over the years, this is your chance to stay ahead with the most current developments in Kotlin, Android, and more. By supporting me on Patreon, you’ll gain early access to content before it appears (or never appears) in talks, articles, and open-source contributions.</p><p>Let’s keep learning and growing together!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*X4PVqitepBrRDONOrkSPfw.jpeg" /><figcaption>I’ve had a growing stack of flashcards and sketches for who knows how long. Why not share them online?</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=596390a4c65b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/coding-kinetics/making-learning-kotlin-an-atomic-habit-with-patreon-596390a4c65b">Making learning Kotlin an atomic habit with Patreon</a> was originally published in <a href="https://medium.com/coding-kinetics">Coding Kinetics</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Kotlin Coroutine Mechanisms: Beginner-Friendly Workshop Setup]]></title>
            <link>https://medium.com/coding-kinetics/kotlin-coroutine-mechanisms-beginner-friendly-workshop-setup-93c81d26448c?source=rss----8e8c18dd036b---4</link>
            <guid isPermaLink="false">https://medium.com/p/93c81d26448c</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[kotlin]]></category>
            <category><![CDATA[tech]]></category>
            <category><![CDATA[kotlin-beginners]]></category>
            <category><![CDATA[coding]]></category>
            <dc:creator><![CDATA[Amanda Hinchman]]></dc:creator>
            <pubDate>Wed, 01 Jan 2025 22:01:24 GMT</pubDate>
            <atom:updated>2024-12-23T00:24:26.009Z</atom:updated>
            <content:encoded><![CDATA[<h4>IntelliJ, Kotlin Koans lab setup, and Coroutine Debugger setup</h4><p>Hello! Welcome to the Coding Kinetics workshop “Kotlin Coroutine Mechanisms”. In this blurb, you’ll learn how to set up your computer to follow along for the Chicago <a href="https://www.meetup.com/chicago-kotlin/events/304049425/?eventOrigin=group_upcoming_events">public community workshop in January 2025</a>. This workshop is inspired by the recent Droidcon NYC 2024 talk, “Kotlin Coroutine Mechanisms”. Watch the full talk here for a sneak preview of the seminar.</p><p><a href="https://www.droidcon.com/2024/10/17/kotlin-coroutine-mechanisms-introduction-to-coroutine-behavior-through-playful-examples/">Kotlin Coroutine Mechanisms: Introduction to coroutine behavior through playful examples</a></p><p>Experienced programmers can scroll down to the “<strong>Setting up the Coroutine Debugger”</strong> section to set up the Coroutine Debugger on their IDE.</p><p>In this blurb, you will:</p><ul><li>Install your IntelliJ IDE setup</li><li>Create a Kotlin Project</li><li>Access the Kotlin Koans tutorial</li><li>Configure your Coroutine Debugger</li></ul><h4>Totally new to programming or Kotlin?</h4><p>No problem. Get started learning and working with Kotlin for free. If you get stuck and want to see other solutions or examples, get to googling to see how others have accomplished the same thing. Google is your friend.</p><p>Make sure to learn the absolute basics of Kotlin syntax before attending the code lab. I will try to make it as beginner-friendly as possible. But we are introducing the idea of concurrency in the lab, and we only have an hour to run the lab. Be sure to follow the instructions below, and especially run through the <strong>Learning Kotlin right in the IDE </strong>section for a free Kotlin tutorial right in your IDE.</p><h3>Download &amp; Set Up IntelliJ IDEA Community Edition</h3><p>An IDE stands for “Interactive Developer Environment”. IDEs are great because you can write and run code with little fuss/setup.</p><p>Head over to the JetBrains link <a href="https://www.jetbrains.com/idea/download/">https://www.jetbrains.com/idea/download/</a>. Ensure that the website detects your proper operating system. In my case, I’m using a MacOS, so the website has directed me to download the appropriate format.</p><figure><img alt="Screenshot of https://www.jetbrains.com/idea/download/ — 2 red boxes highlights which version to use, but you can also check the html url to see what selection had been made for the OS. There is also the Ultimate edition at the top, but you’ll want to scroll down to download the free Community edition." src="https://cdn-images-1.medium.com/max/1024/1*ihfKLtn-UEuWhrJoeNdT9A.png" /><figcaption>Make sure to scroll down to download the free community edition.</figcaption></figure><p>Scroll down to the IntelliJ IDEA Community Edition (CE). That is the IDE that is free for everyone!</p><p>Once you’ve downloaded IntelliJ IDEA, open it up to get to the first screen:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8_RUUUUq1pKahy-2XH_v4A.png" /><figcaption>The welcome screen will show recent projects you’ve worked with: if brand new, there will be no projects.</figcaption></figure><p>Select “New Project” and name your project “KotlinCoroutinesMechanisms”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SEmMXb-d5TxJcB9d9aGs7g.png" /><figcaption>New Project screen</figcaption></figure><p>Give your project a few minutes to get set up. It takes up a lot of processing power on your computer! You can view the bottom left blue bar to see what the IDE is trying to do, but it <em>should</em> be able to configure itself without you have to do anything.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_jj9lotblCbmna2yBBWoNQ.png" /><figcaption>IntelliJ loading screen. Give it a few minutes to complete configuring itself. Ideally, you shouldn’t have to do anything else. If the “Kotlin not configured” popup stays after loading, click “Configure”.</figcaption></figure><p>Once loaded, you should see sample code in the main panel to the right, and a project directory to the left. If you select the target icon at the top of the Project directory panel, you can quickly navigate to the current file you’re looking at.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3NtBnac0yalYoNsEWdYSNQ.png" /><figcaption>Screenshot of initial project setup.</figcaption></figure><p>You can press play to run the code. You should see a new panel pop up at the bottom. In my case, I ended up with the following message:</p><pre>Execution failed for task &#39;:compileKotlin&#39;.<br>&gt; Inconsistent JVM-target compatibility detected for tasks &#39;compileJava&#39; (23) and &#39;compileKotlin&#39; (22).<br><br>* Try:<br>&gt; Run with --stacktrace option to get the stack trace.<br>&gt; Run with --info or --debug option to get more log output.<br>&gt; Run with --scan to get full insights.<br>&gt; Get more help at https://help.gradle.org.<br>BUILD FAILED in 6s<br>1 actionable task: 1 executed<br><br></pre><p>Ope. Incompatibility detected for compileJava (23) and compileKotlin (22). I googled the error message itself exactly as-is and found the following the following suggestion, which fixed my issue.</p><p>Navigate to build.gradle.kts and add the following code above the dependencies section:</p><pre>kotlin {<br>    jvmToolchain(21)<br>}<br><br>dependencies {<br>    ...<br>}</pre><p>A small elephant popup should show. Click that to sync Gradle.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/156/1*uhJBgIT_9vBP2PjAKhYzcA.png" /><figcaption>Sync Gradle popup shows whenever changes are made to build.gradle.kts</figcaption></figure><p>Once it builds successfully, navigate back to the original file and press play again. Alright! I now get:</p><pre>/Users/amandahinchman-dominguez/Library/Java/JavaVirtualMachines/openjdk-23.0.1/Contents/Home/bin/java -javaagent:/Applications/IntelliJ IDEA CE.app/Contents/lib/idea_rt.jar=50284:/Applications/IntelliJ IDEA CE.app/Contents/bin -Dfile.encoding=UTF-8 -Dsun.stdout.encoding=UTF-8 -Dsun.stderr.encoding=UTF-8 -classpath /Users/amandahinchman-dominguez/IdeaProjects/KotlinCoroutinesMechanisms/build/classes/kotlin/main:/Users/amandahinchman-dominguez/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/2.0.21/618b539767b4899b4660a83006e052b63f1db551/kotlin-stdlib-2.0.21.jar:/Users/amandahinchman-dominguez/.gradle/caches/modules-2/files-2.1/org.jetbrains/annotations/13.0/919f0dfe192fb4e063e7dacadee7f8bb9a2672a9/annotations-13.0.jar org.example.MainKt<br>Hello, Kotlin!<br>i = 1<br>i = 2<br>i = 3<br>i = 4<br>i = 5<br><br>Process finished with exit code 0</pre><p>We’re ready to get cooking! Feel free to play with the code in the IDE to make different outputs and experiment as you please.</p><h3>Learning Kotlin via Kotlin Koans</h3><p>There are two options for learning Kotlin via Kotlin Koans — online, or in the IDE via plugins. Pick your preferred path! It’s worth noting I had a few IDE issues trying to import the plugin right in my IntelliJ, but give it a try and see if it works for you.</p><p><a href="https://play.kotlinlang.org/koans/overview">Kotlin Playground: Edit, Run, Share Kotlin Code Online</a></p><h3>Setting up the Coroutine Debugger</h3><p>Check for <a href="https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-dispatchers/-main.html">Dispatchers.Main</a> documentation for your respective platform, but this lab makes use of IntelliJ Studio. If desired, download<a href="https://github.com/ahinchman1/KotlinCoroutineMechanisms"> this GitHub starter project</a> to follow along.</p><p>In the world of coroutines, logging is your friend — but we’re also trying out the functionality offered by IntelliJ/AS IDEs for coroutine debugging.</p><p>The following function is added to your project for convenience:</p><pre>fun log(msg: String) = println(&quot;[${Thread.currentThread().name}] $msg&quot;)</pre><p>You print statements with log($input). Then, edit your run configurations by adding -Dkotlinx.coroutines.debug to your VM options:</p><p>Classes can be run in debug mode, and a Coroutines tab can be opened up in the debug console to observe the state of the coroutine:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MUmxjtM3BG2sCyNEc02enw.png" /></figure><p>That should be it! If you’d like to start playing around with coroutines, feel free to access previous blurbs on Kotlin Coroutine Mechanisms:</p><ul><li><a href="https://hinchman-amanda.medium.com/kotlin-coroutine-mechanisms-runblocking-v-launch-386e1ae8e3c2">Kotlin Coroutine Mechanisms part 1: runBlocking v. launch</a></li><li><a href="https://hinchman-amanda.medium.com/7877f8b67e30">Kotlin Coroutine Mechanisms part 2: launch v. async</a></li><li><a href="https://hinchman-amanda.medium.com/kotlin-coroutine-mechanisms-part-3-swapping-coroutinecontext-983e950ac29a">Kotlin Coroutine Mechanisms part 3: swapping CoroutineContext</a></li></ul><p>See you at the next community workshop!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=93c81d26448c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/coding-kinetics/kotlin-coroutine-mechanisms-beginner-friendly-workshop-setup-93c81d26448c">Kotlin Coroutine Mechanisms: Beginner-Friendly Workshop Setup</a> was originally published in <a href="https://medium.com/coding-kinetics">Coding Kinetics</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>