<?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[Stories by George Mujuru on Medium]]></title>
        <description><![CDATA[Stories by George Mujuru on Medium]]></description>
        <link>https://medium.com/@gmujuru?source=rss-545557e82be7------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*ybIabOdwarn4hlrBUDYkrQ.png</url>
            <title>Stories by George Mujuru on Medium</title>
            <link>https://medium.com/@gmujuru?source=rss-545557e82be7------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 03:14:47 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@gmujuru/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How to stream structured AI on Android without sacrificing UX]]></title>
            <link>https://medium.com/dvt-engineering/how-to-stream-structured-ai-on-android-without-sacrificing-ux-667ac8b83e7c?source=rss-545557e82be7------2</link>
            <guid isPermaLink="false">https://medium.com/p/667ac8b83e7c</guid>
            <category><![CDATA[parser]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[ux]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[token]]></category>
            <dc:creator><![CDATA[George Mujuru]]></dc:creator>
            <pubDate>Fri, 05 Jun 2026 10:47:20 GMT</pubDate>
            <atom:updated>2026-06-05T12:26:26.196Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Why parser-first streaming creates cleaner interfaces, better feedback and more meaningful progress than raw token output</em></p><p><em>By </em><a href="https://medium.com/u/67fd67b3aa39"><em>George Mujuru</em></a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HE4kyeNFyx3lX6lymOJoTA.png" /></figure><p><strong>1. The problem: why streamed AI still feels slow</strong></p><p>Latency is usually the first thing Android teams notice when they add AI features. Five seconds for a chat reply feels slow. Fifteen seconds feels unbearable. That is why streaming, through Server-Sent Events (SSE) and token-by-token updates, has become the default pattern, popularised by ChatGPT.</p><p>But streamed text does not necessarily show meaningful progress. Users are not waiting for words to appear; they are waiting for a useful result, whether that is a four-day trip itinerary, a contract summary or a workout draft.</p><p>Raw token streaming shows the model “typing”, but not the artefact taking shape. Instead of seeing a plan assemble itself, users watch JSON fragments and formatting noise scroll past — and then suddenly get a complete result. The transition is jarring and breaks immersion. The system still feels slow, even when it is not.</p><p>The question, then, is not just how to stream faster. It is how to make users feel that something useful is being built in front of them.</p><p><strong>2. The solution: parser-first streaming with WayPoint</strong></p><p>Parser-first streaming reverses the usual approach. Instead of accumulating all incoming data and parsing after the stream ends, the parser processes each incoming chunk incrementally and emits structural events as soon as a recognisable unit is ready. The UI updates progressively, titles appear, days fill in, activities slot into place, as the model generates them.</p><p>This approach is demonstrated in WayPoint, an open-source Android travel planner built to explore exactly this problem. The project is available at:</p><p><a href="https://github.com/tungamiraimujuru/Waypoint">github.com/tungamiraimujuru/Waypoint</a></p><p>WayPoint integrates with Anthropic’s Claude API to generate structured travel itineraries as JSON, streams the response via SSE, and renders each piece of the itinerary as it arrives — without ever showing the user a raw JSON fragment.</p><figure><img alt="Waypoint demo, of functionality" src="https://cdn-images-1.medium.com/max/800/1*MYuXUS6B_NHSw5wvTNn_0g.gif" /></figure><p><strong>3. Architecture overview</strong></p><p>WayPoint’s architecture started with a simple question: where should the work live? The easiest answer is to do everything inside a single Composable, with networking, streaming state, parsing and rendering all handled in one place. That works for a demo, but it breaks down quickly when you need to test, swap AI providers or reuse logic across screens.</p><p>The work is instead split into five focused components:</p><p><strong>Orchestrator</strong></p><p>Exposes a simple interface: take a request, return a stream of AI events. This shields the rest of the app from which model or provider is in use — whether Anthropic, Gemini, an on-device model or a test fixture.</p><p><strong>SSE client</strong></p><p>Handles HTTP streaming and is unaware of prompts or domain logic. It streams text deltas and cleans up on cancellation. This keeps business logic out of networking code.</p><p><strong>Parser</strong></p><p>The heart of the system. A pure, dependency-free component that processes incoming bytes incrementally and emits structural events. It has no Android dependencies and no coroutines, which keeps it reusable and easy to test in isolation.</p><p><strong>Reducer</strong></p><p>A pure function that takes the current UI state and an event, and returns a new UI state. It lives outside the ViewModel, making logic straightforward to test without any Android frameworks.</p><p><strong>ViewModel</strong></p><p>Glue code that collects events from the orchestrator, runs them through the reducer and exposes a StateFlow to the UI. It stays small because the heavy lifting is elsewhere.</p><p>A few design choices here diverge from typical Android practice. There is no separate use-cases layer — it was an unnecessary ceremony for this scope. A single sealed event stream preserves event ordering. And the parser is kept separate from the network client so that parsing logic stays reusable and isolated.</p><p><strong>4. How the parser works</strong></p><p>Most streaming implementations buffer all incoming data and parse it once the stream ends. This is simple to implement, but the experience it produces, raw JSON appearing character by character, followed by an instant render, is exactly the problem we are trying to solve.</p><p>The WayPoint parser takes a different approach. It is a compact state machine, around 200 lines of Kotlin, that:</p><ul><li>Tracks opening and closing braces to identify when a structural unit (an activity, a day, a title) is complete</li><li>Ignores braces inside strings, to avoid false positives from quoted content</li><li>Strips Markdown code fences that Claude occasionally inserts despite explicit instructions not to — this happened roughly 5% of the time in testing</li><li>Handles truncated buffers mid-string and stays re-entrant by consuming the buffer as it processes</li></ul><p>The parser runs in microseconds, has no Android dependencies and is the most defensively coded piece in the project. Here is a simplified version of the core parsing loop:</p><pre>fun processChunk(chunk: String) { <br>    buffer += chunk <br>    while (buffer.isNotEmpty()) { <br>        when (state) { <br>            OUTSIDE_OBJECT -&gt; { <br>                val start = buffer.indexOf(&#39;{&#39;) <br>                if (start == -1) {<br>                 buffer = &quot;&quot;;<br>                 return <br>                } <br>                buffer = buffer.substring(start) <br>                state = INSIDE_OBJECT <br>                depth = 0 <br>                inString = false <br>                escaped = false <br>            } <br>            INSIDE_OBJECT -&gt; { <br>                loop@ for (i in buffer.indices) { <br>                    val c = buffer[i] <br>                    when { <br>                        escaped -&gt; escaped = false <br>                        c == &#39;\\&#39; &amp;&amp; inString -&gt; escaped = true <br>                        c == &#39;&quot;&#39; -&gt; inString = !inString <br>                        !inString &amp;&amp; c == &#39;{&#39; -&gt; depth++ <br>                        !inString &amp;&amp; c == &#39;}&#39; -&gt; { <br>                            depth-- <br>                            if (depth == 0) { <br>                                emit(buffer.substring(0, i + 1)) <br>                                buffer = buffer.substring(i + 1) <br>                                state = OUTSIDE_OBJECT <br>                                break@loop <br>                            } <br>                        } <br>                    } <br>                } <br>            } <br>        } <br>    } <br>} </pre><p>Each time a complete JSON object is identified, it is emitted as a structural event. The UI reacts to that event immediately, rendering the new element without waiting for the rest of the stream.</p><p><strong>5. Compose UI rendering</strong></p><p>The parser emits structural events, and the UI has to render them efficiently, sometimes dozens of times per second under heavy streaming load.</p><p>The standard Compose pattern of mutating state directly inside the ViewModel became cumbersome at this frequency. The fix was to move state transformation into the pure reducer described above. The ViewModel collects events, applies the reducer and updates a StateFlow. That keeps the ViewModel thin and makes the state transformation logic easy to test independently.</p><p>Two Compose-specific optimisations made a significant difference:</p><ul><li>Stable keys on list items prevent unnecessary recomposition when the list grows incrementally</li><li>Separating the itinerary preview from the streaming message panel means only the component that changes gets recomposed</li></ul><p>Here is a simplified example of how the ViewModel wires events to state:</p><pre>viewModelScope.launch { <br>    orchestrator.stream(request).collect { event -&gt; <br>        _uiState.update { currentState -&gt; <br>            reducer(currentState, event) <br>        } <br>    } <br>} </pre><p>This pattern kept UI performance smooth under streaming loads, with no dropped frames observed during testing on a mid-range Android device.</p><p><strong>6. Claude integration: what worked and what did not</strong></p><p>Using Anthropic’s Claude was a straightforward choice given its stable API and reliable structured JSON output. But integration revealed a few practical challenges worth documenting.</p><p><strong>Default serialisation omits default values</strong></p><p>Kotlin’s default serialisation behaviour omits fields that match their default values. This caused 400 errors because the Claude API expected explicit field names — including the model name — on every request. The fix was to enable encoding of defaults explicitly in the serialisation configuration, ensuring all required fields are always sent.</p><p><strong>Retry logic for streaming failures</strong></p><p>Streaming can fail mid-response: network drops, 5xx errors and rate limits all occur in practice. WayPoint implements bounded retries on these transient errors. Parse errors and client-side 4xx errors do not trigger retries, to avoid wasting API credits on requests that will not succeed.</p><p><strong>Markdown fencing</strong></p><p>Despite explicit instructions in the system prompt to return only raw JSON, Claude wrapped its output in Markdown code fences (```json … ```) approximately 5% of the time during testing. The parser strips these defensively. This is a good example of why production LLM integration requires forgiving parsers — even well-instructed models are not perfectly consistent.</p><p><strong>7. Try it yourself</strong></p><p><strong>Get the code</strong></p><p>WayPoint is open-source and available on GitHub:</p><p><a href="https://github.com/tungamiraimujuru/Waypoint">github.com/tungamiraimujuru/Waypoint</a></p><p><strong>Prerequisites</strong></p><p>Before you begin, you will need:</p><ul><li>Android Studio Hedgehog or later</li><li>Kotlin 1.9+</li><li>An Anthropic API key (available at console.anthropic.com)</li><li>Gradle 8.0+</li></ul><p><strong>Key dependencies</strong></p><p>Add the following to your build.gradle.kts:</p><pre>// HTTP streaming <br>implementation(&quot;com.squareup.okhttp3:okhttp:4.12.0&quot;) <br>// JSON serialisation <br>implementation(&quot;org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.3&quot;) <br>// Coroutines <br>implementation(&quot;org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3&quot;) </pre><p><strong>Getting started</strong></p><p>Clone the repository and open it in Android Studio:</p><pre>git clone https://github.com/tungamiraimujuru/Waypoint.git <br>cd Waypoint </pre><p>Add your Anthropic API key to local.properties:</p><pre>ANTHROPIC_API_KEY=your_key_here </pre><p>Build and run on a device or emulator running Android API 26 or above. The main entry point for the streaming logic is in StreamingOrchestrator.kt. The parser lives in IncrementalJsonParser.kt — this is the best place to start if you want to adapt the pattern for a different structured output format.</p><p>The architecture is intentionally modular. Swapping Claude for a different provider means replacing the SSE client and adjusting the prompt — the parser, reducer and UI layer remain unchanged.</p><p><strong>8. Conclusion</strong></p><p>The core lesson is straightforward: streaming structured AI output is a user experience problem before it is a networking problem. If users cannot see the result taking shape, the system still feels slow, regardless of actual response times.</p><p>A parser-first approach solves this by turning incoming tokens into visible structure. Users do not watch syntax arrive; they watch a plan, a summary or a draft assemble itself step by step.</p><p>WayPoint is a prototype, not a production system. It is missing observability tooling, remote configuration for prompts and model settings, provider fallback chains and performance instrumentation. But the architecture already makes room for these without major rework, and the pattern itself is solid enough to build on.</p><p>Android still lacks much of the ready-made streaming tooling that exists in the JavaScript ecosystem. That leaves room to experiment, and hopefully WayPoint is a useful starting point for teams trying to make AI on Android feel less clunky and more useful.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=667ac8b83e7c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/dvt-engineering/how-to-stream-structured-ai-on-android-without-sacrificing-ux-667ac8b83e7c">How to stream structured AI on Android without sacrificing UX</a> was originally published in <a href="https://medium.com/dvt-engineering">DVT Software Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The State of Jetpack Compose in 2025]]></title>
            <link>https://medium.com/dvt-engineering/the-state-of-jetpack-compose-in-2025-987145a773fb?source=rss-545557e82be7------2</link>
            <guid isPermaLink="false">https://medium.com/p/987145a773fb</guid>
            <category><![CDATA[jetpack-compose]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[androiddev]]></category>
            <dc:creator><![CDATA[George Mujuru]]></dc:creator>
            <pubDate>Fri, 15 Aug 2025 11:18:55 GMT</pubDate>
            <atom:updated>2025-08-15T11:18:55.098Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ox7hAen78SiyY0FHvTrBYA.png" /></figure><p><strong>Introduction</strong></p><p>It has been a few years since Google’s Jetpack Compose made its stable debut, and in that time, it has completely changed how Android apps are built. What began as a modern alternative to the traditional View system has now become the go-to toolkit for Android developers around the world.</p><p>In this blog, we will take a closer look at how Compose has grown and where it stands today. We will look at how widely it has been adopted across the industry, with examples from major apps and development teams that have embraced it fully.</p><p>So, whether you are already using Compose or thinking about giving it a try, this post will give you a holistic view of where things stand.</p><p><strong>Goodbye XML, Hello Compose</strong></p><p>Jetpack Compose was designed to simplify and accelerate UI development on Android. The old view system used XML layouts combined with imperative logic in activities and fragments. This resulted in a lot of boilerplate code, difficult state management and UI inconsistencies as the applications grew more complex.</p><p>In response to these limitations, Compose was developed. The key reasons were: <br>• Declarative UI: Build UI with functions that react to state changes. <br>• Less Boilerplate: No more XML, findViewById, the chaos of adapters. <br>• Unified Toolkit: Everything from layouts to animations is handled in Kotlin. <br>• Faster Iteration: Live previews, hot reload, and simpler testing.</p><p>In 2025, Jetpack Compose has improved in several core areas: <br>• Live Edit 2.0 brings real-time updates to stateful composables and animations, significantly improving developer productivity. <br>• Compose Multiplatform is now stable and production-ready for Android and desktop, with web support rapidly evolving. <br>• Material 3 feels complete, offering robust theming and accessibility out of the box. <br>• Animation APIs enable smoother transitions and improved control, helping developers detect and resolve jank earlier in the development process. <br>• UI Testing Tools have matured with visual diffing, semantic matchers, and flaky test detection, making test coverage more reliable.</p><p>Today, compose has matured into a powerful and stable solution used to build many applications. What started as a newcomer in the Android development world has now become the norm for modern UI development.</p><p><strong>A Good Fit for Modern Android </strong><br> <br>While improvements are still being made, Jetpack Compose has kept up with the needs of modern Android development. It works well for building modern interfaces, including smart features powered by AI, apps for smartwatches using Wear Compose, and flexible layouts for foldable phones and large screens. It’s also used in embedded and IoT environments, like car displays and smart dashboards, and performs surprisingly well.</p><p>Compose Multiplatform goes beyond mobile. Support for desktop, iOS and Android is stable, while web support is still in alpha. However, it’s already useful for trying out internal tools. At the time of writing, version 1.8.0 is the latest stable release for the Android libraries.</p><p>Global multinational companies such as Airbnb, Disney+, Meta (notably Threads), Spotify, Chat GPT and even Google Play have adopted Compose for real-world, user-facing applications. The benefits reported include faster delivery cycles, better performance, and reduced defect rates. In the local and African context, uptake has been slow, with only Standard Bank and Discovery being the most notable users of Jetpack Compose, indicating growth potential.</p><p><strong>Developer Experience over the Past Two Years: A Mixed Bag</strong></p><p>Developers praise the framework for its rapid iteration, composable architecture, and reusability. However, some challenges remain. Understanding recomposition, managing state effectively, and integrating with legacy View-based systems can still be tricky. For teams working with legacy codebases, ComposeView offers a practical way to bring Compose into existing XML-based projects. It lets developers embed composables directly into traditional views, making the migration process less daunting and more incremental. Tooling has improved significantly, though debugging and UI inspection tools still have room to mature.</p><p>Performance has also improved significantly. Smarter recomposition, more efficient lazy layouts, a smoother Skia renderer, and Kotlin 2.x have led to faster builds and improved runtime performance. Development tools such as modifier tracing, recomposition highlights, and memory leak detection further enhance reliability. <br> <br>Over the past few years, I have been using Jetpack Compose as my main tool for Android development, and I have learned a lot through hands-on experience: <br> <br>• Building UIs from designs is quicker and easier. It is much faster to go from a design to a working screen. I can create reusable components which help speed things up. The live preview in Android Studio also saves time since I don’t have to rebuild the whole app just to see small changes. <br>• I used to struggle with recomposition, but I’ve improved over time and now understand how to manage it better.</p><p>•State hoisting has helped me write cleaner code, especially when working with shared or lifted state across components. <br>• The Android developer community has been helpful; for example, tools like custom lint checks (such as Compose Lints by Slack) help catch potential issues early, making it easier to write better Compose code.</p><p><strong>The Ecosystem: Mature and Expanding</strong></p><p>Google continues to invest in its Jetpack Compose through key libraries like Navigation, Paging, Glance, and Material, covering everything from app architecture to home screen widgets. On top of this, community-driven tools such as Accompanist, Showkase, Voyager, and Lottie make it easier to build polished, responsive UIs.</p><p>The tooling is just as strong. Android Studio offers features like Live Edit, Compose Metrics, and helpful lint checks that support quick iteration and code quality.</p><p>Together, this growing ecosystem helps developers build high-quality apps faster, whether for Android alone or across platforms with Compose Multiplatform. Despite the progress, there are still a few areas where Google could improve Jetpack Compose: <br>• Working with XML and older code, in larger apps, switching from XML to Compose can still be tricky. Having better migration tools built in would make it easier to deal with older codebases. <br>• Simpler architectural guidance, better official guidance could assist in removing confusion for newcomers. <br>• Some error messages, especially when a composable can’t be shown, could be clearer and more helpful.</p><p>Compose is also expected to expand further into system-level apps and embedded platforms.</p><p><strong>Conclusion</strong></p><p>In 2025, Jetpack Compose is no longer the future; it is the present. It offers faster development, cleaner architectures, and cross-platform potential. While challenges around learning and tooling remain, the benefits far outweigh the drawbacks. For any developer building Android apps today, sticking with the legacy View system now feels like an avoidable limitation. <br> <br>If you haven’t tried Compose yet, now’s the time to explore it. The ecosystem is mature, the community is active, and the future is clearly composable.</p><p><strong>References</strong></p><p>1. https://developer.android.com/jetpack/androidx/releases/compose <br>2. <a href="https://slackhq.github.io/compose-lints/">https://slackhq.github.io/compose-lints/</a></p><p>3. <a href="https://betulnecanli.medium.com/why-you-should-learn-jetpack-compose-in-">https://betulnecanli.medium.com/why-you-should-learn-jetpack-compose-in-</a>2025-and-how-to-do-it-for-free-a9e1b1db48e8 <br>4. <a href="https://android-developers.googleblog.com/2022/05/airbnb-uses-jetpack-">https://android-developers.googleblog.com/2022/05/airbnb-uses-jetpack-</a><br>compose.html <br>5. <a href="https://github.com/airbnb/Showkase">https://github.com/airbnb/Showkase</a> <br>6. <a href="https://www.linkedin.com/posts/jorgecastillopr_guiding-the-jetpack-compose-migration-at-activity-7308205675501789185-LLdj?utm_source=share&amp;utm_medium=member_desktop&amp;rcm=ACoAAAznNGgBl_8Tm0rhhda-rOFjm37wD5qe5V8">https://www.linkedin.com/posts/jorgecastillopr_guiding-the-jetpack-compose-migration-at-activity-7308205675501789185-LLdj?utm_source=share&amp;utm_medium=member_desktop&amp;rcm=ACoAAAznNGgBl_8Tm0rhhda-rOFjm37wD5qe5V8</a> <a href="https://www.linkedin.com/posts/jorgecastillopr_guiding-the-jetpack-compose-migration-at-activity-7308205675501789185-LLdj?utm_source=share&amp;utm_medium=member_desktop&amp;rcm=ACoAAAznNGgBl_8Tm0rhhda-rOFjm37wD5qe5V8"><br></a>7. <a href="https://www.jetbrains.com/lp/devecosystem-2024/">https://www.jetbrains.com/lp/devecosystem-2024/</a> <br>8. <a href="https://x.com/JorgeCastilloPr/status/1902439932129390808">https://x.com/JorgeCastilloPr/status/1902439932129390808</a> <br>9. <a href="https://www.youtube.com/watch?v=23sNq-N06xU">https://www.youtube.com/watch?v=23sNq-N06xU</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=987145a773fb" width="1" height="1" alt=""><hr><p><a href="https://medium.com/dvt-engineering/the-state-of-jetpack-compose-in-2025-987145a773fb">The State of Jetpack Compose in 2025</a> was originally published in <a href="https://medium.com/dvt-engineering">DVT Software Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>