<?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 Ke on Medium]]></title>
        <description><![CDATA[Stories by Ke on Medium]]></description>
        <link>https://medium.com/@KeKema2012?source=rss-985f4bf781c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*ar-nyndZVfl9_ynqCFBUGQ.png</url>
            <title>Stories by Ke on Medium</title>
            <link>https://medium.com/@KeKema2012?source=rss-985f4bf781c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 10:01:25 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@KeKema2012/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[The Nomad’s Guide to Learning: How to Master New Skills in the AI Era]]></title>
            <link>https://medium.com/@KeKema2012/the-nomads-guide-to-learning-how-to-master-new-skills-in-the-ai-era-94d2df36a866?source=rss-985f4bf781c------2</link>
            <guid isPermaLink="false">https://medium.com/p/94d2df36a866</guid>
            <category><![CDATA[personal-development]]></category>
            <category><![CDATA[skill-acquisition]]></category>
            <category><![CDATA[future-of-work]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[lifelong-learning]]></category>
            <dc:creator><![CDATA[Ke]]></dc:creator>
            <pubDate>Mon, 16 Nov 2026 22:12:42 GMT</pubDate>
            <atom:updated>2026-11-16T22:12:42.881Z</atom:updated>
            <content:encoded><![CDATA[<p>Have you ever felt a wave of anxiety watching the constant stream of tech updates? With AI tools like ChatGPT and Claude evolving by the day, a question haunts me: <strong>“Is what I’m learning today going to be completely useless tomorrow?”</strong></p><p>In a recent interview, Hao Xu-Li (popularly known as Coach Hao), a former TSMC executive and venture capitalist, addressed this exact cultural anxiety. He dropped some powerful truth bombs on <strong>how to learn how to learn</strong> in an era where the traditional rules of education are broken.</p><p>If you want to stop feeling overwhelmed and start building an unbreakable skill set, here is Coach Hao’s blueprint for modern learning.</p><p><strong>1. Master “Mind Stillness” Before You Master a Skill</strong></p><p>When technology shifts beneath our feet, our immediate reflex is to panic-learn. We try to read every article, take every course, and consume endless content. Coach Hao argues that this approach only breeds deep anxiety.</p><p>Instead, the very first thing you need to learn is <strong>Mind Stillness (修心)</strong>.</p><p><strong>Why It Matters</strong></p><p>A frantic mind cannot make precise judgments. When you are constantly distracted by the “new shiny thing” or scrolling through short-form videos out of FOMO (Fear Of Missing Out), your brain enters a state of cognitive overload.</p><p><strong>How to Practice It</strong></p><ul><li><strong>The 5-Minute Rule:</strong> Dedicate just 5 minutes a day to absolute stillness. Step away from your screens and social media feeds.</li><li><strong>Micro-Exploration:</strong> Use those few minutes to explore a completely unfamiliar domain — one small piece at a time.</li><li><strong>The Compounding Effect:</strong> 5 minutes a day equals over 1,500 minutes of focused learning a year. This quiet, deliberate accumulation is what sharpens your intuition and decision-making when the world around you gets chaotic.</li></ul><p><strong>2. From “Building Skyscrapers” to “Chasing Water and Grass”</strong></p><p>Coach Hao presents a brilliant analogy comparing the educational models of the past with the harsh realities of the present.</p><p>2.1 The Old School Model<br>Like building a skyscraper. You build a rigid foundation (School -&gt; Degree -&gt; Profession) to rely on a single secure job for your entire life.</p><p>2.2 The Modern Nomad Model<br>Like a nomad chasing water &amp; grass. You pack up, adapt, and move wherever the new resources flow. Your value is defined by your flexibility, not your history.</p><p>In the AI era, skyscrapers collapse overnight. An industry that seemed rock-solid yesterday can be automated tomorrow. Therefore, you must adopt a <strong>nomadic mindset</strong> toward knowledge. When a field dries up because of automation, don’t mourn it. Pack up your tent and move to where the new value is being created.</p><p><strong>3. Shift from “Systemic Learning” to “Point-Based Learning”</strong></p><p>In college, we learned through massive, highly structured curricula. But the most valuable cutting-edge concepts today — like blockchain or generative AI workflows in their early stages — don’t come with a neat textbook. They are messy, emerging, and unorganised.</p><p>Modern mastery requires <strong>Point-Based Learning</strong>:</p><ol><li><strong>Start with Dot:</strong> Don’t wait for a comprehensive masterclass. Pick up a random piece of information that interests you today. Learn one “dot.”</li><li><strong>Connect the Lines:</strong> As you gather more random dots, you will naturally start seeing how they connect (e.g., how AI prompts connect to marketing workflows, which connect to data authentication).</li><li><strong>Form a 3D Matrix:</strong> Over time, these lines intersect to form a unique, multi-dimensional mental model that belongs entirely to you. This is what Charlie Munger called a <em>latticework of mental models</em>.</li></ol><p><strong>4. Think Less, Do More: The Magic of “Learning by Doing”</strong></p><p>One of the biggest traps for intelligent people is perfectionism. We want to understand the whole system before we take action.</p><p>Coach Hao’s ultimate advice is simple: <strong>Thinking is where problems hide; doing is where answers live.</strong></p><p>Take YouTube or podcasting, for example. No traditional university offers a 30-year historical degree in how to be a modern content creator. The current masters of these spaces didn’t think their way to the top — they <em>built</em> their way there. They started with a smartphone, made mistakes, got feedback, and adapted. Action generates the data you need to learn. Perfection is an illusion; completion is your teacher.</p><p><strong>The Ultimate Benchmark for Growth</strong></p><p>To tie it all together, Coach Hao leaves us with a beautifully simple daily goal inspired by Charlie Munger:</p><blockquote>“Aim to go to bed each night a little wiser than when you woke up.”</blockquote><p>Learning doesn’t have to be a painful, formal chore. Read a book, listen to a podcast, analyse a movie, or even dissect the teamwork dynamics in a sports anime. Every piece of content is a vessel for knowledge if you approach it with an active mind.</p><p>If you can write down just one tiny thing you learned today that you didn’t know this morning, you are already winning the race against obsolescence.</p><p>Ref: <a href="https://www.youtube.com/watch?v=uTzZDdYf8rI">https://www.youtube.com/watch?v=uTzZDdYf8rI</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=94d2df36a866" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Stop Writing Nested Loops: What Swift Algorithms Actually Buys You in Production Code]]></title>
            <link>https://medium.com/@KeKema2012/stop-writing-nested-loops-what-swift-algorithms-actually-buys-you-in-production-code-7642de804c40?source=rss-985f4bf781c------2</link>
            <guid isPermaLink="false">https://medium.com/p/7642de804c40</guid>
            <category><![CDATA[swift-algorithms]]></category>
            <dc:creator><![CDATA[Ke]]></dc:creator>
            <pubDate>Sat, 29 Aug 2026 07:10:28 GMT</pubDate>
            <atom:updated>2026-08-29T07:10:28.637Z</atom:updated>
            <content:encoded><![CDATA[<p>New dependencies are usually a liability, not a convenience. So I went through Apple’s own <a href="https://github.com/apple/swift-algorithms">Swift Algorithms</a> package expecting little more than syntactic sugar not worth the import.</p><p>I was wrong. Here’s why — not from a “cool new API” angle, but from the angle of someone who has to review this code in a pull request, maintain it two years later, and explain the choice to a junior engineer.</p><h3>Why this package exists</h3><p>Swift Algorithms isn’t a community side project. It’s maintained by Apple’s standard library team. Nate Cook’s <a href="https://www.swift.org/blog/swift-algorithms/">original announcement on swift.org</a> frames it as a proving ground — a place to try out generic sequence and collection operations before they’re mature enough for the multi-year Swift Evolution process that would land them in the standard library itself.</p><p>That’s the point that matters for a production decision: this isn’t a third-party abstraction you’re betting on. It’s the closest thing to “future stdlib” you can add today. The bar for inclusion is also higher than a typical utility library — the maintainers explicitly reject anything “trivially composable” or that “might encourage misuse.” That’s the kind of discipline I want underneath my business logic.</p><h3>The real argument: correctness, not brevity</h3><p>Paul Hudson’s <a href="https://www.hackingwithswift.com/articles/243/write-better-code-with-swift-algorithms">walkthrough on Hacking with Swift</a> is a good tour of the package if you want the full catalogue. Read as a senior engineer, though, the pattern that stands out isn’t “fewer characters typed” — it’s “fewer places for bugs to hide.”</p><p>Take pairing up elements from a list, say grouping students into study pairs. The naive way is manual index maths:</p><pre>let students = [&quot;Taylor&quot;, &quot;Sophie&quot;, &quot;Bella&quot;, &quot;Rajesh&quot;, &quot;Tony&quot;]</pre><pre>for i in stride(from: 0, to: students.count, by: 2) {<br>    if i + 1 &lt; students.count {<br>        print(&quot;\(students[i]) and \(students[i + 1])&quot;)<br>    } else {<br>        print(&quot;\(students[i]) is on their own&quot;)<br>    }<br>}</pre><p>That works, but it only works because someone remembered the bounds check. Forget it, and students[i + 1] crashes the moment your array has an odd number of elements. Swift Algorithms gives you chunks(ofCount:) instead:</p><pre>import Algorithms</pre><pre>let pairs = students.chunks(ofCount: 2)</pre><pre>for pair in pairs {<br>    let names = pair.map(\.self)<br>    print(names.joined(separator: &quot; and &quot;))<br>}</pre><p>chunks(ofCount:) hands you slices, not a false promise of uniform pairs, so a trailing partial group is just a shorter slice — you can&#39;t accidentally index past the end. The shape of the API makes the edge case impossible to ignore.</p><p>The same idea applies to chunked(on:) and chunked(by:):</p><pre>struct Student {<br>    let name: String<br>    let grade: String<br>}</pre><pre>let results = [<br>    Student(name: &quot;Taylor&quot;, grade: &quot;A&quot;),<br>    Student(name: &quot;Sophie&quot;, grade: &quot;A&quot;),<br>    Student(name: &quot;Bella&quot;, grade: &quot;B&quot;),<br>    Student(name: &quot;Rajesh&quot;, grade: &quot;C&quot;),<br>]</pre><pre>// Group whenever the grade changes<br>let byGrade = results.chunked(on: \.grade)</pre><pre>// Group whenever a pairwise test fails — here, ascending runs<br>let numbers = [10, 20, 30, 10, 40, 40, 10, 20]<br>let ascendingRuns = numbers.chunked(by: { $0 &lt;= $1 })<br>// [[10, 20, 30], [10, 40, 40], [10, 20]]</pre><p>If you’ve ever inherited a hand-rolled grouping function with a stray mutable array and an off-by-one boundary check, you’ll see straight away why handing this logic to a well-tested, Apple-maintained implementation reduces risk — it isn’t just tidier code.</p><h3>Where I actually reach for this</h3><p>A handful of these have already earned a permanent place in code I write and review.</p><p><strong>chain(_:_:)</strong> replaces array1 + array2 when you&#39;re only iterating, not storing the result:</p><pre>let names1 = [&quot;Jane&quot;, &quot;Elizabeth&quot;, &quot;Mary&quot;]<br>let names2 = [&quot;Daphne&quot;, &quot;Eloise&quot;, &quot;Francesca&quot;]</pre><pre>// Allocates a new array just to loop over it once<br>for name in names1 + names2 { print(name) }</pre><pre>// No extra allocation — chain() just ties the iterators together<br>for name in chain(names1, names2) { print(name) }</pre><p>Allocating a concatenated array to loop over once is invisible in a review and invisible in a unit test — it only shows up as a profiler flag once your data set is large. chain also works across mixed sequence types, which is handy for checking a value against several disjoint bounds:</p><pre>let tooLow = 0...20<br>let tooHigh = 80...100<br>let outOfBounds = chain(tooLow, tooHigh)</pre><pre>outOfBounds.contains(35) // false</pre><p><strong>compacted()</strong> is small, but it&#39;s a review flag for me now:</p><pre>let numbers: [Int?] = [10, nil, 20, nil, 30]</pre><pre>// Works, but the $0 is a workaround, not an intention<br>let safeA = numbers.compactMap { $0 }</pre><pre>// Says exactly what it means<br>let safeB = numbers.compacted()</pre><p>.compactMap { $0 } is a tell that whoever wrote it either didn&#39;t know compacted() existed, or copied it from an old Stack Overflow answer. Beyond readability, compacted() is unconditionally lazy, where compactMap is only lazy inside a lazy chain — so it composes more predictably when you&#39;re stacking several transformations together.</p><p><strong>uniqued(on:)</strong> solves a problem I&#39;ve seen botched repeatedly: deduplicating structs by one property while keeping the first occurrence.</p><pre>struct City {<br>    let name: String<br>    let country: String<br>}</pre><pre>let destinations = [<br>    City(name: &quot;Hamburg&quot;, country: &quot;Germany&quot;),<br>    City(name: &quot;Kyoto&quot;, country: &quot;Japan&quot;),<br>    City(name: &quot;Osaka&quot;, country: &quot;Japan&quot;),<br>]</pre><pre>let oneCityPerCountry = destinations.uniqued(on: \.country)<br>// Hamburg, Kyoto</pre><p>The hand-rolled version usually means a Set of seen keys plus a mutable results array, fine until someone gets the ordering or equality checks wrong. uniqued(on:) is one line, and it&#39;s a line you don&#39;t have to argue about in review.</p><p><strong>product(_:_:)</strong> is worth calling out for what it <em>enables</em>, not just what it replaces:</p><pre>let people = [&quot;Sophie&quot;, &quot;Charlotte&quot;]<br>let games = [&quot;Mario Kart&quot;, &quot;Boomerang Fu&quot;]</pre><pre>for pairing in product(people, games) {<br>    print(&quot;\(pairing.0) will play \(pairing.1)&quot;)<br>}</pre><p>That flattens two nested for loops, but because it returns a real collection, you can compose it further:</p><pre>// 20 random question pairings, no shuffle-then-prefix dance<br>let questions = product(1...12, 1...12).randomSample(count: 20)</pre><p>That composability is the real selling point of the whole package — these are building blocks, not just loop replacements.</p><h3>Caveats before you ship this</h3><p>None of these are dealbreakers, but all are worth flagging to the team before someone hits them mid-review.</p><p><strong>chunks(ofCount:) returns array <em>slices</em>, not arrays.</strong> Index into a slice assuming it starts at 0, and you&#39;ll get a runtime crash the first time your data doesn&#39;t:</p><pre>let pairs = results.chunks(ofCount: 2)</pre><pre>// Crashes: a slice doesn&#39;t necessarily start at index 0<br>// print(pairs[0][0].name)</pre><pre>// Safe: convert to Array first if you need Array semantics<br>let arrayPairs = results.chunks(ofCount: 2).map(Array.init)<br>print(arrayPairs[0][0].name)</pre><p>Worth a line in the team style guide.</p><p><strong>randomSample(count:) doesn&#39;t preserve order</strong> — it&#39;s fast specifically because it doesn&#39;t have to:</p><pre>let lotteryBalls = 1...50<br>let winners = lotteryBalls.randomSample(count: 7) // any order</pre><pre>// Use this instead if order matters<br>let people = [&quot;Chidi&quot;, &quot;Eleanor&quot;, &quot;Jason&quot;, &quot;Tahani&quot;]<br>let selected = people.randomStableSample(count: 2) // keeps original order</pre><p>Pick the wrong one and nothing crashes — you just get a subtly wrong result that’s annoying to debug because the test still looks like it passes.</p><p><strong>product(_:_:) only takes two parameters.</strong> For three-way combinations you&#39;re nesting calls and reading tuple-of-tuple access:</p><pre>let suspects = [&quot;Colonel Mustard&quot;, &quot;Professor Plum&quot;]<br>let locations = [&quot;kitchen&quot;, &quot;library&quot;]<br>let weapons = [&quot;candlestick&quot;, &quot;dagger&quot;]</pre><pre>let guesses = product(product(suspects, locations), weapons)</pre><pre>for guess in guesses {<br>    // guess.0.0 = suspect, guess.0.1 = location, guess.1 = weapon<br>    print(&quot;Was it \(guess.0.0) in the \(guess.0.1) with the \(guess.1)?&quot;)<br>}</pre><p>That isn’t pleasant to read in a diff. Worth a small wrapper type if you do this more than once.</p><h3>The bottom line</h3><p>I don’t adopt dependencies for elegance. I adopt them when they remove a class of bug I’d otherwise catch in review, or replace something a team is bound to get subtly wrong given enough time and enough hands in the file. Swift Algorithms clears that bar: it’s maintained by the team that owns the language’s standard library, it’s explicit about the correctness guarantees it’s aiming for, and the surface area is small enough to adopt without a training session.</p><p>Add it via Swift Package Manager, import Algorithms, and start with chain, chunked(on:), and compacted(). Those three alone will clean up a surprising amount of loop logic sitting in most iOS codebases today.</p><p><em>If you’re evaluating Swift Algorithms for your own codebase, the </em><a href="https://github.com/apple/swift-algorithms"><em>GitHub repo</em></a><em> has per-feature guides worth reading in full before you commit to a pattern across a team.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7642de804c40" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Swift Actors: Managing Reentrancy with Transactional Patterns]]></title>
            <link>https://medium.com/@KeKema2012/swift-actors-managing-reentrancy-with-transactional-patterns-849252251155?source=rss-985f4bf781c------2</link>
            <guid isPermaLink="false">https://medium.com/p/849252251155</guid>
            <category><![CDATA[swift-actor]]></category>
            <category><![CDATA[swift]]></category>
            <dc:creator><![CDATA[Ke]]></dc:creator>
            <pubDate>Thu, 14 May 2026 15:52:37 GMT</pubDate>
            <atom:updated>2026-05-14T15:52:37.361Z</atom:updated>
            <content:encoded><![CDATA[<p>Swift actors are often introduced as the solution to data races. And they are — but only partially.</p><p>What many developers discover quickly is that actors don’t give you <em>transactions</em>. They give you <strong>isolation between suspension points</strong>. The moment you introduce await, your mental model of “this runs atomically” can quietly break.</p><p>This post explores the problem and walks through practical patterns to manage it.</p><h3>The Problem: Reentrancy Breaks Atomic Thinking</h3><p>Consider this code:</p><pre>try await account.enqueue { account in<br>    try account.withdraw(50)<br>    let result = try await remoteAPI.call()<br>    account.deposit(result.reward)<br>}</pre><p>At a glance, this looks like a single logical operation:</p><pre>withdraw → API call → deposit</pre><p>But it is not atomic.</p><h3>Why?</h3><p>Because of this line:</p><pre>let result = try await remoteAPI.call()</pre><p>That await introduces a suspension point.</p><p>When suspension happens:</p><ul><li>The actor is free to run other work</li><li>Other tasks can mutate the actor’s state</li><li>Your function later resumes with potentially <strong>different state</strong></li></ul><h3>A Concrete Race Condition</h3><p>Initial balance: 100</p><p>Your flow:</p><pre>withdraw(50) → balance = 50<br>(await...)<br>deposit(20) → expected balance = 70</pre><p>But during the await, another task runs:</p><pre>withdraw(40) → balance = 10</pre><p>Now your code resumes:</p><pre>deposit(20) → balance = 30</pre><p>Final result: <strong>30 instead of 70</strong></p><p>No data race occurred — but you still got the wrong result.</p><h3>Key Insight</h3><p>Actors guarantee isolation only <strong>between suspension points</strong>, not across them.</p><p>So if you want something to behave like a transaction, you must design it explicitly.</p><h3>Pattern 1: Keep Async Work Outside the Actor</h3><p>The simplest and most important rule:</p><p>Do async work outside, mutate state inside.</p><pre>let result = try await remoteAPI.call()<br>try await account.enqueue { account in<br>    try account.withdraw(50)<br>    account.deposit(result.reward)<br>}</pre><h3>Why this works</h3><ul><li>No await inside the actor block</li><li>No suspension → no interleaving</li><li>Entire mutation is atomic</li></ul><h3>Pattern 2: Actor-Owned Workflow (State Machine)</h3><p>For more complex flows, move the logic <strong>inside the actor</strong> and track state explicitly.</p><pre>actor BankAccount {<br>    private var balance: Int<br>    private var pendingTransactions: Set&lt;UUID&gt; = []<br><br>    init(balance: Int) {<br>        self.balance = balance<br>    }<br><br>    func redeemReward(cost: Int) async throws {<br>        let id = UUID()<br>        // Reserve<br>        guard balance &gt;= cost else {<br>            throw BankError.insufficientFunds<br>        }<br>        balance -= cost<br>        pendingTransactions.insert(id)<br>        do {<br>            // Async step (reentrancy can happen here)<br>            let result = try await remoteAPI.call()<br>            // Validate on resume<br>            guard pendingTransactions.contains(id) else {<br>                throw BankError.transactionCancelled<br>            }<br>            balance += result.reward<br>            pendingTransactions.remove(id)<br>        } catch {<br>            // Rollback<br>            balance += cost<br>            pendingTransactions.remove(id)<br>            throw error<br>        }<br>    }<br>}</pre><h3>Why this works</h3><ul><li>You track intent (pendingTransactions)</li><li>You re-validate state after suspension</li><li>You support rollback</li></ul><p>This is effectively a <strong>manual transaction system</strong>.</p><h3>Pattern 3: Two-Phase Commit</h3><p>A cleaner and more explicit approach is to separate the operation into phases.</p><h3>Step 1: Actor defines primitives</h3><pre>actor BankAccount {<br>    private var balance: Int<br><br>    func reserve(_ amount: Int) throws -&gt; Reservation {<br>        guard balance &gt;= amount else {<br>            throw BankError.insufficientFunds<br>        }<br>        balance -= amount<br>        return Reservation(amount: amount)<br>    }<br><br>    func commit(_ reservation: Reservation, reward: Int) {<br>        balance += reward<br>    }<br><br>    func rollback(_ reservation: Reservation) {<br>        balance += reservation.amount<br>    }<br>}<br><br>struct Reservation {<br>    let amount: Int<br>}</pre><h3>Step 2: Orchestrate outside</h3><pre>let reservation = try await account.reserve(50)<br><br>do {<br>    let result = try await remoteAPI.call()<br>    await account.commit(reservation, reward: result.reward)<br>} catch {<br>    await account.rollback(reservation)<br>    throw error<br>}</pre><h3>Why this works</h3><ul><li>No suspension during critical mutation</li><li>Explicit lifecycle: reserve → commit / rollback</li><li>Easy to reason about and test</li></ul><p>This mirrors how <strong>databases handle transactions</strong>.</p><h3>Pattern 4: Internal Task Queue (Strict Serialization)</h3><p>If you want to eliminate reentrancy entirely, you can enforce serialization manually.</p><pre>actor BankAccount {<br>    private var balance: Int<br>    private var queue: [() async -&gt; Void] = []<br>    private var isProcessing = false<br><br>    func enqueueOperation(_ op: @escaping () async -&gt; Void) {<br>        queue.append(op)<br>        processQueue()<br>    }<br><br>    private func processQueue() {<br>        guard !isProcessing else { return }<br>        isProcessing = true<br>        Task {<br>            while !queue.isEmpty {<br>                let op = queue.removeFirst()<br>                await op()<br>            }<br>            isProcessing = false<br>        }<br>    }<br>}</pre><h3>Trade-offs</h3><ul><li>✅ No interleaving</li><li>❌ More complexity</li><li>❌ Lower throughput</li><li>❌ Easier to misuse</li></ul><h3>Pattern 5: Idempotent Design</h3><p>In real-world systems, another strategy is to <strong>embrace reentrancy</strong> but make operations safe.</p><p>Instead of relying on ordering, design operations so they can be retried or interleaved safely.</p><p>Example idea:</p><pre>applyTransaction(id: UUID, delta: Int)</pre><p>So even if the same operation runs twice or out of order:</p><ul><li>It won’t double-apply</li><li>State remains consistent</li></ul><h3>When to Use Each Pattern</h3><p><strong>Use </strong><strong>enqueue when:</strong></p><ul><li>You have synchronous mutations</li><li>You want simple atomic grouping</li></ul><p><strong>Use state machine when:</strong></p><ul><li>You have multi-step async workflows</li><li>You need correctness across suspension</li></ul><p><strong>Use two-phase commit when:</strong></p><ul><li>You depend on external async systems</li><li>You want clear separation of concerns</li></ul><p><strong>Use queue serialization when:</strong></p><ul><li>You need strict ordering</li><li>You accept performance trade-offs</li></ul><h3>Final Takeaway</h3><p>The biggest misconception is:</p><p>“Actors give me transactions.”</p><p>They don’t.</p><p>They give you:</p><p>“Mutual exclusion between suspension points.”</p><p>Everything beyond that — atomicity, rollback, consistency — is something you must design explicitly.</p><p>Once you accept that, actors become much more powerful — not just safe, but predictable.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=849252251155" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Reducing await Noise with Actor Enqueuing in Swift]]></title>
            <link>https://medium.com/@KeKema2012/reducing-await-noise-with-actor-enqueuing-in-swift-4155cfc6fda8?source=rss-985f4bf781c------2</link>
            <guid isPermaLink="false">https://medium.com/p/4155cfc6fda8</guid>
            <category><![CDATA[swift-programming]]></category>
            <category><![CDATA[actors]]></category>
            <category><![CDATA[concurrency]]></category>
            <category><![CDATA[actor-enqueuing]]></category>
            <dc:creator><![CDATA[Ke]]></dc:creator>
            <pubDate>Wed, 13 May 2026 09:36:01 GMT</pubDate>
            <atom:updated>2026-05-14T15:54:17.713Z</atom:updated>
            <content:encoded><![CDATA[<p>Swift actors are great for protecting mutable state:</p><pre>actor BankAccount {<br>    private var balance: Int = 0<br><br>    func deposit(_ amount: Int) {<br>        balance += amount<br>    }<br><br>    func withdraw(_ amount: Int) throws {<br>        guard balance &gt;= amount else {<br>            throw BankError.insufficientFunds<br>        }<br>        balance -= amount<br>    }<br>}<br><br>enum BankError: Error {<br>    case insufficientFunds<br>}</pre><p>From outside the actor, Swift forces us to prove that we are in that isolation domain before we can access the data. And every isolated call needs await:</p><pre>let account = BankAccount()<br><br>await account.deposit(100)<br>try await account.withdraw(30)<br>await account.deposit(50)</pre><p>This is safe, but with two costs:</p><ol><li>Readability: repeated await makes simple transactional code noisy.</li><li>Atomicity: each await is a separate trip to the actor. Other tasks may run between those calls.</li></ol><p>For example:</p><pre>let balance = await account.currentBalance()<br>if balance &gt;= 100 {<br>    try await account.withdraw(100)<br>}</pre><p>This looks reasonable, but it is not one atomic operation. Another task could withdraw money after currentBalance() but before withdraw(100) . Different threads interleave between each suspension point and change the state of the BankAccount while we are in the middle of the different processes.</p><h4>The idea: enqueue a whole operation onto the actor</h4><p>Actor enqueuing means: instead of calling the actor several times from outside, send one closure to the actor and run that closure while isolated to the actor.</p><p>A common helper looks like this:</p><pre>extension Actor {<br>    func enqueue&lt;T: Sendable&gt;(<br>        _ operation: @Sendable (isolated Self) throws -&gt; T<br>    ) async rethrows -&gt; T {<br>        try operation(self)<br>    }<br>}</pre><p>Now we can batch multiple actor-isolated operations behind one await :</p><pre>try await account.enqueue { account in<br>    account.deposit(100)<br>    try account.withdraw(30)<br>    account.deposit(50)<br>}</pre><p>Inside the closure, account is an isolated BankAccount , so actor-isolated synchronous methods can be called without additional await.</p><h4>Important limitation</h4><p>The best version of this pattern uses a <strong>synchronous</strong> closure:</p><pre>@Sendable (isolated Self) throws -&gt; T</pre><p>That is intentional. If the closure itself becomes async, then you can introduce suspension points inside the operation again:</p><pre>extension Actor {<br>    func enqueue&lt;T: Sendable&gt;(<br>        _ operation: @Sendable (isolated Self) async throws -&gt; T<br>    ) async rethrows -&gt; T {<br>        try await operation(self)<br>    }<br>}</pre><p>This version is sometimes useful, but it does <strong>not </strong>give the same atomic feel, because every await inside the closure can still suspend.</p><p>Prefer this instead:</p><pre>try await account.enqueue { account in<br>    try account.withdraw(50)<br>    account.deposit(10)<br>}</pre><p>Be careful with this:</p><pre>try await account.enqueue { account in<br>    try account.withdraw(50)<br><br>    let result = try await remoteAPI.call()<br><br>    account.deposit(result.reward)<br>}</pre><p>The await remoteAPI.call() allows suspension, so other work may run on the actor before the deposit happens. I explain more <a href="https://medium.com/@KeKema2012/swift-actors-managing-reentrancy-with-transactional-patterns-849252251155">here</a>.</p><h4>When actor enqueuing is useful</h4><p>Use it when you want to:</p><ul><li>reduce repeated await calls</li><li>group several synchronous actor operations</li><li>make read-modify-write logic safer</li><li>express a small transaction-like operation</li></ul><p>Avoid it when the operation depends on slow I/O, networking, database work, or anything else that requires await.</p><h4>Final takeaway</h4><p>Actors give you safe isolation. await gives Swift permission to suspend. Actor enqueuing is a pattern for saying:</p><blockquote>“Run this whole synchronous block inside the actor with one hop.”</blockquote><p>It doesn’t replace actors, and it doesn’t remove suspension from truly async work. But for small, synchronous state mutations, it makes actor code cleaner and helps avoid accidental logical races.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4155cfc6fda8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why is Swift becoming more and more complex?]]></title>
            <link>https://medium.com/@KeKema2012/why-is-swift-becoming-more-and-more-complex-5c824e9d828a?source=rss-985f4bf781c------2</link>
            <guid isPermaLink="false">https://medium.com/p/5c824e9d828a</guid>
            <category><![CDATA[software-design]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[swift-programming]]></category>
            <dc:creator><![CDATA[Ke]]></dc:creator>
            <pubDate>Thu, 07 May 2026 10:53:04 GMT</pubDate>
            <atom:updated>2026-05-07T10:53:04.860Z</atom:updated>
            <content:encoded><![CDATA[<p>Swift has evolved from an iOS development language into a system-level language, and its complexity stems from the systematic demands of software engineering.</p><h4>2015 — When Swift was first released</h4><p>In 2015, when Swift was just released, Apple positioned it very clearly:</p><p>| A language that is more modern, safer, and simpler than Objective-C.</p><p>At that time, many iOS developers, when first seeing Swift, had a feeling:</p><pre>let name = &quot;Swift&quot;</pre><blockquote>“Finally, no more writing tons of brackets.”</blockquote><p>Back then, Swift has:</p><ul><li>Clean syntax</li><li>Elegant type inference</li><li>Optionals felt amazing</li><li>Closures were comfortable to write</li></ul><p>Many people believed:</p><blockquote>Swift would become a language with <strong>extremely high development efficiency.</strong></blockquote><h4>But by 2026, looking back at Swift</h4><p>You suddenly notice:</p><ul><li>nonisolated</li><li>Sendable</li><li>@MainActor</li><li>actor</li><li>some</li><li>any</li><li>isolated</li><li>@preconcurrency</li></ul><p>More and more developers share the same feeling:</p><blockquote>“Why is Swift becoming more and more <strong>difficult</strong>? ”</blockquote><p>Even many experienced iOS engineers now often can’t understand others’ Swift code.</p><p>But interestingly:</p><blockquote>Swift’s complexity is not accidental.</blockquote><p>What it reflects is the transformation of the entire software industry.</p><h4>Why is Swift becoming complex?</h4><p>Because Swift is no longer just an “iOS UI development language.”</p><p>This is the most important point.</p><p>Many people’s impression of Swift is still:</p><ul><li>UITableView</li><li>UIButton</li><li>MVVM</li><li>Writing app UI</li></ul><p>But in reality, Apple has been doing one thing in recent years:</p><blockquote>Pushing Swift toward a system-level language</blockquote><p>In other words:</p><p>Swift is no longer trying to solve:</p><blockquote>How to more easily build an iPhone app</blockquote><p>Instead, it is solving:</p><ul><li>How to ensure concurrency safety</li><li>How to reduce crash rates in large-scale systems</li><li>How to ensure memory safety</li><li>How to support collaboration across millions of lines of code</li><li>How to support cross-platform development</li><li>How to support server-side use</li><li>How to build AI runtimes</li><li>How to compete with Rust / C++ in the future</li></ul><p>Once the goal of the language changes:</p><blockquote>Complexity will inevitably increase.</blockquote><h4>Phase 1: Protocol-Oriented Programming</h4><p>One of Swift’s earliest popular concepts:</p><blockquote>Protocol-Oriented Programming</blockquote><p>When people first saw:</p><ul><li>protocol</li><li>extension</li><li>associatedType</li></ul><p>They thought: “<em>This is way more advanced than Objective-C.</em>”</p><p>Especially after extension appeared: Code suddenly became very elegant.</p><p>But problems also started here.</p><p>Because:</p><blockquote>Generics + protocol + associatedtype -&gt; rapidly increase language complexity</blockquote><p>Later, more things appeared:</p><ul><li>where</li><li>some</li><li>any</li></ul><p>These started to appear more and more.</p><p>Many Swift codebases gradually became: “Like compiler papers” instead of business logic.</p><p>Especially in large project.</p><p>Nested generics became common:</p><pre>AnyPublisher&lt;Result&lt;[Documents]. Error&gt;, Never&gt;</pre><p>Sometimes just a type inference error could make Xcode compile for dozens of seconds.</p><p>At this point, many people realised: “Swift is no longer solving small team rapid development”.</p><h4>Phase 2: SwiftUI</h4><p>SwiftUI is a very interesting thing.</p><p>Because it <strong>looks extremely simple</strong>:</p><pre>VStack {<br>  Text(&quot;Hello world!&quot;)<br>}</pre><p>When people first saw SwiftUI:</p><blockquote>This is much simpler than UIKit!</blockquote><p>But in reality:</p><p>The complexity hidden behind SwiftUI may be <strong>higher than UIKit</strong></p><p>Because SwiftUI is not really a traditional UI framework.</p><p>It is more like:</p><ul><li>A DSL (domain-specific language)</li><li>A state system</li><li>A diffing engine</li><li>A compiler extension</li></ul><p>It relies heavily on complex features:</p><ul><li>Result Builder</li><li>opaque types</li><li>some View</li><li>identify system</li><li>state graph</li><li>diffing</li></ul><p>So many SwiftUI problems become:</p><blockquote>“The code is correct, but the View doesn’t update.”</blockquote><p>or:</p><blockquote>“Why is this animation not working?”</blockquote><p>You eventually realise:</p><p>Many SwiftUI issues are no longer UI problems</p><p>They are:</p><p>Compiler behaviour problems</p><p>To some extent:</p><p>SwiftUI’s biggest characteristic is:</p><p>It looks like a UI framework but behaves like a compiler project.</p><h4>Phase 3: Concurrency</h4><p>What truly made Swift fundamentally complex:</p><blockquote>Concurrency</blockquote><p>Specifically:</p><ul><li>async / await</li><li>actor</li><li>Sendable</li><li>MainActor</li></ul><p>When many people first encounter Swift Concurrency, they wonder:</p><blockquote>“Why do I need to learn so many new concepts just to write a network requests?”</blockquote><p>But what Apple is actually trying to solve is not:</p><blockquote>“How to write async code elegantly”</blockquote><p>Instead:</p><blockquote>How to prevent large-scale concurrent programs from crashing</blockquote><p>These are completely different problems.</p><p>Before:</p><pre>DispatchQueue.main.async</pre><p>could solve most problems.</p><p>But modern apps have changed.</p><p>Today’s apps involve:</p><ul><li>Multithreading</li><li>Real-time data streams</li><li>AI</li><li>Audio &amp; Video</li><li>Cross-module state synchronisation</li><li>Large-scale asynchronous tasks</li></ul><p>When all these stack together:</p><p>Thread safety becomes a disaster.</p><p>So Apple began trying:</p><blockquote>To solve concurrency correctness at the <strong>language level.</strong></blockquote><p>Therefore:</p><ul><li>Sendable</li></ul><p>Essentially describes: “Whether this object can be safely passed across threads.”</p><p>And:</p><ul><li>Actor</li></ul><p>Essentially does: “Data isolation.”</p><p>The problem is:</p><ul><li>The stronger the correctness guarantees</li><li>The heavier the cognitive load</li></ul><p>This is a common trend in modern languages.</p><ul><li>Rust is like this</li><li>Kotlin is like this</li><li>TypeScript is also like this</li></ul><p>Swift has simply reached this stage as well.</p><h4>Why can’t Swift avoid becoming like this?</h4><p>Because software itself has already become more complex.</p><p>2012:</p><ul><li>An app had tens of thousands of lines of code</li></ul><p>2026:</p><p>A “super app” has:</p><ul><li>Millions of lines of code</li><li>Hundreds of developers</li><li>Multiple platforms</li><li>Multithreading</li><li>AI agents</li><li>Real-time synchronisation</li><li>Plugin architectures</li></ul><h4>Then vs Now</h4><p>Before:</p><blockquote>A language only needed to be “easy to write.”</blockquote><p>Now:</p><p>A language must:</p><ul><li>Prevent team mistakes</li><li>Prevent threading issues</li><li>Prevent memory issues</li><li>Prevent large-scale collaboration from going out of control</li></ul><p>So Swift is evolving from:</p><p>“A developer-friendly language”</p><p>into:</p><p>“A large-scale engineering safety language”</p><h4>Why Swift Feels Different Now</h4><p>Many new Swift features don’t look like “business development” anymore.</p><p>They look more like:</p><ul><li>Compiler design</li><li>Type systems</li><li>Concurrency theory</li><li>Memory models</li></ul><p>Because Apple’s goal has changed.</p><h4>Swift is Becoming More Like Rust</h4><p>This is a very interesting trend.</p><p>Although Swift still appears to be an iOS language.</p><p>In recent years it increasingly focuses on:</p><ul><li>Ownership</li><li>Memory Safety</li><li>Concurrency Safety</li><li>Isolation</li><li>Predictability</li></ul><p>These are actually:</p><blockquote>Problems that system-level languages care about.</blockquote><p>In some sense:</p><p>Swift is evolving from: “A better Objective-C” into: “A modern system programming language”</p><h4>Conclusion</h4><p>Many people think:</p><blockquote>Swift has become complex because Apple over-designed it.</blockquote><p>But increasingly, it feels like:</p><blockquote>The real problem is not that Swift is complex.</blockquote><p>Instead:</p><blockquote>Modern software engineering can no longer rely on “simple languages.”</blockquote><h4>Today’s Software Systems</h4><ul><li>Getting larger and larger</li><li>More and more concurrent</li><li>AI becoming more deeply integrated</li><li>Team collaboration becoming more complex</li></ul><p>The focus of language design is no longer just:</p><blockquote>“Does it feel nice to write?”</blockquote><p>But:</p><ul><li>Can it <strong>limit mistakes</strong></li><li>Can it <strong>guarantee safety</strong></li><li>Can it <strong>support large-scale systems</strong></li><li>Can it <strong>make code easier for future AI to understand</strong></li></ul><h4>Final Thought</h4><p>In a sense:</p><blockquote>Swift’s complexity is a reflection of the rising complexity of the entire software industry.</blockquote><p>It is no longer just:</p><blockquote>“An iOS development language”</blockquote><p>But a language Apple is betting on for the next decade:</p><p>A true <strong>system-level language.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5c824e9d828a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding Actor Isolation in Swift: Beyond Locks and Mutexes]]></title>
            <link>https://medium.com/@KeKema2012/understanding-actor-isolation-in-swift-beyond-locks-and-mutexes-628899469d37?source=rss-985f4bf781c------2</link>
            <guid isPermaLink="false">https://medium.com/p/628899469d37</guid>
            <category><![CDATA[swift-concurrency]]></category>
            <category><![CDATA[actors]]></category>
            <dc:creator><![CDATA[Ke]]></dc:creator>
            <pubDate>Wed, 29 Apr 2026 08:27:03 GMT</pubDate>
            <atom:updated>2026-04-29T08:27:03.030Z</atom:updated>
            <content:encoded><![CDATA[<p>Swift’s concurrency model introduces actors as a way to define clear isolation boundaries for state. Each actor owns its own “isolation domain,” and the compiler enforces that any access to its mutable data happens safely within that boundary.</p><p>To interact with an actor’s state, you typically use await. This isn’t just about suspension — it’s how you explicitly acknowledge crossing into the actor’s isolation domain. By doing so, you prove to the compiler that the access is safe.</p><p>What’s particularly powerful is how much the compiler understands about these isolation domains. It can now allow patterns that might look unsafe at first glance — such as working with non-Sendable types in Sendable contexts, or vice versa. However, these are only permitted when the compiler can guarantee that the value never actually leaves the actor’s isolation. In other words, you’re not truly “escaping” the data — you’re still operating within a controlled boundary.</p><p>This level of safety and expressiveness simply isn’t achievable with traditional tools like locks or mutexes. With actors, correctness is enforced at compile time, not left to discipline or convention.</p><p>Now let’s see some code snippets.</p><p>The first example demos three Actor “magic”:</p><ol><li>an actor owns isolated state</li><li>await is how you safely cross into that isolation domain</li><li>a non-Sendable value can still be used safely as long as it never actually escapes the actor’s isolation</li></ol><pre>final class NotSendableCache {<br>    var value: String<br><br>    init(value: String) {<br>        self.value = value<br>    }<br>}<br><br>actor DataStore {<br>    private let cache = NotSendableCache(value: &quot;Hello&quot;)<br><br>    // Safe: access happens inside the actor&#39;s isolation domain<br>    func readValue() -&gt; String {<br>        cache.value<br>    }<br><br>    // Safe: mutation also happens inside the actor<br>    func updateValue(to newValue: String) {<br>        cache.value = newValue<br>    }<br><br>    // This looks like it might expose a non-Sendable object,<br>    // but the closure is isolated to the actor.<br>    func withCache&lt;T&gt;(<br>        _ body: (isolated NotSendableCache) throws -&gt; T<br>    ) rethrows -&gt; T {<br>        try body(cache)<br>    }<br>}</pre><p>And then use it like:</p><pre>let store = DataStore()<br><br>Task {<br>    // Crossing into the actor requires await<br>    let value = await store.readValue()<br>    print(value) // Hello<br><br>    await store.updateValue(to: &quot;Updated&quot;)<br><br>    let updated = await store.readValue()<br>    print(updated) // Updated<br><br>    // The cache itself is not transferred out of the actor.<br>    // We only get temporary access while proven to be in the actor&#39;s isolation.<br>    let count = await store.withCache { cache in<br>        cache.value.count<br>    }<br><br>    print(count) // 7<br>}</pre><p>Summary:</p><p>`NotSendableCache` is a reference type and not Sendable. In a traditional concurrency model, exposing that kind of object across concurrency boundaries would be dangerous. But here, Swift can allow it because the closure parameter is marked isolated, which means the closure runs inside the actor’s isolation domain.</p><p>So although it may look like the actor is “handing out” a non-Sendable object, it is not actually allowing that object to escape into some other concurrent context. The compiler knows the access remains actor-isolated.</p><p>Now let’s see what Swift Actor prevents us doing:</p><pre>final class NotSendableCache {<br>    var value: String<br><br>    init(value: String) {<br>        self.value = value<br>    }<br>}<br><br>actor DataStore {<br>    private let cache = NotSendableCache(value: &quot;Hello&quot;)<br><br>    // Not allowed in strict concurrency settings:<br>    // this would try to move a non-Sendable value across isolation boundaries<br>    func badIdea() -&gt; NotSendableCache {<br>        cache<br>    }<br>}</pre><p>As you can easily see from above code snippets,</p><p><em>Returning the raw NotSendableCache would risk transferring actor-isolated state outside the actor. Swift rejects that. But passing temporary actor-isolated access through a closure is allowed, because the compiler can prove the value does not actually leave the actor’s protection.</em></p><p>Conclusions:</p><blockquote><em>`DataStore` owns a `NotSendableCache`, which is a reference type and therefore not safe to freely share across concurrency domains. Direct access to the actor’s state requires await, because callers must cross into the actor’s isolation domain.</em></blockquote><blockquote><em>The interesting part is withCache. At first glance, it seems to expose a non-Sendable object. But it doesn’t actually let the object escape. Instead, Swift guarantees that the closure executes within the actor’s isolation, so the cache remains protected. This is where actor isolation becomes more expressive than locks or mutexes: the compiler can reason about where the value is allowed to exist, and enforce that at compile time.</em></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=628899469d37" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Shift left]]></title>
            <link>https://medium.com/@KeKema2012/shift-left-9e10d54bd3c1?source=rss-985f4bf781c------2</link>
            <guid isPermaLink="false">https://medium.com/p/9e10d54bd3c1</guid>
            <category><![CDATA[software-quality-testing]]></category>
            <dc:creator><![CDATA[Ke]]></dc:creator>
            <pubDate>Sat, 08 Nov 2025 10:35:03 GMT</pubDate>
            <atom:updated>2025-11-08T10:35:03.683Z</atom:updated>
            <content:encoded><![CDATA[<h3>Problem statement</h3><p>In a software development team, often tests/QA happens at the end of the development life cycle. Bugs are raised, and teams have to spend time triage the bug, priorities them, and assign the bugs for developers to fix. This often impacts the deliverables of customer value. In worse case scenario, company could end up having reputational and financial damages.</p><p>For instance, after developer finishes a feature, a bug is raised by QA engineer, and our experience often ends bad, sometimes developers arguing about the bug, sometimes the edge cases were missing. Then we have to organise a call with wider team, more stakeholders to triage.</p><p>Another problem we faced in our project was that the QA raised a bug and developers confirmed this is not a functional bug, but it is environment and data related issue.</p><p>Imagine the both examples above raised against release candidate build, what do you think is gonna happen between QA, developers, stakeholders, release managers etc.?</p><h3>What is shift left?</h3><p>We strongly believe shifting left could resolve the real pains like we had during our software development journey.</p><p>In QA term, it is seen as moving testing to the early days of SDLC. This could even shift more left by having QA done during HLD, LLD.</p><p>For software developers, it means planning the test cases before writing any production code.</p><h3>How does Shift Left improve collaboration between teams?</h3><h4>✅ Developers + QA work together early</h4><p>Shift Left improves collaboration between teams by bringing key stakeholders — developers, testers, security, and even product — into the process earlier. This leads to shared ownership, faster feedback loops, and fewer surprises late in development.</p><p>Instead of testers waiting for a “finished” product, QA and developers define test cases together — sometimes before code is even written (e.g., using TDD or BDD).</p><h4>🔄 Benefit</h4><ul><li>QA understands the feature context better</li><li>Devs think more clearly about edge cases</li><li>Reduces back-and-forth bug cycles</li></ul><h4>✅ Shared responsibility for quality</h4><p>By introducing automated tests, linting, static analysis, and CI checks early in development, quality isn’t just QA’s job — it becomes everyone’s.</p><h4>🔄 Benefit</h4><ul><li>Bugs are found sooner, not just by QA</li><li>Encourages cleaner, more maintainable code</li><li>Encourages collaboration, CI/CD, automation, and faster releases.</li></ul><h4>✅ Security is involved earlier</h4><p>In traditional workflows, security audits happen late. Shift Left brings DevSecOps practices forward — such as running security scans in CI, or reviewing architecture up front.</p><h4>🔄 Benefit</h4><ul><li>Prevents critical vulnerabilities from reaching production</li><li>Saves time by baking in security from day one</li></ul><h4>✅ Product/UX gets faster validation</h4><p>When teams collaborate on test cases or automation scripts early, features can be demoed and validated sooner, even as part of CI/CD.</p><h4>🔄 Benefit</h4><ul><li>Product sees working prototypes earlier</li><li>Reduces scope creep or misaligned expectations</li></ul><h4>✅ Fewer silos, better communication</h4><ul><li>Shift Left requires cross-functional discussions about:</li><li>How features will be tested</li><li>Defects found early are cheaper and easier to fix.</li><li>How errors will be handled</li><li>What is “done” and “acceptable”</li></ul><h4>🔄 Benefit</h4><ul><li>Teams are aligned</li><li>Less finger-pointing</li><li>Everyone works toward the same quality goals</li></ul><h4>✅ Improve software quality and customer satisfaction</h4><ul><li>Continuous testing and feedback improve reliability.</li><li>Real-World Scenario</li></ul><h4>🧪 In a team using Shift Left</h4><ul><li>Developers write unit/UI tests as they code</li><li>QA defines acceptance criteria during sprint planning</li><li>CI runs automation, tests, and other quality controls on every PR</li><li>PMs get demo builds early via CI/CD pipelines</li></ul><h4>🧪 Automated Testing at Commit Time</h4><p>In our iOS team, we use pre-commit Git hooks to run SwiftLint, SwiftFormat, and unit tests before code is committed.</p><p>💡 Why It’s Shift Left:</p><ul><li>Developers get instant feedback before even pushing code.</li><li>Prevents style issues and obvious bugs from reaching CI.</li></ul><h4>✅ Real Impact</h4><ul><li>Saves CI resources.</li><li>Keeps the main branch clean.</li><li>Reduces PR comments like “fix spacing” or “add test.”</li></ul><h4>🔐 Security Scanning in CI</h4><p>On our CI, we have integrated tools like Snyk to check the vulnerability of our dependencies, SonarQube for static analysis of our code bases to run during every pull request.</p><h4>💡 Why It’s Shift Left</h4><p>Exposes known vulnerabilities before merging, not in staging or prod.</p><h4>✅ Real Impact</h4><ul><li>Avoids security issues being discovered after release.</li><li>Helps developers learn secure coding patterns early.</li></ul><h4>❌ Challenges we faced when shifting left</h4><p>Shift left could cause tooling, training investments, overload security roles and teams would end up having tools overlapping. It is a bit challenging to shift from waterfall to Agile (Shift left).</p><h4>🧱 Cultural Resistance</h4><blockquote>“That’s QA’s job.”</blockquote><blockquote>“We’ve always done it this way.”</blockquote><h4>⚠️ Challenge:</h4><ul><li>Developers may resist writing tests or learning new tools.</li><li>QA may feel their role is being replaced.</li></ul><h4>💡 Solution:</h4><ul><li>Emphasise shared responsibility for quality.</li><li>Provide training and highlight the long-term speed gains.</li><li>Celebrate early wins with examples (e.g., “We caught this bug before it went live!”).</li></ul><h4>🛠 Tooling Complexity</h4><p>Teams struggle to set up CI, linting, static analysis, or pre-commit hooks correctly.</p><h4>⚠️ Challenge:</h4><ul><li>Time spent figuring out tools like SwiftLint, SonarQube, or CI pipelines.</li><li>Tool overload if every team adds their own.</li></ul><h4>💡 Solution:</h4><ul><li>Start small: e.g., just SwiftFormat in pre-commit hooks.</li><li>Document and share a common setup (.swiftlint.yml, CI templates).</li><li>Use GitHub Actions or Xcode Cloud for consistent CI environments.</li></ul><h3>Solutions/Suggestions</h3><p>From our experience, senior stakeholders can help with the cultural resistance, and up skilling the engineers with shifting left mind sight which enables them to embrace the agile way of working.</p><h3>Conclusion</h3><p>Considering pros and cons of shifting left, it looks counter intuitive and it requires upskills and communications with wider team. However, it becomes valuable assets to the company in the long term. It safes guide the quality and security of software products with a happier and more productive teams and leads to more customers satisfactions.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9e10d54bd3c1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What’s New in iOS 26 — the close ButtonRole]]></title>
            <link>https://medium.com/@KeKema2012/whats-new-in-ios-26-the-close-buttonrole-fc92b080d907?source=rss-985f4bf781c------2</link>
            <guid isPermaLink="false">https://medium.com/p/fc92b080d907</guid>
            <category><![CDATA[ios-26-new-features]]></category>
            <dc:creator><![CDATA[Ke]]></dc:creator>
            <pubDate>Sat, 25 Oct 2025 22:43:05 GMT</pubDate>
            <atom:updated>2025-10-25T22:43:05.410Z</atom:updated>
            <content:encoded><![CDATA[<h3>What’s New in iOS 26 — the close ButtonRole</h3><p>in iOS 16, Apple has introduced .<a href="https://developer.apple.com/documentation/swiftui/buttonrole/confirm">confirm</a> and .<a href="https://developer.apple.com/documentation/swiftui/buttonrole/close">close</a> for ButtonRole.</p><p>Unlike a cancel operation, a close operation doesn’t lose progress for a user.</p><p>The below code snippet displays a close button in the toolbar without using a custom label or icon. It provides internal semantics that describes the intent of the button, such as for accessibility and platform consistent presentation.</p><pre>NavigationStack {<br>            Text(&quot;Hello&quot;)<br>                .toolbar {<br>                    Button(role: .close) {<br>                        dismiss()<br>                    }<br>                }<br>        }</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/748/1*5bHN44kn9--oJY2tLtQSkw.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fc92b080d907" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Communicate Well Tech Debt with Non-Technical Stakeholders]]></title>
            <link>https://medium.com/@KeKema2012/how-to-communicate-well-tech-debt-with-non-technical-stakeholders-08d9b11189f2?source=rss-985f4bf781c------2</link>
            <guid isPermaLink="false">https://medium.com/p/08d9b11189f2</guid>
            <category><![CDATA[leadership]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[tech-debt]]></category>
            <dc:creator><![CDATA[Ke]]></dc:creator>
            <pubDate>Fri, 24 Oct 2025 06:42:46 GMT</pubDate>
            <atom:updated>2025-10-24T06:42:46.635Z</atom:updated>
            <content:encoded><![CDATA[<p>I am fortunate enough to have a quick 30 mins drop-in session with <a href="https://x.com/GabEarnsh">Gabrielle Earnshaw</a> in the <a href="https://swiftleeds.co.uk/">SwiftLeeds</a> Conference last week.</p><p>In this blog post, I quickly summarised Gabby’s recommendations about How to Communicate well tech debt with non-technical stakeholders.</p><h3>Engineering functions and Tech Debt</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qOcyj5P73rkUTsHwiDXHrg.png" /><figcaption>Three Engineering Functions: Feature Delivery, Monitoring and Supporting both (Platform)</figcaption></figure><ul><li><strong>Product Features</strong>: Primary value to the business; features bring in revenue.</li><li><strong>Measurement</strong>: Metrics, observability, analytics help validate whether features are successful.</li><li><strong>Platform</strong>: Technical foundation (including tech debt) that supports feature delivery. Weak platforms slow everything down.</li></ul><h3>Communicating Tech Debt to the Business</h3><ul><li><strong>Frame in Business Terms</strong>: Tech debt delays feature delivery → delays value generation.</li><li><strong>Quantify Impact</strong>: Use rough estimates to show how much longer features take due to tech debt vs. with improvements.</li><li><strong>Use Hypotheticals</strong>: “If we fix X, we can halve the time for Y features.”</li><li><strong>Make it Visual</strong>: Create visible roadmaps comparing delivery timelines with/without tech debt fixes.</li><li><strong>Pick a Quick Win</strong>: Start with a small, high-impact fix to build trust and prove the value of addressing tech debt.</li><li><strong>Maintain a List</strong>: Track developer pain points and link them to business impact.</li><li><strong>Empower Product Managers</strong>: Give them understandable estimates and benefits so they can prioritise tech work.</li></ul><h3>Helping Engineers Articulate Pain Points</h3><ul><li><strong>Engineers Struggle to Translate</strong>: They often can’t explain tech frustrations in business terms.</li><li><strong>Bridge the Gap</strong>: Senior/lead engineers should interpret pain points and explain their downstream business impact.</li><li><strong>Encourage Transparency</strong>: Build a culture where engineers can surface issues openly — via retrospectives or discussions.</li></ul><h3>Tackling Team Culture and Low Morale</h3><ul><li><strong>Moaning vs. Action</strong>: Some teams fall into negative cycles of complaining without solutions.</li><li><strong>Make People Feel Heard</strong>: Capture complaints and log them (e.g., on a Miro board) to show they’re acknowledged.</li><li><strong>Shift to Solutions</strong>: Move from venting to actionable fixes. Highlight what <em>can</em> be done next.</li><li><strong>Avoid Circular Conversations</strong>: Reference logged items to avoid repetitive discussion and promote progress.</li><li><strong>Balance Pragmatism</strong>: Not all tech debt needs fixing — evaluate cost vs. benefit commercially.</li></ul><h3>Leading from a Senior Role (Without Authority)</h3><ul><li><strong>Act Like a Lead</strong>: Take initiative even if you’re not formally in a lead role.</li><li><strong>Discovery Phase</strong>: Run listening sessions to identify team pain points.</li><li><strong>Pairing and Mentorship</strong>: Pairing, mob sessions, and practice sharing improve team habits (e.g., TDD).</li><li><strong>Break Down Problems</strong>: Use small focused sessions to brainstorm fixes.</li><li><strong>Prioritise Visibility</strong>: Focus on pain points that will have visible business impact to gain stakeholder buy-in.</li></ul><h3>Building Trust with the Business</h3><ul><li><strong>Demos Are Powerful</strong>: Regular demos showing tech improvements (e.g., CI/CD fixes, build time reduction) build credibility.</li><li><strong>Be Transparent About Failures</strong>: Share setbacks honestly and show steps being taken to prevent recurrence.</li><li><strong>Involve Stakeholders in Planning</strong>: Present tech debt solutions as options, not demands — collaborate on prioritisation.</li></ul><h3>Final Thoughts</h3><ul><li>Fixing tech debt is not just about technical correctness — it’s about aligning with business goals.</li><li>Cultural change takes time; consistent communication and small wins help shift mindset.</li><li>Leadership can come from any level — if you take ownership and help others do the same, you lead by example.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=08d9b11189f2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Swift 6.2 New Type — InlineArray]]></title>
            <link>https://medium.com/@KeKema2012/swift-6-2-new-type-inlinearray-f7bd94a2fb47?source=rss-985f4bf781c------2</link>
            <guid isPermaLink="false">https://medium.com/p/f7bd94a2fb47</guid>
            <category><![CDATA[swift-programming]]></category>
            <category><![CDATA[swift-6]]></category>
            <category><![CDATA[inline-array]]></category>
            <dc:creator><![CDATA[Ke]]></dc:creator>
            <pubDate>Thu, 23 Oct 2025 21:25:54 GMT</pubDate>
            <atom:updated>2025-10-23T21:25:54.746Z</atom:updated>
            <content:encoded><![CDATA[<h3>Swift 6.2 New Type — InlineArray</h3><p>As the Swift language is evolving, and it was made to allow experts writing performance-critical code. Swift 6.2 introduces a new type called <a href="https://developer.apple.com/documentation/swift/inlinearray"><strong>InlineArray</strong></a>.</p><p>According to Apple Developer Documentation above, the short definition of InlineArray is A fixed-size Array.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/958/1*mDl19Gy75Nrw8IL5IYG7lA.png" /></figure><h3>The Array Type</h3><p>Now let’s first recap what’s the Array type in Swift.</p><p>The Array type is a structure that provides an ordered, random-access collection. Features of Array like dynamic resizing make it easy to use and suitable for so many tasks. But this flexibility comes at a cost.</p><p>To support dynamic resizing, an array stores a reference to a heap-allocated buffer. Adding more elements into an Array which is at its capacity requires new memory to be allocated dynamically and existing elements to be copied over.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*d0otmoz6dhhuXA2VkjHBfQ.png" /><figcaption>New memory has to be allocated dynamically and copying existing elements over, when adding more elements over array’s capacity</figcaption></figure><p>When profiling performance-critical code using Arrays, you might notice memory allocation or reference counting for the array buffer that you need to eliminate.</p><p>InlineArray is a new fixed-size array type with inline storage for its elements, and it is perfect to be used in a situation that size of the array never changes, it reduces the cost of the extra heap allocation.</p><p>The elements of an InlineArray are stored directly instead of storing a reference to a buffer. This means the elements of an InlineArray are stored on the stack without additional heap allocation.</p><p>Both <strong>copyable</strong> and <strong>non-copyable</strong> types can be stored in InlineArray. When storing <strong>copyable</strong> types, the InlineArray itself can be copied, and the element values are copied eagerly. Writing the size as part of the type is achieved using a new generics feature to allow integers as type parameters.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*05tWFNjAVg7wbhimQWJHNw.png" /><figcaption>When storing copyable types, copy the InlineArray itself before copying the elements over</figcaption></figure><p>Lastly, the size of the InlineArray can also be inferred from an array literal. Knowing the size of an InlineArray at compile time optimising the code by eliminating bounds checking when the index is less than the size.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f7bd94a2fb47" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>