<?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 Akindele Michael on Medium]]></title>
        <description><![CDATA[Stories by Akindele Michael on Medium]]></description>
        <link>https://medium.com/@AkindeleMichael?source=rss-3e1d95b67d8------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*iIol_ZiSpPG7cRBkldN95w.jpeg</url>
            <title>Stories by Akindele Michael on Medium</title>
            <link>https://medium.com/@AkindeleMichael?source=rss-3e1d95b67d8------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 20:18:31 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@AkindeleMichael/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[Building an AI Agent over Nigeria’s Tax Laws: What Broke and How I Fixed It]]></title>
            <link>https://medium.com/@AkindeleMichael/building-an-ai-agent-over-nigerias-tax-laws-what-broke-and-how-i-fixed-it-efb1e75dbc93?source=rss-3e1d95b67d8------2</link>
            <guid isPermaLink="false">https://medium.com/p/efb1e75dbc93</guid>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[generative-ai-tools]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[agentic-rag]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Akindele Michael]]></dc:creator>
            <pubDate>Mon, 16 Nov 2026 17:46:01 GMT</pubDate>
            <atom:updated>2026-11-16T17:46:01.848Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*R4kmAj2DATRJ5l8v" /><figcaption>Photo by <a href="https://unsplash.com/@googledeepmind?utm_source=medium&amp;utm_medium=referral">Google DeepMind</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>For a while this year, I’ve wanted to build my own AI agent for a real task, not a demo. Then I found Stanford’s <a href="https://cs329z.stanford.edu/">Engineering AI Agents</a> course (CS329Z), and I’ve been following it at my own pace. The slides and readings are excellent, and Claude has been a great tutor, breaking down the ideas and working through my project with me.</p><p>The course is built around one idea I agree with: you learn agents by building them, watching them fail, measuring the failure and fixing it. So I picked a domain where failure is easy to spot: Nigeria’s tax laws.</p><p>On 1 January 2026, the Nigeria Tax Act 2025 came into force and repealed the old income tax, VAT and stamp duty Acts in one go. Most of what people know about Nigerian tax was learned from laws that no longer exist, and the same goes for AI models, which store their knowledge in their weights. That knowledge is hard to update, can’t be cited, and models hallucinate confidently when they don’t know. That makes it a good test: can I build a system that answers from the <em>current</em> law, cites the exact section, and admits when the law doesn’t cover a question?</p><p>This article covers the first two weeks: an agent loop built from scratch, then a retrieval system over four Acts. Mostly, it’s about what broke.</p><h3>What I built</h3><p>During these two weeks, I built a very imperfect retrieval system (RAG) over four Acts: the Nigeria Tax Act (NTA), the Nigeria Tax Administration Act (NTAA), and the two Acts that establish the revenue service and the Joint Revenue Board. No framework, so every step is visible:</p><p>In the first week, we implemented an agent loop: a model, two tools and a while loop, written by hand. The model asks for a tool, my code runs it, sends back the result, and repeats until the model replies with text. Two things stuck with me. The model chooses tools only from their names and descriptions, so the descriptions are the interface. And a tool that returns its error, instead of crashing, lets the model recover.</p><p>In week 2, we did retrieval-augmented generation (RAG) over four Acts: the Nigeria Tax Act (NTA), the Nigeria Tax Administration Act (NTAA), and the two Acts that establish the revenue service and the Joint Revenue Board. I began as demonstrated below:</p><pre>Ingestion (once per Act):<br>  PDF -&gt; clean text -&gt; one chunk per section -&gt; embeddings -&gt; saved index<br><br>Query (every question):<br>  question -&gt; rewrite into the law&#39;s words -&gt; search -&gt; top sections<br>           -&gt; LLM answers from those sections only, citing each one</pre><p>Each chunk carries its Act and section number, so citations come from the data, not the model’s memory:</p><pre>{&quot;act&quot;: &quot;NTA 2025&quot;, &quot;section&quot;: 187, &quot;text&quot;: &quot;187. Subject to paragraph 2 of ...&quot;}</pre><p>The stack is small: Python, PyMuPDF for the PDFs, NumPy for cosine similarity, and Gemini for embeddings and answers. The index is 510 chunks across the four Acts.</p><h3>The data was messier than the AI</h3><p>I expected the hard part to be the model. It was the PDFs.</p><p>My first copy of one Act was a scan, and the extracted text read like this: R£TURNS, inclUding, 20259 for &quot;2025,&quot;. I found a text-based copy instead, which was clean. Then I had to split it into sections, and that took several rounds.</p><p>A section in these Acts starts with its number at the beginning of a line, like7.—(1), or 1. The objective of this Act.... My first pattern found 87 sections in an Act with 148. The missing ones had no dash after the number. Then the table of contents at the front matched too, and later the schedules at the back, where paragraph numbering restarts at 1.</p><p>The fix that worked was simple: <strong>accept a section start only if its number is the next one in sequence.</strong></p><pre>starts, expected = [], 1<br>for m in re.finditer(r&quot;(?m)^\s*(\d+)\.(?:\s*[---]|[\s.]*[A-Z(])&quot;, body):<br>    if int(m.group(1)) == expected:<br>        starts.append((expected, m.start()))<br>        expected += 1</pre><p>False matches almost never land in exactly the right order, so they’re skipped. And when the sequence stops early, it points straight at the problem: print every place the next number appears, and look at it.</p><p>That’s how I found three typos in the official Acts:</p><ul><li><strong>NTAA:</strong> 15. . Notwithstanding, a stray dot after the number.</li><li><strong>NTA:</strong> 186.(1) The following supplies..., no space after the dot.</li><li><strong>NTA:</strong> ENECTED by the National Assembly, the words that mark where the body starts are misspelt.</li></ul><p>The sequence check makes the pipeline tell you where it’s wrong, instead of quietly producing a bad index.</p><h3>Long chunks are cut off without warning</h3><p>One section per chunk worked well, until I embedded the Nigeria Tax Act. The run crashed on its last batch with a rate-limit error: too many <strong>tokens</strong> per minute.</p><p>A token is a piece of a word. “tax” is one token; “taxable” might be two (“tax” + “able”); a reference like 186.(1)(a) splits into about six. A rough rule is one token for every four characters of English, and legal text, full of numbers and references, uses more.</p><p>The culprit was the last chunk. All the schedules at the end of the Act had landed in one piece of about 125,000 characters, or roughly 31,000 tokens. The free tier allows 30,000 tokens a minute, so that one chunk was enough to fail the batch.</p><p>The crash was the lucky part. The embedding model only reads about the first 2,048 tokens of each input. Even if the call had succeeded, the vector for that chunk would have represented only its first few pages, and everything after that would have been unsearchable. Some ordinary sections were too long as well: the two interpretation sections (the definitions) were about 5,000 and 6,000 tokens.</p><p>The fix had two parts:</p><ul><li>Split the schedules by name (“First Schedule”, “Eleventh Schedule”…), so each one is its own chunk with a real citation.</li><li>Split any chunk over 6,000 characters into parts, on paragraph boundaries, keeping its Act and section number.</li></ul><p>I also lost two full embedding runs at 200 of 235 chunks, once to a rate limit and once to a network drop, because nothing was saved until the end. Now the script saves after every batch and resumes from where it stopped (long jobs need checkpoints).</p><h3>The solar question</h3><p>One question taught me more than all the others: <strong>“Is solar equipment exempt from VAT?”</strong></p><p>The first answer was “The retrieved sections don’t cover this.” Search had returned the right-sounding sections: s.186 (exempt supplies) and s.187 (supplies charged at 0%). But I searched the whole Act, and the word “solar” isn’t in either of them.</p><p>The answer is spread across three places:</p><ol><li>The Eleventh Schedule, para 3, defines “renewable energy equipment” as equipment that produces energy from sources “such as sunlight”. So solar equipment counts.</li><li>Para 1(b) of the same schedule lists renewable energy equipment among the items whose VAT collection starts only on a date the Minister sets.</li><li>Section 186(2) says VAT <strong>shall not be collected</strong> on those items unless the Minister sets that date by order in the Official Gazette.</li></ol><p>So it isn’t formally exempt, but VAT isn’t collected on it unless an order says so. Getting there takes two hops, from “solar” to “renewable energy equipment”, and from a schedule back to a section. Plain similarity search does one hop.</p><p>The fix was <strong>query rewriting</strong>. Before searching, a model rewrites the question into the law’s vocabulary, and the system searches with both versions:</p><pre>Original:   Is solar equipment exempt from VAT?<br>Rewritten:  Are solar equipment and renewable energy systems exempt or zero-rated for VAT?</pre><p>With the rewrite, the Eleventh Schedule came back first, and the answer cited all three provisions.</p><p>There was a second lesson in this one. Along the way, both the model and Claude read the schedule as “VAT applies unless the Minister suspends it”, which is backwards. I knew from practice that solar is treated as 0%, and checking s.186(2) showed why: the default is no VAT until an order. The final judge of a legal answer has to be someone who knows the law, and every claim needs a citation so they can check it quickly.</p><h3>Every fix has a cost</h3><p>Query rewriting fixed solar, and broke something else.</p><p>After the change, “What is the rate of VAT?” came back with 7.5%, plus the company income tax rates from s.56. The rewrite had broadened the question to “the standard, reduced, or zero rate”, and with more sections in the prompt, the model used s.56 because it matched the word “rate”. More recall, less precision, in my own system.</p><p>I fixed it with two rules: the rewrite must keep the same tax and scope, and the answer should ignore sections about a different tax. The VAT rate answer was correct again.</p><p>Then that rule caused two new failures. I asked, “What is the penalty for failing to file a VAT return?” The right section, NTAA s.101, came back first in search:</p><blockquote>A taxable person who fails or refuses to file returns … shall be liable to pay an administrative penalty of N100,000.00 in the first month … and N50,000.00 for each subsequent month.</blockquote><p>It says “returns”, not “VAT returns”. So a model told to ignore sections about a different tax decided it might not apply, and abstained. The rule I added for one question broke another.</p><p>So I made the rule precise: a general provision, one about “returns” or “a taxable person” without naming a tax, applies to every tax unless it says otherwise. I also added a rule for partial answers, so a question that’s half covered gets the covered half, plus a plain statement of what’s missing. Better rules alone still weren’t enough, though. The model needed to think first.</p><p><strong>Every change to a prompt, a chunk or a search setting can fix one question and break another, so I re-run the whole question set after every change.</strong> That set is now the most valuable file in the project.</p><h3>Thinking beat a bigger model</h3><p>With the new rules in place, the small model I was using, Gemini Flash-Lite, still abstained on two questions. The right sections were in its prompt. Section 101 was ranked first for the VAT penalty, and s.156, which covers input VAT, was there for the records question. Retrieval had done its job. The model was answering without working through what it had been given.</p><p>I had two options: a bigger model, or let the same small model think before it answers. Gemini models take a thinking budget, which is one setting:</p><pre>config = types.GenerateContentConfig(<br>    thinking_config=types.ThinkingConfig(thinking_budget=1024)<br>)</pre><p>I ran four hard questions under each setup. Two need reasoning (applying a general provision; answering half a question), one is the two-hop solar question, and one should be refused, since no Act names the current Minister of Finance:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PV4bTt1H7qfZNB9L5D0laA.png" /><figcaption>Model’s Test Results</figcaption></figure><p>The small model with thinking answered every question, in every run, and it was more direct than the bigger model. Flash opened the VAT penalty answer with “It depends”, and only one penalty applied.</p><p>The failures I’d been blaming on retrieval and rules were, in the end, about reasoning. One setting fixed them, at the cost of some extra tokens per answer.</p><h3>What’s next for me?</h3><p>Many mistakes are still in the system. When I asked about the penalty for a late company income tax return, it sometimes cited <em>s.128</em>, a much larger penalty that applies only to companies in upstream petroleum operations. The section’s text doesn’t say that; the heading of the Part it sits in does. My chunks start at the section number, so the heading never reaches the model. <strong><em>The fix is to carry each section’s Part and Chapter heading into its chunk.</em></strong></p><p>That’s the pattern of the whole project so far: the hard problems weren’t the model. They were the data(which has been the issue since the creation of anything AI), the vocabulary, and how much context reaches the model.</p><p>Moving to week 3, which is about <em>tool use</em>. Instead of only searching, the agent will look things up deliberately: fetch a section in full, read the heading it sits under, and follow a cross-reference like “<em>subject to paragraph 2 of the Thirteenth Schedule</em>” to where it points. After that, comes evaluations: a proper test set, and a way to check every citation automatically.</p><blockquote>This is a personal learning project, built on the public text of the published Acts. It isn’t legal or tax advice.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*RSSen17YcoTTo4p2pCbCLg.png" /><figcaption>meme from: <a href="https://imgflip.com/memegenerator">https://imgflip.com/memegenerator</a></figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=efb1e75dbc93" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Your Life is a Results Business]]></title>
            <link>https://medium.com/@AkindeleMichael/your-life-is-a-results-business-5b9386610db1?source=rss-3e1d95b67d8------2</link>
            <guid isPermaLink="false">https://medium.com/p/5b9386610db1</guid>
            <category><![CDATA[life-lessons]]></category>
            <category><![CDATA[strategy]]></category>
            <category><![CDATA[lifestyle]]></category>
            <category><![CDATA[life]]></category>
            <dc:creator><![CDATA[Akindele Michael]]></dc:creator>
            <pubDate>Thu, 25 Jun 2026 15:41:15 GMT</pubDate>
            <atom:updated>2026-06-25T15:41:15.062Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*HfPAeuBjCYrjDSGa" /><figcaption>Photo by <a href="https://unsplash.com/@kaleidico?utm_source=medium&amp;utm_medium=referral">Kaleidico</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>I do not have the answer for you. There is no way I would have the answer, and why would you think so? What I have is an observation — a way of looking at life that might make sense of some things, or might not. Take it or leave it: life is a results business. It is not an intentions business, a feelings business, or even a potential business. That idea is simple, but most people avoid it because it is deeply uncomfortable. It removes excuses, stories, and all the private narratives we use to explain why things are not working yet.</p><p>Most of us do not move in a straight line. We move through emotion, acting when we feel good and stopping when we feel bad. Other times, we lean on logic, but even logic can betray us when it is built on an incomplete understanding. So we search. We look for explanations everywhere except where it matters most, borrowing meaning from other people’s stories, quotes, memes, history, and advice. But at some point, none of that works anymore. At some point, you have to look at your actual life — not your ideas about it — and ask a very uncomfortable question: does this feel like something alive, or something that is already dying?</p><p>Let me be clear, death is not always a tragedy. In fact, death is often just honesty telling you that a <strong>season is finished, a structure is no longer holding weight, or a version of you is no longer compatible with your reality</strong>. The real problem is not death, but the refusal to accept what has already ended. That is where people suffer. They suffer not because they are weak, but because they are loyal to things that are already gone, feeding what no longer responds and waiting for what has already left. Slowly, they become stuck in something that no longer lives. Letting something die is not failure; it is acceptance and the beginning of honesty, because every real beginning requires an ending first.</p><p>This is where vision comes in. When a person has vision, life becomes directional. There is movement and meaning, even in difficulty. But when vision dies, mission dies with it, and effort becomes mere noise. You start existing instead of building, and repeating instead of progressing. That is exactly why life is a results business — because without results, vision is only imagination.</p><p>Yet, there is an important distinction, not everyone who feels stuck is actually dead. Some people are simply stale. The difference lies in awareness. They know something is off, they know they are no longer growing, and they know the fire is not what it used to be. That awareness matters because it means there is still light somewhere, and light changes everything. With light, you can see direction. You can see what to keep and what to release, what to rebuild and what to bury. Without it, everything feels like confusion, but with it, even painful decisions become clear.</p><p>I cannot tell you exactly where that light comes from — I hope yours comes from God, maybe from responsibility, or maybe from reaching a point where you are simply tired of your own excuses. What I do know is that when you find even a small amount of light, you do not stay still. You move. Life does not reward awareness alone; it rewards movement that, when repeated, becomes results. It does not happen all at once or in a dramatic transformation. It starts incredibly small: one decision, one correction, one honest conversation, one attempt, one day of discipline. Then another, and another, until what looked like nothing compounds into something undeniable.</p><p>So let me speak directly to you, wherever you currently stand. To the ones who are unaware of their condition — the Dead — I hope something wakes you up before time forces clarity upon you. To the ones who are aware but stuck — the Stale — I hope you stop negotiating with what you already know needs to change. And to the ones who already have direction but are tired, I hope you remember that even good things must sometimes end so better things can begin. Life does not stay still for anyone.</p><p>Now, look at your life honestly. Not your intentions, plans, or explanations, but what is actually alive in it right now. What is dead but still being carried? What are you maintaining that should have already been buried, and what are you refusing to start because you are still attached to what used to be? Time is already moving, and results are already forming.</p><blockquote>In the end, life does not respond to what you meant; it responds to what you built.</blockquote><p>So if something is dead, let it die with clarity, not regret. If something is alive, protect it and build it with everything you have. Follow whatever small light you have without hesitation, because life is a results business, and the only thing that remains is what you were willing to turn into reality while you still had time.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5b9386610db1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Losing the Desire to Create: An Engineering Focus]]></title>
            <link>https://medium.com/@AkindeleMichael/losing-the-desire-to-create-an-engineering-focus-350641adefe1?source=rss-3e1d95b67d8------2</link>
            <guid isPermaLink="false">https://medium.com/p/350641adefe1</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[future-of-work]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[learning]]></category>
            <dc:creator><![CDATA[Akindele Michael]]></dc:creator>
            <pubDate>Tue, 31 Mar 2026 21:13:13 GMT</pubDate>
            <atom:updated>2026-03-31T21:13:13.049Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*uTqJg47B2bNdHMn_" /><figcaption>Photo by <a href="https://unsplash.com/@jovanvasiljevic?utm_source=medium&amp;utm_medium=referral">Jovan Vasiljević</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Back in the day, an idea started with a thrill that lived in a physical notebook. I would sit down and sketch out UI flows, scribble logic sequences, and conduct exhaustive “feasibility studies” that lived entirely in my head and across dozens of browser tabs.</p><p>Building something was a marathon. We didn’t just build; we figured out what we needed to learn, acquired that skill, and <em>then</em> started. The process was long, daunting, and sometimes frustrating — but that friction was exactly what kept us marching.</p><p>When I told someone I had built a multi-themed app, I said it with a specific kind of confidence because I remembered every bug I fought to get there. The codebases might get rusty, but the mental models we built during those “long ways” are still there.</p><p>Also, think back to math class. There was always that moment when the teacher would say, <em>“Put your calculators away.”</em> We hated it, but it forced us to understand the “why” behind the “how.” It built that mental model for solving mathematical problems. It almost became instinctive if not already.</p><p>Today, with Large Language Models (LLMs), it feels like the calculators are permanently out. It begs the question: <strong>Has true learning stopped?</strong> As a community, have we plateaued? When the “hard parts” of coding are abstracted away into a <em>chat prompt</em>, I worry about the next generation of innovators. I worry about myself. Are we creating a world where only a select few truly understand how to build complex systems from the ground up, while the rest of us just learn to “assemble” them?</p><p>And yet, I look at the other side of the coin. I remember scrolling through Twitter (now X) years ago and seeing a video of a Yoruba speaker. I desperately wanted to build a tool that could provide real-time English captions on my screen, but I lacked the specific, high-level skills to make it happen. I felt stuck.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*yMfuz6E0UwRroaXx" /><figcaption>Photo by <a href="https://unsplash.com/@nika_benedictova?utm_source=medium&amp;utm_medium=referral">Nika Benedictova</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Now, with AI, that project isn’t just possible — it’s a weekend task. We can now build systems far more nuanced and difficult than we ever dreamed of in the “notebook era.”</p><blockquote><strong><em>The great paradox of our time:</em></strong><em> AI has lowered the floor for entry, but it has also raised the ceiling for what we can achieve.</em></blockquote><p>Does this nostalgia mean I’m resisting change? I don’t think so. I’ve lived through the shifts; I moved from native Android (Java) to Flutter and haven’t looked back. I’m constantly hunting for new techniques to improve my delivery.</p><p>In fact, I use AI to squash “mad bugs” that would have previously cost me ten days of StackOverflow-induced headaches. I appreciate that efficiency. So, the conflict isn’t about the tools themselves — it’s about how they change the <strong>emotional landscape</strong> of building.</p><p>In the past, I would spend weeks researching a SaaS idea before writing a single line of code. Now, I can feed that idea into an AI and see a generated prototype in minutes. But does that take away the thrill? If the “small projects” are now “solved problems,” does that mean we should only care about massive, complex systems?</p><p>There was a unique joy in the small wins — the first time a button changed colour or a local database persisted. When those wins are “given” to us by an LLM, the hit of dopamine is different. <strong>It’s thinner.</strong></p><p>Two months ago, I built a <a href="https://github.com/DeleMike/hallway">WebSocket server</a> with this <a href="https://hallway-ui.vercel.app/">UI</a> I used AI as a sounding board to ensure my engineering decisions were sound, but I still felt the “builder’s high.” I still love building engineering systems. Perhaps the desire to create isn’t dying — it’s just being forced to evolve.</p><p>Maybe we are being asked to stop obsessing over <strong>syntax</strong> and start obsessing over <strong>architecture</strong>. Maybe the thrill is moving away from “how to write a loop” and toward “how to design a system that matters.” But I still find myself wondering: in this race for complexity, are we losing the simple, quiet joy of just figuring it out ourselves? Or what?</p><p>For all I know, AI didn’t Kill My Desire to build — It Moved It.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*RSSen17YcoTTo4p2pCbCLg.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=350641adefe1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Brain We Built: How Neural Networks Work, Scale, and Changed Everything]]></title>
            <link>https://medium.com/@AkindeleMichael/the-brain-we-built-how-neural-networks-work-scale-and-changed-everything-c91157c7a73a?source=rss-3e1d95b67d8------2</link>
            <guid isPermaLink="false">https://medium.com/p/c91157c7a73a</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[neural-networks]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Akindele Michael]]></dc:creator>
            <pubDate>Fri, 27 Feb 2026 19:17:05 GMT</pubDate>
            <atom:updated>2026-02-27T19:17:05.955Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*DA2gwP6lzMGLQpCi" /><figcaption>Photo by <a href="https://unsplash.com/@steve_j?utm_source=medium&amp;utm_medium=referral">Steve Johnson</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>In my last piece — <em>“</em><a href="https://medium.com/@AkindeleMichael/re-can-you-explain-machine-learning-one-more-time-d22e8ccb07f1"><em>RE: Can You Explain Machine Learning One More Time?</em></a><em>”</em> — I described Machine Learning as a disciplined loop: a computer performs a task, measures its error, adjusts its parameters, and repeats until it gets better. No magic. No intuition. Just iteration.</p><p>If you walked away from that article with a clean mental model of how a machine <em>learns</em>, then you are perfectly positioned for what comes next.</p><p>Here’s the problem—a single algorithm doing linear regression can predict house prices reasonably well. It can flag spam emails. It can even tell you whether a tumour is malignant or benign, given the right features. But ask it to look at a photograph and tell you what animal is in it? It falls apart. Not because the math is wrong, but because the <em>representation</em> is wrong. A flat equation cannot capture the layered complexity of a face, a voice, or a sentence.</p><p>That limitation is exactly what Neural Networks were built to overcome.</p><h3>First, Remember What a Single Neuron Does</h3><p>Before we talk about networks, let us anchor ourselves in something small and familiar.</p><p>A single artificial neuron does two things:</p><p><strong>Step 1 — The Linear Step:</strong> It multiplies each input by a weight, adds a bias, and sums everything up. This is the same equation from linear regression: z = w·x + b. Nothing new here.</p><p><strong>Step 2 — The Activation Step:</strong> It passes that result through an <em>activation function</em> — something like Sigmoid or ReLU — to produce an output called an <em>activation</em>, written as a.</p><p>That activation is the neuron’s answer to the question: <em>“How much do I care about what I just saw?”</em></p><p>If you are a neuron trained to detect circular shapes and you see a wheel, your activation fires high — close to 1. Show you a straight line, and it stays cold — close to 0.</p><p>One neuron. One opinion. That is all it can offer.</p><h3>What Happens When You Stack Them</h3><p>Here is where things get genuinely interesting.</p><p>A Neural Network takes that single neuron and stacks thousands of them into <em>layers</em>. Each layer receives the previous layer’s activations as its inputs, processes them, and passes new activations forward. This chain of transformations is called <strong>forward propagation</strong>.</p><p>Every network has three types of layers:</p><p><strong>The Input Layer</strong> receives raw data — pixel values, numbers from a spreadsheet, words encoded as numbers. It does no computation. It simply passes the data forward.</p><p><strong>The Hidden Layers</strong> are where the actual thinking happens. They are called “hidden” because we never see their intermediate values in the final output. These are the layers doing the heavy lifting.</p><p><strong>The Output Layer</strong> produces the final prediction — a probability for classification, a number for regression, or a set of scores across categories.</p><p>Now here is the part that should genuinely impress you.</p><p>In traditional Machine Learning, for example, <em>I</em> had to engineer the features. I looked at raw data and manually created signals I thought would help, like computing, Area = Width × Height because I suspected the <strong>area </strong>was an important feature(basically feature engineering). I thought that it mattered more than the two dimensions separately. That required domain expertise, intuition, and a lot of trial and error.</p><p>Neural Networks do this <em>automatically</em>. The hidden layers learn their own features from scratch:</p><ul><li><strong>Layer 1</strong> might learn to detect simple edges — horizontal lines, vertical lines, and diagonals.</li><li><strong>Layer 2</strong> combines those edges into shapes — corners, curves, circles.</li><li><strong>Layer 3</strong> combines those shapes into objects — an eye, a tyre, a nose.</li></ul><p>Nobody told it to do this. Nobody labelled the intermediate steps. The network discovered these representations entirely on its own, guided by nothing but the cost function and gradient descent(algorithms like SGD or Adam). This is called <strong>automated feature engineering</strong> — and it is the reason neural networks replaced decades of handcrafted computer vision research almost overnight.</p><h3>Why Depth Changes Everything</h3><p>You might wonder: why not just use one very wide layer instead of many layers stacked together?</p><p>The answer lies in something called <strong>non-linearity</strong>.</p><p>A single layer of neurons — no matter how wide — can only learn linear transformations of the input. Linear transformations are just stretched, rotated versions of the original space. They cannot capture the kinds of twisted, curvy decision boundaries that separate a cat from a dog across a million different poses and lighting conditions.</p><p>But the moment you stack layers and use non-linear activation functions like ReLU (g(z) = max(0, z)) between them, something powerful emerges. Each layer can <em>compose</em> the transformations of the previous layer. The result is a model that can approximate extraordinarily complex functions — functions that no human could write by hand.</p><p>This is the “deep” in <strong>Deep Learning</strong>. The depth is not decorative. It is the source of the capability.</p><p>A shallow model draws straight lines through data. A deep model carves the data space into whatever shapes the problem requires.</p><h3>How It Actually Learns: The Full Picture</h3><p>Building a neural network follows a clear sequence — and if you read the first article, the core loop will feel familiar.</p><ol><li><strong>Prepare your data.</strong> Organise your inputs (x) and your correct answers (y). If your features are on wildly different scales, normalise them — otherwise gradient descent will struggle to converge. The rule from Part 1 still holds: if you scale one feature, scale them all.</li></ol><pre>import tensorflow as tf<br>from tensorflow.keras import Sequential<br>from tensorflow.keras.layers import Dense<br>import numpy as np<br><br># Prepare Data<br>x = np.array([[200.0, 17.0], [120.0, 5.0], [425.0, 20.0], [212.0, 18.0]])<br>y = np.array([1, 0, 0, 1])</pre><p><strong>2. Define the architecture.</strong> Choose how many layers you want, how many neurons per layer, and which activation functions to use. In code using TensorFlow/Keras, this is remarkably clean:</p><pre># Define Architecture<br>model = Sequential([<br>   Dense(units=3, activation=&#39;relu&#39;),<br>   Dense(units=1, activation=&#39;sigmoid&#39;),<br>])</pre><p><strong>3. Compile.</strong> Choose your <em>optimizer</em> (the algorithm that updates the weights — Adam is a popular, adaptive choice that is generally faster than vanilla gradient descent) and your <em>loss function</em> (the ruler that measures how wrong your predictions are).</p><pre>model.compile(optimizer=&#39;adam&#39;, loss=&#39;binary_crossentropy&#39;)</pre><p><strong>4. Train.</strong> Call .fit(). The model runs forward propagation to make predictions, calculates the loss, then runs <strong>backpropagation</strong> — tracing the error backwards through every layer to calculate how much each weight contributed to the mistake. Gradient descent then adjusts each weight accordingly. This repeats for as many <em>epochs</em> as you specify.</p><pre>model.fit(x, y, epochs=10)</pre><p><strong>5. Predict.</strong> Call .predict() on new, unseen data. The weights the model learned during training now do the work.</p><pre>prediction = model.predict(np.array([[300.0, 15.0]]))</pre><p>What makes this remarkable is that the same loop from <a href="https://medium.com/@AkindeleMichael/re-can-you-explain-machine-learning-one-more-time-d22e8ccb07f1">Part 1</a> — perform, measure, adjust, repeat — still powers everything. A neural network with fifty layers and fifty million parameters is still just running that loop, over and over, until the error is small enough.</p><h3>A Note on Activation Functions</h3><p>Not all neurons need to use Sigmoid. The choice of activation function shapes what a layer can express:</p><p><strong>Sigmoid</strong> squashes output between 0 and 1. Useful in output layers for binary classification — the result reads as a probability.</p><p><strong>ReLU (Rectified Linear Unit)</strong> outputs zero for negative inputs and the raw value for positive ones: g(z) = max(0, z). It is computationally cheap and avoids some training problems that Sigmoid suffers from at scale. It is the default choice for hidden layers in most modern networks.</p><p><strong>Linear activation</strong> means no activation at all — the neuron just passes z straight through(g(z) = z). This is used in output layers for regression problems where you want an unbounded numerical prediction.</p><p><strong>Softmax</strong> is the extension of Sigmoid to multiple classes. Instead of one probability, it outputs a <em>distribution</em> of probabilities across all possible categories, where every probability is between 0 and 1, and they all <strong>sum to 1</strong>. It is the standard output for multi-class classification.</p><h3>Why This Changed Everything</h3><p>Neural networks are not new. The foundational ideas go back to the 1940s and 1950s. Researchers knew the theory for decades. So why did the revolution only arrive in the 2010s?</p><p>Three things arrived together:</p><p><strong>Data.</strong> The internet created an ocean of labelled data — images, text, audio — at a scale no previous generation of researchers had access to. Neural networks are hungry. The more data you feed them, the better they become. That food finally existed.</p><p><strong>Compute.</strong> Graphics Processing Units (GPUs), originally built to render video games, turned out to be extraordinarily efficient at the matrix multiplications that power neural network training. Training that would have taken years on a CPU could be done in days.</p><p><strong>Algorithms.</strong> Decades of incremental research — better activation functions, better optimisers, better regularisation techniques — quietly accumulated until the pieces were all in place.</p><p>When those three forces converged, the results were staggering. <a href="https://proceedings.neurips.cc/paper_files/paper/2012/file/c399862d3b9d6b76c8436e924a68c45b-Paper.pdf">In 2012, a deep convolutional neural network called AlexNet cut the top-5 error rate from 26.2% to 15.3% — an 11 percentage point gap that left every other competitor far behind, achieving state-of-the-art results</a>. Not a marginal improvement. A generational leap.</p><p>What followed is history: speech recognition, language translation, protein folding, drug discovery, autonomous vehicles, and the large language models powering conversations like the one you are having right now.</p><h3>Stacking your NNs…</h3><p>In Part 1, I closed with this:</p><p><em>“Machine Learning is not magic, nor is it intuition encoded in silicon. It is a disciplined system of optimisation built on a simple, repeating loop.”</em></p><p>That is still true. Every neural network — whether it has three layers or three hundred, whether it is classifying spam or generating images — is still running the same loop. Perform. Measure. Adjust. Repeat.</p><p>What has changed is the <em>depth</em> of that loop. Each layer learns to see the world differently from the last. Simple edges become shapes. Shapes become objects. Objects become meaning.</p><p>One neuron has one opinion. Stack enough of them, train them on enough data, and something genuinely surprising emerges — not intelligence in the human sense, but a kind of learned intuition that can do things no human explicitly programmed.</p><p>That is not magic. But it is close enough to deserve the awe.</p><p><em>This article is part of an ongoing series documenting my journey through the </em><a href="https://learn.deeplearning.ai/specializations/machine-learning/"><em>DeepLearning.AI Machine Learning Specialisation</em></a><em>. If you found this useful, the first article — “</em><a href="https://medium.com/@AkindeleMichael/re-can-you-explain-machine-learning-one-more-time-d22e8ccb07f1"><em>RE: Can You Explain Machine Learning One More Time?</em></a><em>” — is a good place to start.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*RSSen17YcoTTo4p2pCbCLg.png" /><figcaption>meme from: <a href="https://imgflip.com/memegenerator">https://imgflip.com/memegenerator</a></figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c91157c7a73a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding How a WebSocket Server Works — in One Go File]]></title>
            <link>https://medium.com/@AkindeleMichael/understanding-how-a-websocket-server-works-in-one-go-file-2c80fa28bb18?source=rss-3e1d95b67d8------2</link>
            <guid isPermaLink="false">https://medium.com/p/2c80fa28bb18</guid>
            <category><![CDATA[design-patterns]]></category>
            <category><![CDATA[websocket]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[backend-development]]></category>
            <category><![CDATA[system-design-concepts]]></category>
            <dc:creator><![CDATA[Akindele Michael]]></dc:creator>
            <pubDate>Fri, 13 Feb 2026 13:33:00 GMT</pubDate>
            <atom:updated>2026-02-13T13:33:00.129Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Real-time on the web is not magic. It is just a TCP connection that refuses to close. And so is a Websocket.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KnCtQPMAJGl0fyugKV93Eg.png" /></figure><p>A WebSocket starts as HTTP. And HTTP follows a simple model:</p><p>Client sends a request.<br>Server sends a response.<br>The connection closes.</p><p>That works perfectly for loading web pages.<br>It does not work well for chat applications, multiplayer games, or live dashboards.</p><p>So how do real-time systems actually work?</p><p>The answer isn’t magic. It’s a protocol upgrade.</p><h3>What Actually Happens During a WebSocket Upgrade</h3><p>A WebSocket connection starts as HTTP.</p><p>Then something special happens.</p><p>The client sends:</p><pre>Upgrade: websocket<br>Connection: Upgrade</pre><p>The server responds:</p><pre>101 Switching Protocols</pre><p>At that moment, something fundamental changes. The HTTP connection becomes a persistent TCP connection. And it stays open.</p><p>Now:</p><ul><li><em>The client can send data at any time.</em></li><li><em>The server can send data at any time.</em></li></ul><p>Communication becomes bidirectional. That’s it.<br>Hence, a WebSocket is simply:</p><blockquote>A long-lived TCP connection established through an HTTP upgrade.</blockquote><p>No polling.<br>No repeated requests.<br>No reopening connections.</p><p>Just an open pipe between client and server.</p><h3>But What Is TCP?</h3><p>Before WebSockets make sense, TCP must make sense.</p><p>Transmission Control Protocol is the foundation of most internet communication. It guarantees four things:</p><ul><li>Data arrives.</li><li>Data arrives in order.</li><li>Missing packets are retransmitted.</li><li>Duplicate packets are discarded.</li></ul><p>This happens through a three-way handshake before any data flows:</p><pre>Client -&gt; SYN<br>Server -&gt; SYN-ACK<br>Client -&gt; ACK</pre><p>Only then does communication begin. This is why TCP powers HTTP, APIs, chat systems, and file &amp; database transfers — anywhere correctness matters more than speed.</p><p>UDP takes the opposite approach. No handshake. No guarantees. No retransmission. It’s “<em>fire and forget</em>” — faster, lower overhead, and the right choice for live video, gaming, and voice calls where a dropped frame is better skipped than resent.</p><p><strong>WebSockets run on top of TCP</strong>; after all, HTTP runs on TCPs too, a WebSocket is just an upgrade<strong>.</strong> Which means they inherit all four guarantees. When we say “the connection stays open,” what we really mean is: the underlying TCP connection stays open. That persistent, reliable pipe is what makes real-time systems work.</p><h3>The Architecture: Hub and Clients</h3><p>Now let’s see what this looks like in Go.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0SH5ZKTWkM0Yg7xbZDfCdA.png" /></figure><p>The entire server is built around two primitives.</p><p>A <strong>Client</strong> represents one connected session:</p><pre>type Client struct {<br>    conn *websocket.Conn<br>    send chan Message<br>    name string // optional; just following business rules<br>}</pre><p>A <strong>Hub</strong> owns all shared state:</p><pre>type Hub struct {<br>    clients    map[*Client]bool<br>    broadcast  chan Message<br>    register   chan *Client<br>    unregister chan *Client<br>    history    []Message // optional; just a business case for my side project<br>}</pre><p>The Hub runs in a single goroutine. That single goroutine is the only thing that ever reads or writes, clients and history — so there are no data races(which I faced while building this project for 2 hours!), and no mutex is ever needed(I learnt about the Hub Design Architecture while working on this project, removing all the Mutex objects).</p><p>Every connected client gets two goroutines of its own:</p><ul><li>readPump — reads frames from the WebSocket, forwards them to the hub</li><li>writePump — drains the client&#39;s send channel, writes frames to the wire</li></ul><p>Total goroutine count: <strong>1 (hub) + 2×N (clients).</strong></p><p>In a standard HTTP request, you read the request and write the response in the same function because it happens linearly (A then B).</p><p>In WebSockets, the client might send a message <em>while</em> the server is trying to send a notification. They are independent streams.</p><ul><li><strong>readPump</strong>: Is the <strong>Listener</strong>. It sits there waiting for the <em>Client</em> to say something.</li><li><strong>writePump</strong>: Is the <strong>Speaker</strong>. It sits there waiting for the <em>Hub</em> (the server) to say something.</li></ul><p>And because they both involve blocking operations (waiting for data), they <strong>must run in separate Goroutines</strong>.</p><p>Here is exactly what they are waiting for:</p><ul><li>In<strong> </strong>readPumpthe code c.conn.ReadJSON(&amp;msg), pauses the code execution completely until <strong>data arrives from the internet(client message)</strong>. It is waiting for a message to come in.</li><li>In writePump the line range c.send pauses the code execution completely until <strong>data is put into the Go channel</strong>.</li></ul><h3>The Hub’s Event Loop</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eBByPJmFJBmFerP59cC9aw.png" /></figure><p>The hub runs a select loop forever, processing one event at a time:</p><pre>func (h *Hub) run() {<br>    for {<br>        select {<br>        case client := &lt;-h.register:<br>            h.clients[client] = true<br>            for _, msg := range h.history {<br>                client.send &lt;- msg        // replay last 100 messages<br>            }<br>            go h.broadcastUserCount()<br>            go h.broadcastSystem(client.name + &quot; joined&quot;)<br>       case client := &lt;-h.unregister:<br>            if _, ok := h.clients[client]; ok {<br>                delete(h.clients, client)<br>                close(client.send)<br>                go h.broadcastUserCount()<br>                go h.broadcastSystem(client.name + &quot; left&quot;)<br>            }<br>        case message := &lt;-h.broadcast:<br>            if message.Type == ChatMessage {<br>                h.history = append(h.history, message)<br>                if len(h.history) &gt; MaxHistory {<br>                    h.history = h.history[len(h.history)-MaxHistory:]<br>                }<br>            }<br>            for client := range h.clients {<br>                client.send &lt;- message<br>            }<br>        }<br>    }<br>}</pre><p>Three cases. Three responsibilities.</p><p><strong>register</strong> — A new client arrives. Replay history so they see the last 100 messages immediately, then announce their arrival to everyone else.</p><p><strong>unregister</strong> — A client disconnects. Remove them, close their send channel (which signals writePump to exit), and announce their departure.</p><p><strong>broadcast</strong> — A message needs to go to everyone. If it&#39;s a chat message, append it to history and trim to 100. Then fan it out to every connected client&#39;s send channel.</p><h3>The Wire Format</h3><p>Every WebSocket frame<em>(Remember, messages are sent in frames in WebSockets) </em>is a JSON object with a type and a payload:</p><pre>type Message struct {<br>    Type    string `json:&quot;type&quot;`<br>    Payload any    `json:&quot;payload&quot;`<br>}</pre><p>And for our use case, three message types exist:</p><pre>// User sends a message<br>{ &quot;type&quot;: &quot;chatMessage&quot;, &quot;payload&quot;: { &quot;username&quot;: &quot;alice&quot;, &quot;message&quot;: &quot;Hello!&quot; } }<br><br>// Server announces an event<br>{ &quot;type&quot;: &quot;system&quot;,      &quot;payload&quot;: { &quot;text&quot;: &quot;alice joined&quot; } }<br><br>// Server updates the live client(user) count<br>{ &quot;type&quot;: &quot;userCount&quot;,   &quot;payload&quot;: { &quot;count&quot;: 3 } }</pre><p>Clients only ever send chatMessage. The server generates system and userCount itself.</p><h3>Server’s Full Lifecycle</h3><p>Here is what happens when Alice, for example, opens the app, sends a message, and closes the tab.</p><ol><li>Browser opens ws://localhost:8080/chat?username=alice</li><li>TCP handshake → HTTP upgrade → 101 Switching Protocols</li><li>serveChat upgrades the connection, resolves the username, and creates a Client</li><li>hub.register &lt;- client — the hub adds her to the map and replays history to her send channel</li><li>&quot;alice joined&quot; is broadcast to everyone</li><li>Alice types “Hello” → readPump reads it → stamps her name → sends to hub.broadcast</li><li>Hub appends to history, fans the message out to all clients</li><li>Every writePump serialises it to JSON and pushes it down the wire</li><li>Alice closes the tab → readPump exits on read error → hub.unregister &lt;- client</li><li>Hub removes her, closes her send channel → writePump exits</li><li>&quot;alice left&quot; is broadcast to everyone still connected</li></ol><h3>Conclusion</h3><p>WebSockets is not magic, but rather a clever, standardised way to upgrade a standard HTTP request into a long-lived, bidirectional TCP connection.</p><p>In my implementation, what makes Go a natural fit for this pattern is that the concurrency model maps almost directly onto the problem. A hub is a goroutine. A client is two goroutines. Communication between them is channels. There is no framework doing this work — it’s just the language.</p><p>The <a href="https://github.com/DeleMike/hallway/blob/main/main.go">full source is on GitHub</a> — one file, no abstractions, no magic.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*RSSen17YcoTTo4p2pCbCLg.png" /><figcaption>from https://memegenerator.com/</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2c80fa28bb18" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[RE: Can You Explain Machine Learning One More Time?]]></title>
            <link>https://medium.com/@AkindeleMichael/re-can-you-explain-machine-learning-one-more-time-d22e8ccb07f1?source=rss-3e1d95b67d8------2</link>
            <guid isPermaLink="false">https://medium.com/p/d22e8ccb07f1</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[education]]></category>
            <dc:creator><![CDATA[Akindele Michael]]></dc:creator>
            <pubDate>Mon, 26 Jan 2026 09:37:23 GMT</pubDate>
            <atom:updated>2026-01-26T09:46:24.757Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*roCWIxsDjCn2eLnU" /><figcaption>Photo by <a href="https://unsplash.com/@sxoxm?utm_source=medium&amp;utm_medium=referral">Sven Mieke</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Every generation reaches a point where human effort alone is no longer enough. The problems become too large, too complex, or too repetitive to solve by hand. At that point, the natural question is not “Can we work harder?” but <strong>“Can we build systems that get better on their own?”</strong></p><p>That question is what gave rise to Artificial Intelligence — and more specifically, Machine Learning.</p><p><strong>Artificial Intelligence (AI)</strong> is the broad idea: machines performing tasks that normally require human intelligence — perception, reasoning, decision-making, and learning. It is the latest <em>wonder</em> of the world. However, to truly understand how it works, we must look at its engine: <strong>Machine Learning.</strong></p><h3>The Core Philosophy</h3><p>Machine Learning (ML) is a subset of AI. While AI is the broad goal, ML is the practical methodology. It is the ability of a computer to learn patterns from data and improve its performance on a task without being explicitly programmed on how to do so.</p><h4>The (T, P, E) Framework</h4><p>A classic engineering definition captures the essence of ML precisely:</p><blockquote><em>“A computer program is said to learn from </em><strong><em>Experience (E)</em></strong><em> with respect to a </em><strong><em>Task (T)</em></strong><em> and a </em><strong><em>Performance measure (P)</em></strong><em> if its performance at task </em><strong>T</strong><em>, as measured by </em><strong>P</strong><em>, improves with experience </em><strong>E</strong><em>.”</em></blockquote><h4>The Core Learning Loop</h4><ol><li><strong>Perform:</strong> The computer executes a Task (<strong><em>T</em></strong>).</li><li><strong>Evaluate:</strong> The output is measured using a Performance metric (<strong><em>P</em></strong>).</li><li><strong>Experience:</strong> The outcome becomes Experience (<strong><em>E</em></strong>).</li><li><strong>Iterate:</strong> This experience is fed back into the loop, allowing the computer to understand and improve its performance.</li></ol><h3>The Two Branches of Learning</h3><h4>Supervised Learning (Learning with Examples)</h4><p>The model learns a mapping from inputs (<strong><em>x</em></strong>) to correct outputs (<strong><em>y</em></strong>). It learns to predict data based on samples where the “right answer” is already known.</p><ul><li><strong>Regression:</strong> Predicting continuous values (e.g., shoe prices).</li><li><strong>Classification:</strong> Predicting discrete categories (e.g., Spam vs. Not Spam).</li></ul><h4>Unsupervised Learning (Finding Structure)</h4><p>The algorithm is given inputs (<strong><em>x</em></strong>) but no labels (<strong><em>y</em></strong>). It must discover patterns, structures, or commonalities in the data on its own.</p><ul><li><strong>Clustering:</strong> Grouping similar data points (e.g., market groups).</li><li><strong>Anomaly Detection:</strong> Finding “outliers” (e.g., fraud detection).</li><li><strong>Dimensionality Reduction:</strong> Simplifying a big dataset into a smaller one without losing too much information.</li></ul><h3>The Mathematics of Regression</h3><p>To build a model that predicts values, we start with <strong>Linear Regression</strong>.</p><h4>The Model</h4><p>For a single feature (<em>univariate linear regression</em>), we use a function that takes inputs <strong><em>x</em></strong> and predicts <em>ŷ</em>:</p><pre>ŷ = f(x) = wx + b<br><br><br>w (Weight): The importance of the feature.<br>b (Bias): The offset or baseline.</pre><h4>The Cost Function</h4><p>A model learns by measuring what it costs to predict the wrong thing. We use the <strong>Mean Squared Error (MSE)</strong> to find the error between our prediction <em>ŷ</em> and the actual value (<em>y</em>):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/703/1*H-l5PEtEnMS9aSN13_Ba2A.png" /><figcaption>Cost function</figcaption></figure><p>The goal of training is to find the <strong>best weights</strong> and <strong>bias</strong> that make this cost function as <strong>small as possible</strong>.</p><h4>Gradient Descent: The Downhill Climb</h4><p>Gradient Descent is the algorithm used to find the <em>coefficients</em> <strong><em>w</em></strong> and <strong><em>b</em></strong> efficiently. Imagine taking the tiniest steps possible in the steepest direction until you reach the bottom of a valley.</p><p><strong>The Algorithm:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/724/1*75TCxbpgyo4JOq52oJwJaw.png" /><figcaption>Gradient descent algorithm</figcaption></figure><p><strong>α(Learning Rate)</strong>: The <strong>α </strong>is the size of the step which the algorithm should move downhill while trying to reduce the error produced by the cost function. If too small, the model is slow. If too large, it may fail to converge.</p><h3>Scaling and Engineering</h3><p>In real-world applications, raw data is <strong>rarely</strong> ready for a model.</p><h4>Feature Scaling</h4><p>If features are on different scales, Gradient Descent will be slow or fail. We use <strong>Z-score Normalization</strong> or <strong>Min-Max Scaling</strong> to centre the data so the algorithm performs better — mostly <strong>Z-score Normalization.</strong></p><blockquote><strong>Rule:</strong> If you scale one feature, you must scale them all.</blockquote><h4>Feature Engineering</h4><p>This is the process of using your own knowledge (or intuition) about a problem to transform your raw data into more useful features for your machine learning model.</p><p>We transform raw data into better signals:</p><ul><li><strong>New Features:</strong> Combining “Width” and “Length” into “Area.”</li><li><strong>Polynomial Features:</strong> Squaring <strong><em>x</em></strong> to fit a curve instead of a line.</li><li><strong>One-Hot Encoding:</strong> Converting text categories (like city names) into 0s and 1s so the model can understand them.</li></ul><h3>Classification: Beyond the Straight Line</h3><p>When our task (<strong><em>T</em></strong>) changes from predicting a number to predicting a category (like “Yes” or “No”), a straight line (Linear Regression) fails. A line can go to infinity, but a probability must stay between <strong><em>0</em></strong> and <strong><em>1</em></strong>.</p><h4>The Sigmoid “Squash”</h4><p>To fix this, we wrap our linear equation in a Sigmoid Function. This function takes any value and “squashes” it into a range between <strong><em>0</em></strong> and <strong><em>1</em></strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-arezJVrO1iHiUvYUTqwXQ.png" /><figcaption>Sigmoid function</figcaption></figure><p>Now, the output isn’t just a number; it is a probability. If the output is <strong><em>0.7</em></strong>, there is a <strong><em>70%</em></strong> chance the item belongs to that category.</p><h4>Why the Cost Function Changes</h4><p>In classification, <strong>Mean Squared Error</strong> is a poor “rod” for our model. It creates a “bumpy” error landscape with many false bottoms (local minima) where Gradient Descent can get stuck.</p><p>Instead, we use <strong>Binary Cross-Entropy (Log Loss)</strong>. This cost function is designed to be “convex” (smooth and bowl-shaped), ensuring that Gradient Descent always finds the true bottom. It also penalises confident, wrong predictions much more harshly than Linear Regression ever could.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bQz7sayRv2-jANvWeOqPGQ.png" /><figcaption>Log Loss Function. Image from DeepLearning.AI</figcaption></figure><h3>Generalization</h3><blockquote>The ultimate goal of Machine Learning is not to perform well on the data we have, but to perform well on data we have <strong>never seen</strong>.</blockquote><h4>Underfitting vs. Overfitting</h4><ul><li><strong>Underfitting (High Bias):</strong> The model is too simple. It’s like trying to draw a circle using only straight lines. It misses the pattern entirely.</li><li><strong>Overfitting (High Variance):</strong> The model is too complex. It doesn’t just learn the pattern; it memorises the “<em>noise</em>” or accidents in the data. It performs perfectly in training but fails miserably in the real world.</li></ul><h4>Regularization: The Safety Valve</h4><p>How do we stop a model from overfitting? We use <strong>Regularization</strong>.</p><p>Instead of removing features, we add a <strong><em>penalty</em></strong> to the Cost Function for having weights (<strong><em>w</em></strong>)<strong> </strong>that are too large. It tells the model: <em>“You can use all these features, but you aren’t allowed to rely too heavily on any single one of them.”</em></p><p>This forces the model to find a simpler, more balanced path that generalizes better to new experience (<strong><em>E</em></strong>).</p><h3>The Loop Never Ends</h3><p>Machine Learning is not magic, nor is it intuition encoded in silicon. It is a disciplined system of optimization built on a simple, repeating loop:</p><ol><li><strong>Perform</strong> a task based on current parameters.</li><li><strong>Measure</strong> the error (Cost) using a specific rule.</li><li><strong>Adjust</strong> the parameters using Gradient Descent.</li><li><strong>Repeat</strong> until the error is minimized.</li></ol><p>Once you understand this loop, the “Black Box” disappears. New algorithms become variations of familiar ideas, and complex models become layered extensions of simple ones. This loop powers everything from the recommendation engine on your phone to the fraud detection protecting your bank account. No single equation is special on its own; the power lies in the <strong>iteration</strong>.</p><p><em>Note: This write-up will not be possible without this </em><a href="https://learn.deeplearning.ai/specializations/machine-learning/"><em>Machine Learning Specialization Course on DeepLearning.AI</em></a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*RSSen17YcoTTo4p2pCbCLg.png" /><figcaption>meme from: https://imgflip.com/memegenerator</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d22e8ccb07f1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Surgical Precision of Software Engineering: Building Systems That Matter]]></title>
            <link>https://medium.com/@AkindeleMichael/the-surgical-precision-of-software-engineering-building-systems-that-matter-32f2af74ceda?source=rss-3e1d95b67d8------2</link>
            <guid isPermaLink="false">https://medium.com/p/32f2af74ceda</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[golang]]></category>
            <category><![CDATA[cli-tool]]></category>
            <category><![CDATA[system-design-concepts]]></category>
            <dc:creator><![CDATA[Akindele Michael]]></dc:creator>
            <pubDate>Mon, 15 Dec 2025 15:48:25 GMT</pubDate>
            <atom:updated>2025-12-15T15:48:25.498Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Every system you build is a critical system.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Qe7aXE6yjhK7R3O3kmFnVA.png" /><figcaption>Scout generated by Gemini <a href="https://blog.google/technology/ai/nano-banana-pro/">Nano Banana Pro</a></figcaption></figure><p>Let that sink in for a moment. Whether it’s a directory analyzer, a to-do app, or infrastructure that powers financial transactions, someone will depend on it. They’ll trust it. They’ll build routines around it. And when it fails, the impact won’t be abstract — it might derail their day or cost them something meaningful.</p><p>This is why software engineering isn’t just about making things work. It’s an art form. A discipline. A practice of building <em>consistently</em>, with the same care a surgeon brings to an operating room.</p><h3>Software Engineering as a Careful Craft</h3><p>Real engineering is <strong>meticulous</strong>, <strong>intentional</strong>, <strong>documented</strong>,<strong> well-tested</strong>, and grounded in <strong>practicality</strong>. It isn’t about clever shortcuts or “move fast and break things.” It’s about precision — understanding that every line of code is a <em>promise</em> to your users and your future self.</p><p>A surgeon wouldn’t “mostly” sterilize instruments or skip a protocol because “it usually works.” They follow steps, double-check, and build systems that prevent failure before it happens.</p><p>Great software engineering works the same way.</p><h3>The Pillars of Engineering Craft</h3><p><strong>1. Deliberate Architecture</strong><br>Before writing code, think about the structure.<br>Where are the boundaries? Who owns what? How does this scale or evolve? A well-designed system guides you toward the right decisions and resists the wrong ones.</p><p><strong>2. Ruthless Testing</strong><br>“Works on my machine” is meaningless.<br>Does it work with slow networks, full disks, malformed input, or chaotic user behaviour?<br>Testing isn’t about proving you’re right — it’s about finding where you’re wrong before users do. Personally, I fail here. I don’t write tests as I build modules of my software.</p><p><strong>3. Living Documentation</strong><br>Code tells you <em>what</em> the system does. Documentation tells you <em>why</em>. <br>Good docs turn hours of onboarding into minutes and save future developers (including you) from uncertainty and re-learning.</p><p><strong>4. Pragmatic Problem-Solving</strong><br>Great engineers value clarity over cleverness. They pick simplicity over elegance when simplicity serves the user better. They recognize tradeoffs and optimize for what matters most.</p><h3>A Case Study: Building Scout</h3><p>To make this philosophy tangible, consider <a href="https://github.com/DeleMike/scout"><em>Scout</em></a> — a CLI tool I built that scans a directory using local AI and tells you what’s inside: file types, likely purpose, key files, and next steps.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FuDZDLUPq0J8%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DuDZDLUPq0J8&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FuDZDLUPq0J8%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/b355227db21af7ac38f29dee04ed36ca/href">https://medium.com/media/b355227db21af7ac38f29dee04ed36ca/href</a></iframe><p>It sounds simple.<br>But simple for the user means intentionally complex behind the scenes.</p><p><strong>Modular Architecture from Day One</strong><br>Scout was architected as four independent stages:</p><blockquote><strong>Scanner -&gt; Extractor -&gt; Analyzer -&gt;AI Summarizer</strong></blockquote><p>Each does exactly one job. This means:</p><ul><li>Each component is testable in isolation</li><li>Implementations can change without breaking the whole system</li><li>New file types can be added without touching existing logic</li><li>The codebase is approachable for contributors</li></ul><p>This is deliberate architecture — the difference between software that lasts months and software that lasts years.</p><p><strong>Defensive Programming</strong><br>Every operation was designed assuming it could fail:</p><ul><li>AI timeouts handled gracefully</li><li>Clear, actionable error messages</li><li>Noise directories are ignored safely</li><li>Inputs validated before processing</li></ul><p>This is the mindset behind ruthless testing: anticipate failure, don’t react to it.</p><p><strong>Documentation That Serves</strong></p><p>The README isn’t decoration — it’s onboarding.<br>It explains:</p><ul><li>What Scout is and why it exists</li><li>How to install it (with a Makefile to automate the tedious parts)</li><li>Example outputs to set expectations</li><li>Troubleshooting for common issues</li></ul><p>This is a documentation that respects the user.</p><p><strong>Pragmatic Choices</strong><br>Scout uses a local LLM, a llama model, rather than cloud APIs because it’s faster, private, free, and works offline. The tradeoff? More complex setup. So the Makefile handles most of it, and fallback behaviour ensures Scout still works even when the model doesn’t.</p><p>This is pragmatic engineering: understand tradeoffs, choose intentionally, and mitigate pain points.</p><h4>Why This Level of Care Matters</h4><p>Users don’t think about your architecture or test coverage — they think about whether <em>your tool works when they need it</em>.<br>The irony is that reliability <em>comes from</em> good architecture, test coverage(which I do not do), and thoughtful design.</p><p>When you engineer with care:</p><ul><li>Updates don’t mysteriously break things</li><li>Failures are understandable, not catastrophic</li><li>Contributors aren’t afraid to touch the code</li><li>You don’t dread the 3 AM emergency</li></ul><h4>Shift Your Mindset</h4><p>Stop thinking of software as “just code.” Think of it as a set of promises:</p><ul><li>A function promises correct behaviour</li><li>A test promises that behaviour won’t regress</li><li>Documentation promises clarity</li><li>Error handling promises resilience</li></ul><p>When you adopt this mindset:</p><ul><li>Skipping tests feels like breaking a promise</li><li>Copy-pasting without understanding feels dangerous</li><li>Leaving TODOs in production feels careless</li><li>Not documenting decisions feels disrespectful to others</li></ul><p>This is the mindset of an engineer — someone who builds systems, not just code.</p><h4>Build like a Surgeon</h4><p>Before you ship your next feature, ask:</p><ol><li>Have I thought through the architecture?</li><li>Have I tested failure cases, not just the happy path?</li><li>Will future readers understand <em>why</em> I did this?</li><li>Is this the simplest solution that truly solves the problem?</li></ol><p>If the answer is yes, you’re not just coding — you’re engineering.</p><p>And once you build with this level of precision, it’s hard to go back.<br>Messy systems look fragile.<br>Clean systems look like promises kept.</p><p>Software engineering is an art. Not the art of making things complicated, but the art of making things <em>reliably simple</em>. It’s the art of building consistently, carefully, and with respect for everyone who will ever touch your code.</p><p>Every system you build is critical. Build it like it matters. Because it does.</p><p><em>Interested in seeing this philosophy in action? Check out </em><a href="https://github.com/DeleMike/scout"><em>Scout</em></a><em> on GitHub — a practical example of modular architecture, defensive programming, and pragmatic engineering choices. Or better yet, build something yourself and ask: “Did I build this like a surgeon, or did I just make it work?”</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=32f2af74ceda" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Bouncer at the Door: Understanding Rate Limiting]]></title>
            <link>https://medium.com/@AkindeleMichael/the-bouncer-at-the-door-understanding-rate-limiting-ef83c7c8e910?source=rss-3e1d95b67d8------2</link>
            <guid isPermaLink="false">https://medium.com/p/ef83c7c8e910</guid>
            <category><![CDATA[genai]]></category>
            <category><![CDATA[backend-development]]></category>
            <category><![CDATA[golang]]></category>
            <category><![CDATA[rate-limiting]]></category>
            <category><![CDATA[backend]]></category>
            <dc:creator><![CDATA[Akindele Michael]]></dc:creator>
            <pubDate>Mon, 24 Nov 2025 16:02:11 GMT</pubDate>
            <atom:updated>2025-11-24T16:02:11.223Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Biargeq-QRj6lJkr" /><figcaption>Photo by <a href="https://unsplash.com/@alecfavale?utm_source=medium&amp;utm_medium=referral">Alec Favale</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Imagine you run a popular gaming centre in your neighbourhood. The generator is humming, the AC is perfectly chilled, and all your PS5 consoles are lined up and ready. Business is booming. But you have one problem — his name is <em>Jon</em>.</p><p>Jon arrives before you open, grabs the best controller, and plays FIFA from morning till night. He wears out your equipment, burns your fuel, and monopolises the console so no one else can play. If you let this continue, you won’t just lose customers, you’ll lose your business.</p><p>In software systems, <strong>your API is the console</strong>, and overactive users, bots, or scripts behave like Jon, who, if left unchecked, overwhelm your servers and increase costs, especially for AI services like in <a href="https://github.com/DeleMike/AIpply"><strong>AIpply</strong></a>, where each generation has a dollar cost.</p><p>This is why you need <strong>Rate Limiting</strong>: a digital bouncer standing at the door to ensure fairness.</p><h3>Why Rate Limiting Matters</h3><p>Rate limiting ensures fairness, stability, and cost control. It prevents a single user from overwhelming your API within a fixed time period.</p><p>In <a href="https://aipply-web-app.web.app/">AIpply</a>, each user is allowed a fixed number of AI generations per day. If they exceed this limit, further requests are denied until the next day.</p><p>In practical terms, rate limiting enforces the rule: “Your turn is over for today or for now. Please come back later.” This keeps the system healthy for everyone.</p><h3>Redis as the Shared Logbook</h3><p><a href="https://github.com/DeleMike/AIpply">AIpply</a> uses a <strong>Fixed Window Rate Limiter</strong> powered by Redis.</p><p>Think of Redis as a shared logbook behind the counter. You track each user not by their face, but by their <strong>IP address</strong>. For every request a user makes, the system updates their page in this logbook for the current day.</p><p><strong>Redis:</strong></p><ul><li><em>Stores a daily count of each user’s requests</em></li><li><em>Automatically resets the count at midnight</em></li><li><em>Is shared across all servers, preventing bypassing through another server</em></li><li><em>Supports atomic operations using pipelines, ensuring accuracy under high load</em></li></ul><p>Because the rate limit data lives in Redis rather than server memory, the system is highly scalable and suitable for distributed deployments.</p><h3>The Middleware: Your Digital Bouncer</h3><p>Below is the AIpply rate limit middleware with improved comments, showing clearly how the logic works.</p><pre>import (<br> &quot;context&quot;<br> &quot;net/http&quot;<br> &quot;time&quot;<br><br> &quot;github.com/DeleMike/AIpply/api/metrics&quot;<br> &quot;github.com/gin-gonic/gin&quot;<br>)<br><br>const (<br> rateLimitPerDay = 18 // 6 full cycles per day (3 endpoints × 6 times)<br> redisPrefix     = &quot;rate_limit:&quot;<br>)<br><br>// RateLimit middleware to limit requests per IP.<br>func RateLimit() gin.HandlerFunc {<br> return func(c *gin.Context) {<br>  redisClient := metrics.GetRedisClient()<br><br>  if redisClient == nil {<br>   c.AbortWithStatusJSON(http.StatusInternalServerError, gin.H{&quot;error&quot;: &quot;Rate limit service unavailable&quot;})<br>   return<br>  }<br>  <br>  // Create a unique Redis key combining:<br>  // - prefix<br>  // - user IP<br>  // - current date (YYYY-MM-DD)<br>  ip := c.ClientIP()<br>  now := time.Now()<br>  key := redisPrefix + ip + &quot;:&quot; + now.Format(&quot;2006-01-02&quot;)<br>  ctx := context.Background()<br><br>  // get current trial count<br>  count, err := redisClient.Get(ctx, key).Int64()<br>  if err != nil &amp;&amp; err.Error() != &quot;redis: nil&quot; {<br>   c.AbortWithStatusJSON(http.StatusInternalServerError, gin.H{&quot;error&quot;: &quot;Failed to check rate limit&quot;})<br>   return<br>  }<br><br>  // check limit<br>  if count &gt;= rateLimitPerDay {<br>   c.AbortWithStatusJSON(http.StatusTooManyRequests, gin.H{<br>    &quot;error&quot;:   &quot;Daily limit exceeded&quot;,<br>    &quot;message&quot;: &quot;You&#39;ve reached your daily limit of 6 generations. Please try again in 24 hours.&quot;,<br>   })<br>   return<br>  }<br><br>  // Compute time until midnight for expiry<br>  midnight := time.Date(now.Year(), now.Month(), now.Day()+1, 0, 0, 0, 0, now.Location())<br>  expiry := time.Until(midnight)<br><br>  // update redis data<br>  pipe := redisClient.TxPipeline()<br>  pipe.Incr(ctx, key)<br>  pipe.Expire(ctx, key, expiry)<br>  _, err = pipe.Exec(ctx)<br><br>  if err != nil {<br>   c.AbortWithStatusJSON(http.StatusInternalServerError, gin.H{&quot;error&quot;: &quot;Failed to update rate limit&quot;})<br>   return<br>  }<br><br>  c.Next()<br><br> }<br>}</pre><p>This design scales naturally because Redis acts as the <em>central source of truth</em>.</p><p>When new servers are added:</p><ul><li>They all read and write to the same Redis instance</li><li>A user who hits a limit on one server is still <strong>blocked</strong> on another</li><li>No single server needs to maintain the rate limit state</li></ul><p>This, of course, results in a resilient, distributed, scalable rate-limiting system that can grow with our application. In fact, we could also add:</p><h4>Subscription-Based Limits</h4><p><em>Different limits for free and premium users.</em></p><h4>API Key–Based Limits</h4><p><em>Better tracking for mobile apps and logged-in users.</em></p><h4>Burst + Daily Limits</h4><p><em>For example, 3 requests per minute and 50 per day.</em></p><h4>Credit-Based Billing</h4><p><em>Users purchase additional AI generations.</em></p><p>Because the current design is clean and modular(I suppose 😅🥲), these enhancements can be introduced without rewriting the entire system.</p><h3>Finally, for me…</h3><p>Rate limiting is not simply a protective mechanism. It is a framework for fairness(this was why I implemented it in the first place), stability, and predictability in an AI-driven application like AIpply.</p><p>Generally, by implementing a rate limiter:</p><ul><li>You prevent system overload</li><li>Protect operating costs</li><li>Ensure fair access to users</li><li>Support future scalability</li></ul><p>In other words, you are placing a reliable bouncer at the door of your system — ensuring that everyone gets a fair turn and the platform remains sustainable as it grows.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*RSSen17YcoTTo4p2pCbCLg.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ef83c7c8e910" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Beyond Breakpoints, Loops, and Returns: The Art of Surviving as a Developer]]></title>
            <link>https://medium.com/@AkindeleMichael/beyond-breakpoints-loops-and-returns-the-art-of-surviving-as-a-developer-c0a2de5736ed?source=rss-3e1d95b67d8------2</link>
            <guid isPermaLink="false">https://medium.com/p/c0a2de5736ed</guid>
            <category><![CDATA[imposter-syndrome]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[career-advice]]></category>
            <category><![CDATA[life-lessons]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Akindele Michael]]></dc:creator>
            <pubDate>Tue, 21 Oct 2025 15:01:57 GMT</pubDate>
            <atom:updated>2025-10-21T15:01:57.957Z</atom:updated>
            <content:encoded><![CDATA[<p>Programming is a tricky, self-destructive, draining, thrilling — yet enriching — endeavour. It’s an art form built on a foundation of pure logic. But learning it feels anything but logical. It’s a human journey of emotional highs and crushing lows. We all know the technical terms. We set <strong>breakpoints</strong> when we are hopelessly stuck. We write <strong>loops</strong> to execute instructions with brutal consistency. And we hope for a valuable <strong>return</strong> at the end.</p><p>As it turns in, the human journey of becoming a developer follows the same pattern.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BXzhlcRIZvje3H4EJLzEuQ.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@fer_nando?utm_source=medium&amp;utm_medium=referral">Fer Nando</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>The Breakpoint — The Art of Stupidity</h3><p>There are many times when you are writing code and you just feel dumb. This imposter syndrome is even more prevalent with the rise of AI code generators. Not too long ago, you’d pull your hair out just to understand the reason of an error message. You’d do a desperate Google search, find someone’s code on a forum or StackOverFlow, and then… <strong>Ctrl+C, Ctrl+V</strong>.</p><p>You’d pretend to read the snippet you obviously didn’t understand. You’d slap on some comments to make your reviewer <em>think</em> you understood the “technical decision” and were following the architecture. Then a review or a new feature request would come, and you wouldn’t even know where to start. You’d realize a “great refactor” was needed, all because you copied an architecture that was <em>kind of</em> like yours, but not really.</p><p>And you feel that immeasurable, <em>stupid</em> <em>pain</em>.</p><p>This pain is familiar. Remember being new? You’d see things like Polymorphism, an abstract class abstract Vehicle{}, arrow functions ()=&gt;{}, list comprehensions [l for l in list if l % 5 == 0], chan, or RWMutex, and it just hits you.</p><p>Bam! “This is too much stuff.”</p><p>You feel overwhelmed. Does it lead to regret? Does it lead to quitting?</p><p>For me, it leads to regret and a temporary exit. But it’s only temporary. Why? Because there is a dying thirst for the knowledge of programming and logical reasoning. A total quit isn’t an option, but a good break — a reflection period — is definitely something you should try.</p><p>This is the breakpoint. It’s the mandatory pause when you’re hit with a roadblock, and it’s the only way I move forward.</p><h3>The Loop — The Art of Obedience and Consistency</h3><p>One thing I love in every success story is the art of obedience. Succeeding in tech is no different.</p><p>You’ll set out to learn a concept, feel pumped, and then hit the real deal. Quitting comes to mind, as we talked about. But this is the point where you are <em>learning</em>. You are doing hard things to rewire your brain to adapt. You can’t just decide to write a variable in Python and name it return. As a learner, you will fail and fail until you realize, &quot;Oh! What a stupid mistake.&quot;</p><p>You are allowed to be stupid to grow. That’s okay.</p><p>Lately, someone came to me with their code. pd.read_csv(&#39;data.csv&#39;) was not working. I was getting tired of saying the same thing (check your working directory!), and I started to feel stupid myself. &quot;You can&#39;t review this newbie&#39;s code?&quot; I told him to ensure the file was in the same directory. He said it was.</p><p>That’s the beauty of newbies; they want you to figure it out with little information. I finally told him to share his code, and I saw it: he had written pd.read_csv(&#39;data.csv.1&#39;). The file didn&#39;t exist. After he removed the .1, it worked.</p><p>You see? The process is a <strong>loop</strong> of analysis and change. First, you must obey the rules — the programming constructs and syntax. Then, you must be consistent in that obedience, because errors (especially subtle string errors) are annoying and not all compilers will catch them.</p><p>Even though he didn’t spot the issue himself, he experienced the process. This loop of obedience and consistency is what builds natural confidence.</p><p>There are harder things I want to do, and to be frank, I don’t always apply these rules to myself. That’s why I’m not sad anymore when a new programming language or tech defeats me. I’m only sad at myself when I know I’m not where I want to be <em>because of me</em>.</p><h3>The Return — The Rewards and the Infinite</h3><p>After countless cycles through loops and sequences, the process finally yields its result.</p><p>For many of us, that first return is landing a job. The hunt for that role is its own grueling marathon, but crossing the finish line does more than just kill imposter syndrome — it validates the entire struggle. It’s the moment you realize the pain had a purpose.</p><p>But the rewards are far greater than a single job title. There is also the opportunity to join other developers in discussions, visit tech seminars to witness the sheer skill of brilliant minds at tech events, and to feel that contagious inspiration to get better.</p><p>This is where the journey becomes infinite. Programming is an industry that only rewards those who stay in the loop. There’s a brutal concept called “Technological Obsolescence,” where today’s cutting-edge tool becomes tomorrow’s useless relic. The cycle of learning, obeying rules, and staying consistent doesn’t just get you your first job; it’s the only thing that lets you keep growing. You must always strive to be better.</p><p>There are many things to always do as a developer, but I want to point out that to survive this infinite game requires two principles (not an exclusive list, but my personal ones). First, gratitude. Without it, the frustration is unbearable. Be grateful for every fellow techie who helped you, directly or indirectly — all those blog posts and ChatGPT (come on, have you not asked it for help?). Be grateful for the struggle itself. Second, as you win, stay humble(keep an open mind when working on a new project). If you don’t, the next complex codebase will do it for you. Sometimes, a massive service outage, like AWS going down, does it for all of us, reminding everyone that even the most robust systems are fragile. Some people are building compilers, you are building complex UXs — each of you finds the other’s work hard enough to focus on a path, but we need each other to function together. Humility keeps you open to learning; learning is what keeps you from fading out of the system.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*RSSen17YcoTTo4p2pCbCLg.png" /><figcaption>From <a href="https://imgflip.com/memegenerator">https://imgflip.com/memegenerator</a></figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c0a2de5736ed" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Build a Real-Time Chat App in Flutter Using WebSockets]]></title>
            <link>https://medium.com/@AkindeleMichael/how-to-build-a-real-time-chat-app-in-flutter-using-websockets-03d39fd052d8?source=rss-3e1d95b67d8------2</link>
            <guid isPermaLink="false">https://medium.com/p/03d39fd052d8</guid>
            <category><![CDATA[websocket]]></category>
            <category><![CDATA[socketio]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[software-design]]></category>
            <category><![CDATA[software-engineering]]></category>
            <dc:creator><![CDATA[Akindele Michael]]></dc:creator>
            <pubDate>Mon, 29 Sep 2025 11:10:56 GMT</pubDate>
            <atom:updated>2025-09-29T11:10:56.751Z</atom:updated>
            <content:encoded><![CDATA[<p>Building a chat application might seem daunting, and implementing it with a WebSocket API can feel even more intimidating. If you’ve used Firebase before, the process feels more straightforward — but with WebSockets, it can seem like you’re juggling endless events. The upside is that WebSockets give you far more control over your app’s real-time behaviour. Once you understand event-driven architecture and how WebSockets work, the whole process becomes surprisingly manageable. In this piece, I’ll walk you through exactly how I built my own real-time chat app in Flutter using WebSockets.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*-TjLySrFeVxSNtUw" /><figcaption>Photo by <a href="https://unsplash.com/@austindistel?utm_source=medium&amp;utm_medium=referral">Austin Distel</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>When building a Flutter app and I need an advanced feature, my first step is usually some quick research to see if a package already exists 😅 — why reinvent the wheel? After the backend team released the chat endpoints, my first thought was, ‘Where do I even start?’ A quick call clarified things, and that’s when I decided to use the socket_io_client package for the real-time chat feature. Why? Because the endpoints supported everything we needed: instant messaging, online presence indicators (‘online’, ‘offline’), typing notifications, and more. That made the decision easy.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*4pEQmDTIADuaOnsW" /><figcaption>Photo by <a href="https://unsplash.com/@lonelyblue?utm_source=medium&amp;utm_medium=referral">lonely blue</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>To implement it, I broke the process into three components<strong>:</strong></p><ol><li><strong>SocketServiceclass:</strong> A central class to manage the WebSocket connection, listen for events from the server, and send events out.</li><li><strong>State Management(Riverpod) layer:</strong> To manage the app’s state. This lets the UI reactively update when the connection status changes or a new message arrives.</li><li><strong>The UI (</strong><strong>ChatScreen)</strong>: The screen that displays messages and user status, pulling real-time data from our SocketService via Riverpod providers.</li></ol><p>The Main events I used in the app:</p><ol><li><strong>Emitting (Sending to Server):</strong></li></ol><ul><li>startChat: Tell the server I&#39;m viewing a specific user&#39;s chat.</li><li>sendMessage: Send a new message.</li><li>typing: Notify the server that I&#39;m typing (or stopped typing).</li><li>readMessage: Tell the server I&#39;ve seen the messages.</li></ul><p><strong>2. Listening (Receiving from Server):</strong></p><ul><li>newMessage: A new message has arrived.</li><li>typing: Someone else is typing.</li><li>userOnlineStatus: The other user&#39;s online status has changed.</li></ul><h3>So, Why WebSockets?</h3><p>Before diving into the implementation, it’s worth asking: why use WebSockets for chat?</p><p>Imagine texting a friend, but having to refresh the screen every few seconds to see if they replied. That’s how traditional HTTP requests work — the app has to constantly ask the server, <em>“Anything new? Anything new?”</em> This approach (called <strong>polling</strong>) isn’t just clunky; it also consumes extra network bandwidth and processing resources, since most requests return no new data. At scale, this leads to wasted CPU, memory, and server capacity compared to a single persistent WebSocket connection.</p><p>WebSockets are different. They open a persistent, two-way communication channel between the client and the server. This means the moment the server has something new (like a message), it pushes it directly to the app — instantly, no refresh and no wasted resources. That’s what makes a chat app feel truly “real-time.” ⚡</p><h3>Step 1: The Engine Room — SocketService.dart</h3><p>This class is the heart of the chat feature. It’s responsible for one thing: managing the WebSocket connection.</p><h3>Connecting and Handling Real-World Issues</h3><p>Connecting isn’t just a one-time thing. Mobile networks are unreliable. What if the connection drops? You need to reconnect automatically. What if it’s taking too long to connect? You need to time out.</p><p>My connectAndListen method handles this. I used the socket_io_client package to configure the connection.</p><pre>// In socket_service.dart<br><br>// ...<br>_socket = IO.io(<br>  &#39;https://chat-api.drazex.com&#39;,<br>  IO.OptionBuilder()<br>      .setTransports([&#39;websocket&#39;]) // Use WebSocket transport only for stability<br>      .enableAutoConnect()         // The library will try to connect automatically<br>      .setAuth({&#39;token&#39;: token})   // Send my user&#39;s auth token<br>      .setTimeout(15000)           // If it can&#39;t connect in 15s, time out<br>      .setReconnectionAttempts(5)  // Try to reconnect up to 5 times<br>      .enableReconnection()        // IMPORTANT: Enable auto-reconnect!<br>      .build(),<br>);<br><br>// ...</pre><p>Notice the options like setReconnectionAttempts and enableReconnection. This is crucial for a good user experience on a mobile device!</p><h3>Step 2: The Event System — Listening and Speaking</h3><p>Our SocketService needs to be able to listen for events from the server and speak (emit events) to the server.</p><h3>Listening with Streams</h3><p>Instead of just printing data, I used Dart’s StreamController to broadcast incoming events to the rest of the app. This way, my UI can listen to these streams and update itself automatically.</p><pre>// In socket_service.dart<br><br>// Create controllers to broadcast events<br>final _messageController = StreamController&lt;ChatMessage&gt;.broadcast();<br>final _typingController = StreamController&lt;Map&lt;String, dynamic&gt;&gt;.broadcast();<br>final _onlineStatusController = StreamController&lt;Map&lt;String, dynamic&gt;&gt;.broadcast();<br><br>// Expose the streams for the UI to listen to<br>Stream&lt;ChatMessage&gt; get onNewMessage =&gt; _messageController.stream;<br>Stream&lt;Map&lt;String, dynamic&gt;&gt; get onUserTyping =&gt; _typingController.stream;<br>Stream&lt;Map&lt;String, dynamic&gt;&gt; get onOnlineStatus =&gt; _onlineStatusController.stream;<br><br>void _listenForEvents() {<br>  // 📩 Listen for new messages<br>  _socket!.on(&#39;newMessage&#39;, (data) {<br>    print(&#39;📩 New message received: $data&#39;);<br>    final message = ChatMessage.fromJson(data);<br>    _messageController.add(message); // Add the message to the stream<br>  });<br>  // ⌨️ Listen for typing indicators<br>  _socket!.on(&#39;typing&#39;, (data) {<br>    print(&#39;⌨️ Typing status received: $data&#39;);<br>    _typingController.add(data as Map&lt;String, dynamic&gt;);<br>  });<br>  // 🟢 Listen for online status<br>  _socket!.on(&#39;userOnlineStatus&#39;, (data) {<br>    print(&#39;🟢 Online status received: $data&#39;);<br>    _onlineStatusController.add(data as Map&lt;String, dynamic&gt;);<br>  });<br>}</pre><h3>Speaking (Emitting Events)</h3><p>Sending data is more straightforward. I created simple methods that emit an event with the right name and data.</p><pre>// In socket_service.dart<br>void sendMessage(String receiverId, String message) {<br>  // Only send if the socket is actually connected<br>  if (_isConnected &amp;&amp; _socket?.connected == true) {<br>    final payload = {<br>      &#39;receiverId&#39;: receiverId,<br>      &#39;message&#39;: message,<br>      &#39;clientTimestamp&#39;: DateTime.now().millisecondsSinceEpoch,<br>    };<br>    print(&#39;📤 Sending message: $payload&#39;);<br>    _socket?.emit(&#39;sendMessage&#39;, payload);<br>  }<br>}<br>void sendTypingStatus(String receiverId, bool isTyping) {<br>  if (_isConnected &amp;&amp; _socket?.connected == true) {<br>    _socket?.emit(&#39;typing&#39;, {&#39;receiverId&#39;: receiverId, &#39;isTyping&#39;: isTyping});<br>  }<br>}</pre><h3>Step 3: State Management with Riverpod</h3><p>How does the UI know if we’re connected, connecting, or have an error? A simple bool isConnected isn&#39;t enough.</p><p>I created a SocketConnectionState class and managed it with a StateNotifier. This gives the UI a rich, detailed view of the connection status.</p><pre>// In socket_service.dart<br><br>// A class to hold all possible connection states<br>class SocketConnectionState {<br>  final bool isConnected;<br>  final bool isConnecting;<br>  final String? error;<br>  // ... constructor ...<br>}<br><br>// A Riverpod provider to make the state available to the whole app<br>final socketConnectionProvider = StateNotifierProvider.autoDispose<br>    SocketConnectionNotifier,<br>    SocketConnectionState&gt;((ref) =&gt; SocketConnectionNotifier());</pre><p>Now, anywhere in my app, I can “watch” this provider to know exactly what’s going on.</p><h3>Step 4: Building the Reactive Chat Screen</h3><p>This is where everything comes together. The ChatScreen uses Riverpod to watch the state and streams from our SocketService.</p><h3>Displaying Connection and User Status</h3><p>In the app bar, I wanted to show if the other user was “online,” “typing…” or “offline.” I also wanted a banner to appear if my own connection dropped.</p><p>By watching my providers, the UI rebuilds automatically whenever the status changes.</p><pre>// In chat_screen.dart (inside the build method)<br><br>// Watch the socket connection state reactively<br>final connectionState = ref.watch(socketConnectionProvider);<br>final isConnected = connectionState.isConnected;<br>final isConnecting = connectionState.isConnecting;<br><br>// Watch the real-time status of the other user<br>final userStatusAsync = ref.watch(userStatusProvider(widget.otherUserId));<br><br>// ... then in the UI ...<br>// A banner that shows when disconnected<br>if (!isConnected &amp;&amp; !isConnecting) {<br>  _buildConnectionBanner(connectionState.error);<br>}<br><br>// The user status display in the AppBar<br>_buildStatusDisplay(isConnected, userStatusAsync);</pre><p>This is the beauty of Riverpod. I don’t need to manually call setState. I just declare what I&#39;m watching, and the UI takes care of itself.</p><h3>Sending a Message</h3><p>The send button is simple. It just calls the sendMessage method from our SocketService.</p><pre>// In chat_screen.dart<br><br>void _sendMessage() {<br>  final text = _controller.text.trim();<br>  if (text.isEmpty) return;<br>  <br>  // Get the socket service from Riverpod<br>  final socketService = ref.read(socketServiceProvider);<br>  <br>  // Call the method to send the message<br>  socketService.sendMessage(widget.otherUserId, text);<br>  <br>  _controller.clear();<br>}</pre><h3>What I Learned</h3><p>Building this was a huge learning experience. Here are the things that tripped me up and the things that saved me:</p><ul><li><strong>Connection isn’t Instant:</strong> The UI might be ready before the socket is connected. Building a proper connection state (isConnecting, isConnected, error) was a game-changer. Don&#39;t rely on a simple boolean! The booleans! Bruhh!!! I…almost ran nuts!</li><li><strong>Streams are Your Best Friend:</strong> Using StreamController and Riverpod&#39;s StreamProvider made the UI incredibly simple. It completely separated the &quot;how to get data&quot; from the &quot;how to display data.&quot;</li><li><strong>The App Lifecycle Matters:</strong> What happens when the user backgrounds the app? I used WidgetsBindingObserver to detect when the app was paused or resumed, so I could intelligently reconnect and refresh the user&#39;s status.</li><li><strong>Log Everything:</strong> During development, print statements are your best debugger. I logged every event sent, every event received, and every connection status change. It saved me hours of guessing.</li></ul><p>Implementing WebSockets felt intimidating at first, but breaking it into core parts — <strong>connecting, listening, emitting, and managing state</strong> — made the process much more manageable. By combining <a href="https://pub.dev/packages/socket_io_client">socket_io_client</a> for networking with <a href="https://pub.dev/packages/flutter_riverpod">Riverpod</a> for state management, I was able to build a chat app that feels modern, responsive, and reliable.</p><p>If you’re starting (or suddenly handed a task involving WebSockets), my advice is simple: <strong>get the connection working first.</strong> Once that’s stable, layer in features like presence, typing indicators, and message delivery one step at a time.</p><p>You’ll be surprised how quickly a “scary” real-time system starts to feel within your control — and how powerful your app can become 🚀.</p><p><em>Try setting up a simple WebSocket connection in your own app. Start small, and you’ll be amazed at how quickly it comes together. Once you’ve built a chat app, you’ve basically learned the foundation for all of them.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*RSSen17YcoTTo4p2pCbCLg.png" /><figcaption>From <a href="https://imgflip.com/memegenerator">https://imgflip.com/memegenerator</a></figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=03d39fd052d8" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>