<?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:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:googleplay="http://www.google.com/schemas/play-podcasts/1.0"><channel><title><![CDATA[Mubbie's Notebook]]></title><description><![CDATA[Here, I share my thoughts, ideas, learnings and more. ✍🏾️ Welcome!]]></description><link>https://notebook.mubbie.dev</link><image><url>https://substackcdn.com/image/fetch/$s_!CIZW!,w_256,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7c94ebb7-4de1-4a7c-a20b-4619bef0d877_3000x4000.jpeg</url><title>Mubbie&apos;s Notebook</title><link>https://notebook.mubbie.dev</link></image><generator>Substack</generator><lastBuildDate>Mon, 01 Jun 2026 02:06:13 GMT</lastBuildDate><atom:link href="https://notebook.mubbie.dev/feed" rel="self" type="application/rss+xml"/><copyright><![CDATA[Mubarak Idoko]]></copyright><language><![CDATA[en]]></language><webMaster><![CDATA[mubbiesnotebook@substack.com]]></webMaster><itunes:owner><itunes:email><![CDATA[mubbiesnotebook@substack.com]]></itunes:email><itunes:name><![CDATA[Mubarak Idoko]]></itunes:name></itunes:owner><itunes:author><![CDATA[Mubarak Idoko]]></itunes:author><googleplay:owner><![CDATA[mubbiesnotebook@substack.com]]></googleplay:owner><googleplay:email><![CDATA[mubbiesnotebook@substack.com]]></googleplay:email><googleplay:author><![CDATA[Mubarak Idoko]]></googleplay:author><itunes:block><![CDATA[Yes]]></itunes:block><item><title><![CDATA[Agents are Loops]]></title><description><![CDATA[AI agents are simpler than you think]]></description><link>https://notebook.mubbie.dev/p/agents-are-loops</link><guid isPermaLink="false">https://notebook.mubbie.dev/p/agents-are-loops</guid><dc:creator><![CDATA[Mubarak Idoko]]></dc:creator><pubDate>Tue, 28 Apr 2026 00:29:07 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!SpNF!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcae5cd95-a527-460b-9d5a-8d6c391d8fb2_690x362.webp" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!w_n1!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F68267682-7023-42a3-a437-5dfca4fb71e4_1480x1145.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!w_n1!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F68267682-7023-42a3-a437-5dfca4fb71e4_1480x1145.png 424w, https://substackcdn.com/image/fetch/$s_!w_n1!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F68267682-7023-42a3-a437-5dfca4fb71e4_1480x1145.png 848w, https://substackcdn.com/image/fetch/$s_!w_n1!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F68267682-7023-42a3-a437-5dfca4fb71e4_1480x1145.png 1272w, https://substackcdn.com/image/fetch/$s_!w_n1!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F68267682-7023-42a3-a437-5dfca4fb71e4_1480x1145.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!w_n1!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F68267682-7023-42a3-a437-5dfca4fb71e4_1480x1145.png" width="1456" height="1126" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/68267682-7023-42a3-a437-5dfca4fb71e4_1480x1145.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1126,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:223847,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://notebook.mubbie.dev/i/195695282?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F68267682-7023-42a3-a437-5dfca4fb71e4_1480x1145.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!w_n1!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F68267682-7023-42a3-a437-5dfca4fb71e4_1480x1145.png 424w, https://substackcdn.com/image/fetch/$s_!w_n1!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F68267682-7023-42a3-a437-5dfca4fb71e4_1480x1145.png 848w, https://substackcdn.com/image/fetch/$s_!w_n1!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F68267682-7023-42a3-a437-5dfca4fb71e4_1480x1145.png 1272w, https://substackcdn.com/image/fetch/$s_!w_n1!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F68267682-7023-42a3-a437-5dfca4fb71e4_1480x1145.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Image Source: <a href="https://xkcd.com/">XKCD</a></em></p><h2>Act 1: From Chat to Action</h2><p>In <a href="https://notebook.mubbie.dev/p/chatgpt-doesnt-think-it-pays-attention">Part 1: ChatGPT Doesn&#8217;t Think. It Pays Attention</a>, we opened up the hood and looked at how LLMs actually work. From how they tokenize the input text, embed it into vectors, run it through layers of attention, and predict the next token. As well as how they continue to do so until they get a token to end/stop. That is the core of every AI tool you use today, whether it is ChatGPT, Claude, Gemini, Grok, GLM, Kimi, etc. It is attention and next-token prediction, all the way down.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://notebook.mubbie.dev/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Mubbie's Notebook! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p>But here is the thing. LLMs, on their own, can only <em>talk.</em> They produce text, and stop at that. They cannot read your files. They cannot run code. They cannot search the web, book a flight, send an email, or do anything in the real world. They are incredibly sophisticated text generators, but text generators nonetheless.</p><p>And yet, tools like <a href="https://docs.anthropic.com/en/docs/claude-code">Claude Code</a>, <a href="https://www.cursor.com/">Cursor</a>, <a href="https://openai.com/codex/">OpenAI&#8217;s Codex</a>, and <a href="https://github.com/features/copilot">GitHub Copilot</a> clearly <em>do</em> things. They, for instance, read your codebase, edit files, run tests, fix bugs, and commit changes. If LLMs can only produce text, how are these tools taking actions in the real world?</p><p>The answer is surprisingly simple, and that is what this post is about.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!qHju!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbaf0435a-fd09-41cf-8bd5-cfa27fc022e1_512x390.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!qHju!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbaf0435a-fd09-41cf-8bd5-cfa27fc022e1_512x390.png 424w, https://substackcdn.com/image/fetch/$s_!qHju!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbaf0435a-fd09-41cf-8bd5-cfa27fc022e1_512x390.png 848w, https://substackcdn.com/image/fetch/$s_!qHju!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbaf0435a-fd09-41cf-8bd5-cfa27fc022e1_512x390.png 1272w, https://substackcdn.com/image/fetch/$s_!qHju!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbaf0435a-fd09-41cf-8bd5-cfa27fc022e1_512x390.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!qHju!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbaf0435a-fd09-41cf-8bd5-cfa27fc022e1_512x390.png" width="512" height="390" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/baf0435a-fd09-41cf-8bd5-cfa27fc022e1_512x390.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:390,&quot;width&quot;:512,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:97476,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://notebook.mubbie.dev/i/195695282?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbaf0435a-fd09-41cf-8bd5-cfa27fc022e1_512x390.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!qHju!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbaf0435a-fd09-41cf-8bd5-cfa27fc022e1_512x390.png 424w, https://substackcdn.com/image/fetch/$s_!qHju!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbaf0435a-fd09-41cf-8bd5-cfa27fc022e1_512x390.png 848w, https://substackcdn.com/image/fetch/$s_!qHju!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbaf0435a-fd09-41cf-8bd5-cfa27fc022e1_512x390.png 1272w, https://substackcdn.com/image/fetch/$s_!qHju!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbaf0435a-fd09-41cf-8bd5-cfa27fc022e1_512x390.png 1456w" sizes="100vw"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Image Source: <a href="https://innovation.consumerreports.org/encoding-loyalty-principles-into-ai-agents-behavior/">Inyoung Cheong: Consumer Reports</a></em></p><p>If you have been following the AI space at all, you have probably heard the word &#8220;agent&#8221; thrown around a lot. It is one of those terms that means something different depending on who you ask. Some people use it to mean autonomous AI that can operate independently. Others use it to mean any AI that can do more than chat. The marketing around it tends to make it sound like futuristic (which it is) but also really complex.</p><p>It&#8217;s really not.</p><p><a href="https://simonwillison.net/2025/Sep/18/agents/">Simon Willison</a> has, perhaps, the clearest definition I have found: <strong>an agent is an LLM that runs tools in a loop to achieve a goal.</strong> That is it. An LLM (the language brain), tools (the hands), and a loop (repeated attempts with feedback). If you understand those three things, you understand what every agentic product is doing under the hood.</p><p>In this post, we will build up from &#8220;what is a tool?&#8221; to &#8220;what is an agent?&#8221; to &#8220;how do coding agents like Claude Code actually work?&#8221; And then we will build a tiny one ourselves in about 80 lines of Python. By the end, the magic should feel a lot less magical and a lot more mechanical.</p><h3>Chatbot vs. Agent: The Key Difference</h3><p>Before we get into the details, it helps to draw a clear line between two things that look similar but work very differently.</p><p>A <strong>chatbot</strong> is a single exchange portal. You send a message, the LLM processes it, and it sends back a response. The LLM cannot take actions, check results, or try again if something goes wrong. This is what you are doing when you ask ChatGPT a question and get an answer. The model generates text, and that is the end of the interaction (until you type something else).</p><p>An <strong>agent</strong> is a loop. You give it a goal (&#8220;fix the failing test in auth.py&#8221;). Instead of just generating a response, it figures out what to do, takes an action (reads and/or runs the test file), observes the result (sees the error message), decides on the next step (reads the source file), takes another action (edits the code), checks the result (runs the tests), and repeats until the goal is met or it runs out of budget. This is the loop that I am concerned could replace me at my job, lol.</p><p>The difference is not the model, because the same LLM powers both. Agents, however, have a <strong>program loop</strong> wrapped around the model. So while a chatbot calls the LLM once, an agent calls the LLM in a loop, with tool execution happening between calls.</p><p>It is worth noting, though, that even familiar chatbot interfaces are starting to blur this line. For instance, if you ask ChatGPT what time it is, the model does not know the time, but it can use a tool to look it up and respond. Similarly, it can search the web to see what important events are happening in your city around that time. So while it might not be a full agent loop, the underlying mechanism is the same.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!BMjI!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6cc65ba1-2136-4c2c-b2b3-88b270a19527_1280x720.webp" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!BMjI!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6cc65ba1-2136-4c2c-b2b3-88b270a19527_1280x720.webp 424w, https://substackcdn.com/image/fetch/$s_!BMjI!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6cc65ba1-2136-4c2c-b2b3-88b270a19527_1280x720.webp 848w, https://substackcdn.com/image/fetch/$s_!BMjI!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6cc65ba1-2136-4c2c-b2b3-88b270a19527_1280x720.webp 1272w, https://substackcdn.com/image/fetch/$s_!BMjI!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6cc65ba1-2136-4c2c-b2b3-88b270a19527_1280x720.webp 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!BMjI!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6cc65ba1-2136-4c2c-b2b3-88b270a19527_1280x720.webp" width="1280" height="720" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/6cc65ba1-2136-4c2c-b2b3-88b270a19527_1280x720.webp&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:720,&quot;width&quot;:1280,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:106136,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/webp&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://notebook.mubbie.dev/i/195695282?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6cc65ba1-2136-4c2c-b2b3-88b270a19527_1280x720.webp&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!BMjI!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6cc65ba1-2136-4c2c-b2b3-88b270a19527_1280x720.webp 424w, https://substackcdn.com/image/fetch/$s_!BMjI!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6cc65ba1-2136-4c2c-b2b3-88b270a19527_1280x720.webp 848w, https://substackcdn.com/image/fetch/$s_!BMjI!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6cc65ba1-2136-4c2c-b2b3-88b270a19527_1280x720.webp 1272w, https://substackcdn.com/image/fetch/$s_!BMjI!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6cc65ba1-2136-4c2c-b2b3-88b270a19527_1280x720.webp 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Image Source: <a href="https://jakobnielsenphd.substack.com/p/ai-agents">Jakob Nielsen on UX</a></em></p><p><a href="https://www.ibm.com/think/topics/ai-agents">IBM</a> frames agents as systems that &#8220;autonomously perform tasks by designing workflows with available tools.&#8221; <a href="https://github.com/resources/articles/what-are-ai-agents">GitHub</a> describes them as AI systems that &#8220;can independently plan and execute complex tasks.&#8221; At the implementation level, it is simpler than either of those descriptions makes it sound. It is a while loop.</p><p>Here is the core of the post in one sentence: <strong>everything we are about to cover, from tool use to the agent loop to coding harnesses, is mostly just different ways of putting an LLM inside a while loop with access to functions it can call.</strong></p><p>Let&#8217;s start with the functions.</p><div><hr></div><h2>Act 2: Tool Use</h2><h3>What Is a Tool?</h3><p>A tool, in the context of LLMs, is just a function that the LLM can ask your program to run. It is a regular function, like one you would write in Python, JavaScript, or Bash. The only difference in this case is that you <em>describe</em> the function to the LLM (its name, what it does, what argument it takes, etc.), and the model gets to decide when to call it and with what input.</p><p>Let&#8217;s look at an example to see what this might look like in practice. Say you have a function called <code>get_weather</code> that takes a city name and returns the current weather (the details of how you get the weather don&#8217;t matter). You tell the LLM that it has access to a tool called <code>get_weather</code>. And that the function takes one argument, <code>city</code>, which is a string. The LLM can use it when someone asks about the weather. You pass this description along when you call the LLM.</p><p>Now, when a user asks &#8220;What is the weather in Seattle?&#8221; (Nobody should be asking this, though, as it should be obvious that if it&#8217;s summer, it&#8217;s sunny, if it&#8217;s not summer, it&#8217;s raining, haha), the LLM has a choice. It can either try to answer from its training data (which might be outdated or wrong), or it can output a structured <strong>tool call</strong> that says: &#8220;I want to call <code>get_weather</code> with city <code>Seattle</code>.&#8221;</p><p>Here&#8217;s an important detail. The LLM does not actually run the function. It <em>requests</em> that the function be run. It outputs a structured message (usually JSON) that says &#8220;call this tool with these arguments.&#8221; Then, your code, the program sitting between the user and the LLM, intercepts that request, executes the actual function, gets the result, and sends it back to the LLM. The LLM then uses the result to generate its final response.</p><p>Thus, the LLM is the decision maker. Your code, running in whatever runtime you have set up, is the executor. The LLM says <em>what</em> to do, your program does it, and the LLM uses your program output to improve its response.</p><p>This pattern goes by different names depending on the provider. Anthropic calls it <a href="https://docs.anthropic.com/en/docs/build-with-claude/tool-use/overview">tool use</a>. OpenAI calls it <a href="https://platform.openai.com/docs/guides/function-calling">function calling</a>. It is the same concept, just different branding.</p><h3>A Concrete Example</h3><p>Let&#8217;s walk through a complete example from start to finish, so this isn&#8217;t abstract anymore.</p><p><strong>Setup.</strong> You are building an app that lets users ask about the weather. You have access to a weather API that returns the current temperature and conditions for a given city name. You define this as a tool:</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;json&quot;,&quot;nodeId&quot;:&quot;c14bda0b-bb5f-4e90-ad71-cde13e975c09&quot;}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-json">tools = [
    {
        "name": "get_weather",
        "description": "Get the current weather for a city",
        "input_schema": {
            "type": "object",
            "properties": {
                "city": {
                    "type": "string",
                    "description": "The name of the city"
                }
            },
            "required": ["city"]
        }
    }
]</code></pre></div><p>That JSON schema describes the tool to the LLM. And you are basically telling it: this tool exists, here is what it does, here are the arguments it expects, and their types. The LLM reads this description the same way it reads any other text in its context, and it uses that understanding to decide when and how to call the tool.</p><p><strong>Conversation.</strong> Now a user asks: &#8220;What&#8217;s the weather in Seattle?&#8221;</p><p>Here is what happens step by step:</p><ol><li><p><strong>User sends message.</strong> &#8220;What&#8217;s the weather in Seattle?&#8221;</p></li><li><p><strong>Your code sends this to the LLM</strong>, along with the tool definitions. The LLM now knows it has a <code>get_weather</code> tool available.</p></li><li><p><strong>The LLM responds with a tool call</strong> instead of regular text. So instead of guessing at the weather (and potentially hallucinating), it outputs something like:</p></li></ol><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;json&quot;,&quot;nodeId&quot;:&quot;f3164a70-0744-44f2-9aee-ff3f8c94f806&quot;}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-json">{
    "type": "tool_use",
    "name": "get_weather",
    "input": { "city": "Seattle" }
}</code></pre></div><ol><li><p><strong>Your code executes the tool.</strong> You take the city name &#8220;Seattle&#8221;, call your weather API, and get back real data:</p></li></ol><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;json&quot;,&quot;nodeId&quot;:&quot;0d877919-74ed-4b6a-a8c7-287187b6ba0e&quot;}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-json">{ "temperature": 58, "condition": "cloudy", "humidity": 72 }</code></pre></div><ol><li><p><strong>Your code sends the result back to the LLM</strong> as a tool result message.</p></li><li><p><strong>The LLM generates its final response</strong>, now grounded in real data: &#8220;It&#8217;s currently 58&#176;F and cloudy in Seattle, with 72% humidity.&#8221;</p></li></ol><p>Here is what that looks like in simplified Python using the <a href="https://platform.claude.com/docs/en/api/sdks/python">Anthropic SDK</a>:</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;python&quot;,&quot;nodeId&quot;:&quot;3408e4c5-0c25-4524-8025-4759b778c04f&quot;}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-python">import anthropic
import requests

client = anthropic.Anthropic()

# The actual function that gets weather data
def get_weather(city):
    response = requests.get(f"https://api.weather.example.com/current?city={city}")
    return response.json()  # e.g. {"temperature": 58, "condition": "cloudy", "humidity": 72}

# The tool definition: tells the LLM what this function does and what arguments it takes
tools = [
    {
        "name": "get_weather",
        "description": "Get the current weather for a city",
        "input_schema": {
            "type": "object",
            "properties": {
                "city": {
                    "type": "string",
                    "description": "The name of the city"
                }
            },
            "required": ["city"]
        }
    }
]

# Step 1: Send the user's message with the tools available
response = client.messages.create(
    model="claude-opus-4-7",
    max_tokens=1024,
    tools=tools,
    messages=[
      {
        "role": "user", 
        "content": "What's the weather in Seattle?"
      }
    ]
)

# Step 2: The LLM responds with a tool call
# response.stop_reason == "tool_use"
# response.content contains a tool_use block:
# {"type": "tool_use", "id": "toolu_abc123", "name": "get_weather", "input": {"city": "Seattle"}}

tool_use_block = next(b for b in response.content if b.type == "tool_use")

# Step 3: YOUR code executes the actual function
weather_data = get_weather(tool_use_block.input["city"])  # calls the real weather API

# Step 4: Send the tool result back to the LLM
follow_up = client.messages.create(
    model="claude-opus-4-7",
    max_tokens=1024,
    tools=tools,
    messages=[
        {"role": "user", "content": "What's the weather in Seattle?"},
        {"role": "assistant", "content": response.content},
        {"role": "user", "content": [
            {
                "type": "tool_result",
                "tool_use_id": tool_use_block.id,
                "content": str(weather_data)
            }
        ]}
    ]
)

# Step 5: The LLM now responds with a grounded answer
print(follow_up.content[0].text)
# "It's currently 58&#176;F and cloudy in Seattle, with 72% humidity."</code></pre></div><p>There are a few things worth noticing here.</p><p>First, the LLM never touched the weather API. It decided <em>what</em> to call and <em>with what arguments</em>, but your code did the actual execution. The LLM itself is sandboxed; so while it can request actions, it cannot take them directly. This is important for safety, as you can control what actually runs, and for flexibility (as you can connect any tool you want, from databases to APIs, file systems, and shell commands).</p><p>Second, the tool description matters. If you describe the tool poorly, the LLM will not know when to use it or how to call it correctly. If you describe it well, the LLM will use it at the right time with the right arguments. Writing good tool descriptions is a real skill, similar to writing good prompts.</p><p>Thirdly, if you look at the message flow, it is a conversation. It starts with the user message, the assistant&#8217;s response (tool call), the tool&#8217;s execution and result, and finally the assistant&#8217;s final response. Like in a regular chat, the LLM is still predicting the next token. However, in this case, one of the possible &#8220;next tokens&#8221; is a structured tool call instead of natural language text. The model learns when to emit tool calls during training, and the tool definitions in context tell it <em>which</em> tools are available for the current conversation.</p><h3>From One Tool Call to Many</h3><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!mBRp!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa4dc6a1d-611f-414e-a4c5-8142099135ab_1200x628.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!mBRp!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa4dc6a1d-611f-414e-a4c5-8142099135ab_1200x628.jpeg 424w, https://substackcdn.com/image/fetch/$s_!mBRp!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa4dc6a1d-611f-414e-a4c5-8142099135ab_1200x628.jpeg 848w, https://substackcdn.com/image/fetch/$s_!mBRp!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa4dc6a1d-611f-414e-a4c5-8142099135ab_1200x628.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!mBRp!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa4dc6a1d-611f-414e-a4c5-8142099135ab_1200x628.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!mBRp!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa4dc6a1d-611f-414e-a4c5-8142099135ab_1200x628.jpeg" width="1200" height="628" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a4dc6a1d-611f-414e-a4c5-8142099135ab_1200x628.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:628,&quot;width&quot;:1200,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:114177,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://notebook.mubbie.dev/i/195695282?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa4dc6a1d-611f-414e-a4c5-8142099135ab_1200x628.jpeg&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!mBRp!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa4dc6a1d-611f-414e-a4c5-8142099135ab_1200x628.jpeg 424w, https://substackcdn.com/image/fetch/$s_!mBRp!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa4dc6a1d-611f-414e-a4c5-8142099135ab_1200x628.jpeg 848w, https://substackcdn.com/image/fetch/$s_!mBRp!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa4dc6a1d-611f-414e-a4c5-8142099135ab_1200x628.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!mBRp!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa4dc6a1d-611f-414e-a4c5-8142099135ab_1200x628.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Image Source: <a href="https://marketoonist.com/">marketoonist</a></em></p><p>Our weather example was a single tool call. And our entire flow was a simple question, with only one function available that produced a single result/answer. Real-world tasks are rarely that simple.</p><p>For instance, we can think about what happens when someone asks a coding agent to &#8220;find all the TODO comments in a project and make a checklist.&#8221; A request like this requires multiple steps. We could say:</p><ol><li><p>List the files in the project directory</p></li><li><p>Read each file and search for TODO comments</p></li><li><p>Collect all the results</p></li><li><p>Format them into a checklist</p></li></ol><p>Each step will have a separate tool call. The LLM could call <code>list_files</code> to get a list of filenames. After that, it calls <code>read_file</code> on each of them, reads the contents, finds and extracts the TODOs, and then synthesizes everything into a response. Each tool result becomes the context for the next decision.</p><p>Another approach could be for the LLM to call a <code>grep</code> tool to search for lines containing the text &#8220;TODO&#8221;, &#8220;todo&#8221;, &#8220;to do&#8221;, etc. And then it could call a <code>read_lines</code> tool to read the lines around the todo pattern, find details about each todo, and synthesize the output into a response.</p><p>Or let&#8217;s consider another task that we referenced earlier (a much harder one): &#8220;fix the failing test in <code>test_auth.py</code>.&#8221; The steps could look like:</p><ol><li><p>Read <code>test_auth.py</code> to see what test is failing.</p></li><li><p>Run the test to see the actual error message.</p></li><li><p>Read the source file that the test is testing.</p></li><li><p>Edit the source file to fix the bug.</p></li><li><p>Run the test again.</p></li><li><p>If it fails again, read the error, edit again, run again.</p></li><li><p>If it passes, report success.</p></li></ol><p>That is seven or more tool calls, with the LLM deciding on each step based on the results of the previous step. And at step 6, the key insight is that the LLM can <em>fail, see the failure, and try again.</em> This way, it is not just executing in a fixed sequence. Instead, it adapts and takes action based on feedback.</p><p>This is how tool calling becomes a <strong>loop.</strong> The LLM calls a tool, observes the result, decides what to do next, then calls another tool, observes the result, and keeps going. The conversation history grows with each step, and the LLM continues to use that full history to make each subsequent decision.</p><p>This loop is what turns an LLM from a chatbot into an agent.</p><div><hr></div><h2>Act 3: The Agent Loop</h2><h3>The Core Concept</h3><p>At the end of Act 2, we saw how multiple tool calls naturally chain together. The LLM, as we described, calls a tool, gets a result, uses the result to decide what to do next, such as calling another tool, and so on. That chain is the agent loop, and implementing it is interestingly simple.</p><p>Here&#8217;s what it could look like in pseudocode:</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;python&quot;,&quot;nodeId&quot;:&quot;d9ed8263-fca3-42be-a959-7b000a739967&quot;}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-python">while not done:
  1. Send the conversation history to the LLM
  2. The LLM responds with either:
    a. Text (it is done, or it wants to say something)
    b. A tool call (it wants to do something)
  3. If tool call:
    a. Execute the tool
    b. Add the result to the conversation
    c. Go back to step 1
  4. If text, we are done</code></pre></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!IAMa!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2d92f1f7-469a-4675-b483-2f78cb7720c3_740x265.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!IAMa!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2d92f1f7-469a-4675-b483-2f78cb7720c3_740x265.png 424w, https://substackcdn.com/image/fetch/$s_!IAMa!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2d92f1f7-469a-4675-b483-2f78cb7720c3_740x265.png 848w, https://substackcdn.com/image/fetch/$s_!IAMa!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2d92f1f7-469a-4675-b483-2f78cb7720c3_740x265.png 1272w, https://substackcdn.com/image/fetch/$s_!IAMa!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2d92f1f7-469a-4675-b483-2f78cb7720c3_740x265.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!IAMa!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2d92f1f7-469a-4675-b483-2f78cb7720c3_740x265.png" width="740" height="265" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/2d92f1f7-469a-4675-b483-2f78cb7720c3_740x265.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:265,&quot;width&quot;:740,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:40043,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://notebook.mubbie.dev/i/195695282?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2d92f1f7-469a-4675-b483-2f78cb7720c3_740x265.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!IAMa!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2d92f1f7-469a-4675-b483-2f78cb7720c3_740x265.png 424w, https://substackcdn.com/image/fetch/$s_!IAMa!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2d92f1f7-469a-4675-b483-2f78cb7720c3_740x265.png 848w, https://substackcdn.com/image/fetch/$s_!IAMa!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2d92f1f7-469a-4675-b483-2f78cb7720c3_740x265.png 1272w, https://substackcdn.com/image/fetch/$s_!IAMa!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2d92f1f7-469a-4675-b483-2f78cb7720c3_740x265.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Image Source: <a href="https://xkcd.com/">XKCD</a></em></p><p>Given that agent architecture, we can now do a rough implementation in Python:</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;python&quot;,&quot;nodeId&quot;:&quot;9d183fe0-cbba-474f-a57d-d5f109d825dd&quot;}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-python">import anthropic

client = anthropic.Anthropic()

def agent_loop(user_message, system_prompt, tools):
    messages = [{"role": "user", "content": user_message}]

    while True:
        response = client.messages.create(
            model="claude-opus-4-7",
            max_tokens=4096,
            system=system_prompt,
            tools=tools,
            messages=messages
        )

        # Add the assistant's response to the conversation history
        messages.append({"role": "assistant", "content": response.content})

        # If the model is done talking, return the final text
        if response.stop_reason == "end_turn":
            return response.content[0].text

        # If the model wants to use a tool, execute it
        if response.stop_reason == "tool_use":
            tool_results = []
            for block in response.content:
                if block.type == "tool_use":
                    result = execute_tool(block.name, block.input)
                    tool_results.append({
                        "type": "tool_result",
                        "tool_use_id": block.id,
                        "content": result
                    })

            # Add tool results to the conversation and loop back
            messages.append({"role": "user", "content": tool_results})</code></pre></div><p>While running, our agent loop continues until the LLM decides it is done and responds with text instead of a tool call. The underlying logic itself makes it very simple and accessible to have an agent up and running. After that, we can naturally layer additional logic and complexity, such as parallelism and multi-agent workflows, on top of the agent loop to make it more sophisticated.</p><p><a href="https://ampcode.com/notes/how-to-build-an-agent">Thorsten Ball</a>, who works on <a href="https://ampcode.com/">Ampcode</a> (a coding agent), in describing this logic, wrote, &#8220;It&#8217;s an LLM, a loop, and enough tokens. The rest is elbow grease.&#8221; <a href="https://www.mihaileric.com/The-Emperor-Has-No-Clothes/">Mihail Eric</a> demonstrated this by building a working Claude Code clone in roughly 200 lines of Python with a loop, some tool definitions, and API calls. Similarly, the <a href="https://platform.claude.com/docs/en/agents-and-tools/tool-use/build-a-tool-using-agent">Anthropic guide on building agents</a> describes this same pattern.</p><p>I must confess that, when I started learning about this, I was surprised to find that there is no special &#8220;agent mode&#8221; in the model. Realizing that helped me feel confident that I can utilize AI to build sophisticated workflows. And honestly, almost anybody could, too.</p><h3>Why the Loop Works</h3><p>You might be wondering now, if the LLM is predicting the next token, how does a simple loop produce behavior that looks so intelligent? To answer that, we can look at three properties of LLMs that enable this.</p><p><strong>First, LLMs are good at deciding what to do next.</strong> After each tool call, the LLM receives a full conversation history that includes the original goal, every tool call it has made so far, and every result it has gotten back. Given all of that context, next-token prediction naturally tends towards the next useful action. Even though it could help, the model typically does not need a formal plan to predict what a helpful coding (or any) assistant would do next, given everything that has happened so far. And those predictions often turn out to be the right thing.</p><p><strong>Second, LLMs can recover from errors.</strong> This is the part that makes agents feel genuinely useful. If a tool call fails (e.g., a file is not found, a test fails, a command returns an error, etc.), the error message is returned to the conversation. The LLM sees the error and can try a different approach. For instance, maybe it got the file path wrong, so it lists the directory first and shows the correct name. Maybe the code fix did not work; it can read the error message more carefully and try a different edit. This is the feedback loop in action, and it is why agents can handle tasks that are not straightforward. We can think of it as the <a href="https://huggingface.co/learn/agents-course/unit1/agent-steps-and-structure">&#8220;Think, Act, Observe&#8221;</a> cycle: the agent allows the LLM to predict, execute, read the results, and predict again.</p><p>An interesting story that illustrates this comes from <a href="https://steipete.me/">Peter Steinberger</a>, the creator of <a href="https://openclaw.ai/">OpenClaw</a>. He had built a text-based travel agent to help him navigate a city, find restaurants, and translate text. He accidentally sent a voice message, even though he had never built in voice support. To his surprise, the agent responded in a few seconds. What happened was the agent recognized the audio input, searched the local machine for <a href="https://ffmpeg.org/">FFMPEG</a> to convert the audio format, found an OpenAI API key, made a voice-to-text API call, and then responded to the transcribed message. Nobody programmed that workflow. The agent improvised it from the tools available to it. You can read about this <a href="https://www.businessinsider.com/openclaw-creator-moment-ai-changed-everything-2026-4">here</a>, or hear Peter Steinberger talk about it on <a href="https://www.youtube.com/watch?v=7rzYDM6vMtI">TED</a>.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!wom8!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc75c201c-c3ec-4858-ba1c-3517c6f8204c_1200x628.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!wom8!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc75c201c-c3ec-4858-ba1c-3517c6f8204c_1200x628.jpeg 424w, https://substackcdn.com/image/fetch/$s_!wom8!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc75c201c-c3ec-4858-ba1c-3517c6f8204c_1200x628.jpeg 848w, https://substackcdn.com/image/fetch/$s_!wom8!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc75c201c-c3ec-4858-ba1c-3517c6f8204c_1200x628.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!wom8!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc75c201c-c3ec-4858-ba1c-3517c6f8204c_1200x628.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!wom8!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc75c201c-c3ec-4858-ba1c-3517c6f8204c_1200x628.jpeg" width="1200" height="628" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/c75c201c-c3ec-4858-ba1c-3517c6f8204c_1200x628.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:628,&quot;width&quot;:1200,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:105586,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://notebook.mubbie.dev/i/195695282?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc75c201c-c3ec-4858-ba1c-3517c6f8204c_1200x628.jpeg&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!wom8!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc75c201c-c3ec-4858-ba1c-3517c6f8204c_1200x628.jpeg 424w, https://substackcdn.com/image/fetch/$s_!wom8!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc75c201c-c3ec-4858-ba1c-3517c6f8204c_1200x628.jpeg 848w, https://substackcdn.com/image/fetch/$s_!wom8!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc75c201c-c3ec-4858-ba1c-3517c6f8204c_1200x628.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!wom8!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc75c201c-c3ec-4858-ba1c-3517c6f8204c_1200x628.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Image Source: <a href="https://marketoonist.com/">marketoonist</a></em></p><p><strong>Third, the context window holds everything together.</strong> The entire conversation history (user messages, tool calls, tool results, the model&#8217;s own reasoning) stays in the context window. The LLM can look back at anything. It can see what the user originally asked, what it has tried, what worked, and what did not. This is why context window size matters so much for agents. A longer context window means the agent can take more steps before it runs out of space to remember what it has done. This is also directly connected to what we covered in <a href="https://notebook.mubbie.dev/p/chatgpt-doesnt-think-it-pays-attention">Part 1</a> about attention. The model attends to the full context at every step, meaning that token 1 (the user&#8217;s original request) is just as accessible as the most recent tool result.</p><p>One more thing worth connecting back to Part 1. Remember <a href="https://notebook.mubbie.dev/p/chatgpt-doesnt-think-it-pays-attention">chain-of-thought prompting and reasoning models</a>? Those techniques make agents significantly better. When an LLM can &#8220;think&#8221; through what to do next (by generating reasoning tokens before committing to a tool call), it makes fewer mistakes and picks better actions. Extended thinking essentially gives the model scratch paper before each decision in the loop.</p><h4>A Note on Context Windows</h4><p>A question might be looming in your mind about what happens when we start to hit the agent&#8217;s context window limit. It is a fair question, because if the agent loop keeps appending tool calls and results to the conversation history, that history will grow with every iteration. And every iteration, the entire history gets sent back to the LLM.</p><p>Modern models have large context windows. <a href="https://docs.anthropic.com/en/docs/build-with-claude/context-windows">Claude</a> supports up to 1M tokens. <a href="https://ai.google.dev/gemini-api/docs/long-context">Gemini</a> also goes up to 1 million (and has experimented with even more). <a href="https://developers.openai.com/api/docs/models/gpt-5.5">GPT-5.5</a> reaches 1,050,000 tokens. These are big numbers. To put things in perspective, 200,000 tokens is roughly 150,000 words, or about the length of two full novels. So, for most tasks, you won't run out of space.</p><p>That said, big does not mean unlimited, and there are real problems that surface well before we actually hit the limit.</p><p><strong>The first problem is cost.</strong> LLM APIs charge per token, both input and output. Every time the agent loops, it sends the <em>entire</em> conversation history as input. So if your conversation is 50,000 tokens long and the agent makes 10 more tool calls, you are paying for 50,000+ input tokens on every single call. The cost grows quadratically with the task's length. Hence, long agent sessions can get expensive fast.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!5Ruz!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa867a0ff-a0ba-428f-9426-14406417f0f3_1200x628.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!5Ruz!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa867a0ff-a0ba-428f-9426-14406417f0f3_1200x628.jpeg 424w, https://substackcdn.com/image/fetch/$s_!5Ruz!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa867a0ff-a0ba-428f-9426-14406417f0f3_1200x628.jpeg 848w, https://substackcdn.com/image/fetch/$s_!5Ruz!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa867a0ff-a0ba-428f-9426-14406417f0f3_1200x628.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!5Ruz!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa867a0ff-a0ba-428f-9426-14406417f0f3_1200x628.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!5Ruz!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa867a0ff-a0ba-428f-9426-14406417f0f3_1200x628.jpeg" width="1200" height="628" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a867a0ff-a0ba-428f-9426-14406417f0f3_1200x628.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:628,&quot;width&quot;:1200,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:82077,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://notebook.mubbie.dev/i/195695282?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa867a0ff-a0ba-428f-9426-14406417f0f3_1200x628.jpeg&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!5Ruz!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa867a0ff-a0ba-428f-9426-14406417f0f3_1200x628.jpeg 424w, https://substackcdn.com/image/fetch/$s_!5Ruz!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa867a0ff-a0ba-428f-9426-14406417f0f3_1200x628.jpeg 848w, https://substackcdn.com/image/fetch/$s_!5Ruz!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa867a0ff-a0ba-428f-9426-14406417f0f3_1200x628.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!5Ruz!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa867a0ff-a0ba-428f-9426-14406417f0f3_1200x628.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Image Source: <a href="https://marketoonist.com/">marketoonist</a></em></p><p><strong>The second problem is latency.</strong> More input tokens mean more time for the model to process the request. An agent call with 5,000 tokens of context is fast. An agent call with 100,000 tokens of context is noticeably slower. For interactive coding agents where you are watching the agent work in real time, this slowdown can become very visible.</p><p><strong>The third problem, and honestly, the most interesting one, is attention quality.</strong> Remember from <a href="https://notebook.mubbie.dev/p/chatgpt-doesnt-think-it-pays-attention">Part 1</a> that attention determines which information is relevant. In theory, self-attention gives every token equal access to every other token. In practice, however, research has shown that LLMs tend to pay more attention to information at the beginning and end of the context window, and less to information in the middle. This is sometimes called the &#8220;<a href="https://arxiv.org/abs/2307.03172">lost in the middle</a>&#8221; problem (Liu et al., 2023). So if a critical piece of information (like the original error message that the agent is trying to fix) ends up buried in the middle of a 100,000-token conversation, the model might not attend to it as strongly as it should. The information is technically <em>there</em>, but the model might not make good use of it.</p><p>So how do production agents handle this? There are a few approaches.</p><p><strong>Compaction</strong> (sometimes called summarization) is the most common technique. When the conversation gets too long, the agent pauses and asks the LLM to summarize the conversation so far into a shorter version. The summary replaces the older parts of the conversation, freeing up space while (hopefully) preserving the important details. <a href="https://docs.anthropic.com/en/docs/build-with-claude/compaction">Anthropic&#8217;s API</a>, and generally almost all LLM providers, support this directly. But the trade-off is obvious, since summaries are lossy. The LLM has to decide what is important to keep and what to throw away, and it does not always get that right. A subtle detail from 30 tool calls ago might turn out to be exactly what the agent needs later, but if it got summarized away, it is gone.</p><p><strong>Selective context</strong> is another approach. Instead of keeping the entire conversation history, the agent includes only the parts relevant to the current step. For a coding agent, that might mean: always include the original user request, always include the most recent few tool calls, and only include file contents when they are actively being worked on. This keeps the context focused and small, but it requires careful engineering to decide what to include and what to leave out.</p><p><strong>Caching</strong> specifically helps with the cost problem. If the first 80% of your conversation is the same across consecutive calls (which it is, since you only append new messages at the end), you do not need to reprocess it. Techniques like <a href="https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching">prompt </a>and&nbsp;<a href="https://medium.com/@joaolages/kv-caching-explained-276520203249">KV caching</a>&nbsp;(which we briefly mentioned in Part 1) allow the model to reuse computations from previous calls rather than reprocess the entire history from scratch each time.</p><p>The bottom line is that context windows are large enough for most tasks, and getting larger all the time. The real constraint, though, is not just the hard limit. It is also the cost, speed, and attention-quality trade-offs that come with filling the context window. The best agents are smart about what they put in the context and how they manage it over long sessions.</p><h3>What Agents Are NOT</h3><p>This is the part where I want to be honest, because there is a lot of hype around agents, and I think it is important to be clear about what they actually are right now.</p><p><strong>Agents are not autonomous AI.</strong> The word &#8220;autonomous&#8221; is used a lot in marketing, but current agents lack goals, desires, and self-awareness. They run a loop until the loop ends. They do not decide to start working on their own. A human initiates the task, and the agent runs until it finishes, gets stuck, or hits a budget limit. That is not autonomy in any meaningful sense.</p><p><strong>Agents are not reliable.</strong> This is the big one. Agents can and do get stuck in loops, trying the same failing approach over and over. They hallucinate tool arguments (such as calling <code>read_file</code> with a path that does not exist). They make confident but wrong decisions (they could edit the wrong file, or &#8220;fix&#8221; a bug by deleting the test that caught it). They sometimes do something completely unrelated to what you asked. Every person I know who uses coding agents has had stories of an agent going off the rails. They are powerful tools, but they still require supervision. The amount of supervision could be reduced over time, but we are not there yet. But who knows, <a href="https://www.deepseek.com/en/">DeepSeek</a> could drop a new model tomorrow that changes everything.</p><p><strong>Agents are not magic.</strong> This is the &#8220;<a href="https://www.mihaileric.com/The-Emperor-Has-No-Clothes/">emperor has no clothes</a>&#8221; observation from <a href="https://x.com/mihail_eric">Mihail Eric</a>, and it is the central theme of this post. The core architecture of every AI agent, from the simplest scripts to products like Claude Code and Cursor, is a while loop with an LLM and some tools. The complexity in production agents is not in the architecture. It is in the engineering: error handling, safety guardrails, context management, prompt tuning, and UX polish. The core is genuinely simple.</p><p><strong>Agents are not free.</strong> Each iteration of the loop is an LLM API call, and each one costs money. A simple task might take 3-5 tool calls. A complex task (like refactoring a module and updating all its tests) might take 30, 50, or more. The token usage adds up quickly, and this is before you count the growing context window that gets sent with every call. This is why production agents have budget limits and stop conditions. Without them, a confused agent could burn through a lot of tokens going in circles.</p><h3>Types of Agents</h3><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Kd4Z!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fad2db7f3-db90-4129-956a-6e1448c4deb3_1200x628.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Kd4Z!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fad2db7f3-db90-4129-956a-6e1448c4deb3_1200x628.jpeg 424w, https://substackcdn.com/image/fetch/$s_!Kd4Z!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fad2db7f3-db90-4129-956a-6e1448c4deb3_1200x628.jpeg 848w, https://substackcdn.com/image/fetch/$s_!Kd4Z!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fad2db7f3-db90-4129-956a-6e1448c4deb3_1200x628.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!Kd4Z!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fad2db7f3-db90-4129-956a-6e1448c4deb3_1200x628.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Kd4Z!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fad2db7f3-db90-4129-956a-6e1448c4deb3_1200x628.jpeg" width="1200" height="628" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/ad2db7f3-db90-4129-956a-6e1448c4deb3_1200x628.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:628,&quot;width&quot;:1200,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:88725,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://notebook.mubbie.dev/i/195695282?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fad2db7f3-db90-4129-956a-6e1448c4deb3_1200x628.jpeg&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Kd4Z!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fad2db7f3-db90-4129-956a-6e1448c4deb3_1200x628.jpeg 424w, https://substackcdn.com/image/fetch/$s_!Kd4Z!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fad2db7f3-db90-4129-956a-6e1448c4deb3_1200x628.jpeg 848w, https://substackcdn.com/image/fetch/$s_!Kd4Z!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fad2db7f3-db90-4129-956a-6e1448c4deb3_1200x628.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!Kd4Z!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fad2db7f3-db90-4129-956a-6e1448c4deb3_1200x628.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Image Source: <a href="https://marketoonist.com/">marketoonist</a></em></p><p>I do not want to spend too long on taxonomy because it can get academic fast, but it is helpful to know the main categories people are talking about when they say &#8220;agent.&#8221;</p><p><strong>Retriever agents</strong> search through documents, summarize what they find, and cite sources. Think of research assistants or tools that answer questions from a company&#8217;s internal documentation. These are sometimes implemented using <a href="https://www.ibm.com/think/topics/retrieval-augmented-generation">RAG</a> (Retrieval-Augmented Generation).</p><p><strong>Workflow agents</strong> perform multi-step tasks using APIs. This could include booking a flight, processing a form, ordering food, purchasing groceries, pulling data from multiple sources, and generating a report. The tools here are usually API calls to external services.</p><p><strong>Coding agents</strong> read files, edit code, run tests, and iterate until things work. This is what <a href="https://docs.anthropic.com/en/docs/claude-code">Claude Code</a>, <a href="https://www.cursor.com/">Cursor</a>, <a href="https://openai.com/codex/">OpenAI&#8217;s Codex</a>, <a href="https://ampcode.com/">Amp</a>, and <a href="https://aider.chat/">Aider</a> are. We will go deep on these in Act 4.</p><p><strong>Multi-agent systems</strong> use multiple LLMs/agents coordinating together. One agent writes code, another reviews it, a third runs tests. Or a &#8220;manager&#8221; agent delegates tasks to specialized sub-agents. These are more experimental and more complex, but the building block is still the same (an LLM in a loop with tools).</p><p>If you want the textbook taxonomy (reflex agents, goal-based agents, utility-based agents, learning agents), <a href="https://www.ibm.com/think/topics/ai-agent-types">IBM has a good overview</a>. <a href="https://www.databricks.com/blog/types-ai-agents-definitions-roles-and-examples">Databricks</a> also has a practical breakdown. But for the purposes of this post, we are going to focus on <strong>coding agents</strong>, because that is where the &#8220;it&#8217;s just a loop&#8221; insight is most visible and most useful.</p><p>Let&#8217;s build one.</p><div><hr></div><h2>Act 4: Coding Harnesses</h2><h3>What Is a Coding Harness?</h3><p>Now that we understand the agent loop, let&#8217;s look at a specific, practical application: <strong>coding agents</strong>.</p><p>A coding harness (sometimes called a coding agent) is just the agent loop from Act 3 with tools designed for software development. Instead of <code>get_weather</code>, the tools are things like <code>read_file</code>, <code>edit_file</code>, and <code>run_command</code>. The LLM reads your code, decides what to change, makes the change, and checks if it worked.</p><p>This is what powers the popular coding agents like Codex, Amp, OpenCode, Cline, etc. When you use any of these tools, and it feels like the AI is &#8220;understanding&#8221; your codebase and making intelligent changes, what is actually happening is the loop we just described. The LLM reads files (tool call), thinks about what to do (next-token prediction), edits code (tool call), runs tests (tool call), sees if they pass (reads the result), and keeps going until it is done.</p><p>As we mentioned earlier, <a href="https://ampcode.com/notes/how-to-build-an-agent">Thorsten Ball</a> from Amp described this process as an LLM, a loop, and enough tokens. According to him, the rest is elbow grease. It turns out the &#8220;elbow grease&#8221; is quite significant (we will get to that), but the architecture underneath all of these products is the same simple loop.</p><h3>The Minimal Tool Set</h3><p>So what tools does our coding agent actually need? Honestly, not many. Learning that surprised me, too.</p><p><a href="https://www.mihaileric.com/The-Emperor-Has-No-Clothes/">Mihail Eric</a> built a working Claude Code clone with just <strong>three tools</strong>:</p><ol><li><p><code>read_file(path)</code> &#8212; read the contents of a file</p></li><li><p><code>list_files(directory)</code> &#8212; list files in a directory</p></li><li><p><code>edit_file(path, old_text, new_text)</code> &#8212; find a piece of text in a file and replace it with something else</p></li></ol><p>With just these, the LLM can navigate a codebase to see what is there (<code>list_files</code> tool), understand the code by inspecting the files (<code>read_file</code> tool), and make changes to the code (<code>edit_file</code> tool). These three operations cover a surprisingly large range of coding tasks. In fact, if we want to push things to the extreme, we could get away with just giving the agent one tool, a <code>bash</code> tool that allows it access to a shell (even a pseudo/simulated shell would do), and use shell commands to see the files, read the code, and make edits. We won&#8217;t be going to that extreme in our example, but you get the idea.</p><p>Here is what the implementations of those tools could look like:</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;python&quot;,&quot;nodeId&quot;:&quot;83bcb883-75f6-4214-be2d-4caa2eeed56d&quot;}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-python">import os

def read_file(path):
    with open(path, 'r', encoding='utf-8') as f:
        return f.read()

def list_files(directory):
    entries = []
    for name in os.listdir(directory):
        full = os.path.join(directory, name)
        entries.append(f"{'[DIR] ' if os.path.isdir(full) else ''}{name}")
    return "\n".join(entries)

def edit_file(path, old_text, new_text):
    content = read_file(path)
    if old_text not in content:
        return f"Error: could not find the specified text in {path}"
    updated = content.replace(old_text, new_text, 1)
    with open(path, 'w', encoding='utf-8') as f:
        f.write(updated)
    return f"Successfully edited {path}"</code></pre></div><p>Looking at how simple those functions are, it becomes immediately obvious that the intelligence is not in the tools. It is in the LLM deciding <em>which</em> tool to call, <em>when</em> to call it, and <em>with what arguments</em>. The tools are hands. The LLM is the brain telling the hands what to do.</p><p>Production agents add more tools on top of these. The most common additions are:</p><ul><li><p><code>run_command(command)</code> &#8212; execute a shell command (run tests, install packages, compile code, check git status, etc.)</p></li><li><p><code>search(pattern)</code> &#8212; search across files using something like grep or <a href="https://github.com/BurntSushi/ripgrep">ripgrep</a></p></li><li><p><code>create_file(path, content)</code> &#8212; create a new file from scratch</p></li><li><p><code>delete_file(path)</code> &#8212; remove a file</p></li></ul><p>That said, the core insight that you do not need many tools still holds. As we established, three (or even one) gets you surprisingly far. Everything else is optimization.</p><h3>Building a Coding Agent from Scratch</h3><p>Let&#8217;s put it all together and build a minimal but functional coding agent. We need three things: a system prompt, tool definitions, and the agent loop.</p><h4>The System Prompt</h4><p>The system prompt tells the LLM what it is and how it should behave. For a coding agent, we want to tell it to read files before editing them and to verify its changes:</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;python&quot;,&quot;nodeId&quot;:&quot;02d91f86-13b9-4aff-8cab-1998a318052a&quot;}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-python">system_prompt = """You are a coding assistant. You help users with their codebase
by reading, understanding, and editing files.

Rules:
- Always read a file before editing it so you understand the current state
- After making an edit, read the file again to verify your change was applied correctly
- If something goes wrong, try a different approach
- Explain what you are doing and why"""</code></pre></div><h4>The Tool Definitions</h4><p>These are the JSON schemas that tell the LLM what tools are available. Same format we saw in Act 2 with the weather example:</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;json&quot;,&quot;nodeId&quot;:&quot;caf985b1-df5b-46b0-87ae-b95a780550ee&quot;}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-json">tools = [
    {
        "name": "read_file",
        "description": "Read the contents of a file at the given path",
        "input_schema": {
            "type": "object",
            "properties": {
                "path": {
                    "type": "string",
                    "description": "The path to the file to read"
                }
            },
            "required": ["path"]
        }
    },
    {
        "name": "list_files",
        "description": "List all files and directories at the given path",
        "input_schema": {
            "type": "object",
            "properties": {
                "directory": {
                    "type": "string",
                    "description": "The directory path to list"
                }
            },
            "required": ["directory"]
        }
    },
    {
        "name": "edit_file",
        "description": "Edit a file by replacing old_text with new_text. The old_text must match exactly.",
        "input_schema": {
            "type": "object",
            "properties": {
                "path": {
                    "type": "string",
                    "description": "The path to the file to edit"
                },
                "old_text": {
                    "type": "string",
                    "description": "The exact text to find in the file"
                },
                "new_text": {
                    "type": "string",
                    "description": "The text to replace it with"
                }
            },
            "required": ["path", "old_text", "new_text"]
        }
    }
]</code></pre></div><h4>The Agent Loop</h4><p>Now we wire it all together. This is the same loop from Act 3, but with the actual tool execution connected:</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;python&quot;,&quot;nodeId&quot;:&quot;17d45066-a93c-4d1d-acc0-0fb567e6f6fd&quot;}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-python">import anthropic

client = anthropic.Anthropic()

def execute_tool(name, args):
    if name == "read_file":
        return read_file(args["path"])
    elif name == "list_files":
        return list_files(args["directory"])
    elif name == "edit_file":
        return edit_file(args["path"], args["old_text"], args["new_text"])
    else:
        return f"Unknown tool: {name}"

def run_agent(user_message):
    messages = [{"role": "user", "content": user_message}]

    while True:
        response = client.messages.create(
            model="claude-opus-4-7",
            max_tokens=4096,
            system=system_prompt,
            tools=tools,
            messages=messages
        )

        messages.append({"role": "assistant", "content": response.content})

        if response.stop_reason == "end_turn":
            # Extract and return the final text
            for block in response.content:
                if hasattr(block, "text"):
                    return block.text
            return "Done."

        if response.stop_reason == "tool_use":
            tool_results = []
            for block in response.content:
                if block.type == "tool_use":
                    print(f"  &#8594; Tool call: {block.name}({block.input})")
                    result = execute_tool(block.name, block.input)
                    print(f"  &#8592; Result: {result[:200]}...")
                    tool_results.append({
                        "type": "tool_result",
                        "tool_use_id": block.id,
                        "content": str(result)
                    })

            messages.append({"role": "user", "content": tool_results})

# Run it
print(run_agent("Add a docstring to the main function in app.py"))</code></pre></div><p>That is your entire coding agent in roughly 80 lines of Python. From here, you can embellish it, but this is roughly the starting point that Cursor, for instance, begins.</p><h3>A Real Walkthrough: &#8220;Add a Docstring&#8221;</h3><p>Let&#8217;s see what happens when we actually run this agent. Say you have a file called, <code>app.py,</code> that looks like this:</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;python&quot;,&quot;nodeId&quot;:&quot;d9dc32fe-dbe6-4398-a30e-468a32534a58&quot;}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-python">import sys

def main():
    print("Hello, world!")
    return 0

if __name__ == "__main__":
    sys.exit(main())</code></pre></div><p>You ask the agent: &#8220;Add a docstring to the main function in app.py.&#8221;</p><p>Here is what happens, step by step:</p><p><strong>Step 1.</strong> The LLM receives your message and the tool definitions. It thinks: &#8220;I need to see the current code first before I can edit it.&#8221;</p><p><strong>Step 2.</strong> The LLM outputs a tool call: <code>read_file(path="app.py")</code>. Your code executes it, reads the file, and sends the contents back to the LLM.</p><p><strong>Step 3.</strong> The LLM now sees the code. It identifies the <code>main</code> function and sees that it has no docstring. It decides to add one.</p><p><strong>Step 4.</strong> The LLM outputs a tool call: <code>edit_file(path="app.py", old_text="def main():\n print(\"Hello, world!\")", new_text="def main():\n \"\"\"Entry point for the application.\"\"\"\n print(\"Hello, world!\")")</code>. Your code executes the find-and-replace.</p><p><strong>Step 5.</strong> The LLM wants to verify the change, so it outputs another tool call: <code>read_file(path="app.py")</code>. Your code reads the file again and sends it back.</p><p><strong>Step 6.</strong> The LLM sees the updated file with the docstring in place. Everything looks correct.</p><p><strong>Step 7.</strong> The LLM responds with text: &#8220;Done. I added a docstring to the <code>main</code> function in app.py.&#8221;</p><h4>A Harder Example: Fix a Failing Test</h4><p>Now consider a more complex task: &#8220;Fix the failing test in test_auth.py.&#8221; (We keep coming back to this one, haha)</p><p>The trace might look something like this:</p><ol><li><p><code>read_file("test_auth.py")</code> &#8594; sees the test code, identifies the failing test</p></li><li><p><code>run_command("python -m pytest test_auth.py -x")</code> &#8594; sees the error: <code>AssertionError: expected 200 but got 401</code></p></li><li><p><code>read_file("auth.py")</code> &#8594; reads the source code being tested</p></li><li><p><code>edit_file("auth.py", ...)</code> &#8594; fixes the bug in the authentication logic</p></li><li><p><code>run_command("python -m pytest test_auth.py -x")</code> &#8594; tests still fail with a different error</p></li><li><p><code>read_file("auth.py")</code> &#8594; re-reads the file to understand the new error</p></li><li><p><code>edit_file("auth.py", ...)</code> &#8594; tries a different fix</p></li><li><p><code>run_command("python -m pytest test_auth.py -x")</code> &#8594; all tests pass</p></li><li><p>Responds: &#8220;Fixed. The issue was&#8230;&#8221;</p></li></ol><p>Notice that in step 5, the fix did not work. The agent saw the failure, read the error, and tried again. This is the feedback loop that we referenced in Act 3. We see the agent adapting based on what happens at each step. This ability to recover from failure is exactly what makes agents feel very powerful.</p><p>This example also uses <code>run_command</code>, which our minimal three-tool agent does not have. Adding it is straightforward:</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;python&quot;,&quot;nodeId&quot;:&quot;a4720b81-b4df-42db-a89c-a5fe577ebff6&quot;}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-python">import subprocess

def run_command(command):
    result = subprocess.run(
        command, shell=True, capture_output=True, text=True, timeout=30
    )
    output = result.stdout + result.stderr
    return output[:10000]  # truncate long outputs to avoid filling up the context</code></pre></div><p>With these four tools (read, list, edit, run), you can handle the majority of real coding tasks.</p><h3>What Production Agents Add on Top</h3><p>Our toy agent works. You could use it right now for simple tasks. But if you compare the experience to using Claude Code or Cursor, you&#8217;ll notice a significant gap. Production agents add a lot of engineering on top of the core loop. Here are some of the things that separate a weekend project like this from a real product.</p><p><strong>Better tools.</strong> Production agents have more than our four basic tools. They include things like <a href="https://github.com/BurntSushi/ripgrep">ripgrep</a> for fast code search, git operations (diff, commit, checkout, etc.), <a href="https://microsoft.github.io/language-server-protocol/">LSP integration</a> for type checking and go-to-definition, and browser tools for looking up documentation. More tools means the agent can handle more situations without getting stuck.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!XZcF!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F782f517d-41de-48dc-b306-86514600d57e_1200x873.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!XZcF!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F782f517d-41de-48dc-b306-86514600d57e_1200x873.jpeg 424w, https://substackcdn.com/image/fetch/$s_!XZcF!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F782f517d-41de-48dc-b306-86514600d57e_1200x873.jpeg 848w, https://substackcdn.com/image/fetch/$s_!XZcF!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F782f517d-41de-48dc-b306-86514600d57e_1200x873.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!XZcF!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F782f517d-41de-48dc-b306-86514600d57e_1200x873.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!XZcF!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F782f517d-41de-48dc-b306-86514600d57e_1200x873.jpeg" width="1200" height="873" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/782f517d-41de-48dc-b306-86514600d57e_1200x873.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:873,&quot;width&quot;:1200,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:116840,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://notebook.mubbie.dev/i/195695282?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F782f517d-41de-48dc-b306-86514600d57e_1200x873.jpeg&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!XZcF!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F782f517d-41de-48dc-b306-86514600d57e_1200x873.jpeg 424w, https://substackcdn.com/image/fetch/$s_!XZcF!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F782f517d-41de-48dc-b306-86514600d57e_1200x873.jpeg 848w, https://substackcdn.com/image/fetch/$s_!XZcF!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F782f517d-41de-48dc-b306-86514600d57e_1200x873.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!XZcF!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F782f517d-41de-48dc-b306-86514600d57e_1200x873.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Image Source: <a href="https://marketoonist.com/">marketoonist</a></em></p><p><strong>Safety and permissions.</strong> This is critical. Our toy agent will happily run <code>rm -rf /</code> if the LLM decides to. Production agents have permission systems that ask for confirmation before running destructive commands, sandboxing that limits what the agent can access, allowlisted commands, and cost limits that stop the agent after a certain number of API calls. <a href="https://code.claude.com/docs/en/permissions#permission-system">Claude Code&#8217;s permission system</a>, for example, distinguishes between read-only operations (auto-approved) and write operations (require confirmation, unless you explicitly configure otherwise).</p><p><strong>Context management.</strong> As we discussed in the context window section, long agent sessions fill up the context. Production agents use compaction, selective context inclusion, and caching to keep things manageable. They might summarize older parts of the conversation, only include file contents that are actively relevant, and cache previous computations to reduce cost and latency.</p><p><strong>System prompts.</strong> Our system prompt was four lines. Production system prompts are long and carefully tuned. They include detailed instructions about coding style, error handling, when to ask for clarification versus when to proceed, safety rules, and much more. The quality of the system prompt has a huge impact on how useful the agent feels.</p><p><strong>Streaming and UX.</strong> When you watch Codex or Cursor work, you see what the agent is doing in real time. This includes which file it is reading, what command it is running, and what changes it is making. That part of the process is not AI work. It generally takes sophisticated frontend and UX engineering to achieve, but it makes a massive difference to the user experience. Because watching an agent work in real time (and being able to interrupt it) builds trust in a way that waiting for a final answer generally does not.</p><p><strong>Diff-based editing.</strong> Our <code>edit_file</code> tool uses simple string find-and-replace, which is fragile. If the LLM gets the <code>old_text</code> slightly wrong (for instance, an extra space, or a missing newline), the edit fails. Production agents use more robust editing strategies, such as unified diffs, AST-based edits (modifying the code&#8217;s syntax tree rather than raw text), or dedicated&nbsp;<a href="https://docs.anthropic.com/en/agents-and-tools/tool-use/text-editor-tool">text editor tools</a>&nbsp;designed for this purpose.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!hTQw!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffa2499e9-9166-4b74-92d3-b76f1588e793_1280x1026.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!hTQw!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffa2499e9-9166-4b74-92d3-b76f1588e793_1280x1026.png 424w, https://substackcdn.com/image/fetch/$s_!hTQw!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffa2499e9-9166-4b74-92d3-b76f1588e793_1280x1026.png 848w, https://substackcdn.com/image/fetch/$s_!hTQw!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffa2499e9-9166-4b74-92d3-b76f1588e793_1280x1026.png 1272w, https://substackcdn.com/image/fetch/$s_!hTQw!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffa2499e9-9166-4b74-92d3-b76f1588e793_1280x1026.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!hTQw!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffa2499e9-9166-4b74-92d3-b76f1588e793_1280x1026.png" width="1280" height="1026" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/fa2499e9-9166-4b74-92d3-b76f1588e793_1280x1026.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1026,&quot;width&quot;:1280,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:398331,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://notebook.mubbie.dev/i/195695282?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffa2499e9-9166-4b74-92d3-b76f1588e793_1280x1026.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!hTQw!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffa2499e9-9166-4b74-92d3-b76f1588e793_1280x1026.png 424w, https://substackcdn.com/image/fetch/$s_!hTQw!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffa2499e9-9166-4b74-92d3-b76f1588e793_1280x1026.png 848w, https://substackcdn.com/image/fetch/$s_!hTQw!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffa2499e9-9166-4b74-92d3-b76f1588e793_1280x1026.png 1272w, https://substackcdn.com/image/fetch/$s_!hTQw!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffa2499e9-9166-4b74-92d3-b76f1588e793_1280x1026.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><strong>Observability.</strong> Production agents log every tool call, every tool result, every decision the LLM makes, and other relevant telemetry. When something goes wrong (and it will), you need to be able to look at the trace and understand what happened and why. Without good logging, debugging an agent would be very difficult (perhaps impossible).</p><p>In summary, while the core is simple, the product is hard. But understanding the core means you understand what every coding agent is doing (including the sophisticated ones). We have seen that the difference between our 80-line script and OpenCode is not the architecture. It is the thousands of hours of engineering, testing, and prompt tuning that make the loop reliable, safe, and pleasant to use.</p><p>If you want to go deeper, <a href="https://www.youtube.com/watch?v=I82j7AzMU80">Theo&#8217;s video</a> walks through how Claude Code works using the <a href="https://ampcode.com/notes/how-to-build-an-agent">Thorsten Ball</a> and <a href="https://www.mihaileric.com/The-Emperor-Has-No-Clothes/">Mihail Eric</a> posts as source material. It is a great watch.</p><h3>MCP: A Standard for Tools</h3><p>There is one more thing worth mentioning before we close out this section.</p><p>One problem with the current landscape is that every agent has its own way of defining and connecting to tools. If you build a useful tool (say, a tool that queries your company&#8217;s database), you have to integrate it separately with every agent you want to use it with. Codex might have one tool format, and Cursor another. Your custom agent has whatever you built.</p><p><a href="https://modelcontextprotocol.io/">Model Context Protocol (MCP)</a> is an open standard created by Anthropic and later donated to the Linux Foundation that aims to solve this. The idea is to build your tool server once using the MCP specification, and any MCP-compatible agent can connect to it.</p><p>The best analogy I have seen for it is USB. Before USB, every device had its own proprietary connector. Printers, keyboards, cameras, external drives, and mice all need different cables and ports. USB created one universal standard, and now everything works (mostly, especially with USB-C). MCP is trying to do the same thing for LLM tools. Build a tool once, use it everywhere.</p><p>MCP is already supported by Claude Code, Cursor, Windsurf, VS Code, OpenAI&#8217;s Codex, and others. It is still early, and the ecosystem is growing. Still, the direction is to get us to the point where, instead of every agent building its own integration from scratch, there can be a shared standard that lets tools and agents interoperate.</p><p>I am not going to go deep on MCP here because it could be its own post. But if you are building tools for LLMs, it is worth looking at the <a href="https://modelcontextprotocol.io/">MCP documentation</a> or this <a href="https://www.descope.com/learn/post/mcp">blog post</a> to understand it and how you can use it.</p><div><hr></div><h2>Act 5: Tying It All Together</h2><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!SpNF!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcae5cd95-a527-460b-9d5a-8d6c391d8fb2_690x362.webp" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!SpNF!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcae5cd95-a527-460b-9d5a-8d6c391d8fb2_690x362.webp 424w, https://substackcdn.com/image/fetch/$s_!SpNF!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcae5cd95-a527-460b-9d5a-8d6c391d8fb2_690x362.webp 848w, https://substackcdn.com/image/fetch/$s_!SpNF!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcae5cd95-a527-460b-9d5a-8d6c391d8fb2_690x362.webp 1272w, https://substackcdn.com/image/fetch/$s_!SpNF!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcae5cd95-a527-460b-9d5a-8d6c391d8fb2_690x362.webp 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!SpNF!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcae5cd95-a527-460b-9d5a-8d6c391d8fb2_690x362.webp" width="690" height="362" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/cae5cd95-a527-460b-9d5a-8d6c391d8fb2_690x362.webp&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:362,&quot;width&quot;:690,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:14280,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/webp&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://notebook.mubbie.dev/i/195695282?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcae5cd95-a527-460b-9d5a-8d6c391d8fb2_690x362.webp&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!SpNF!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcae5cd95-a527-460b-9d5a-8d6c391d8fb2_690x362.webp 424w, https://substackcdn.com/image/fetch/$s_!SpNF!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcae5cd95-a527-460b-9d5a-8d6c391d8fb2_690x362.webp 848w, https://substackcdn.com/image/fetch/$s_!SpNF!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcae5cd95-a527-460b-9d5a-8d6c391d8fb2_690x362.webp 1272w, https://substackcdn.com/image/fetch/$s_!SpNF!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcae5cd95-a527-460b-9d5a-8d6c391d8fb2_690x362.webp 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Image Source: <a href="https://www.interconnects.ai/">interconnects</a></em></p><p>We have covered a lot of ground. Let&#8217;s trace the full journey one more time.</p><p>In <a href="https://notebook.mubbie.dev/p/chatgpt-doesnt-think-it-pays-attention">Part 1</a>, we learned how LLMs work. Text goes in, gets tokenized, embedded into vectors, and runs through layers of attention. The model predicts the next token, generates it, and repeats. That is the engine behind every AI chatbot you use today.</p><p>In this post, we learned how to make that engine <em>do things</em>. The key ideas are simple enough to fit on a napkin:</p><ul><li><p>A <strong>tool</strong> is a function that the LLM can ask your code to run.</p></li><li><p>A <strong>tool call</strong> is the LLM saying, &#8220;run this function with these arguments&#8221; rather than generating regular text.</p></li><li><p>An <strong>agent</strong> is an LLM in a loop, making tool calls, reading results, and deciding what to do next until the task is done.</p></li><li><p>A <strong>coding agent</strong> is the same loop with tools for reading files, editing code, and running commands.</p></li></ul><p>That is it. We built a working coding agent in about 80 lines of Python, three tools, a system prompt, and a while loop. The same architecture that sits underneath Claude Code, Cursor, Codex, and every other coding agent on the market.</p><p>We established that the &#8220;emperor has no clothes&#8221; insight from <a href="https://www.mihaileric.com/The-Emperor-Has-No-Clothes/">Mihail Eric</a> is real. The core of these systems is not complicated. What <em>is</em> complicated is everything that makes them reliable, safe, and pleasant to use (such as prompt engineering, safety guardrails, context management, UX, error handling, and the thousands of small decisions that turn a weekend prototype into a product people trust with their codebase).</p><p>But you do not need to understand all of that to understand what is happening when you use these tools. You just need to understand the loop.</p><div><hr></div><p>Writing this post (and <a href="https://notebook.mubbie.dev/p/chatgpt-doesnt-think-it-pays-attention">Part 1</a>) has changed how I think about the AI tools I use every day. Before I started digging into this, coding agents felt like black boxes. Now, when I watch Claude Code read a file, edit some code, run the tests, see a failure, and try again, I can see the loop. I can see the tool calls. I can see the conversation history growing. It still feels magical, but I'm confident I intuitively understand what is going on and that it is a loop interacting with a very good language model.</p><p>I think that understanding matters. Obviously, not because everyone needs to build their own agent (although you could, and maybe you should try), but because understanding what these tools are actually doing helps you use them better. You start to understand why they fail, get stuck, and sometimes do something completely unrelated to what you asked. And you start to understand what is likely to get better over time (the models, the context windows, the reasoning, the harness) and what is fundamentally a hard problem (reliability, safety, knowing when to stop).</p><p>If you want to go deeper, the resources section below has everything I found most useful while learning this material. The <a href="https://ampcode.com/notes/how-to-build-an-agent">Thorsten Ball</a> and <a href="https://www.mihaileric.com/The-Emperor-Has-No-Clothes/">Mihail Eric</a> posts are the best starting points if you want to build your own agent. <a href="https://www.youtube.com/watch?v=I82j7AzMU80">Theo&#8217;s video</a> is a great companion if you prefer watching to reading.</p><p>Thanks for reading both parts of this series. I hope it helped demystify what is going on inside the AI tools you use every day. If you have questions, feedback, or corrections, I would love to hear from you.</p><p>AI still does not think. It still pays attention. But now it has hands.</p><div><hr></div><h2>Resources</h2><h3>Build Your Own Agent</h3><ul><li><p><a href="https://ampcode.com/notes/how-to-build-an-agent">Thorsten Ball: How to Build an Agent</a> &#8212; Build a code-editing agent in under 400 lines of Go. The best &#8220;see it with your own eyes&#8221; tutorial. &#8220;It&#8217;s an LLM, a loop, and enough tokens.&#8221;</p></li><li><p><a href="https://www.mihaileric.com/The-Emperor-Has-No-Clothes/">Mihail Eric: The Emperor Has No Clothes</a> &#8212; Build a Claude Code clone in roughly 200 lines of Python. The post that inspired the title of this series&#8217; central insight.</p></li><li><p><a href="https://www.youtube.com/watch?v=I82j7AzMU80">Theo: How does Claude Code actually work?</a> &#8212; Video walkthrough of the Thorsten Ball and Mihail Eric posts. Great companion if you prefer watching to reading.</p></li><li><p><a href="https://github.com/anthropics/claude-cookbooks/tree/main/patterns/agents">Anthropic Cookbook: Agent Patterns</a> &#8212; Reference implementations for common agent workflows (prompt chaining, routing, parallelization, orchestrator-workers, evaluator-optimizer).</p></li></ul><h3>Agent Concepts and Overviews</h3><ul><li><p><a href="https://simonwillison.net/2025/Sep/18/agents/">Simon Willison: Agents</a> &#8212; The clearest definition of what an agent is. &#8220;An LLM agent runs tools in a loop to achieve a goal.&#8221;</p></li><li><p><a href="https://www.anthropic.com/research/building-effective-agents">Anthropic: Building Effective Agents</a> &#8212; Anthropic&#8217;s guide to designing agentic systems. Covers workflows vs. agents, prompt chaining, routing, parallelization, and orchestrator-worker patterns.</p></li><li><p><a href="https://www.anthropic.com/engineering/effective-context-engineering-for-ai-agents">Anthropic: Context Engineering for AI Agents</a> &#8212; Deep dive into managing context in agentic systems. Covers retrieval strategies, compaction, and the shift from prompt engineering to context engineering.</p></li><li><p><a href="https://www.anthropic.com/engineering/writing-tools-for-agents">Anthropic: Writing Effective Tools for AI Agents</a> &#8212; How to design and evaluate tools that agents can use reliably. Covers naming, descriptions, evaluation-driven development, and common failure modes.</p></li><li><p><a href="https://www.ibm.com/think/topics/ai-agents">IBM: What are AI Agents?</a> &#8212; Solid overview of agent concepts and how they differ from traditional automation.</p></li><li><p><a href="https://www.ibm.com/think/topics/agentic-ai">IBM: Agentic AI</a> &#8212; Explains the broader &#8220;agentic AI&#8221; concept and how it relates to individual agents.</p></li><li><p><a href="https://www.ibm.com/think/topics/ai-agent-types">IBM: Types of AI Agents</a> &#8212; Textbook taxonomy (reflex, goal-based, utility-based, learning agents) explained clearly.</p></li><li><p><a href="https://www.ibm.com/think/topics/components-of-ai-agents">IBM: Components of AI Agents</a> &#8212; Breaks down what goes into an agent: perception, decision-making, action, and learning.</p></li><li><p><a href="https://github.com/resources/articles/what-are-ai-agents">GitHub: What are AI Agents?</a> &#8212; GitHub&#8217;s overview of AI agents and how they are used in software development.</p></li><li><p><a href="https://aws.amazon.com/what-is/ai-agents/">AWS: What are AI Agents?</a> &#8212; Amazon&#8217;s explainer covering agent architectures and evaluation.</p></li><li><p><a href="https://cloud.google.com/discover/what-are-ai-agents">Google Cloud: What are AI Agents?</a> &#8212; Google&#8217;s overview with the Think/Act/Observe framework.</p></li><li><p><a href="https://www.microsoft.com/en-us/microsoft-copilot/copilot-101/how-do-ai-agents-work">Microsoft: How do AI Agents Work?</a> &#8212; Microsoft&#8217;s perspective on agent architecture and Copilot&#8217;s agentic features.</p></li><li><p><a href="https://mitsloan.mit.edu/ideas-made-to-matter/agentic-ai-explained">MIT Sloan: Agentic AI Explained</a> &#8212; Business-oriented explainer of agentic AI and its implications.</p></li><li><p><a href="https://www.glean.com/blog/7-core-components-of-an-ai-agent-architecture-explained">Glean: 7 Core Components of AI Agent Architecture</a> &#8212; Practical breakdown of what goes into a production agent.</p></li><li><p><a href="https://www.databricks.com/blog/types-ai-agents-definitions-roles-and-examples">Databricks: Types of AI Agents</a> &#8212; Pragmatic taxonomy with real-world examples.</p></li><li><p><a href="https://www.evidentlyai.com/blog/ai-agents-examples">Evidently AI: AI Agent Examples</a> &#8212; Collection of concrete agent use cases across industries.</p></li><li><p><a href="https://huggingface.co/learn/agents-course/unit1/agent-steps-and-structure">HuggingFace: Agents Course</a> &#8212; Free course covering the Think/Act/Observe cycle, tool use, and agent design patterns.</p></li></ul><h3>Tool Use and Function Calling</h3><ul><li><p><a href="https://platform.claude.com/docs/en/agents-and-tools/tool-use/overview">Anthropic: Tool Use Documentation</a> &#8212; Official guide to implementing tool use with Claude. Covers tool definitions, message flow, and best practices.</p></li><li><p><a href="https://platform.claude.com/docs/en/agents-and-tools/tool-use/text-editor-tool">Anthropic: Text Editor Tool</a> &#8212; Anthropic&#8217;s built-in text editor tool for code editing, more robust than simple find-and-replace.</p></li><li><p><a href="https://platform.claude.com/docs/en/api/sdks/python">Anthropic Python SDK</a> &#8212; Python SDK documentation with tool use examples.</p></li><li><p><a href="https://platform.openai.com/docs/guides/function-calling">OpenAI: Function Calling Guide</a> &#8212; OpenAI&#8217;s equivalent guide to tool use (they call it &#8220;function calling&#8221;).</p></li></ul><h3>Context Management</h3><ul><li><p><a href="https://docs.anthropic.com/en/docs/build-with-claude/context-windows">Anthropic: Context Windows</a> &#8212; Documentation on context window sizes and management.</p></li><li><p><a href="https://platform.claude.com/docs/en/build-with-claude/compaction">Anthropic: Compaction</a> &#8212; How to use conversation compaction to manage long agent sessions.</p></li><li><p><a href="https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching">Anthropic: Prompt Caching</a> &#8212; Reduce costs and latency by caching repeated parts of the conversation.</p></li><li><p><a href="https://arxiv.org/abs/2307.03172">Lost in the Middle: How Language Models Use Long Contexts</a> (Liu et al., 2023) &#8212; The paper showing that LLMs attend less to information in the middle of long contexts.</p></li><li><p><a href="https://medium.com/@joaolages/kv-caching-explained-276520203249">KV Caching Explained</a> &#8212; Accessible explainer of how KV caching speeds up autoregressive generation.</p></li></ul><h3>MCP (Model Context Protocol)</h3><ul><li><p><a href="https://modelcontextprotocol.io/">MCP Documentation</a> &#8212; The official specification and getting-started guide for MCP.</p></li><li><p><a href="https://www.anthropic.com/news/model-context-protocol">Anthropic: Introducing MCP</a> &#8212; Anthropic&#8217;s announcement of the Model Context Protocol.</p></li><li><p><a href="https://www.descope.com/learn/post/mcp">Descope: What is MCP and How It Works</a> &#8212; Clear third-party explainer of MCP with diagrams.</p></li></ul><h3>Coding Agents (Products)</h3><ul><li><p><a href="https://openai.com/codex/">OpenAI Codex</a> &#8212; OpenAI&#8217;s cloud-based coding agent with MCP support.</p></li><li><p><a href="https://www.cursor.com/">Cursor</a> &#8212; AI-powered code editor built on top of VS Code.</p></li><li><p><a href="https://ampcode.com/">Amp</a> &#8212; Coding agent from the team behind Zed, built in Go.</p></li><li><p><a href="https://aider.chat/">Aider</a> &#8212; Open-source terminal-based coding agent for pair programming with LLMs.</p></li><li><p><a href="https://github.com/cline/cline">Cline</a> &#8212; Open-source VS Code extension for autonomous coding.</p></li><li><p><a href="https://docs.anthropic.com/en/docs/claude-code">Claude Code</a> &#8212; Anthropic&#8217;s CLI-based coding agent. <a href="https://code.claude.com/docs/en/best-practices">Best practices guide</a>.</p></li><li><p>There are many more like OpenCode, Pi, RooCode, Crush, Kiro, etc.</p></li></ul><h3>Coding Agent Deep Dives</h3><ul><li><p><a href="https://code.claude.com/docs/en/best-practices">Claude Code: Best Practices</a> &#8212; Anthropic&#8217;s official guide to getting the most out of Claude Code. Covers context management, CLAUDE.md files, and effective prompting patterns.</p></li><li><p><a href="https://www.anthropic.com/engineering/equipping-agents-for-the-real-world-with-agent-skills">Anthropic: Agent Skills</a> &#8212; How to package domain expertise into reusable skills that agents can discover and apply.</p></li><li><p><a href="https://www.freecodecamp.org/news/claude-code-handbook/">freeCodeCamp: The Claude Code Handbook</a> &#8212; Comprehensive guide covering installation, workflows, parallel agents, MCP integrations, and autonomous loops.</p></li><li><p><a href="https://microsoft.github.io/language-server-protocol/">LSP (Language Server Protocol)</a> &#8212; The protocol that enables type checking, go-to-definition, and other IDE features that production coding agents integrate with.</p></li><li><p><a href="https://github.com/BurntSushi/ripgrep">ripgrep</a> &#8212; The fast search tool that many coding agents use under the hood for codebase search.</p></li></ul><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://notebook.mubbie.dev/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Mubbie's Notebook! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[ChatGPT Doesn’t Think. It Pays Attention. ]]></title><description><![CDATA[A plain-English tour of Transformers, GPT, and LLMs (with just enough math)]]></description><link>https://notebook.mubbie.dev/p/chatgpt-doesnt-think-it-pays-attention</link><guid isPermaLink="false">https://notebook.mubbie.dev/p/chatgpt-doesnt-think-it-pays-attention</guid><dc:creator><![CDATA[Mubarak Idoko]]></dc:creator><pubDate>Mon, 27 Apr 2026 15:43:57 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!c0Y5!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F387f90dc-8819-4197-9ac5-e2e58707602a_500x377.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!1J41!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F91276eea-6961-4857-8727-3efb04932f0c_733x797.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!1J41!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F91276eea-6961-4857-8727-3efb04932f0c_733x797.png 424w, https://substackcdn.com/image/fetch/$s_!1J41!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F91276eea-6961-4857-8727-3efb04932f0c_733x797.png 848w, https://substackcdn.com/image/fetch/$s_!1J41!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F91276eea-6961-4857-8727-3efb04932f0c_733x797.png 1272w, https://substackcdn.com/image/fetch/$s_!1J41!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F91276eea-6961-4857-8727-3efb04932f0c_733x797.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!1J41!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F91276eea-6961-4857-8727-3efb04932f0c_733x797.png" width="733" height="797" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/91276eea-6961-4857-8727-3efb04932f0c_733x797.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:797,&quot;width&quot;:733,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:56147,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://notebook.mubbie.dev/i/195629229?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F91276eea-6961-4857-8727-3efb04932f0c_733x797.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!1J41!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F91276eea-6961-4857-8727-3efb04932f0c_733x797.png 424w, https://substackcdn.com/image/fetch/$s_!1J41!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F91276eea-6961-4857-8727-3efb04932f0c_733x797.png 848w, https://substackcdn.com/image/fetch/$s_!1J41!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F91276eea-6961-4857-8727-3efb04932f0c_733x797.png 1272w, https://substackcdn.com/image/fetch/$s_!1J41!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F91276eea-6961-4857-8727-3efb04932f0c_733x797.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Image Source: <a href="https://xkcd.com/">XKCD</a></em></p><div><hr></div><p><strong>Reading guide:</strong> This is a long post (~40 min read). Here is how to navigate it.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://notebook.mubbie.dev/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Mubbie's Notebook! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><ul><li><p><strong>Want the full picture?</strong> Read straight through. Each section builds on the last.</p></li><li><p><strong>Already know what RNNs are?</strong> Skip to <em>Act 2: The Transformer</em>.</p></li><li><p><strong>Just want to understand GPT/ChatGPT?</strong> Jump to <em>Act 3: From Transformer to GPT</em>.</p></li><li><p><strong>Curious about scaling, RLHF, or reasoning?</strong> Head to <em>Act 4: From GPT to LLMs</em>.</p></li><li><p><strong>Short on time?</strong> Read the <em>recap in Act 5</em> for the full story in a few paragraphs.</p></li></ul><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!c0Y5!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F387f90dc-8819-4197-9ac5-e2e58707602a_500x377.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!c0Y5!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F387f90dc-8819-4197-9ac5-e2e58707602a_500x377.png 424w, https://substackcdn.com/image/fetch/$s_!c0Y5!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F387f90dc-8819-4197-9ac5-e2e58707602a_500x377.png 848w, https://substackcdn.com/image/fetch/$s_!c0Y5!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F387f90dc-8819-4197-9ac5-e2e58707602a_500x377.png 1272w, https://substackcdn.com/image/fetch/$s_!c0Y5!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F387f90dc-8819-4197-9ac5-e2e58707602a_500x377.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!c0Y5!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F387f90dc-8819-4197-9ac5-e2e58707602a_500x377.png" width="500" height="377" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/387f90dc-8819-4197-9ac5-e2e58707602a_500x377.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:377,&quot;width&quot;:500,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:302336,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://notebook.mubbie.dev/i/195629229?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F387f90dc-8819-4197-9ac5-e2e58707602a_500x377.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!c0Y5!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F387f90dc-8819-4197-9ac5-e2e58707602a_500x377.png 424w, https://substackcdn.com/image/fetch/$s_!c0Y5!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F387f90dc-8819-4197-9ac5-e2e58707602a_500x377.png 848w, https://substackcdn.com/image/fetch/$s_!c0Y5!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F387f90dc-8819-4197-9ac5-e2e58707602a_500x377.png 1272w, https://substackcdn.com/image/fetch/$s_!c0Y5!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F387f90dc-8819-4197-9ac5-e2e58707602a_500x377.png 1456w" sizes="100vw"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><div id="datawrapper-iframe" class="datawrapper-wrap outer" data-attrs="{&quot;url&quot;:&quot;https://datawrapper.dwcdn.net/RBCSM/2/&quot;,&quot;thumbnail_url&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/26a07b74-f6dd-4a94-b952-255444f6928c_1220x738.png&quot;,&quot;thumbnail_url_full&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/1288fe99-48f0-420b-845b-87e5107f0f5a_1220x808.png&quot;,&quot;height&quot;:401,&quot;title&quot;:&quot;Content&quot;,&quot;description&quot;:&quot;&quot;}" data-component-name="DatawrapperToDOM"><iframe id="iframe-datawrapper" class="datawrapper-iframe" src="https://datawrapper.dwcdn.net/RBCSM/2/" width="730" height="401" frameborder="0" scrolling="no"></iframe><script type="text/javascript">!function(){"use strict";window.addEventListener("message",(function(e){if(void 0!==e.data["datawrapper-height"]){var t=document.querySelectorAll("iframe");for(var a in e.data["datawrapper-height"])for(var r=0;r<t.length;r++){if(t[r].contentWindow===e.source)t[r].style.height=e.data["datawrapper-height"][a]+"px"}}}))}();</script></div><div><hr></div><h2>Act 1: Introduction</h2><p>You&#8217;ve probably used ChatGPT today. Or maybe Google Translate, or Gemini, Claude, or one of the dozen AI tools that have quietly crept into our everyday life over the past couple of years. Typically, you type something in (or talk) and the AI just&#8230; it just responds. It feels like magic, or at least like something impossibly complex (in my opinion, it is, lol).</p><p>Personally, I started dabbling with ChatGPT back in 2023 while working on my senior thesis in college. I was building a machine learning system to detect security bugs in C/C++ code. Throughout all my prompting, I had this nagging feeling that everything I was doing was almost useless, because I knew I could give ChatGPT the code and it would find those bugs itself. Or it could be fine-tuned to do so, similar to how Wiz, the cybersecurity startup, <a href="https://www.wiz.io/blog/small-language-model-for-secrets-detection-in-code">did to a Llama model</a>. It is such powerful technology.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!_FAX!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88fe895d-7858-4940-9dba-fa9193b38df8_1125x638.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!_FAX!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88fe895d-7858-4940-9dba-fa9193b38df8_1125x638.jpeg 424w, https://substackcdn.com/image/fetch/$s_!_FAX!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88fe895d-7858-4940-9dba-fa9193b38df8_1125x638.jpeg 848w, https://substackcdn.com/image/fetch/$s_!_FAX!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88fe895d-7858-4940-9dba-fa9193b38df8_1125x638.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!_FAX!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88fe895d-7858-4940-9dba-fa9193b38df8_1125x638.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!_FAX!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88fe895d-7858-4940-9dba-fa9193b38df8_1125x638.jpeg" width="1125" height="638" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/88fe895d-7858-4940-9dba-fa9193b38df8_1125x638.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:638,&quot;width&quot;:1125,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:101077,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://notebook.mubbie.dev/i/195629229?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88fe895d-7858-4940-9dba-fa9193b38df8_1125x638.jpeg&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!_FAX!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88fe895d-7858-4940-9dba-fa9193b38df8_1125x638.jpeg 424w, https://substackcdn.com/image/fetch/$s_!_FAX!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88fe895d-7858-4940-9dba-fa9193b38df8_1125x638.jpeg 848w, https://substackcdn.com/image/fetch/$s_!_FAX!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88fe895d-7858-4940-9dba-fa9193b38df8_1125x638.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!_FAX!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88fe895d-7858-4940-9dba-fa9193b38df8_1125x638.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>The interesting thing, however, is that all these tools, every single one of them, run on the same core idea; an idea from a single paper published in 2017 by a team of researchers at Google. The paper is called &#8220;<a href="https://arxiv.org/abs/1706.03762">Attention Is All You Need</a>&#8221;, and it introduced the <a href="https://developers.google.com/machine-learning/crash-course/llm/transformers">Transformer</a>. If you&#8217;ve heard the term and wondered what it actually means, or if you&#8217;ve never heard it and want to understand what&#8217;s going on when you talk to ChatGPT, this post is for you.</p><p>This is the first post in a two-part series. We&#8217;ll cover Transformers and LLMs here, then tackle agents and coding tools (like Claude Code) in upcoming posts. We&#8217;ll also touch briefly on the &#8220;thinking&#8221; part of LLMs (reasoning). That said, for now we&#8217;ll focus just on text, not images, audio, or other modalities, even though those are mostly built on the same underlying tech.</p><p>Let&#8217;s get into it.</p><h3>The World Before Transformers</h3><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!1iUg!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6e41fb06-6e25-452f-9f3e-2dbb9f2b2982_968x726.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!1iUg!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6e41fb06-6e25-452f-9f3e-2dbb9f2b2982_968x726.png 424w, https://substackcdn.com/image/fetch/$s_!1iUg!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6e41fb06-6e25-452f-9f3e-2dbb9f2b2982_968x726.png 848w, https://substackcdn.com/image/fetch/$s_!1iUg!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6e41fb06-6e25-452f-9f3e-2dbb9f2b2982_968x726.png 1272w, https://substackcdn.com/image/fetch/$s_!1iUg!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6e41fb06-6e25-452f-9f3e-2dbb9f2b2982_968x726.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!1iUg!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6e41fb06-6e25-452f-9f3e-2dbb9f2b2982_968x726.png" width="968" height="726" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/6e41fb06-6e25-452f-9f3e-2dbb9f2b2982_968x726.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:726,&quot;width&quot;:968,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:911261,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://notebook.mubbie.dev/i/195629229?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6e41fb06-6e25-452f-9f3e-2dbb9f2b2982_968x726.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!1iUg!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6e41fb06-6e25-452f-9f3e-2dbb9f2b2982_968x726.png 424w, https://substackcdn.com/image/fetch/$s_!1iUg!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6e41fb06-6e25-452f-9f3e-2dbb9f2b2982_968x726.png 848w, https://substackcdn.com/image/fetch/$s_!1iUg!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6e41fb06-6e25-452f-9f3e-2dbb9f2b2982_968x726.png 1272w, https://substackcdn.com/image/fetch/$s_!1iUg!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6e41fb06-6e25-452f-9f3e-2dbb9f2b2982_968x726.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Image Source: <a href="https://ghost.oxen.ai/">oxen.ai</a></em></p><p>Before we can appreciate what the Transformer did, we need to understand what existed before it.</p><p>Before 2017, the dominant approach for language tasks (translation, text generation, etc.) was the <strong><a href="https://www.geeksforgeeks.org/machine-learning/introduction-to-recurrent-neural-network/">Recurrent Neural Network (RNN)</a></strong> and its more popular variants <strong><a href="https://colah.github.io/posts/2015-08-Understanding-LSTMs/">LSTMs</a></strong> (Long Short-Term Memory) and <strong><a href="https://www.analyticsvidhya.com/blog/2021/03/introduction-to-gated-recurrent-unit-gru/">GRUs</a></strong> (Gated Recurrent Units). The straightforward idea at the core of these models was to process text sequentially, one word at a time, from left to right, and at each step update an internal &#8220;memory&#8221; (called a hidden state) that tries to capture everything the model has read so far.</p><p>You can think of it like reading a book through a mail slot (or using one of those <a href="https://www.speedreadinglounge.com/speed-reading-apps">speed reader apps</a> that use <a href="https://iovs.arvojournals.org/article.aspx?articleid=2808669">Rapid Serial Visual Presentation (RSVP)</a>. You see one word, you try to remember it, then the next word comes, and you try to fold that into what you already remember. However, by the time you&#8217;re 50 words in, your memory of word 1 is fuzzy at best (even if you might have a rough idea of what you read). The hidden state in RNNs is a fixed-size vector that tries to compress an ever-growing amount of information, and eventually, something has to give.</p><p>Using these models created two big problems:</p><ol><li><p><strong>They are slow. (Unlike speed reading with RSVP)</strong>. Because RNNs process words sequentially (word 1 must be processed before word 2, word 2 before word 3, and so on), you can&#8217;t parallelize the computation. Each step depends on the previous one. This made training painfully slow, especially on longer sequences. As <a href="https://www.atlantic.net/gpu-server-hosting/gpu-parallel-computing-techniques-challenges-and-best-practices/">GPUs got faster at handling many tasks simultaneously</a>, RNNs couldn&#8217;t take advantage of that because their architecture was fundamentally sequential.</p></li><li><p><strong>They were forgetful.</strong> That fixed-size hidden state was a bottleneck. Long-range dependencies (where a word early in a sentence is crucial for understanding a word much later) are hard for the model to learn. Consider the sentence: &#8220;The cat that chased the dog that barked at the mailman sat on the mat.&#8221; By the time the model reaches &#8220;sat,&#8221; the hidden state&#8217;s memory of &#8220;cat&#8221; (the actual subject) has been diluted by everything in between. This is related to what&#8217;s known as the <strong><a href="https://www.geeksforgeeks.org/deep-learning/vanishing-and-exploding-gradients-problems-in-deep-learning/">vanishing gradient problem</a>:</strong> as the model learns connections over long distances, the training signal becomes weaker and weaker. Like a game of telephone, the final state has limited context on the initial states.</p></li></ol><p>Researchers knew this was a problem, and they tried to fix it. LSTMs and GRUs were <a href="https://web.stanford.edu/class/archive/cs/cs224n/cs224n.1194/slides/cs224n-2019-lecture07-fancy-rnn.pdf">specifically designed</a> to be better at retaining information across longer sequences, and they helped, but they didn&#8217;t solve the fundamental bottleneck. The hidden state remained a fixed-size summary of everything that had come before.</p><p>Then, in 2014, we had a breakthrough. <a href="https://machinelearningmastery.com/the-attention-mechanism-from-scratch/">Attention mechanisms</a> (introduced by Bahdanau et al.) gave models the ability to &#8220;look back&#8221; at any part of the input when generating each word of the output, instead of relying entirely on that compressed hidden state. This was a huge improvement for tasks like translation. But attention was still being used <em>in addition to</em> the RNN, not <em>instead of it</em>. Hence, the sequential processing bottleneck still existed.</p><p>Then came the 2017 paper that changed everything. A group of researchers at Google experimented with a simple, but honestly, radical idea: what if we got rid of recurrence entirely and relied <em>only</em> on attention?</p><p>The result was the <strong>Transformer.</strong> And it worked so well that it became the default backbone for modern language models.</p><div><hr></div><h2>Act 2: The Transformer</h2><p>Thus far, we have identified the problem: RNNs process words one at a time and struggle with long-range dependencies. We have also established that the solution is the Transformer, which relies on Attention. But what is Attention? Let&#8217;s build up our understanding using three analogies.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!CkTA!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F400bc0a9-ea8e-4458-b43f-678e9978d2d8_800x600.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!CkTA!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F400bc0a9-ea8e-4458-b43f-678e9978d2d8_800x600.jpeg 424w, https://substackcdn.com/image/fetch/$s_!CkTA!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F400bc0a9-ea8e-4458-b43f-678e9978d2d8_800x600.jpeg 848w, https://substackcdn.com/image/fetch/$s_!CkTA!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F400bc0a9-ea8e-4458-b43f-678e9978d2d8_800x600.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!CkTA!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F400bc0a9-ea8e-4458-b43f-678e9978d2d8_800x600.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!CkTA!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F400bc0a9-ea8e-4458-b43f-678e9978d2d8_800x600.jpeg" width="800" height="600" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/400bc0a9-ea8e-4458-b43f-678e9978d2d8_800x600.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:600,&quot;width&quot;:800,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:66664,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://notebook.mubbie.dev/i/195629229?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F400bc0a9-ea8e-4458-b43f-678e9978d2d8_800x600.jpeg&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!CkTA!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F400bc0a9-ea8e-4458-b43f-678e9978d2d8_800x600.jpeg 424w, https://substackcdn.com/image/fetch/$s_!CkTA!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F400bc0a9-ea8e-4458-b43f-678e9978d2d8_800x600.jpeg 848w, https://substackcdn.com/image/fetch/$s_!CkTA!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F400bc0a9-ea8e-4458-b43f-678e9978d2d8_800x600.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!CkTA!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F400bc0a9-ea8e-4458-b43f-678e9978d2d8_800x600.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h3>The Cocktail Party</h3><p>Imagine you&#8217;re at a crowded party. There are dozens of conversations happening around you all at once. Music is playing, people are laughing, some people are dancing, others are drinking. Despite all the noise, when someone across the room says your name, your brain instantly locks onto that signal. You didn&#8217;t need to listen to every conversation in sequence to find the relevant one. Your brain, in a sense, just attended (or paid attention) to the right thing.</p><p>You can also split your focus. You might be talking to someone, but part of your brain is monitoring an interesting conversation happening nearby. You&#8217;re processing multiple streams of information in parallel, dynamically deciding what&#8217;s relevant and what to ignore.</p><p>That&#8217;s the core intuition behind attention in machine learning. Instead of processing information one piece at a time and hoping a hidden state remembers what matters, what if the model could &#8220;hear&#8221; the entire input at once and dynamically focus on the most relevant parts? In a Transformer, &#8220;locking on&#8221; means assigning larger numerical weights to certain tokens and smaller weights to others.</p><p>That is what the Transformer does. But &#8220;dynamically focus&#8221; is still vague, so we have to get more concrete.</p><h3>The Library</h3><p>Say you walk into a library with a specific research question. For instance, &#8220;What was the world like when the dinosaurs were alive?&#8221; That question is your <strong>Query</strong> or what you are looking for.</p><p>Every book on the shelf has a title and a short description on its spine. Those are the <strong>Keys</strong>, letting you know what each book is about.</p><p>Now, you scan the shelves. Your brain automatically scores how relevant each book is to your research question. A book about exactly your topic (in our case, that could be <a href="https://a.co/d/08cmduVX">The Complete Book of Dinosaurs</a>) would have high relevance. A book about something tangentially related, for instance, <a href="https://a.co/d/0bp7AX9n">Asteroids: Astronomical and Geological Bodies</a>, would have low relevance. And a book about something completely unrelated (let&#8217;s say a book about how Toy Story was animated) would have basically near-zero relevance.</p><p>Now, here&#8217;s where things get interesting. Instead of just grabbing the single most relevant book, you pull information from <em>many</em> books, each one contributing in proportion to how relevant it was to your question. These contributions are the <strong>Values</strong>, the actual content each book offers. A highly relevant book significantly enhances your understanding. A barely relevant one contributes almost nothing, but isn&#8217;t completely ignored either.</p><p>The result is a <em>weighted combination</em> of information from across the entire library, tailored specifically to your question. That&#8217;s attention, or a blending of all available information, weighted by relevance.</p><h3>The Google Search</h3><p>Now that we have the intuition from the library, let&#8217;s map it to something even more familiar and then jump straight into the math.</p><p>You type a search query into Google (or Bing &#8212; yes, people use Bing). That&#8217;s your <strong>Q</strong>. Google compares that query against the titles and descriptions of billions of pages (the <strong>K</strong>s), scores each page&#8217;s relevance, and returns results weighted by those scores. The actual content of each page (the <strong>V</strong>s) gets weighted by relevance, so the top results get your attention, while page-ten results barely register. One difference worth noting, though, is that Google shows you a ranked list of separate results, whereas Attention blends all the results into a single, relevance-weighted output.</p><p>The mapping here is actually clean enough that we can walk through the actual math. Here&#8217;s the equation from the paper:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\mathrm{Attention}(Q, K, V) = \\mathrm{softmax}\\!\\left(\\frac{QK^{T}}{\\sqrt{d_k}}\\right)V&quot;,&quot;id&quot;:&quot;JWCJBHJABE&quot;}" data-component-name="LatexBlockToDOM"></div><p>If that looks intimidating, don&#8217;t worry; we&#8217;ll break it down piece by piece. But first, let&#8217;s establish some building blocks so we know what Q, K, and V actually <em>are</em>.</p><h3>The Building Blocks</h3><p>Q, K, and V are not words themselves; they&#8217;re vectors (lists of numbers) derived from the input tokens. For every token, the model creates three different vector &#8220;versions&#8221;: a <strong>Query</strong> (&#8220;what am I looking for?&#8221;), a <strong>Key</strong> (&#8220;how should others find me?&#8221;), and a <strong>Value</strong> (&#8220;what information do I contribute?&#8221;). So if your sentence has 10 tokens, you have 10 query vectors (one per token), stacked into the matrix <em>Q</em>. Same for <em>K</em> and <em>V</em>. Attention uses Query&#8211;Key matching to figure out what&#8217;s relevant, then uses those relevance scores to blend the Values.</p><p>But where do these vectors come from? Let&#8217;s trace the path from raw text to math.</p><h4>Tokens</h4><p>Models don&#8217;t operate on whole words. They operate on <strong><a href="https://learn.microsoft.com/en-us/dotnet/ai/conceptual/understanding-tokens">tokens</a></strong>, which are word pieces.</p><p>For example, &#8220;unbelievable&#8221; might become tokens like: [&#8220;un&#8221;, &#8220;believ&#8221;, &#8220;able&#8221;]</p><p>Each token has a <a href="https://medium.com/@bishalmukherjee2/llm-tokens-what-they-are-and-why-you-should-care-7d97c2130141">unique numerical identifier</a>.</p><p>So your sentence:</p><blockquote><p><em>&#8220;The cat sat.&#8221;</em></p></blockquote><p>might become tokens: [&#8220;The&#8221;, &#8220;cat&#8221;, &#8220;sat&#8221;] that map to token IDs: [713, 4583, 987]</p><h4>Embeddings</h4><p>Now we need to convert those IDs into a form the model can work with mathematically. That&#8217;s where <a href="https://www.ibm.com/think/topics/embedding">embeddings</a> come in.</p><p>An embedding is a learned lookup table in which each token ID maps to a vector (a list of numbers). At first, these vectors are random. During training, they get adjusted so that tokens used in similar contexts end up with vectors that are close together.</p><p>In practice, the Transformer has an embedding table with one row per token in its vocabulary (e.g., 50,000 rows) and a fixed number of columns (e.g., 768). Looking up an embedding is simple:</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;plaintext&quot;,&quot;nodeId&quot;:&quot;eb8c4e0b-7387-49e0-bd6a-f64aee87caa7&quot;}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-plaintext">embedding_table[token_id] = vector of numbers
</code></pre></div><p>So if the token ID for &#8220;cat&#8221; is 4583, you look up row 4583 and get its embedding vector:</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;plaintext&quot;,&quot;nodeId&quot;:&quot;98b600bf-c0bf-4621-bcae-a4eb71266ebb&quot;}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-plaintext">cat  -&gt;  [0.12, -1.80, 0.03, 2.10, ...]
</code></pre></div><p>In real models, these vectors are typically hundreds or thousands of numbers long (e.g., 512, 768, 4096). The key idea is that similar words tend to have similar vectors. For instance, &#8220;king&#8221; and &#8220;queen&#8221; would be close together, while &#8220;king&#8221; and &#8220;toaster&#8221; would be far apart.</p><h4>Position Information</h4><p>There&#8217;s one more thing we need before we can feed tokens into the attention module. If we only used embeddings, these two inputs would look identical (same tokens, same embeddings):</p><ul><li><p>&#8220;cat sat on mat&#8221;</p></li><li><p>&#8220;mat on sat cat&#8221;</p></li></ul><p>Word order matters, so we add <a href="https://www.geeksforgeeks.org/nlp/positional-encoding-in-transformers/">positional encoding</a> as a way of &#8220;tagging&#8221; each token with where it appears in the sentence. In simple terms, every token&#8217;s embedding gets a small numerical adjustment based on its position. We&#8217;ll explore exactly how this works <a href="https://mubbie.github.io/2026/04/26/chatgpt-doesnt-think-it-oays-attention.html#positional-encoding-teaching-the-model-word-order">later in this post</a>, but for now, know that after this step, each token has a vector that captures both <em>what</em> the token means and <em>where</em> it appears.</p><p>The result is that each token in your input is now represented as a vector that encodes meaning and position. These are the vectors that get transformed into Q, K, and V for the attention mechanism.</p><p>Here&#8217;s the full pipeline:</p><blockquote><p><em><strong>Text &#8594; Tokens &#8594; Token IDs &#8594; Embedding Vectors &#8594; Add Position &#8594; Token Vectors (ready for attention)</strong></em></p></blockquote><p>Now let&#8217;s break down the attention equation.</p><h3>The Attention Equation, Step by Step</h3><p>One important note before we begin: if your sentence has <em><strong>n</strong></em> tokens, then <strong>Q</strong> and <strong>K</strong> are each like tables with <em><strong>n</strong></em> rows (one row per token) and <em>d_k </em>columns. When we compute <em>QK&#7488;</em>, the result is an <em>n &#215; n</em> table of every token scored against every other token. It&#8217;s a grid of &#8220;who cares about whom.&#8221;</p><h4>Step 1: Score how relevant each key is to your query.</h4><p>When you Google something, the search engine needs to figure out which pages are relevant to what you typed. Mathematically, one way to measure how similar two things are is the <a href="https://www.mathsisfun.com/algebra/vectors-dot-product.html">dot product</a>. If two vectors point in the same direction, their dot product is high; if they&#8217;re unrelated, it&#8217;s low. So we take the dot product of the <strong>Query</strong> with every <strong>Key</strong>:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;QK^{T} = \\text{relevance scores}\n&quot;,&quot;id&quot;:&quot;FPPLSVDAKU&quot;}" data-component-name="LatexBlockToDOM"></div><p>Each score indicates how well a particular key matches the given query. We use the transpose of K (<em>K&#7488;</em>) so that the matrix dimensions line up correctly for the dot product. Q has shape (<em>n</em> &#215; <em>d_k</em>), and <em>K&#7488; </em>has shape (<em>d_k</em> &#215; <em>n</em>), giving us that (<em>n</em> &#215; <em>n</em>) table of scores. </p><h4>Step 2: Scale the scores down.</h4><p>Here&#8217;s a practical problem. When the vectors are high-dimensional (as in Transformers), dot products can be very large in magnitude. Large values push the softmax function (next step) into extreme territory where one score could dominate, and everything else gets crushed to near-zero. So we divide by &#8730;d_k (the square root of the key dimension) to keep things in a reasonable range. You can think of this as volume control. We&#8217;re turning down the loudest values so the quieter ones don&#8217;t get drowned out.</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\frac{QK^{T}}{\\sqrt{d_k}} = \\text{scaled scores}&quot;,&quot;id&quot;:&quot;YBAKFHVYOB&quot;}" data-component-name="LatexBlockToDOM"></div><h4>Step 3: Convert scores to weights.</h4><p>Right now, we have raw scores; some large, some small, some negative. We need to turn these into clean proportions that add up to 1, so we can use them as weights. That&#8217;s what the <a href="https://developers.google.com/machine-learning/crash-course/neural-networks/multi-class">softmax function</a> does. It takes any set of numbers and squishes them into a probability distribution: the biggest score gets the biggest weight, smaller scores get smaller weights, and everything sums to 1.</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\mathrm{softmax}\\!\\left(\\frac{QK^{T}}{\\sqrt{d_k}}\\right) = \\text{attention weights}&quot;,&quot;id&quot;:&quot;YRPLHEBBDI&quot;}" data-component-name="LatexBlockToDOM"></div><p>To make this concrete, let&#8217;s go back to our sentence: &#8220;The cat sat on the mat because <strong>it</strong> was tired.&#8221;</p><p>When computing attention for the token &#8220;it,&#8221; the model might assign weights like:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!IUCo!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F54941e66-8412-4aa0-9be5-40e314496c83_484x396.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!IUCo!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F54941e66-8412-4aa0-9be5-40e314496c83_484x396.png 424w, https://substackcdn.com/image/fetch/$s_!IUCo!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F54941e66-8412-4aa0-9be5-40e314496c83_484x396.png 848w, https://substackcdn.com/image/fetch/$s_!IUCo!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F54941e66-8412-4aa0-9be5-40e314496c83_484x396.png 1272w, https://substackcdn.com/image/fetch/$s_!IUCo!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F54941e66-8412-4aa0-9be5-40e314496c83_484x396.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!IUCo!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F54941e66-8412-4aa0-9be5-40e314496c83_484x396.png" width="484" height="396" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/54941e66-8412-4aa0-9be5-40e314496c83_484x396.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:false,&quot;imageSize&quot;:&quot;normal&quot;,&quot;height&quot;:396,&quot;width&quot;:484,&quot;resizeWidth&quot;:484,&quot;bytes&quot;:26010,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://notebook.mubbie.dev/i/195629229?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F54941e66-8412-4aa0-9be5-40e314496c83_484x396.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:&quot;center&quot;,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!IUCo!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F54941e66-8412-4aa0-9be5-40e314496c83_484x396.png 424w, https://substackcdn.com/image/fetch/$s_!IUCo!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F54941e66-8412-4aa0-9be5-40e314496c83_484x396.png 848w, https://substackcdn.com/image/fetch/$s_!IUCo!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F54941e66-8412-4aa0-9be5-40e314496c83_484x396.png 1272w, https://substackcdn.com/image/fetch/$s_!IUCo!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F54941e66-8412-4aa0-9be5-40e314496c83_484x396.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>The model has figured out that &#8220;it&#8221; most likely refers to &#8220;cat&#8221;, so &#8220;cat&#8221; gets the lion&#8217;s share of the attention.</p><h4>Step 4: Use the weights to blend the values.</h4><p>Now we have a weight for every token in the input. The final step is to multiply each <strong>Value</strong> by its weight and add them all up:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\text{output(it)} = 0.72 \\cdot V(\\text{cat}) + 0.12 \\cdot V(\\text{mat}) + 0.10 \\cdot V(\\text{tired}) + \\cdots&quot;,&quot;id&quot;:&quot;VKQWOGSQZR&quot;}" data-component-name="LatexBlockToDOM"></div><p>The result isn&#8217;t a single vector for the whole sentence, but rather an output vector <em>per token</em>. Each token gets its own context-aware version of itself, updated using information from the tokens it attended to. The token &#8220;it&#8221; now carries information that&#8217;s heavily influenced by &#8220;cat,&#8221; because that&#8217;s what the attention weights determined was most relevant.</p><p>This gives us the full equation:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\mathrm{Attention}(Q, K, V) = \\mathrm{softmax}\\!\\left(\\frac{QK^{T}}{\\sqrt{d_k}}\\right)V&quot;,&quot;id&quot;:&quot;RENOBKPQUA&quot;}" data-component-name="LatexBlockToDOM"></div><p>Hence, we have the four steps written as one expression. <strong>Score, scale, normalize, blend.</strong></p><p>If you want to see what it looks like in code, here&#8217;s a simplified version in Python using <a href="https://numpy.org/">numpy</a>:</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;python&quot;,&quot;nodeId&quot;:&quot;2fb59213-8fed-4f62-ab3d-032d262c2aa5&quot;}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-python">import numpy as np

def attention(Q, K, V):
    d_k = K.shape[-1]
    scores = Q @ K.T                # Step 1: dot product (relevance scores)
    scores = scores / np.sqrt(d_k)  # Step 2: scale down
    weights = softmax(scores)       # Step 3: convert to weights (0 to 1, sum to 1)
    output = weights @ V            # Step 4: weighted blend of values
    return output
</code></pre></div><p>These four steps are deceptively simple when laid out like this, but arriving at this formula took years of research, failed experiments, and the combined effort of dozens of researchers building on each other&#8217;s work. The simplicity of the final result is a testament to how much hard work it took to get there. Now let&#8217;s see what happens when you put it to work.</p><h3>Self-Attention: Every Word Queries Every Other Word</h3><p>Here is where things get clever. In the library analogy, we imagined one researcher walking in with one question. But in a Transformer, every word in the input is the researcher. Every single token forms its own Query and asks, &#8220;What in this sentence is relevant to <em>me</em>?&#8221; At the same time, every token offers up its Key and its Value to all the other tokens. And all of this happens simultaneously, in parallel, for every token in the input.</p><p>This is called <a href="https://sebastianraschka.com/blog/2023/self-attention-from-scratch.html">self-attention</a> (sometimes called intra-attention), and it is the mechanism that makes Transformers tick. The &#8220;self&#8221; part means that the Queries, Keys, and Values all come from the same sequence. The model is not looking at some external source of information. It is looking at <em>itself</em>, figuring out the internal relationships between its own tokens.</p><p>Let&#8217;s walk through what this looks like with a concrete example. Take this sentence:</p><blockquote><p><em>&#8220;The cat sat on the mat because <strong>it</strong> was tired.&#8221;</em></p></blockquote><p>When the model is processing the token &#8220;it,&#8221; it needs to figure out what &#8220;it&#8221; refers to. Is it the cat? The mat? Something else? With self-attention, the token &#8220;it&#8221; produces a Query vector. Every other token produces a Key vector. The model compares the Query for &#8220;it&#8221; against all of these Keys using dot products, and the score between &#8220;it&#8221; and &#8220;cat&#8221; ends up being high because the model has <a href="https://jalammar.github.io/illustrated-transformer/">learned representations</a> where these tokens are closely related in this context. The score with &#8220;mat&#8221; is lower. Similarly with &#8220;the&#8221; or &#8220;on.&#8221;</p><p>After softmax, the attention weights might look something like this:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Pf2g!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd1e32d46-ee6b-46fb-9752-3d1fe06cfec7_502x486.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Pf2g!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd1e32d46-ee6b-46fb-9752-3d1fe06cfec7_502x486.png 424w, https://substackcdn.com/image/fetch/$s_!Pf2g!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd1e32d46-ee6b-46fb-9752-3d1fe06cfec7_502x486.png 848w, https://substackcdn.com/image/fetch/$s_!Pf2g!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd1e32d46-ee6b-46fb-9752-3d1fe06cfec7_502x486.png 1272w, https://substackcdn.com/image/fetch/$s_!Pf2g!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd1e32d46-ee6b-46fb-9752-3d1fe06cfec7_502x486.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Pf2g!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd1e32d46-ee6b-46fb-9752-3d1fe06cfec7_502x486.png" width="502" height="486" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/d1e32d46-ee6b-46fb-9752-3d1fe06cfec7_502x486.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:486,&quot;width&quot;:502,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:31885,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://notebook.mubbie.dev/i/195629229?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd1e32d46-ee6b-46fb-9752-3d1fe06cfec7_502x486.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Pf2g!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd1e32d46-ee6b-46fb-9752-3d1fe06cfec7_502x486.png 424w, https://substackcdn.com/image/fetch/$s_!Pf2g!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd1e32d46-ee6b-46fb-9752-3d1fe06cfec7_502x486.png 848w, https://substackcdn.com/image/fetch/$s_!Pf2g!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd1e32d46-ee6b-46fb-9752-3d1fe06cfec7_502x486.png 1272w, https://substackcdn.com/image/fetch/$s_!Pf2g!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd1e32d46-ee6b-46fb-9752-3d1fe06cfec7_502x486.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>So the output vector for &#8220;it&#8221; becomes heavily influenced by the Value vector of &#8220;cat.&#8221; In plain English, the model has updated the representation of &#8220;it&#8221; to carry information from &#8220;cat.&#8221; This resembles what linguists call <a href="https://nlp.stanford.edu/projects/coref.shtml">coreference resolution</a>, the problem of determining what a pronoun refers to in a text. The remarkable thing is that Transformers often learn to do this kind of behavior implicitly, just from training on large amounts of text.</p><p>And here is the part that matters most for performance. Remember how RNNs had to pass information step by step through the hidden state? If &#8220;cat&#8221; is 10 words away from &#8220;it,&#8221; the RNN needs 10 sequential steps (with 10 chances to lose information along the way) to connect them. With self-attention, the path length between <em>any</em> two tokens is <em>O(1)</em>, meaning constant. It does not matter if the two words are next to each other or 500 tokens apart. The attention mechanism connects them directly in a single step. This is one of the key advantages highlighted in <a href="https://arxiv.org/abs/1706.03762">Table 1 of the original paper</a>, where self-attention achieves <em>O(1) </em>maximum path length compared to <em>O(n)</em> for recurrent layers. To understand more about the notation, you can read about Big-O <a href="https://medium.com/free-code-camp/big-o-notation-simply-explained-with-illustrations-and-video-87d5a71c0174">here</a>.</p><p>The tradeoff is computational cost. That <em>n &#215; n</em> attention matrix means self-attention scales quadratically with sequence length (<em>O(n&#178; &#183; d)</em> per layer). For short and medium sequences, this is fine, and the parallelism more than makes up for it. For very long sequences (tens of thousands of tokens), this becomes expensive, which is a big part of why <a href="https://www.c-sharpcorner.com/article/why-are-large-language-models-llms-so-expensive/">running LLMs costs so much</a>. There is a large and ongoing research effort to make attention more efficient. A good overview is this <a href="https://arxiv.org/abs/2009.06732">survey on efficient Transformers</a>, and implementations like <a href="https://arxiv.org/abs/2205.14135">FlashAttention</a> have made significant progress on the practical side by optimizing how attention runs on GPUs. But for the original Transformer and most models you interact with today, the full <em>n &#215; n</em> attention is what runs under the hood.</p><p>One last thing before we move on. Self-attention by itself has no built-in notion of word order. The attention scores are computed purely from the content of the vectors, not from where they appear in the sentence. That is exactly why we added positional encodings back in the <a href="https://mubbie.github.io/2026/04/26/chatgpt-doesnt-think-it-oays-attention.html#the-building-blocks">building blocks section</a>. Without them, &#8220;The cat sat on the mat&#8221; and &#8220;mat the on sat cat the&#8221; would produce identical attention patterns. Positional encodings give the model the ordering information it needs so that attention can focus on <em>what</em> matters while still knowing <em>where</em> everything is.</p><h3>Multi-Head Attention: More Than One Perspective</h3><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!6FaB!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fece47221-24dc-4f92-bf7f-af5e1e78e6a5_720x656.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!6FaB!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fece47221-24dc-4f92-bf7f-af5e1e78e6a5_720x656.jpeg 424w, https://substackcdn.com/image/fetch/$s_!6FaB!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fece47221-24dc-4f92-bf7f-af5e1e78e6a5_720x656.jpeg 848w, https://substackcdn.com/image/fetch/$s_!6FaB!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fece47221-24dc-4f92-bf7f-af5e1e78e6a5_720x656.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!6FaB!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fece47221-24dc-4f92-bf7f-af5e1e78e6a5_720x656.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!6FaB!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fece47221-24dc-4f92-bf7f-af5e1e78e6a5_720x656.jpeg" width="720" height="656" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/ece47221-24dc-4f92-bf7f-af5e1e78e6a5_720x656.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:656,&quot;width&quot;:720,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:42492,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://notebook.mubbie.dev/i/195629229?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fece47221-24dc-4f92-bf7f-af5e1e78e6a5_720x656.jpeg&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!6FaB!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fece47221-24dc-4f92-bf7f-af5e1e78e6a5_720x656.jpeg 424w, https://substackcdn.com/image/fetch/$s_!6FaB!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fece47221-24dc-4f92-bf7f-af5e1e78e6a5_720x656.jpeg 848w, https://substackcdn.com/image/fetch/$s_!6FaB!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fece47221-24dc-4f92-bf7f-af5e1e78e6a5_720x656.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!6FaB!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fece47221-24dc-4f92-bf7f-af5e1e78e6a5_720x656.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>So we have self-attention. Every token can attend to every other token and produce a context-aware output. That is powerful on its own. But there is a problem.</p><p>A single attention head computes one set of attention weights. That means each token gets one &#8220;opinion&#8221; about what is relevant. But language is complicated. When you read a sentence, multiple things are going on at the same time. Consider:</p><blockquote><p><em>&#8220;The cat sat on the mat because it was tired.&#8221;</em></p></blockquote><p>To fully understand this sentence, you need to track several different kinds of relationships simultaneously:</p><ul><li><p><strong>Grammar:</strong> &#8220;cat&#8221; is the subject, &#8220;sat&#8221; is the verb; they need to agree.</p></li><li><p><strong>Reference:</strong> &#8220;it&#8221; refers to &#8220;cat,&#8221; not &#8220;mat.&#8221;</p></li><li><p><strong>Proximity:</strong> &#8220;on&#8221; relates to &#8220;mat&#8221; (what it sat on) and &#8220;sat&#8221; (the action).</p></li></ul><p>A single attention head must represent all these different relationships using a single attention pattern. That is a lot to ask. It is like asking one person to read a sentence, track its grammar, meaning, and structure, and report back with a single answer. The <a href="https://arxiv.org/abs/1706.03762">original paper</a> describes this limitation as &#8220;averaging inhibits&#8221; the model&#8217;s ability to attend to information from different representation subspaces.</p><p>As you can tell, that would be challenging. So the solution is to ask several people rather than just one.</p><h4>How It Works</h4><p>Multi-head attention runs multiple attention functions in parallel, each one independently learning to focus on a different type of relationship. The <a href="https://arxiv.org/abs/1706.03762">original Transformer paper</a> uses 8 heads (so 8 parallel attention functions), but other models use different numbers (12, 16, 32, etc.).</p><p>Here is how it works step by step:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!xbMb!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F06c5e345-7ac5-4564-a730-c1d1909af196_742x877.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!xbMb!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F06c5e345-7ac5-4564-a730-c1d1909af196_742x877.png 424w, https://substackcdn.com/image/fetch/$s_!xbMb!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F06c5e345-7ac5-4564-a730-c1d1909af196_742x877.png 848w, https://substackcdn.com/image/fetch/$s_!xbMb!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F06c5e345-7ac5-4564-a730-c1d1909af196_742x877.png 1272w, https://substackcdn.com/image/fetch/$s_!xbMb!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F06c5e345-7ac5-4564-a730-c1d1909af196_742x877.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!xbMb!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F06c5e345-7ac5-4564-a730-c1d1909af196_742x877.png" width="742" height="877" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/06c5e345-7ac5-4564-a730-c1d1909af196_742x877.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:877,&quot;width&quot;:742,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:62791,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://notebook.mubbie.dev/i/195629229?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F06c5e345-7ac5-4564-a730-c1d1909af196_742x877.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!xbMb!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F06c5e345-7ac5-4564-a730-c1d1909af196_742x877.png 424w, https://substackcdn.com/image/fetch/$s_!xbMb!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F06c5e345-7ac5-4564-a730-c1d1909af196_742x877.png 848w, https://substackcdn.com/image/fetch/$s_!xbMb!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F06c5e345-7ac5-4564-a730-c1d1909af196_742x877.png 1272w, https://substackcdn.com/image/fetch/$s_!xbMb!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F06c5e345-7ac5-4564-a730-c1d1909af196_742x877.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Image Source: <a href="https://xkcd.com/">XKCD</a></em></p><ol><li><p><strong>Project into smaller spaces.</strong> For each head, the model takes the input vectors and projects them into a smaller set of Q, K, and V vectors using learned <a href="https://mathworld.wolfram.com/LinearTransformation.html">linear transformations</a> (basically learned weight matrices). If the model dimension is 512 and there are 8 heads, each head works with vectors of size <em>512 / 8 = 64</em>. This is where the Q, K, and V vectors actually get created. Each head learns <em>its own</em> set of projection weights, which means each head learns to &#8220;look at&#8221; the input differently.</p></li><li><p><strong>Run attention independently.</strong> Each head takes its own Q, K, and V and runs the same attention calculation we covered earlier (dot product, scale, softmax, blend) and produces its own output.</p></li><li><p><strong>Concatenate and project back.</strong> The outputs from all 8 heads are concatenated (stuck together side by side) into a single long vector. Then a final linear transformation projects it back to the original model dimension.</p></li></ol><p>In equation form:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\text{MultiHead}(Q, K, V) = \\text{Concat}(\\text{head}_1, \\ldots, \\text{head}_h) \\cdot W^O&quot;,&quot;id&quot;:&quot;AOXUGZFZUD&quot;}" data-component-name="LatexBlockToDOM"></div><p>where each head is:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\text{head}_i = \\text{Attention}(QW_i^Q,\\ KW_i^K,\\ VW_i^V)&quot;,&quot;id&quot;:&quot;EJEUUAMAYK&quot;}" data-component-name="LatexBlockToDOM"></div><p>The <em>W&#7522;_Q</em>, <em>W&#7522;_K</em>, and <em>W&#7522;_V</em> are the learned projection matrices for head <em>i</em>. They are what allow each head to develop its own &#8220;perspective&#8221; on the input. <em>W&#7484;</em> is the final output projection that combines everything back together.</p><p>Here is a simplified code version (note that real implementations are more efficient, projecting once and reshaping rather than looping, but this captures the logic clearly):</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;python&quot;,&quot;nodeId&quot;:&quot;eff61902-9f07-4d4d-bb81-1e3119504a51&quot;}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-python">def multi_head_attention(Q, K, V, W_q, W_k, W_v, W_o, num_heads):
    heads = []
    for i in range(num_heads):
        Q_i = Q @ W_q[i]           # project Q for this head
        K_i = K @ W_k[i]           # project K for this head
        V_i = V @ W_v[i]           # project V for this head
        head_i = attention(Q_i, K_i, V_i)  # run attention
        heads.append(head_i)
    
    concatenated = concat(heads)   # stick all outputs together
    output = concatenated @ W_o    # project back to model dimension
    return output
</code></pre></div><h4>What the Heads Actually Learn</h4><p>The key insight is that because each head has its own learned projections, different heads end up specializing in different things. The model is not told what to specialize in. This happens naturally during training.</p><p>The attention visualizations in the original paper (Figures 3, 4, and 5) show this clearly. For the sentence &#8220;The Law will never be perfect, but its application should be just,&#8221; different heads in layer 5 learned very different behaviors:</p><ul><li><p>One head learned to connect &#8220;its&#8221; to &#8220;Law&#8221; (resolving what &#8220;its&#8221; refers to).</p></li><li><p>Another head learned to track the overall syntactic structure of the sentence.</p></li><li><p>Yet another seemed to focus on adjacent word relationships.</p></li></ul><p>Nobody programmed these behaviors. The heads figured them out on their own because having multiple specialized perspectives is much more effective than having one general-purpose perspective. <a href="https://jalammar.github.io/illustrated-transformer/">Jay Alammar&#8217;s illustrated guide</a> has great visualizations of this if you want to see more examples.</p><h4>Why Not Just Use a Bigger Single Head?</h4><p>You might wonder why we don&#8217;t just make one attention head bigger instead of using 8 smaller ones. The paper actually tested this (see <a href="https://arxiv.org/abs/1706.03762">Table 3, rows (A)</a>). Single-head attention performed about 0.9 <a href="https://learn.microsoft.com/en-us/azure/ai-services/translator/custom-translator/concepts/bleu-score">BLEU (Bilingual Evaluation Understudy), which measures the quality of generated text,</a> points worse than the best multi-head configuration, even when the total computation was kept the same. Interestingly, too many heads also hurt performance. 8 heads turned out to be a sweet spot for their model.</p><p>The reason multi-head works better is that a single head, no matter how big, produces a single set of attention weights. It has to <em>average</em> across all the different types of relationships. Multi-head attention avoids this by giving each head the freedom to specialize, and then combining their outputs. It is like the difference between asking one generalist and asking a team of specialists.</p><h4>A Note on Cost</h4><p>You might worry that running 8 attention functions is 8 times more expensive. It is not. Because each head operates on vectors of dimension <em>d_model / h </em>(64 instead of 512 in the base model), the total computational cost is roughly the same as running a single attention head with the full dimension. You get the benefit of multiple perspectives without paying extra. This is pointed out in <a href="https://arxiv.org/abs/1706.03762">Section 3.2.2 of the original paper</a>.</p><h3>Positional Encoding: Teaching the Model Word Order</h3><p>We touched on this briefly in the <a href="https://mubbie.github.io/2026/04/26/chatgpt-doesnt-think-it-oays-attention.html#the-building-blocks">building blocks section</a>, but it warrants a closer look.</p><p>Here is the problem again. Self-attention computes scores based purely on the <em>content</em> of the vectors. It does not care where a token appears in the sequence. Without any positional information, the model would have no way to tell apart &#8220;the cat chased the dog&#8221; and &#8220;the dog chased the cat.&#8221; They contain the same tokens, so as far as attention is concerned, they look identical. Obviously, those sentences mean very different things.</p><p>RNNs did not have this problem because they processed tokens in order. Position was baked into the architecture. But the Transformer threw out sequential processing in favor of parallelism, so it needs another way to know where things are.</p><p>The solution is to add a <a href="https://kazemnejad.com/blog/transformer_architecture_positional_encoding/">positional encoding</a> to each token&#8217;s embedding before feeding it into the model. The positional encoding is a vector of the same size as the embedding, and you simply add them together element by element:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;H_0 = X + P&quot;,&quot;id&quot;:&quot;BVBQZPGCZF&quot;}" data-component-name="LatexBlockToDOM"></div><p>where <em>X </em>is the token embedding and <em>P </em>is the positional encoding. If your sequence has <em>n </em>tokens, then <em>X </em>is an <em>n &#215; d_model</em> table of embeddings and <em>P </em>is an <em>n &#215; d_model</em> table of positional encodings. You add them row by row, so each token&#8217;s vector ends up carrying information about both <em>what</em> the token is and <em>where</em> it appears.</p><h4>How the Original Paper Does It</h4><p>The authors of &#8220;<a href="https://arxiv.org/abs/1706.03762">Attention Is All You Need</a>&#8221; used sine and cosine functions at different frequencies to generate positional encodings. The formulas are:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;PE_{(pos, 2i)} = \\sin\\left(\\frac{pos}{10000^{2i/d_{model}}}\\right)&quot;,&quot;id&quot;:&quot;AWCVCVUJZA&quot;}" data-component-name="LatexBlockToDOM"></div><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;PE_{(pos, 2i+1)} = \\cos\\left(\\frac{pos}{10000^{2i/d_{model}}}\\right)&quot;,&quot;id&quot;:&quot;LSURVDLDDL&quot;}" data-component-name="LatexBlockToDOM"></div><p>where <em>pos</em> is the position in the sequence (0, 1, 2, &#8230;) and <em>i </em>is the dimension index.</p><p>You do not need to memorize these formulas. The only thing that matters is that every position gets a unique pattern of numbers.</p><p>That said, the intuition behind them is actually straightforward. Think of it like an <a href="https://en.wikipedia.org/wiki/Odometer">odometer</a> in a car. The rightmost digit changes fastest (every mile), the next digit changes every 10 miles, the next every 100 miles, and so on. Each &#8220;digit&#8221; cycles at a different rate, so every mileage reading is unique.</p><p>Sinusoidal positional encodings work the same way. Each dimension of the encoding oscillates at a different frequency. The early dimensions cycle quickly (changing significantly between adjacent positions), while the later dimensions cycle slowly (changing gradually over long stretches of the sequence). The combination of all these frequencies at different rates gives every position a unique &#8220;fingerprint.&#8221;</p><p>This design has a nice property: for any fixed <em>k </em>distance between two positions, the positional encoding of <em>pos + k</em> can be expressed as a <a href="https://blog.timodenk.com/linear-relationships-in-the-transformers-positional-encoding/">linear function</a> of the encoding at <em>pos</em>. This means the model can potentially learn to attend by <em>relative</em> position (how far apart two tokens are) rather than just absolute position (what position number each one has).</p><h4>Do You Have to Use Sinusoids?</h4><p>No. The paper also experimented with <a href="https://arxiv.org/abs/1705.03122">learned positional embeddings</a> (where the model learns a separate vector for each position during training, similar to how it learns token embeddings) and found that both approaches produced nearly identical results (see <a href="https://arxiv.org/abs/1706.03762">Table 3, row (E)</a>).</p><p>The authors chose sinusoidal encodings because they hypothesized that it would allow the model to generalize to sequence lengths longer than anything it saw during training. Since the sine and cosine functions are defined for any position, the model does not encounter the &#8220;I&#8217;ve never seen position 5001&#8221; problem that a learned embedding table would.</p><p>In practice, many modern Transformer models use entirely different approaches. For instance, <a href="https://arxiv.org/abs/2104.09864">Rotary Position Embeddings (RoPE)</a> have become popular in recent LLMs because they encode relative position directly into the attention computation. But the core idea remains the same: the model needs <em>some</em> way to know where tokens are, and positional encodings provide that.</p><div><hr></div><h3>Putting It All Together: The Full Transformer Architecture</h3><p>We now have all the pieces. Let&#8217;s see how they fit together.</p><p>The Transformer follows an <a href="https://arxiv.org/abs/1706.03762">encoder-decoder structure</a>, which was common in sequence-to-sequence models before it. The encoder reads the input (for example, a French sentence) and builds a rich representation of it. The decoder takes that representation and generates the output (the English translation) one token at a time.</p><p>What makes the Transformer different is <em>how</em> the encoder and decoder are built. Instead of recurrent layers, they are built entirely from the components we&#8217;re learning about in this post.</p><p>Let&#8217;s walk through each part.</p><h4>The Encoder</h4><p>The encoder is a stack of <em>N = 6 </em>identical layers (in the base model). Each layer has two sub-layers:</p><ol><li><p><strong>Multi-head self-attention.</strong> Every token in the input attends to every other token, exactly as we described. This is where the model builds context-aware representations.</p></li><li><p><strong>A position-wise feed-forward network.</strong> After attention gathers information from across the sequence, this network processes each token independently. It consists of two linear transformations with a <a href="https://machinelearningmastery.com/rectified-linear-activation-function-for-deep-learning-neural-networks/">ReLU activation</a> in between:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\text{FFN}(x) = \\max(0,\\ xW_1 + b_1)W_2 + b_2&quot;,&quot;id&quot;:&quot;IBJJSZESDA&quot;}" data-component-name="LatexBlockToDOM"></div></li></ol><p>You can think of the division of labor this way: attention figures out <em>what information to gather</em> from other tokens, and the feed-forward network figures out <em>what to do with</em> that gathered information. The feed-forward network applies the same transformation to each token position independently, but it uses different learned parameters at each layer. In the base model, the input and output dimensions are <em>d_model = 512</em>, and the inner layer has a dimension of <em>d_ff = 2048</em>.</p><p>Each of these two sub-layers also has two additional components wrapped around it:</p><p><strong>Residual connections.</strong> The output of each sub-layer is added back to its input before moving on. In other words, the model computes <em>x + SubLayer(x)</em> rather than just <em>SubLayer(x)</em>. This idea comes from <a href="https://arxiv.org/abs/1512.03385">deep residual networks (ResNets)</a>, and it solves a practical problem: in deep networks (with many layers), information can get lost or distorted as it passes through layer after layer. By adding the input back to the output, the model always has access to the original information. If a layer does not learn anything useful, the residual connection lets the signal pass through unchanged rather than getting corrupted. Think of it like keeping a photocopy of a document before editing it. If the edits make things worse, you still have the original.</p><p><strong><a href="https://arxiv.org/abs/1607.06450">Layer normalization</a>.</strong> After each residual connection, the model normalizes the values to keep them in a stable range. Without normalization, the numbers flowing through the network can gradually grow very large or very small as they pass through layer after layer, making training unstable. Layer norm keeps things well-behaved.</p><p>So the full operation for each sub-layer is:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\text{output} = \\text{LayerNorm}(x + \\text{SubLayer}(x))&quot;,&quot;id&quot;:&quot;NILGIFPPOC&quot;}" data-component-name="LatexBlockToDOM"></div><p>Stack 6 of these layers on top of each other, and that is the encoder. The input tokens go in at the bottom (after embedding and positional encoding), flow through all 6 layers, and what comes out at the top is a set of context-aware representations, one per token, that capture the meaning of the entire input sequence.</p><h4>The Decoder</h4><p>The decoder is also a stack of <em>N = 6 </em>identical layers, but each layer has <em>three</em> sub-layers instead of two:</p><ol><li><p><strong>Masked multi-head self-attention.</strong> This is the same self-attention as in the encoder, with one crucial difference: masking. When the model is generating output, it produces tokens one at a time, left to right. When predicting token 5, it should only see tokens 1 through 4. It must not be able to peek at tokens 6, 7, 8, and beyond, because those have not been generated yet. The mask enforces this by setting all &#8220;illegal&#8221; attention scores (positions to the right of the current position) to a very large negative number (conceptually &#8722;&#8734;) before the softmax step. Since softmax of a very large negative number is essentially 0, those future positions get zero attention weight, effectively making them invisible. This is what makes the model <a href="https://huggingface.co/docs/transformers/en/glossary#autoregressive">autoregressive</a>, meaning it generates one token at a time based on what came before.</p></li><li><p><strong>Cross-attention (encoder-decoder attention).</strong> This is the layer that connects the decoder to the encoder. The Queries come from the decoder (from the previous decoder layer&#8217;s output), but the Keys and Values come from the <em>encoder&#8217;s</em> output. This allows every decoder position to attend to all positions in the input sequence. It is how the decoder &#8220;reads&#8221; the original input. For example, when translating a French sentence into English, the decoder looks back at the French to decide which English word to produce next. This mimics the traditional encoder-decoder attention from older <a href="https://arxiv.org/abs/1409.3215">sequence-to-sequence models</a>, but uses multi-head attention instead of simpler mechanisms.</p></li><li><p><strong>A position-wise feed-forward network.</strong> Same as in the encoder.</p></li></ol><p>Each sub-layer again has residual connections and layer normalization wrapped around it, just like in the encoder.</p><h4>The Three Types of Attention</h4><p>It is worth pausing to note that the Transformer uses multi-head attention in three distinct ways:</p><ol><li><p><strong>Encoder self-attention.</strong> Every token in the input attends to every other input token. No masking. This builds a rich representation of the input.</p></li><li><p><strong>Decoder masked self-attention.</strong> Every token in the output attends to previous output tokens only. Masking prevents looking ahead. This maintains the autoregressive property.</p></li><li><p><strong>Cross-attention.</strong> The decoder attends to the encoder&#8217;s output. Queries from the decoder, Keys, and Values from the encoder. This is the bridge between input and output.</p></li></ol><p>These three uses of the same mechanism are one of the elegant aspects of the Transformer design. The same multi-head attention operation, applied in different configurations, handles input understanding, output generation, and input-output connection.</p><h4>Embeddings and the Final Output</h4><p>At the very bottom of both the encoder and decoder, input tokens are converted to vectors through the embedding layer and combined with positional encodings, as we covered in the <a href="https://mubbie.github.io/2026/04/26/chatgpt-doesnt-think-it-oays-attention.html#the-building-blocks">building blocks section</a>.</p><p>At the very top of the decoder, the output vectors need to be converted back into actual words (or more precisely, token probabilities). This is done with a linear layer followed by a <a href="https://developers.google.com/machine-learning/crash-course/neural-networks/multi-class">softmax function</a>:</p><div class="latex-rendered" data-attrs="{&quot;persistentExpression&quot;:&quot;\\text{probabilities} = \\text{softmax}(\\text{decoder_output} \\cdot W_{vocab})&quot;,&quot;id&quot;:&quot;RUYLDFBKQN&quot;}" data-component-name="LatexBlockToDOM"></div><p>This produces a probability distribution over the entire vocabulary. The model picks the token with the highest probability (or <a href="https://towardsdatascience.com/how-to-sample-from-language-models-682bceb97277/">samples from the distribution</a>) as its prediction.</p><p>One interesting detail from the paper: the same weight matrix is shared between the two embedding layers (encoder input and decoder input) and the pre-softmax linear transformation. This <a href="https://arxiv.org/abs/1608.05859">weight tying</a> reduces the total number of parameters and was found to work well in practice.</p><h4>Seeing It All Together</h4><p>If you want to see this full architecture in action, the <a href="https://poloclub.github.io/transformer-explainer/">Transformer Explainer</a> from Georgia Tech&#8217;s Polo Club is an excellent interactive tool. You can type in different inputs and watch how tokens flow through embeddings, attention layers, and feed-forward networks in real time. I highly recommend spending some time with it.</p><p>The full architecture from the original paper looks like this:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!jzDA!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2aa0ea20-3c96-4dd1-aef1-d2d30b3bee0a_2872x2282.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!jzDA!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2aa0ea20-3c96-4dd1-aef1-d2d30b3bee0a_2872x2282.png 424w, https://substackcdn.com/image/fetch/$s_!jzDA!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2aa0ea20-3c96-4dd1-aef1-d2d30b3bee0a_2872x2282.png 848w, https://substackcdn.com/image/fetch/$s_!jzDA!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2aa0ea20-3c96-4dd1-aef1-d2d30b3bee0a_2872x2282.png 1272w, https://substackcdn.com/image/fetch/$s_!jzDA!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2aa0ea20-3c96-4dd1-aef1-d2d30b3bee0a_2872x2282.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!jzDA!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2aa0ea20-3c96-4dd1-aef1-d2d30b3bee0a_2872x2282.png" width="1456" height="1157" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/2aa0ea20-3c96-4dd1-aef1-d2d30b3bee0a_2872x2282.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1157,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:572319,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://notebook.mubbie.dev/i/195629229?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2aa0ea20-3c96-4dd1-aef1-d2d30b3bee0a_2872x2282.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!jzDA!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2aa0ea20-3c96-4dd1-aef1-d2d30b3bee0a_2872x2282.png 424w, https://substackcdn.com/image/fetch/$s_!jzDA!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2aa0ea20-3c96-4dd1-aef1-d2d30b3bee0a_2872x2282.png 848w, https://substackcdn.com/image/fetch/$s_!jzDA!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2aa0ea20-3c96-4dd1-aef1-d2d30b3bee0a_2872x2282.png 1272w, https://substackcdn.com/image/fetch/$s_!jzDA!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2aa0ea20-3c96-4dd1-aef1-d2d30b3bee0a_2872x2282.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>To summarize the data flow:</p><ol><li><p>Input tokens get embedded and combined with positional encodings.</p></li><li><p>They pass through 6 encoder layers (self-attention + feed-forward, with residual connections and layer norm at each step).</p></li><li><p>The encoder&#8217;s final output is sent to the decoder.</p></li><li><p>The decoder takes the previously generated output tokens (also embedded with positional encodings), passes them through 6 decoder layers (masked self-attention + cross-attention + feed-forward).</p></li><li><p>The decoder&#8217;s output goes through a linear layer and softmax to produce the next token prediction.</p></li><li><p>That predicted token gets fed back in as input, and steps 4 and 5 repeat until the sequence is complete.</p></li></ol><p>And that is the Transformer. Every component we covered in this section (attention, multi-head attention, positional encoding, feed-forward networks, residual connections, layer normalization) works together to create a model that can process entire sequences in parallel and learn complex relationships between tokens at any distance.</p><p>The original &#8220;Attention Is All You Need&#8221; paper tested this architecture on machine translation and <a href="https://arxiv.org/abs/1706.03762">achieved state-of-the-art results</a> on both English-to-German and English-to-French benchmarks, while training significantly faster than the RNN-based models it replaced. The big Transformer model achieved a <a href="https://learn.microsoft.com/en-us/azure/ai-services/translator/custom-translator/concepts/bleu-score">BLEU</a> score of 28.4 on English-to-German (see <a href="https://arxiv.org/abs/1706.03762">Table 2</a>), improving over the previous best by more than 2 points, after training for just 3.5 days on 8 GPUs.</p><p>But the real impact of the Transformer turned out to be far greater than that of machine translation. Researchers soon realized that parts of this architecture could be repurposed for a much more ambitious goal: building a general-purpose language model. That is where GPT comes in.</p><div><hr></div><h2>Act 3: From Transformer to GPT</h2><h3>The Big Bet: Decoder Only</h3><p>The Transformer we just walked through was designed for translation. The encoder reads a sentence in one language, and the decoder writes it in another. It is a sequence-to-sequence machine, and it was very good at that job.</p><p>But in 2018, researchers at <a href="https://openai.com/index/language-unsupervised/">OpenAI</a> made a surprising and bold bet: what if you threw away the encoder entirely and just kept the decoder?</p><p>This bet gave birth to <a href="https://cdn.openai.com/research-covers/language-unsupervised/language_understanding_paper.pdf">GPT</a> (Generative Pre-trained Transformer). It doesn&#8217;t have an encoder, and there is no cross-attention, only a stack of decoder layers with masked self-attention, trained only to <strong>predict the next token.</strong></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!aWv2!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7e0b5fd3-e62c-42ab-af98-43e077ac1602_2870x1898.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!aWv2!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7e0b5fd3-e62c-42ab-af98-43e077ac1602_2870x1898.png 424w, https://substackcdn.com/image/fetch/$s_!aWv2!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7e0b5fd3-e62c-42ab-af98-43e077ac1602_2870x1898.png 848w, https://substackcdn.com/image/fetch/$s_!aWv2!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7e0b5fd3-e62c-42ab-af98-43e077ac1602_2870x1898.png 1272w, https://substackcdn.com/image/fetch/$s_!aWv2!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7e0b5fd3-e62c-42ab-af98-43e077ac1602_2870x1898.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!aWv2!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7e0b5fd3-e62c-42ab-af98-43e077ac1602_2870x1898.png" width="1456" height="963" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/7e0b5fd3-e62c-42ab-af98-43e077ac1602_2870x1898.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:963,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:572113,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://notebook.mubbie.dev/i/195629229?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7e0b5fd3-e62c-42ab-af98-43e077ac1602_2870x1898.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!aWv2!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7e0b5fd3-e62c-42ab-af98-43e077ac1602_2870x1898.png 424w, https://substackcdn.com/image/fetch/$s_!aWv2!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7e0b5fd3-e62c-42ab-af98-43e077ac1602_2870x1898.png 848w, https://substackcdn.com/image/fetch/$s_!aWv2!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7e0b5fd3-e62c-42ab-af98-43e077ac1602_2870x1898.png 1272w, https://substackcdn.com/image/fetch/$s_!aWv2!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7e0b5fd3-e62c-42ab-af98-43e077ac1602_2870x1898.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>It takes a sequence of tokens, and the model tries to predict the next token. Hence, the training objective is: given everything that came before, what is the most likely next token?</p><p>However, to predict the next word well, the model has to <em>implicitly</em> learn an enormous amount about language. It has to learn grammar (so sentences are well-formed), facts (so statements are plausible), reasoning patterns (so arguments follow logically), style and tone (so text sounds natural), and much more. All of these things are baked into the patterns of which words tend to follow which other words in real text.</p><p>The training process works like this:</p><ol><li><p>Take a large chunk of text (from the internet, books, articles, code, etc.).</p></li><li><p>For each position in the text, the model sees all the tokens before that position and tries to predict the token at that position.</p></li><li><p>Compare the model&#8217;s prediction to the actual token. Compute a <a href="https://ml-cheatsheet.readthedocs.io/en/latest/loss_functions.html">loss</a> (how wrong was it?).</p></li><li><p>Use <a href="https://www.3blue1brown.com/lessons/backpropagation">backpropagation</a> to adjust the model&#8217;s weights slightly in the direction that would have made the prediction better.</p></li><li><p>Repeat this billions of times, across billions of tokens.</p></li></ol><p>This is called <a href="https://www.emergentmind.com/topics/autoregressive-large-language-models-ar-llms">autoregressive language modeling</a>. &#8220;Autoregressive&#8221; just means each prediction depends on the previous ones. The model generates one token, feeds it back in as input, generates the next token, feeds that back in, and so on.</p><p>The architectural changes from the full Transformer are minimal:</p><ul><li><p><strong>No encoder.</strong> There is no separate &#8220;input understanding&#8221; module. The decoder <em>is</em> the whole model.</p></li><li><p><strong>No cross-attention.</strong> Since there is no encoder, the cross-attention layer (where the decoder would read the encoder&#8217;s output) is removed. Each decoder layer now has just two sub-layers: masked self-attention and a feed-forward network.</p></li><li><p><strong>Masked self-attention only.</strong> The model can never look at future tokens. When predicting token 5, it can only see tokens 1 through 4. This is the same masking we described in the decoder section, and it is essential for autoregressive generation.</p></li></ul><p>That is the entire GPT architecture. The <a href="https://cdn.openai.com/research-covers/language-unsupervised/language_understanding_paper.pdf">original GPT paper</a> (Radford et al., 2018) used 12 decoder layers with a model dimension of 768, trained on <a href="https://www.computerhope.com/jargon/b/bookcorpus.htm">BooksCorpus</a> (roughly 7,000 books). It was solid proof of concept. What came next was much bigger.</p><h3>How GPT Actually Generates Text</h3><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!PdlL!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F156aacf5-afee-4ed3-968f-1fd117839584_1400x933.webp" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!PdlL!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F156aacf5-afee-4ed3-968f-1fd117839584_1400x933.webp 424w, https://substackcdn.com/image/fetch/$s_!PdlL!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F156aacf5-afee-4ed3-968f-1fd117839584_1400x933.webp 848w, https://substackcdn.com/image/fetch/$s_!PdlL!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F156aacf5-afee-4ed3-968f-1fd117839584_1400x933.webp 1272w, https://substackcdn.com/image/fetch/$s_!PdlL!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F156aacf5-afee-4ed3-968f-1fd117839584_1400x933.webp 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!PdlL!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F156aacf5-afee-4ed3-968f-1fd117839584_1400x933.webp" width="1400" height="933" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/156aacf5-afee-4ed3-968f-1fd117839584_1400x933.webp&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:933,&quot;width&quot;:1400,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:158392,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/webp&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://notebook.mubbie.dev/i/195629229?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F156aacf5-afee-4ed3-968f-1fd117839584_1400x933.webp&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!PdlL!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F156aacf5-afee-4ed3-968f-1fd117839584_1400x933.webp 424w, https://substackcdn.com/image/fetch/$s_!PdlL!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F156aacf5-afee-4ed3-968f-1fd117839584_1400x933.webp 848w, https://substackcdn.com/image/fetch/$s_!PdlL!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F156aacf5-afee-4ed3-968f-1fd117839584_1400x933.webp 1272w, https://substackcdn.com/image/fetch/$s_!PdlL!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F156aacf5-afee-4ed3-968f-1fd117839584_1400x933.webp 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Understanding how GPT generates text is important because this is what is happening every time you use ChatGPT, Claude, Gemini, Grok, or any other AI chat tool. It all comes down to a loop.</p><p>Let&#8217;s walk through a concrete example. You type:</p><blockquote><p><em>&#8220;The capital of France is&#8221;</em></p></blockquote><p>Here is what happens:</p><p><strong>Step 1.</strong> The model tokenizes your input: [&#8220;The&#8221;, &#8220;capital&#8221;, &#8220;of&#8221;, &#8220;France&#8221;, &#8220;is&#8221;]. Each token gets embedded, positional encodings are added, and the resulting vectors flow through all the decoder layers (masked self-attention, feed-forward, residual connections, layer norm, just like we covered).</p><p><strong>Step 2.</strong> At the output, the model produces a probability distribution over its entire vocabulary (which could be 50,000+ tokens). Each token in the vocabulary gets a probability. &#8220;Paris&#8221; might get 0.92. &#8220;London&#8221; might get 0.03. &#8220;Berlin&#8221; might get 0.01. And so on.</p><p><strong>Step 3.</strong> The model selects a token from this distribution. In the simplest case, it picks the one with the highest probability: &#8220;Paris.&#8221;</p><p><strong>Step 4.</strong> That token gets appended to the input. Now the sequence is [&#8220;The&#8221;, &#8220;capital&#8221;, &#8220;of&#8221;, &#8220;France&#8221;, &#8220;is&#8221;, &#8220;Paris&#8221;]. The whole process conceptually repeats from Step 1 with this new, longer sequence (in practice, real systems use a technique called <a href="https://medium.com/@joaolages/kv-caching-explained-276520203249">KV caching</a> to reuse computations from previous steps and avoid redundant work). The model predicts the next token, maybe &#8220;.&#8221; or &#8220;,&#8221; and so on.</p><p><strong>Step 5.</strong> This loop continues until the model produces a special <a href="https://www.natebrake.com/blog/end-of-sequence-explained">end-of-sequence token</a>, or until it hits a maximum length limit.</p><p>Here is a simplified version in code:</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;python&quot;,&quot;nodeId&quot;:&quot;af9896d0-87ff-4f15-b856-86073878f480&quot;}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-python">def generate(model, prompt_tokens, max_new_tokens):
    tokens = prompt_tokens
    for _ in range(max_new_tokens):
        probabilities = model(tokens)          # forward pass through all layers
        next_token = sample(probabilities)      # pick a token
        tokens = tokens + [next_token]          # append to sequence
        if next_token == END_OF_SEQUENCE:
            break
    return tokens
</code></pre></div><p>If you want to see a real (but still readable) implementation of this, <a href="https://github.com/karpathy/minGPT">Karpathy&#8217;s minGPT</a> is about 300 lines of core code. It is a great way to see how simple the generation loop really is.</p><h4>Temperature: Controlling Creativity</h4><p>You might have noticed I said the model &#8220;selects a token from this distribution.&#8221; How it selects matters a lot, and this is controlled by a parameter called <a href="https://medium.com/@kelseyywang/a-comprehensive-guide-to-llm-temperature-%EF%B8%8F-363a40bbc91f">temperature</a>.</p><p><strong>Temperature = 0 (or very close to 0).</strong> The model always picks the single most likely token. This is deterministic so that you will get the same output every time for the same input. It tends to be more consistent, though not necessarily more correct, and can be repetitive.</p><p><strong>Temperature = 1.</strong> The model samples proportionally to the probabilities. If &#8220;Paris&#8221; has a 0.92 probability and &#8220;Lyon&#8221; has a 0.02 probability, there is a small but real chance it picks &#8220;Lyon.&#8221; This adds variety and creativity, but it can also lead to incoherent or surprising outputs.</p><p><strong>Temperature between 0 and 1.</strong> This is the sweet spot for most applications. The distribution is &#8220;sharpened&#8221; so high-probability tokens are even more favored, but there is still some randomness. Most AI tools you use operate somewhere in this range.</p><p>This is why you can ask ChatGPT the same question twice and get different answers. It is not &#8220;thinking differently&#8221; each time. The underlying probabilities remain the same, but random sampling selects different paths through the distribution.</p><h3>Pre-training: Learning from the Internet</h3><p>So, where does GPT get its knowledge? Pre-training is the process of training the model on a massive dataset of text before it is used for any specific task.</p><p>It&#8217;s an absurd amount of text. <a href="https://arxiv.org/abs/2005.14165">GPT-3</a>, for example, was trained on roughly 300 billion tokens drawn from a mix of sources such as filtered web pages (<a href="https://commoncrawl.org/">Common Crawl</a>), books, Wikipedia, and more. The model reads all of this text and learns to predict the next token, over and over, adjusting its weights with each example.</p><p>Through this process, the model picks up patterns at every level of language. It learns spelling and grammar (how words and sentences are typically formed). It learns facts (associations between entities and their properties, like &#8220;Paris is the capital of France&#8221;). It learns reasoning patterns (if A implies B and B implies C, then A implies C). It learns style and tone (how a legal document sounds different from a text message). All of this comes from the statistical regularities in the training data.</p><p>One important distinction, though, is that the model is not simply memorizing text. Most of what makes it useful is <a href="https://developers.google.com/machine-learning/crash-course/overfitting/generalization">generalization</a>, the ability to apply learned patterns to new inputs it has never seen before. When you ask it a question it has never encountered verbatim, it can still produce a reasonable answer because it has learned the <em>patterns</em> behind how questions like that tend to be answered. That said, models can and do memorize some sequences, especially ones that appear frequently in the training data. It is best to think of it as mostly pattern-learning with some memorization mixed in.</p><p>It is also worth briefly mentioning how the model sees text. As we covered in the <a href="https://mubbie.github.io/2026/04/26/chatgpt-doesnt-think-it-oays-attention.html#the-building-blocks">building blocks section</a>, models do not operate on whole words. They use <a href="https://www.geeksforgeeks.org/nlp/subword-tokenization-in-nlp/">subword tokenization</a> schemes like <a href="https://huggingface.co/learn/nlp-course/en/chapter6/5">Byte Pair Encoding (BPE)</a> to break text into smaller pieces:</p><ul><li><p>&#8220;unbelievable&#8221; might become [&#8220;un&#8221;, &#8220;believ&#8221;, &#8220;able&#8221;] (like we saw earlier)</p></li><li><p>&#8220;ChatGPT&#8221; might become something like [&#8220;Chat&#8221;, &#8220;G&#8221;, &#8220;PT&#8221;] (the exact split depends on the tokenizer)</p></li></ul><p>This lets the model represent unfamiliar or rare words by composing them from smaller pieces it has seen before.</p><p>Here is what to keep in mind heading into Act 4:</p><ul><li><p>Pre-training produces a <em>general-purpose</em> language model.</p></li><li><p>It can do many things (answer questions, write code, summarize text, translate languages), but it is not specifically optimized for any of them.</p></li><li><p>It is an incredibly capable autocomplete engine. However, you might ask it a question, and it might continue the text as if you were writing a webpage, generating more questions instead of an answer. Turning this raw capability into a helpful assistant requires additional training. That is where fine-tuning and RLHF come in.</p></li></ul><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!YVGT!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6b8aac46-aaf5-44b5-8046-1d57502fc549_2292x1234.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!YVGT!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6b8aac46-aaf5-44b5-8046-1d57502fc549_2292x1234.jpeg 424w, https://substackcdn.com/image/fetch/$s_!YVGT!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6b8aac46-aaf5-44b5-8046-1d57502fc549_2292x1234.jpeg 848w, https://substackcdn.com/image/fetch/$s_!YVGT!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6b8aac46-aaf5-44b5-8046-1d57502fc549_2292x1234.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!YVGT!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6b8aac46-aaf5-44b5-8046-1d57502fc549_2292x1234.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!YVGT!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6b8aac46-aaf5-44b5-8046-1d57502fc549_2292x1234.jpeg" width="1456" height="784" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/6b8aac46-aaf5-44b5-8046-1d57502fc549_2292x1234.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:784,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:147919,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://notebook.mubbie.dev/i/195629229?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6b8aac46-aaf5-44b5-8046-1d57502fc549_2292x1234.jpeg&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!YVGT!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6b8aac46-aaf5-44b5-8046-1d57502fc549_2292x1234.jpeg 424w, https://substackcdn.com/image/fetch/$s_!YVGT!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6b8aac46-aaf5-44b5-8046-1d57502fc549_2292x1234.jpeg 848w, https://substackcdn.com/image/fetch/$s_!YVGT!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6b8aac46-aaf5-44b5-8046-1d57502fc549_2292x1234.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!YVGT!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6b8aac46-aaf5-44b5-8046-1d57502fc549_2292x1234.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Image Source: <a href="https://cameronrwolfe.substack.com/">Deep (Learning) Focus</a></em></p><div><hr></div><h2>Act 4: From GPT to LLMs</h2><h3>Scaling Laws: Bigger Is (Predictably) Better</h3><p>GPT-1 started as a proof-of-concept. It showed that a decoder-only Transformer could learn useful language patterns simply by predicting the next word in a sentence. At 117 million parameters and 7,000 books&#8217; worth of data, it was a solid achievement for 2018, even if it wasn&#8217;t a total game-changer yet.</p><p>What followed was a bit of a turning point for the industry: the discovery that AI performance improves predictably as you increase the model size, data, and training time.</p><p>This was formalized in a 2020 paper from OpenAI called <a href="https://arxiv.org/abs/2001.08361">&#8220;Scaling Laws for Neural Language Models&#8221;</a> (Kaplan et al.). The key finding was that the model&#8217;s loss (how bad its predictions are) decreases as a <a href="https://en.wikipedia.org/wiki/Power_law">power law</a> along three axes:</p><ul><li><p><strong>Model size</strong> (number of parameters)</p></li><li><p><strong>Dataset size</strong> (number of tokens trained on)</p></li><li><p><strong>Compute</strong> (total amount of training computation)</p></li></ul><p>What surprised people was how smooth and predictable this relationship is. You can plot model size on one axis and performance on the other, and it forms a clean curve. This means you can roughly forecast how good a model will be <em>before you finish training it</em>, just by knowing how big it is and how much data and compute you are throwing at it. It is not a guarantee, but it held up well enough to guide billions of dollars of investment.</p><p>The GPT family illustrates this scaling trajectory clearly:</p><p>ModelYearParametersNotable Milestone<a href="https://cdn.openai.com/research-covers/language-unsupervised/language_understanding_paper.pdf">GPT-1</a>2018117MProof of concept<a href="https://cdn.openai.com/better-language-models/language_models_are_unsupervised_multitask_learners.pdf">GPT-2</a>20191.5BDeemed <a href="https://openai.com/index/better-language-models/">&#8220;too dangerous to release&#8221;</a> at the time<a href="https://arxiv.org/abs/2005.14165">GPT-3</a>2020175B<a href="https://www.ibm.com/think/topics/few-shot-learning">Few-shot learning</a> emerges<a href="https://arxiv.org/abs/2303.08774">GPT-4</a>2023UndisclosedMultimodal (text + images)</p><p>The important thing to notice is that there was no fundamental architectural change between GPT-1 and GPT-3. It is the same decoder-only Transformer, trained with the same next-token prediction objective. The difference is scale. More parameters, more data, more compute. And with that scale came capabilities that nobody explicitly programmed.</p><p>GPT-2 could generate surprisingly coherent paragraphs. GPT-3 could do things like answer questions, write code, and translate between languages, all without being specifically trained for those tasks. You could show it a few examples of a task (this is called <a href="https://arxiv.org/abs/2005.14165">few-shot learning</a>), and it would figure out the pattern and apply it. This ability appeared as the model got bigger. It was not there in GPT-1, barely there in GPT-2, and clearly present in GPT-3.</p><p>But scale alone does not make a model <em>helpful.</em> A scaled-up GPT is still fundamentally an autocomplete engine. It predicts what text is likely to come next, not what text would be <em>useful</em> to a human. Getting from &#8220;impressive autocomplete&#8221; to &#8220;helpful assistant&#8221; required a different kind of training.</p><h3>Fine-Tuning and RLHF: From Autocomplete to Assistant</h3><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!vUl0!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F09ec9724-8fca-4db6-9f62-5c7ca8c67ed7_1176x638.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!vUl0!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F09ec9724-8fca-4db6-9f62-5c7ca8c67ed7_1176x638.jpeg 424w, https://substackcdn.com/image/fetch/$s_!vUl0!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F09ec9724-8fca-4db6-9f62-5c7ca8c67ed7_1176x638.jpeg 848w, https://substackcdn.com/image/fetch/$s_!vUl0!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F09ec9724-8fca-4db6-9f62-5c7ca8c67ed7_1176x638.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!vUl0!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F09ec9724-8fca-4db6-9f62-5c7ca8c67ed7_1176x638.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!vUl0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F09ec9724-8fca-4db6-9f62-5c7ca8c67ed7_1176x638.jpeg" width="1176" height="638" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/09ec9724-8fca-4db6-9f62-5c7ca8c67ed7_1176x638.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:638,&quot;width&quot;:1176,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:161483,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://notebook.mubbie.dev/i/195629229?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F09ec9724-8fca-4db6-9f62-5c7ca8c67ed7_1176x638.jpeg&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!vUl0!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F09ec9724-8fca-4db6-9f62-5c7ca8c67ed7_1176x638.jpeg 424w, https://substackcdn.com/image/fetch/$s_!vUl0!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F09ec9724-8fca-4db6-9f62-5c7ca8c67ed7_1176x638.jpeg 848w, https://substackcdn.com/image/fetch/$s_!vUl0!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F09ec9724-8fca-4db6-9f62-5c7ca8c67ed7_1176x638.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!vUl0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F09ec9724-8fca-4db6-9f62-5c7ca8c67ed7_1176x638.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Image Source: <a href="https://cameronrwolfe.substack.com/">Deep (Learning) Focus</a></em></p><p>Imagine you have a friend who has read the entire internet. They know an extraordinary amount about everything. But if you ask them a question, instead of answering it, they just continue your sentence as if they were writing the rest of a webpage. You ask &#8220;What is the capital of France?&#8221; and they respond with &#8220;What is the capital of Germany? What is the capital of Spain?&#8221; because on the internet, questions are often followed by more questions.</p><p>That is what a raw pre-trained GPT model is like. It has the knowledge, but it has not learned <em>how to be helpful.</em></p><p>The fix comes in two stages.</p><h4>Stage 1: Supervised Fine-Tuning (SFT)</h4><p>The first stage is conceptually simple. You hire human annotators and have them write examples of ideal behavior. They write prompts (&#8220;Explain quantum computing to a 5-year-old&#8221;) and then write high-quality responses. You then train the model on these examples so it learns to <em>imitate</em> the style, format, and helpfulness of the human-written responses.</p><p>This is called <a href="https://cameronrwolfe.substack.com/p/understanding-and-using-supervised">Supervised Fine-Tuning</a> (SFT). It uses the same training process as pre-training (predict the next token, compute the loss, backpropagate), but the training data is now curated conversations rather than raw internet text.</p><p>SFT gets you a long way there. After this stage, the model starts responding to questions with actual answers instead of continuing text. But it still has problems. It might give plausible-sounding but wrong responses. It might be unnecessarily verbose. It might produce outputs that are technically correct but not what the user actually wanted. These are subtle quality issues that are hard to capture with simple &#8220;predict the next token&#8221; training.</p><h4>Stage 2: RLHF (Reinforcement Learning from Human Feedback)</h4><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!KPAx!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fead5ebee-d843-4585-9dc2-b8ae3cfab38e_2396x466.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!KPAx!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fead5ebee-d843-4585-9dc2-b8ae3cfab38e_2396x466.jpeg 424w, https://substackcdn.com/image/fetch/$s_!KPAx!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fead5ebee-d843-4585-9dc2-b8ae3cfab38e_2396x466.jpeg 848w, https://substackcdn.com/image/fetch/$s_!KPAx!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fead5ebee-d843-4585-9dc2-b8ae3cfab38e_2396x466.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!KPAx!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fead5ebee-d843-4585-9dc2-b8ae3cfab38e_2396x466.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!KPAx!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fead5ebee-d843-4585-9dc2-b8ae3cfab38e_2396x466.jpeg" width="1456" height="283" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/ead5ebee-d843-4585-9dc2-b8ae3cfab38e_2396x466.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:283,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:97379,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://notebook.mubbie.dev/i/195629229?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fead5ebee-d843-4585-9dc2-b8ae3cfab38e_2396x466.jpeg&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!KPAx!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fead5ebee-d843-4585-9dc2-b8ae3cfab38e_2396x466.jpeg 424w, https://substackcdn.com/image/fetch/$s_!KPAx!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fead5ebee-d843-4585-9dc2-b8ae3cfab38e_2396x466.jpeg 848w, https://substackcdn.com/image/fetch/$s_!KPAx!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fead5ebee-d843-4585-9dc2-b8ae3cfab38e_2396x466.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!KPAx!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fead5ebee-d843-4585-9dc2-b8ae3cfab38e_2396x466.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p><em>Image Source: <a href="https://cameronrwolfe.substack.com/">Deep (Learning) Focus</a></em></p><p>This is the innovation that made <a href="https://openai.com/index/chatgpt/">ChatGPT</a> feel different from everything before it.</p><p>The idea, <a href="https://arxiv.org/abs/2203.02155">introduced by OpenAI in their InstructGPT paper</a> (Ouyang et al., 2022), is to train the model using human <em>preferences</em> rather than human-written examples. Here is how it works:</p><ol><li><p><strong>Generate multiple responses.</strong> For a given prompt, the model generates several different responses.</p></li><li><p><strong>Humans rank them.</strong> Human raters look at the responses and rank them from best to worst. Which response is most helpful? Most accurate? Most safe? These rankings capture subtle quality differences that are hard to specify in a rule.</p></li><li><p><strong>Train a reward model.</strong> Using those rankings, you train a separate model (called a <a href="https://huggingface.co/blog/rlhf">reward model</a>) to predict which responses humans would prefer. The reward model learns to assign higher scores to responses that humans rated highly.</p></li><li><p><strong>Fine-tune with reinforcement learning.</strong> Finally, you use <a href="https://huggingface.co/blog/rlhf">reinforcement learning</a> (specifically an algorithm called <a href="https://openai.com/index/openai-baselines-ppo/">PPO</a>, or Proximal Policy Optimization) to adjust the language model so it generates responses that score highly with the reward model. The language model is essentially learning to produce outputs that humans would prefer.</p></li></ol><p>In simple terms: SFT teaches the model <em>what</em> a good response looks like by showing examples. RLHF teaches the model <em>why</em> one response is better than another by learning from human preferences. Together, they turn a raw language model into something that feels like a helpful, conversational assistant.</p><p>This is a big part of why ChatGPT felt like such a step change when it launched in November 2022. The jump was not only about model size. A large part of the &#8220;ChatGPT feel&#8221; came from post-training with human feedback. OpenAI <a href="https://openai.com/index/chatgpt/">describes ChatGPT</a> as a sibling model to InstructGPT, which was trained with RLHF to follow instructions. The model had been trained to <em>care about what humans want</em>, not just to predict the next word.</p><p>It is worth noting that RLHF is not the only approach. Anthropic (the company behind <a href="https://www.anthropic.com/claude">Claude</a>) has developed related techniques called <a href="https://labelbox.com/guides/reinforcement-learning-from-ai-feedback-rlaif/">RLAIF</a> (Reinforcement Learning from AI Feedback) and <a href="https://arxiv.org/abs/2212.08073">Constitutional AI</a>, which supplement or replace human feedback in parts of the process. <a href="https://arxiv.org/abs/2307.09288">Meta</a> and <a href="https://arxiv.org/abs/2305.18290">Google</a> have also explored related alignment approaches. The details differ, but the core idea is the same: additional training after pre-training to make the model more helpful, harmless, and honest.</p><h3>Reasoning: The &#8220;Thinking&#8221; Part</h3><p>Remember the title of this post? &#8220;ChatGPT Doesn&#8217;t Think. It Pays Attention.&#8221; That is true in a fundamental sense. Everything under the hood is still attention and next-token prediction. But recent developments have pushed these models into territory that looks a lot like thinking, and it is worth understanding how.</p><h4>Chain-of-Thought Prompting</h4><p>In 2022, researchers at Google <a href="https://arxiv.org/abs/2201.11903">published a paper</a> (Wei et al.) showing that if you prompt a language model to &#8220;think step by step,&#8221; its performance on complex reasoning tasks improves dramatically. This technique is called <a href="https://www.promptingguide.ai/techniques/cot">chain-of-thought (CoT) prompting</a>.</p><p>For example, if you ask a model, &#8220;If a store has 3 apples and someone buys 2, then the store gets a delivery of 7 more, how many apples does the store have?&#8221; and just ask for the answer, it might get it wrong. But if you prompt it to work through the problem step by step, it performs much better because each intermediate step (3 - 2 = 1, then 1 + 7 = 8) becomes part of the generated text, and the model can attend to its own reasoning as it goes.</p><p>One way to think about this is that the model is doing its &#8220;reasoning&#8221; in the form of text it can read back. The intermediate steps are tokens, and the model attends to those tokens when generating the next ones. It is still next-token prediction, but applied to a reasoning trace that the model itself is producing. From this perspective, it is paying more attention rather than thinking in the way humans do.</p><h4>Reasoning Models</h4><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!gNVl!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8f49c2a4-d74c-4cd6-8649-63e14eb7fefa_900x600.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!gNVl!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8f49c2a4-d74c-4cd6-8649-63e14eb7fefa_900x600.png 424w, https://substackcdn.com/image/fetch/$s_!gNVl!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8f49c2a4-d74c-4cd6-8649-63e14eb7fefa_900x600.png 848w, https://substackcdn.com/image/fetch/$s_!gNVl!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8f49c2a4-d74c-4cd6-8649-63e14eb7fefa_900x600.png 1272w, https://substackcdn.com/image/fetch/$s_!gNVl!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8f49c2a4-d74c-4cd6-8649-63e14eb7fefa_900x600.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!gNVl!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8f49c2a4-d74c-4cd6-8649-63e14eb7fefa_900x600.png" width="900" height="600" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/8f49c2a4-d74c-4cd6-8649-63e14eb7fefa_900x600.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:600,&quot;width&quot;:900,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:354436,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://notebook.mubbie.dev/i/195629229?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8f49c2a4-d74c-4cd6-8649-63e14eb7fefa_900x600.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!gNVl!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8f49c2a4-d74c-4cd6-8649-63e14eb7fefa_900x600.png 424w, https://substackcdn.com/image/fetch/$s_!gNVl!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8f49c2a4-d74c-4cd6-8649-63e14eb7fefa_900x600.png 848w, https://substackcdn.com/image/fetch/$s_!gNVl!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8f49c2a4-d74c-4cd6-8649-63e14eb7fefa_900x600.png 1272w, https://substackcdn.com/image/fetch/$s_!gNVl!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8f49c2a4-d74c-4cd6-8649-63e14eb7fefa_900x600.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Image Source: <a href="https://www.csail.mit.edu/news/reasoning-skills-large-language-models-are-often-overestimated">MIT CSAIL</a></em></p><p>More recently, companies have taken this idea further by training models specifically to produce extended reasoning chains before giving a final answer. <a href="https://openai.com/index/learning-to-reason-with-llms/">OpenAI&#8217;s o1 and o3 models</a> and <a href="https://docs.anthropic.com/en/docs/build-with-claude/extended-thinking">Anthropic&#8217;s Claude with extended thinking</a> are examples.</p><p>These models are trained (often using reinforcement learning) to generate long internal reasoning traces. When you ask a complex question, the model might produce hundreds or thousands of tokens of step-by-step reasoning before arriving at an answer. The final answer tends to be significantly more accurate than what a model would produce if it tried to answer immediately.</p><p>The underlying mechanism is still attention and token prediction. But by training the model to produce intermediate reasoning steps, you effectively give it more &#8220;compute&#8221; at inference time. Instead of going directly from question to answer in a single pass, the model takes many steps, and each step can attend to all previous reasoning. It is similar to giving someone scratch paper for a math test versus asking them to do it all in their head.</p><h4>So Does It Think?</h4><p>This is one of the most debated questions in AI. The honest answer is it depends on what you mean by &#8220;think.&#8221;</p><p>If thinking means manipulating symbols step by step to arrive at a conclusion, then yes, reasoning models do something that looks like that. If thinking requires genuine understanding, consciousness, or intentionality, then no, these models are still doing sophisticated pattern matching over tokens.</p><p>What is clear is that these techniques produce better results on complex tasks. Whether you call it &#8220;thinking&#8221; or &#8220;structured token prediction&#8221; is partly a philosophical question. The practical reality is that the same core mechanism (attention + next-token prediction) can be steered to produce remarkably capable reasoning behavior through the right training and prompting techniques.</p><p>And that ties back to the title; even when the model &#8220;thinks,&#8221; it is paying attention.</p><h3>Emergent Abilities and the LLM Paradigm</h3><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!s3Y6!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F49502335-d1bf-47d6-9990-fc23ff51955a_800x672.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!s3Y6!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F49502335-d1bf-47d6-9990-fc23ff51955a_800x672.png 424w, https://substackcdn.com/image/fetch/$s_!s3Y6!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F49502335-d1bf-47d6-9990-fc23ff51955a_800x672.png 848w, https://substackcdn.com/image/fetch/$s_!s3Y6!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F49502335-d1bf-47d6-9990-fc23ff51955a_800x672.png 1272w, https://substackcdn.com/image/fetch/$s_!s3Y6!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F49502335-d1bf-47d6-9990-fc23ff51955a_800x672.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!s3Y6!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F49502335-d1bf-47d6-9990-fc23ff51955a_800x672.png" width="800" height="672" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/49502335-d1bf-47d6-9990-fc23ff51955a_800x672.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:672,&quot;width&quot;:800,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:230814,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://notebook.mubbie.dev/i/195629229?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F49502335-d1bf-47d6-9990-fc23ff51955a_800x672.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!s3Y6!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F49502335-d1bf-47d6-9990-fc23ff51955a_800x672.png 424w, https://substackcdn.com/image/fetch/$s_!s3Y6!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F49502335-d1bf-47d6-9990-fc23ff51955a_800x672.png 848w, https://substackcdn.com/image/fetch/$s_!s3Y6!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F49502335-d1bf-47d6-9990-fc23ff51955a_800x672.png 1272w, https://substackcdn.com/image/fetch/$s_!s3Y6!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F49502335-d1bf-47d6-9990-fc23ff51955a_800x672.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Something unexpected happened as language models got bigger. They started doing things that nobody explicitly trained them to do.</p><p>These are called <a href="https://arxiv.org/abs/2206.07682">emergent abilities</a> (Wei et al., 2022), and they are one of the more surprising and interesting phenomena in modern AI. An emergent ability is a capability that is not present in smaller models but appears once the model reaches a certain scale. On some benchmarks, it can look like the ability turns on suddenly, almost like a <a href="https://en.wikipedia.org/wiki/Phase_transition">phase transition</a>, even though the underlying improvements may be more gradual than they first appear.</p><p>Examples include:</p><ul><li><p><strong>Few-shot learning.</strong> Show the model a few examples of a task it has never seen, and it figures out the pattern. GPT-3 could do this. GPT-2 mostly could not.</p></li><li><p><strong>Chain-of-thought reasoning.</strong> The step-by-step reasoning we just discussed only works well in models above a certain size.</p></li><li><p><strong>Code generation.</strong> Large models can write working code from natural language descriptions, even though they were trained primarily on text, not specifically on programming tasks.</p></li><li><p><strong>Translation between languages</strong> the model saw relatively little of during training.</p></li><li><p><strong>Arithmetic</strong> on numbers the model has never seen before (up to a point).</p></li></ul><p>What makes this surprising is that none of these abilities were explicitly part of the training objective. The model was just trained to predict the next token. But at sufficient scale, next-token prediction apparently requires learning representations so rich that these capabilities come along for free.</p><p>This has led to a paradigm shift in how people think about AI systems. Before LLMs, the standard approach was to build a separate model for each task: one model for translation, one for summarization, one for question answering, and one for sentiment analysis. Each one required its own architecture, training data, and engineering effort.</p><p>The LLM paradigm is different. You train one very large model on a general objective (predict the next token), then adapt it to specific tasks through prompting, fine-tuning, or RLHF. This is why companies like OpenAI, Anthropic, Google, and Meta have invested so heavily in building larger and larger models. The returns from scale have been extraordinary so far.</p><p>Of course, whether this paradigm will continue to hold is an open question. There is <a href="https://arxiv.org/abs/2304.15004">active debate</a> about whether emergent abilities are truly sudden or just artifacts of how we measure them. There are real <a href="https://arxiv.org/abs/2311.07911">limitations</a> to what these models can do (they can still hallucinate confidently, struggle with certain types of reasoning, and make basic factual errors). And the cost of training and running these models is enormous, raising questions about sustainability and access.</p><p>But the trajectory from 2017 to today is remarkable. A single architecture, the Transformer, built on a single mechanism, attention, has gone from improving machine translation to powering the most capable AI systems ever built. And it all started with a paper titled &#8220;Attention Is All You Need.&#8221;</p><div><hr></div><h2>Act 5: Tying It All Together</h2><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!OGfa!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4aaba0f6-93d4-4240-92a6-f350bf587db4_272x185.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!OGfa!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4aaba0f6-93d4-4240-92a6-f350bf587db4_272x185.jpeg 424w, https://substackcdn.com/image/fetch/$s_!OGfa!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4aaba0f6-93d4-4240-92a6-f350bf587db4_272x185.jpeg 848w, https://substackcdn.com/image/fetch/$s_!OGfa!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4aaba0f6-93d4-4240-92a6-f350bf587db4_272x185.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!OGfa!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4aaba0f6-93d4-4240-92a6-f350bf587db4_272x185.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!OGfa!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4aaba0f6-93d4-4240-92a6-f350bf587db4_272x185.jpeg" width="272" height="185" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/4aaba0f6-93d4-4240-92a6-f350bf587db4_272x185.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:185,&quot;width&quot;:272,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:10531,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://notebook.mubbie.dev/i/195629229?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4aaba0f6-93d4-4240-92a6-f350bf587db4_272x185.jpeg&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!OGfa!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4aaba0f6-93d4-4240-92a6-f350bf587db4_272x185.jpeg 424w, https://substackcdn.com/image/fetch/$s_!OGfa!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4aaba0f6-93d4-4240-92a6-f350bf587db4_272x185.jpeg 848w, https://substackcdn.com/image/fetch/$s_!OGfa!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4aaba0f6-93d4-4240-92a6-f350bf587db4_272x185.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!OGfa!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4aaba0f6-93d4-4240-92a6-f350bf587db4_272x185.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>We have covered a lot of ground. Let&#8217;s trace the full journey one more time.</p><p>It started with a problem. RNNs processed language one word at a time, struggling with long sequences and unable to take advantage of modern parallel hardware. Attention mechanisms helped, but they were bolted onto the sequential architecture rather than replacing it.</p><p>In 2017, a team of researchers at Google tried to find out what would happen if we dropped the sequential part and relied only on attention. The Transformer they built replaced recurrence entirely with self-attention, allowing every token to attend to every other token in a single step. With multi-head attention, they gave the model multiple perspectives on every word. And positional encodings preserved word order. On the other hand, residual connections and layer normalization kept training stable, and the final result was a model that could process entire sequences in parallel, learn long-range dependencies, and train significantly faster than anything before it.</p><p>Then came GPT, simplifying that architecture further. Researchers at OpenAI removed the encoder and cross-attention, relying only on the decoder stack, and trained it to predict the next token. The model also learned grammar, facts, reasoning, style, and more. Over time, we learned that as we scale up with more parameters and more data, we start to get capabilities that were never explicitly programmed. Finally, adding in fine-tuning and RLHF and we get a model that stops being a fancy autocomplete and starts acting like a helpful assistant.</p><p>Every time you talk to ChatGPT, Claude, Gemini, or any other AI assistant, this is what is happening under the hood. The input text gets turned into tokens, those tokens are embedded into vectors along with their positional information. Then they flow through layers of attention where every token attends to every other token, gathering context from across the entire input. Then the model predicts the next token. And the next. And the next. One token at a time, with each subsequent token informed by everything that came before.</p><p>It is attention, all the way down.</p><div><hr></div><p>Writing this post over the past few weeks has been a big learning experience for me. The thing that surprised me most is how simple the core ideas are after I started to understand them. None of the individual components is complicated on its own; what makes them powerful is how they compose together and what happens when you scale them up.</p><p>I also came away with a deeper appreciation of the researchers behind this work. It is easy to look at the logic and think it is obvious, but it took years of work, building on decades of research in neural networks, sequence modeling, computing, and optimization, to arrive at something that looks this clean.</p><p>If you want to go deeper, attached below are resources that I found most valuable while learning the material. And if this is the first article you are reading in this series, be on the lookout for the other posts on AI agents and coding tools like Claude Code or Codex, building on the foundation laid here. Thanks for reading. I hope this helped demystify what is going on inside the AI tools you use every day. If you have questions, feedback, or corrections, I would love to hear from you.</p><p>ChatGPT doesn&#8217;t think. It pays attention. Now you know how.</p><div><hr></div><h2>Resources</h2><h3>Interactive Tools</h3><ul><li><p><a href="https://poloclub.github.io/transformer-explainer/">Transformer Explainer</a> (Georgia Tech Polo Club) - Interactive visualization where you can watch attention and data flow through a Transformer in real time. Spend an hour with this.</p></li><li><p><a href="https://github.com/karpathy/minGPT">Karpathy&#8217;s minGPT</a> - A full GPT implementation in about 300 lines of Python.</p></li><li><p><a href="https://github.com/karpathy/nanoGPT">Karpathy&#8217;s nanoGPT</a> - More recent and minimal GPT training repo. Pairs well with his YouTube walkthrough linked below.</p></li><li><p><a href="https://github.com/poloclub/transformer-explainer">Transformer Explainer source code</a> - Source code for the Transformer Explainer tool.</p></li><li><p><a href="https://github.com/Nicolepcx/Transformers-in-Action">Transformers in Action code</a> - Code repository for the Transformers in Action book.</p></li><li><p><a href="https://arxiv.org/html/2601.04213v1">AnimatedLLM: Explaining LLMs with Interactive Visualizations</a>, <a href="https://animatedllm.github.io/">AnimatedLLM</a> - Understanding the mechanics of LLMs (Includes text generation and training)</p></li><li><p><a href="https://bbycroft.net/llm">LLM Visualization</a> - Interactive walkthrough of the internals of various LLMS such as nano-gpt, GPT-2, and GPT-3.</p></li></ul><h3>The Original Paper</h3><ul><li><p><a href="https://arxiv.org/abs/1706.03762">&#8220;Attention Is All You Need&#8221;</a> (Vaswani et al., 2017) - The paper that started it all. Worth reading even if you skip the math.</p></li></ul><h3>Video Explainers</h3><ul><li><p><a href="https://www.youtube.com/watch?v=LPZh9BOjkQs">3Blue1Brown: Large Language Models explained briefly</a> - Short visual intro to LLMs, chatbots, pretraining, and tokens.</p></li><li><p><a href="https://www.youtube.com/watch?v=wjZofJX0v4M">3Blue1Brown: But what is a GPT? Visual intro to Transformers</a> - Visual explanation of how GPT works from the ground up.</p></li><li><p><a href="https://www.youtube.com/watch?v=eMlx5fFNoYc">3Blue1Brown: Attention in Transformers, visually explained</a> - Step-by-step walkthrough of the attention mechanism.</p></li><li><p><a href="https://www.youtube.com/watch?v=KJtZARuO3JY">3Blue1Brown: Visualizing Transformers and Attention (full talk)</a> - Grant Sanderson&#8217;s full conference talk. More detailed than the shorter videos.</p></li><li><p><a href="https://www.youtube.com/watch?v=kCc8FmEb1nY">Andrej Karpathy: Let&#8217;s build GPT from scratch</a> - Two hours of building a GPT from scratch in code. Long but worth it.</p></li><li><p><a href="https://www.youtube.com/watch?v=7xTGNNLPyMI">Andrej Karpathy: Deep Dive into LLMs like ChatGPT</a> - General audience deep dive into LLM technology.</p></li><li><p><a href="https://www.youtube.com/watch?v=zxQyTK8quyY">StatQuest: Transformer Neural Networks, Clearly Explained</a> - Methodical, step-by-step walkthrough.</p></li><li><p><a href="https://www.youtube.com/watch?v=5sLYAQS9sWQ">IBM Technology: How Large Language Models Work</a> - Accessible overview from IBM.</p></li><li><p><a href="https://www.youtube.com/watch?v=ECR4oAwocjs">Polo Club: Transformers Explained Visually</a> - Video companion to the Transformer Explainer tool.</p></li><li><p><a href="https://www.youtube.com/watch?v=bCz4OMemCcA">Umar Jamil: Attention is All You Need (including math)</a> - Detailed walkthrough of the paper with math, inference, and training.</p></li><li><p><a href="https://www.youtube.com/watch?v=Pnd8bCJ4Z3A">Leon Petrou: Transformers, explained</a> - Another visual explanation of the architecture.</p></li></ul><h3>Further Reading</h3><ul><li><p><a href="https://jalammar.github.io/illustrated-transformer/">Jay Alammar: The Illustrated Transformer</a> - Visual guide to the Transformer with diagrams for every component.</p></li><li><p><a href="https://sebastianraschka.com/blog/2023/self-attention-from-scratch.html">Sebastian Raschka: Understanding Self-Attention from Scratch</a> - Code-first walkthrough of self-attention.</p></li><li><p><a href="https://lilianweng.github.io/posts/2023-01-27-the-transformer-family-v2/">Lilian Weng: The Transformer Family Version 2.0</a> - Comprehensive survey of Transformer variants and improvements.</p></li><li><p><a href="https://lilianweng.github.io/posts/2018-06-24-attention/">Lilian Weng: Attention? Attention!</a> - Thorough overview of attention mechanisms from basics to advanced variants.</p></li><li><p><a href="https://colah.github.io/posts/2015-08-Understanding-LSTMs/">Christopher Olah: Understanding LSTMs</a> - Classic post explaining LSTMs with diagrams. Good for understanding what came before Transformers.</p></li><li><p><a href="https://kazemnejad.com/blog/transformer_architecture_positional_encoding/">Amirhossein Kazemnejad: Transformer Architecture - The Positional Encoding</a> - Deep dive into positional encoding.</p></li><li><p><a href="https://www.manning.com/books/transformers-in-action">Transformers in Action</a> (Nicole Koenigstein, Manning) - Hands-on book for implementing Transformers.</p></li><li><p><a href="http://introml.mit.edu/notes/transformers.html">MIT 6.390: Introduction to Machine Learning - Transformers</a> - Lecture notes on Transformers from MIT.</p></li><li><p><a href="https://developers.google.com/machine-learning/crash-course/llm">Google ML Crash Course: Introduction to LLMs</a> - Google&#8217;s structured intro to large language models.</p></li><li><p><a href="https://huggingface.co/learn/llm-course/en/chapter1/4">Hugging Face LLM Course: How do Transformers work?</a> - Part of Hugging Face&#8217;s free LLM course.</p></li><li><p><a href="https://www.understandingai.org/p/large-language-models-explained-with">Understanding AI: Large language models, explained with a minimum of math and jargon</a> - Plain-language LLM explainer.</p></li><li><p><a href="https://blog.miguelgrinberg.com/post/how-llms-work-explained-without-math">Miguel Grinberg: How LLMs Work, Explained Without Math</a> - Another no-math explainer focused on intuition.</p></li><li><p><a href="https://www.freecodecamp.org/news/a-beginners-guide-to-large-language-models/">freeCodeCamp: A Beginner&#8217;s Guide to Large Language Models</a> - Beginner-friendly intro.</p></li><li><p><a href="https://www.ibm.com/think/topics/transformer-model">IBM: What is a Transformer Model?</a> - IBM&#8217;s overview of Transformers.</p></li><li><p><a href="https://www.ibm.com/think/topics/large-language-models">IBM: What are Large Language Models?</a> - IBM&#8217;s LLM overview.</p></li><li><p><a href="https://uit.stanford.edu/service/techtraining/ai-demystified/llm">Stanford: AI Demystified - LLMs</a> - Stanford&#8217;s introductory guide.</p></li><li><p><a href="https://news.mit.edu/2024/large-language-models-use-surprisingly-simple-mechanism-retrieve-stored-knowledge-0325">MIT News: Large language models use a surprisingly simple mechanism to retrieve stored knowledge</a> - Research on how LLMs retrieve facts internally.</p></li></ul><h3>Key Papers</h3><ul><li><p><a href="https://cdn.openai.com/research-covers/language-unsupervised/language_understanding_paper.pdf">GPT-1: Improving Language Understanding by Generative Pre-Training</a> (Radford et al., 2018)</p></li><li><p><a href="https://cdn.openai.com/better-language-models/language_models_are_unsupervised_multitask_learners.pdf">GPT-2: Language Models are Unsupervised Multitask Learners</a> (Radford et al., 2019)</p></li><li><p><a href="https://arxiv.org/abs/2005.14165">GPT-3: Language Models are Few-Shot Learners</a> (Brown et al., 2020)</p></li><li><p><a href="https://arxiv.org/abs/2303.08774">GPT-4 Technical Report</a> (OpenAI, 2023)</p></li><li><p><a href="https://arxiv.org/abs/2203.02155">InstructGPT: Training language models to follow instructions with human feedback</a> (Ouyang et al., 2022) - The RLHF paper behind ChatGPT.</p></li><li><p><a href="https://arxiv.org/abs/2001.08361">Scaling Laws for Neural Language Models</a> (Kaplan et al., 2020)</p></li><li><p><a href="https://arxiv.org/abs/2201.11903">Chain-of-Thought Prompting Elicits Reasoning in Large Language Models</a> (Wei et al., 2022)</p></li><li><p><a href="https://arxiv.org/abs/2206.07682">Emergent Abilities of Large Language Models</a> (Wei et al., 2022)</p></li><li><p><a href="https://arxiv.org/abs/2212.08073">Constitutional AI: Harmlessness from AI Feedback</a> (Bai et al., 2022) - Anthropic&#8217;s alignment approach.</p></li><li><p><a href="https://arxiv.org/abs/2307.09288">Llama 2: Open Foundation and Fine-Tuned Chat Models</a> (Touvron et al., 2023)</p></li><li><p><a href="https://arxiv.org/abs/1409.0473">Neural Machine Translation by Jointly Learning to Align and Translate</a> (Bahdanau et al., 2014) - The paper that introduced attention.</p></li><li><p><a href="https://arxiv.org/abs/1409.3215">Sequence to Sequence Learning with Neural Networks</a> (Sutskever et al., 2014) - The encoder-decoder paper.</p></li><li><p><a href="https://arxiv.org/abs/1512.03385">Deep Residual Learning for Image Recognition</a> (He et al., 2015) - Residual connections.</p></li><li><p><a href="https://arxiv.org/abs/1607.06450">Layer Normalization</a> (Ba et al., 2016)</p></li><li><p><a href="https://arxiv.org/abs/2104.09864">RoFormer: Enhanced Transformer with Rotary Position Embedding</a> (Su et al., 2021) - RoPE, used in many modern LLMs.</p></li><li><p><a href="https://arxiv.org/abs/2009.06732">Efficient Transformers: A Survey</a> (Tay et al., 2020)</p></li><li><p><a href="https://arxiv.org/abs/2205.14135">FlashAttention: Fast and Memory-Efficient Exact Attention</a> (Dao et al., 2022)</p></li><li><p><a href="https://arxiv.org/abs/2408.04619">Transformer Explainer: Interactive Learning of Text-Generative Models</a> (Cho et al., 2024)</p></li><li><p><a href="https://arxiv.org/abs/2304.15004">Are Emergent Abilities of Large Language Models a Mirage?</a> (Schaeffer et al., 2023)</p></li></ul><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://notebook.mubbie.dev/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Mubbie's Notebook! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[Getting Lean Before GTA 6]]></title><description><![CDATA[Notes on diet, exercise, and sustainable healthy habits]]></description><link>https://notebook.mubbie.dev/p/getting-lean-before-gta-6</link><guid isPermaLink="false">https://notebook.mubbie.dev/p/getting-lean-before-gta-6</guid><dc:creator><![CDATA[Mubarak Idoko]]></dc:creator><pubDate>Sat, 21 Feb 2026 18:19:33 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!9C-g!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F73760f93-ac83-4c58-90e7-7a6fc8fa1391_2250x2250.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<blockquote><p>&#8220;Even if it don&#8217;t benefit your goals, do some push-ups&#8230;&#8221; - <em>Kendrick Lamar</em></p></blockquote><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!lcKF!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4ce87cc3-d88e-4a22-be26-dd0a5e2efdb4_220x289.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!lcKF!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4ce87cc3-d88e-4a22-be26-dd0a5e2efdb4_220x289.png 424w, https://substackcdn.com/image/fetch/$s_!lcKF!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4ce87cc3-d88e-4a22-be26-dd0a5e2efdb4_220x289.png 848w, https://substackcdn.com/image/fetch/$s_!lcKF!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4ce87cc3-d88e-4a22-be26-dd0a5e2efdb4_220x289.png 1272w, https://substackcdn.com/image/fetch/$s_!lcKF!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4ce87cc3-d88e-4a22-be26-dd0a5e2efdb4_220x289.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!lcKF!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4ce87cc3-d88e-4a22-be26-dd0a5e2efdb4_220x289.png" width="220" height="289" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/4ce87cc3-d88e-4a22-be26-dd0a5e2efdb4_220x289.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:289,&quot;width&quot;:220,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:15379,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://mubbiesnotebook.substack.com/i/188729814?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4ce87cc3-d88e-4a22-be26-dd0a5e2efdb4_220x289.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!lcKF!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4ce87cc3-d88e-4a22-be26-dd0a5e2efdb4_220x289.png 424w, https://substackcdn.com/image/fetch/$s_!lcKF!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4ce87cc3-d88e-4a22-be26-dd0a5e2efdb4_220x289.png 848w, https://substackcdn.com/image/fetch/$s_!lcKF!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4ce87cc3-d88e-4a22-be26-dd0a5e2efdb4_220x289.png 1272w, https://substackcdn.com/image/fetch/$s_!lcKF!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4ce87cc3-d88e-4a22-be26-dd0a5e2efdb4_220x289.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Image Source: <a href="https://xkcd.com/">XKCD</a></em></p><h2>Introduction</h2><p>Around the middle of last year, I decided to go on a bulk as a way to gain muscle. This went on for a couple of months, and I gained about 25 pounds. I also made a few mistakes along the way: I stopped running and did very little cardio apart from soccer. I got busy at work and let my regular weight training slide.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://notebook.mubbie.dev/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Mubbie's Notebook! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p>By September, I was 230 pounds and feeling less and less like my normal self. I decided the bulk was enough &#8212; it was time to cut.</p><p>Over the next couple of months, I followed a disciplined cutting plan and learned a lot that could be helpful for anyone in a similar position. The biggest lesson was learning how to build healthy habits that are actually sustainable, rather than riding the ups and downs of gaining and losing weight.</p><p>Before I get into strategies and recommendations, I want to be upfront about something: the subject of weight loss and diet can be tricky. I strongly believe everyone can pursue better health regardless of their current size; whether that means losing weight, gaining weight, or maintaining. Wherever you are right now is a valid starting point, not a moral failing. My goal here is to share what worked for me and offer a useful starting point you can adapt to your own goals.</p><p>And yes, I&#8217;m going to lean into getting lean and building muscle. So consider this a practical guide for anyone like me who wants to get lean (and maybe a little shredded &#129310;&#127998;) before GTA 6 comes out (whenever that is)&#8230; and actually keep those gains.</p><h2>Setting the Stage (or Arranging the Gym)</h2><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!9C-g!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F73760f93-ac83-4c58-90e7-7a6fc8fa1391_2250x2250.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!9C-g!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F73760f93-ac83-4c58-90e7-7a6fc8fa1391_2250x2250.jpeg 424w, https://substackcdn.com/image/fetch/$s_!9C-g!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F73760f93-ac83-4c58-90e7-7a6fc8fa1391_2250x2250.jpeg 848w, https://substackcdn.com/image/fetch/$s_!9C-g!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F73760f93-ac83-4c58-90e7-7a6fc8fa1391_2250x2250.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!9C-g!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F73760f93-ac83-4c58-90e7-7a6fc8fa1391_2250x2250.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!9C-g!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F73760f93-ac83-4c58-90e7-7a6fc8fa1391_2250x2250.jpeg" width="1456" height="1456" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/73760f93-ac83-4c58-90e7-7a6fc8fa1391_2250x2250.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1456,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:663139,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://mubbiesnotebook.substack.com/i/188729814?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F73760f93-ac83-4c58-90e7-7a6fc8fa1391_2250x2250.jpeg&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!9C-g!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F73760f93-ac83-4c58-90e7-7a6fc8fa1391_2250x2250.jpeg 424w, https://substackcdn.com/image/fetch/$s_!9C-g!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F73760f93-ac83-4c58-90e7-7a6fc8fa1391_2250x2250.jpeg 848w, https://substackcdn.com/image/fetch/$s_!9C-g!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F73760f93-ac83-4c58-90e7-7a6fc8fa1391_2250x2250.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!9C-g!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F73760f93-ac83-4c58-90e7-7a6fc8fa1391_2250x2250.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Image Source: <a href="https://andyandersoncartoons.com/products/new-years-resolution-cartoon-gym">Andy Anderson Cartoons</a></em></p><p>Before we jump into strategies and plans, it&#8217;s worth establishing some concrete ideas: what it actually means to be lean, why health and sustainability matter more than extremes, and how to stay mindful of social media influence.</p><h3>Why Bother Getting Lean or Building Muscle?</h3><p>The simple answer is: it usually makes people healthier, and often more confident in their bodies (and yes, sometimes more attractive to others). But that&#8217;s vague, so here&#8217;s what I actually mean.</p><h4>Health</h4><p>Most bodies function best in a &#8220;middle zone.&#8221; That is, not too heavy or too light, but in a range where energy, hormones, mood, sleep, and performance tend to be more stable.</p><ul><li><p><strong>On the higher end</strong>, carrying a lot of extra body weight can make everyday movement harder, reduce endurance, and increase strain on joints. It can also make it easier to drift into a lifestyle where you move less, recover worse, and become more at risk for health issues (especially related to the heart).</p></li><li><p><strong>On the lower end</strong>, getting extremely lean can come with its own problems. When body fat gets too low (especially for long periods), the body can start treating life like a survival situation: energy drops, recovery gets worse, cravings go up, and brain fog can kick in. Hormones can also take a hit, and women may lose their menstrual cycle, while men can see testosterone drop. Plus, people at this level can feel cold, tired, and hungry all the time.</p></li></ul><p>That&#8217;s why the goal here isn&#8217;t to be &#8220;as lean as possible.&#8221; It&#8217;s to get lean enough to feel good, move well, perform well, and stay healthy.</p><p>This also means we don&#8217;t need to train like professional athletes. Basic guidelines like regular movement and aiming for ~150 minutes per week of moderate-intensity cardio are a great baseline. And adding strength training on top of that tends to compound the benefits, which takes us to our next section.</p><h4>Muscle</h4><p>Muscle matters because it&#8217;s the foundation of strength and stability (joints, posture, balance), movement (walking, stairs, lifting groceries, playing sports), and resilience (recovering from injury and staying capable as you get older).</p><p>Too little muscle is limiting. Too much muscle, especially when it&#8217;s pushed with performance-enhancing drugs, can come with tradeoffs, too. For most of us, the sweet spot is being strong enough to live well and move confidently, without making fitness our entire identity (and without sacrificing the rest of our lives to maintain it).</p><h4>Attractiveness</h4><p>Attraction is personal and cultural, and nobody owes anyone a certain look. That said, people often respond positively to signs of health such as energy, confidence, good posture, and the ability to move well. My take is that if you take care of your health, you tend to show up better in life, and that often translates socially, too.</p><p>So the goal of getting lean and building muscle, at least for me (and hopefully for others too), is to live longer, feel better day to day, be capable, and enjoy more of life without living at the extremes.</p><h3>Social Media and TV</h3><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!6fdY!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11cea313-eb44-4176-88ae-57d658d8ff75_400x512.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!6fdY!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11cea313-eb44-4176-88ae-57d658d8ff75_400x512.jpeg 424w, https://substackcdn.com/image/fetch/$s_!6fdY!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11cea313-eb44-4176-88ae-57d658d8ff75_400x512.jpeg 848w, https://substackcdn.com/image/fetch/$s_!6fdY!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11cea313-eb44-4176-88ae-57d658d8ff75_400x512.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!6fdY!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11cea313-eb44-4176-88ae-57d658d8ff75_400x512.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!6fdY!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11cea313-eb44-4176-88ae-57d658d8ff75_400x512.jpeg" width="400" height="512" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/11cea313-eb44-4176-88ae-57d658d8ff75_400x512.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:512,&quot;width&quot;:400,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:42058,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://mubbiesnotebook.substack.com/i/188729814?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11cea313-eb44-4176-88ae-57d658d8ff75_400x512.jpeg&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!6fdY!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11cea313-eb44-4176-88ae-57d658d8ff75_400x512.jpeg 424w, https://substackcdn.com/image/fetch/$s_!6fdY!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11cea313-eb44-4176-88ae-57d658d8ff75_400x512.jpeg 848w, https://substackcdn.com/image/fetch/$s_!6fdY!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11cea313-eb44-4176-88ae-57d658d8ff75_400x512.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!6fdY!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11cea313-eb44-4176-88ae-57d658d8ff75_400x512.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Image Source: <a href="https://manbicep.com/tag/exercise-myths/">exercise myths | Man Bicep</a></em></p><p>Now that we&#8217;ve talked about why someone might want to get lean or build muscle, it&#8217;s worth acknowledging the media environment we&#8217;re working in.</p><p>The modern fitness &#8220;baseline&#8221; is warped. Movies, Instagram, and YouTube are full of people who look shredded, dry, and jacked year-round&#8212;and it quietly trains our brains to think that&#8217;s what &#8220;normal fit&#8221; looks like. But much of what we see is a peak look, not an everyday one, and it often comes with hidden methods and costs.</p><p>A few things that routinely get left out of the highlight reel:</p><ul><li><p><strong>Curation + selection bias</strong>: We are mostly seeing people with great genetics for building muscle, years of experience, insane training regimens, and a strong incentive to look exceptional on camera.</p></li><li><p><strong>Camera tricks</strong>: Lighting, angles, a pump, and posing can make someone look dramatically leaner and bigger than they do walking around on a random Tuesday.</p></li><li><p><strong>&#8220;Peak Week&#8221; Physiques</strong>: Some of the physiques that we see that look incredible are achieved temporarily through aggressive dieting, dehydration, and other short-term tactics that don&#8217;t feel great to maintain.</p></li><li><p><strong>Editing</strong>: Everything from filters to retouching to post-production can make bodies look more &#8220;superhero&#8221; than human.</p></li></ul><p>This matters because it changes the comparison game. Research consistently finds that <a href="https://pubmed.ncbi.nlm.nih.gov/18424245/">exposure to idealized physiques can increase body dissatisfaction and appearance comparison</a>.</p><p>Similarly, while not everyone with an impressive physique is using performance-enhancing drugs (some people are dedicated and genetically gifted), enough people are using them (or going to extreme, temporary, photo-shoot preparation) that it is hard to know what you&#8217;re looking at. At the same time, PEDs are not harmless; they&#8217;re associated with <a href="https://nida.nih.gov/research-topics/anabolic-steroids">real health risks</a>, including cardiovascular and psychiatric effects. And using these drugs gives people a real boost. One analogy (popularized by Coach Greg Doucette, a polarizing but useful voice in the fitness space) is that training naturally is like building a house with one worker, while using PEDs is like adding several other people to join the job site. The progress can look completely different, and so does the cost.</p><p>For a deeper look at how normalized this is, the documentary <em><a href="https://www.imdb.com/title/tt1151309/">Bigger, Stronger, Faster</a></em> is a good cultural snapshot into the fitness space, especially in America, and how blurry the line gets between aspiration and deception.</p><p>Some actors who have played superhero roles have openly acknowledged how brutal it can be to prepare for such a role.</p><ul><li><p><strong>Zac Efron</strong>: has described his <em>Baywatch</em> look as difficult to attain and unsustainable, sharing about the <a href="https://variety.com/2022/film/news/zac-efron-baywatch-training-fitness-routine-depression-1235364455/">depression/insomnia and the extreme measures involved</a>.</p></li><li><p><strong>Kumail Nanjiani</strong> was unusually honest about the resources behind his transformation for <em><a href="https://www.imdb.com/title/tt9032400/">Eternals</a></em>, including a full year, <a href="https://www.vulture.com/article/kumail-nanjiani-eternals-profile.html">top trainers, elite nutrition support</a>, and <a href="https://www.businessinsider.com/kumail-nanjiani-eternals-workout-diet-trainer-2019-12">basically turning fitness into a job</a>.</p></li><li><p><strong>Chris Hemsworth</strong> has also spoken publicly about the <a href="https://www.glamour.com/story/chris-hemsworth-says-his-wife-called-his-thor-muscles-too-much">intensity of building and maintaining a Thor-level physique</a> (and more recently has emphasized a <a href="https://economictimes.indiatimes.com/us/life/chris-hemsworths-recent-interviews-highlight-why-recovery-and-simplicity-are-replacing-extreme-fitness-culture/articleshow/126965192.cms">shift toward recovery and sustainability</a> over extremes).</p></li></ul><p>Another useful lens here is Derek from <a href="https://moreplatesmoredates.com/">More Plates More Dates</a>, who spends a lot of time talking about <a href="https://www.youtube.com/watch?v=qN4sknMBzfQ">how common PED use is in certain fitness and entertainment circles</a> and why transparency matters. Whether or not you agree with his style, he&#8217;s part of a broader pushback against fake-natty marketing and unrealistic expectations.</p><p>There&#8217;s also an academic side to this. A <a href="https://pmc.ncbi.nlm.nih.gov/articles/PMC12694696/">growing body of research</a> links heavy exposure to idealized fitness content with things like obsessive food/exercise behaviors and muscle dysmorphia (sometimes called &#8220;bigorexia&#8221;), especially in young men comparing themselves to hyper-muscular bodies online.</p><p>And for women, the social-media pressure to be extremely lean can overlap with low energy availability/<a href="https://pubmed.ncbi.nlm.nih.gov/37752011/">RED-S</a> (a well-studied syndrome where chronic under-fueling can disrupt hormones, recovery, and overall health).</p><p>My point isn&#8217;t that we should not watch fitness content. It&#8217;s that we should use fitness content for ideas and lessons, and not for identity. If you&#8217;re training naturally (and even if you aren&#8217;t), it&#8217;s helpful to be careful about who you compare yourself to. A body you can maintain while sleeping well, performing optimally, and enjoying your life is a better target than the most flattering look that might require your whole world to revolve around staying shredded.</p><h2>Can We Finally Start Getting Lean? (Yes)</h2><h3>Nutrition: It Always Starts With Food</h3><p>Like the XKCD comic above, our metabolisms follow the laws of thermodynamics. When we eat, our bodies pull energy from food. If we eat more than we need, the extra gets stored as fat. If we eat less, the body taps into fat stores, glycogen, and sometimes muscle for energy. So to gain weight, we need to eat more than we burn; to lose weight, we need to eat less.</p><p>It is really that simple at the highest level, but let&#8217;s break it down some more.</p><h4>How Weight Loss (and Gain) Actually Works</h4><p>Each of us burns a baseline amount of energy every day to keep our bodies running: the brain, digestive system, heart, and everything else. This is called your <strong>basal metabolic rate (BMR)</strong>. On top of that, any movement or exercise burns additional energy. The total of these two is your <strong>total daily energy expenditure (TDEE)</strong>.</p><p>Hence, the formula is:</p><blockquote><p><em><strong>TDEE = BMR + Energy from Activity</strong></em></p><ul><li><p><em>Eat consistently below your TDEE &#8594; lose weight</em></p></li><li><p><em>Eat consistently above your TDEE &#8594; gain weight</em></p></li><li><p><em>Eat around your TDEE &#8594; maintain</em></p></li></ul></blockquote><h5>Quick Start (14 days)</h5><ul><li><p>Weigh daily and track a 7-day average</p></li><li><p>Pick cut (&#8211;300 to &#8211;500/day) or lean bulk (+150 to +300/day)</p></li><li><p>Hit protein daily + lift 2&#8211;4x/week</p></li><li><p>Walk 7&#8211;10k steps/day</p></li><li><p>After 14 days, adjust by 150&#8211;250 calories/day based on the trend</p></li></ul><p>We measure this energy in calories. As a rough benchmark, about 3,500 calories equals one pound of body fat. So a daily deficit of 500 calories generally leads to about one pound of weight loss per week. A surplus of the same amount leads to about a pound gained.</p><h4>Not All Calories Are Created Equal</h4><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!PmC2!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fea677507-b12e-4cd4-9a0d-fbca3c26624d_331x308.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!PmC2!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fea677507-b12e-4cd4-9a0d-fbca3c26624d_331x308.jpeg 424w, https://substackcdn.com/image/fetch/$s_!PmC2!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fea677507-b12e-4cd4-9a0d-fbca3c26624d_331x308.jpeg 848w, https://substackcdn.com/image/fetch/$s_!PmC2!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fea677507-b12e-4cd4-9a0d-fbca3c26624d_331x308.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!PmC2!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fea677507-b12e-4cd4-9a0d-fbca3c26624d_331x308.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!PmC2!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fea677507-b12e-4cd4-9a0d-fbca3c26624d_331x308.jpeg" width="331" height="308" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/ea677507-b12e-4cd4-9a0d-fbca3c26624d_331x308.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:308,&quot;width&quot;:331,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:65919,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://mubbiesnotebook.substack.com/i/188729814?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fea677507-b12e-4cd4-9a0d-fbca3c26624d_331x308.jpeg&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!PmC2!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fea677507-b12e-4cd4-9a0d-fbca3c26624d_331x308.jpeg 424w, https://substackcdn.com/image/fetch/$s_!PmC2!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fea677507-b12e-4cd4-9a0d-fbca3c26624d_331x308.jpeg 848w, https://substackcdn.com/image/fetch/$s_!PmC2!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fea677507-b12e-4cd4-9a0d-fbca3c26624d_331x308.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!PmC2!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fea677507-b12e-4cd4-9a0d-fbca3c26624d_331x308.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Image Source: <a href="https://www.fuelrunning.com/posts.php?blogFolder=quotes&amp;postName=whats-your-favorite-exercise-chewing">Fuel Running</a></em></p><p>While the math of calories in vs. calories out drives weight change, what you eat matters a lot for how you feel along the way. Our food contains three macronutrients, and each behaves differently.</p><ul><li><p><strong>Protein</strong> is digested slowly and requires more energy to process, which keeps you full longer. It&#8217;s also essential for preserving muscle during a cut. This is the one to prioritize.</p></li><li><p><strong>Carbohydrates</strong> digest quickly and provide near-instant energy. But eating a lot of them (particularly highly refined carbs) at once can spike your energy, followed by a crash (and sometimes hunger or sleepiness).</p></li><li><p><strong>Fats</strong> are more calorie-dense (9 calories per gram as opposed to 4 for protein and carbs) and tend to make food taste better, but they add up fast.</p></li></ul><p><strong>Fiber</strong> is also worth mentioning as high-fiber foods take longer to digest, support gut health, and help keep you full.</p><p>This is why <strong>calorie density</strong> matters so much in practice. Calorie-dense foods like cookies, soft drinks, and cake go down quickly and barely register as filling. Less calorie-dense foods like vegetables, fruits, and lean proteins fill you up with far fewer calories. When you&#8217;re trying to lose weight, leaning toward the latter makes the whole process dramatically easier.</p><h4>Making it Practical</h4><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!kGG-!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd9448fe6-7494-4e72-9162-3628d6218381_415x540.gif" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!kGG-!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd9448fe6-7494-4e72-9162-3628d6218381_415x540.gif 424w, https://substackcdn.com/image/fetch/$s_!kGG-!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd9448fe6-7494-4e72-9162-3628d6218381_415x540.gif 848w, https://substackcdn.com/image/fetch/$s_!kGG-!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd9448fe6-7494-4e72-9162-3628d6218381_415x540.gif 1272w, https://substackcdn.com/image/fetch/$s_!kGG-!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd9448fe6-7494-4e72-9162-3628d6218381_415x540.gif 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!kGG-!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd9448fe6-7494-4e72-9162-3628d6218381_415x540.gif" width="415" height="540" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/d9448fe6-7494-4e72-9162-3628d6218381_415x540.gif&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:540,&quot;width&quot;:415,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:46337,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/gif&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://mubbiesnotebook.substack.com/i/188729814?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd9448fe6-7494-4e72-9162-3628d6218381_415x540.gif&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!kGG-!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd9448fe6-7494-4e72-9162-3628d6218381_415x540.gif 424w, https://substackcdn.com/image/fetch/$s_!kGG-!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd9448fe6-7494-4e72-9162-3628d6218381_415x540.gif 848w, https://substackcdn.com/image/fetch/$s_!kGG-!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd9448fe6-7494-4e72-9162-3628d6218381_415x540.gif 1272w, https://substackcdn.com/image/fetch/$s_!kGG-!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd9448fe6-7494-4e72-9162-3628d6218381_415x540.gif 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Image Source: <a href="https://www.glasbergen.com/">Glasbergen Cartoon Services</a></em></p><p>So here&#8217;s the part we can apply repeatedly.</p><h5>1. Know your numbers (roughly)</h5><ul><li><p>Find your BMR using an online calculator (I <a href="https://www.sailrabbit.com/bmr/">like this one from sailrabbit</a>, but there are many others, <a href="https://www.myfitnesspal.com/tools/bmr-calculator">like this simpler one from MyFitnessPal</a>).</p></li><li><p>Estimate your daily activity calories using a fitness watch (Apple Watch, Fitbit, etc.), or you can compute your BMR and TDEE from an online calculator <a href="https://www.calculator.net/tdee-calculator.html">like this one from calculator.net</a>.</p></li></ul><p>These numbers are estimates, but that&#8217;s fine; all calorie measurements are. The point is to have a rough idea of your daily calorie burn and a working target.</p><h5>2. Pick Your Goal and a Realistic Pace</h5><p><strong>If you&#8217;re cutting (losing fat):</strong></p><ul><li><p>Aim to lose about 0.5-1.0% of your bodyweight per week (slower is generally better because it is more sustainable). For most people, this amounts to a daily deficit of roughly 300-500 calories.</p></li></ul><p><strong>If you&#8217;re lean bulking (gaining weight/building muscle without getting fluffy):</strong></p><ul><li><p>Aim to gain about 0.25-0.5% of your bodyweight per week. A surplus of roughly 150-300 calories per day is a good starting point.</p></li></ul><p>Whatever your goal is, try to avoid extremes. For instance, a 1,000-calorie deficit would lead to faster weight loss (roughly 2 pounds per week), but it would feel miserable and hard to sustain.</p><h5>3. Use the Scale as a Feedback Loop</h5><ul><li><p>Weigh yourself daily, ideally in the morning under the same conditions.</p></li><li><p><strong>Ignore individual days.</strong> Your weight can swing 2-3 pounds overnight based on hydration, inflammation, glycogen levels, and what you ate. Look at the 7-day average instead.</p></li><li><p>After every two weeks, adjust based on the trend:</p><ul><li><p>If you&#8217;re not losing on a cut: Reduce food slightly or add more daily exercise (for instance, ~150-250 calories/day or add ~2-3k steps/day).</p></li><li><p>Losing too fast or feeling awful: Add some food back (~150-250 calories/day).</p></li><li><p>Not gaining on a bulk: Add ~150&#8211;250 calories/day (a snack or bigger portions).</p></li></ul></li></ul><h5>4. Hit the Big Rocks</h5><p>If you do nothing else, focus on these:</p><ol><li><p><strong>Protein:</strong> Aim for roughly 0.7-1.0g per pound of your goal bodyweight per day. This is especially important while cutting, as protein helps keep you full, supports muscle repair, and helps ensure the weight you lose is mostly fat.</p></li><li><p><strong>Fiber and volume:</strong> Fill your plate with fruits, vegetables, beans, and whole grains. These foods physically fill you up without packing a lot of calories.</p></li><li><p><strong>Watch liquid calories:</strong> Sugary drinks, juices, and other &#8220;easy calories&#8221; add up fast and don&#8217;t satisfy hunger. This is one of the simplest places to cut.</p></li><li><p><strong>Keep strength training:</strong> Lifting while cutting sends your body the signal to hold onto muscle. Without it, you risk losing muscle along with fat.</p></li></ol><h5>5. Make Things Sustainable</h5><p>The best diet is the one you can stick to long-term. The trick is to keep the foods you enjoy while swapping portions or ingredients so they still fit your target.</p><div id="datawrapper-iframe" class="datawrapper-wrap outer" data-attrs="{&quot;url&quot;:&quot;https://datawrapper.dwcdn.net/ZOty7/1/&quot;,&quot;thumbnail_url&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/d97f48d6-be92-421f-917c-93e0b1af8a7f_1220x770.png&quot;,&quot;thumbnail_url_full&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/36a09edc-0240-47e9-ba63-240f84b49538_1220x770.png&quot;,&quot;height&quot;:381,&quot;title&quot;:&quot;Created with Datawrapper&quot;,&quot;description&quot;:&quot;&quot;}" data-component-name="DatawrapperToDOM"><iframe id="iframe-datawrapper" class="datawrapper-iframe" src="https://datawrapper.dwcdn.net/ZOty7/1/" width="730" height="381" frameborder="0" scrolling="no"></iframe><script type="text/javascript">!function(){"use strict";window.addEventListener("message",(function(e){if(void 0!==e.data["datawrapper-height"]){var t=document.querySelectorAll("iframe");for(var a in e.data["datawrapper-height"])for(var r=0;r<t.length;r++){if(t[r].contentWindow===e.source)t[r].style.height=e.data["datawrapper-height"][a]+"px"}}}))}();</script></div><p>There are also a ton of low-calorie cookbooks and recipes, as well as ways to prepare regular foods in low-calorie ways (for instance, baking instead of frying chicken). The key is building a rotation of meals you look forward to eating, not ones you tolerate.</p><h5>6. Plan for the Real World</h5><p>One big meal with friends won&#8217;t derail your goals. When we know a big meal is coming, it is best to plan for it:</p><ul><li><p>Keep earlier meals lighter and protein-focused.</p></li><li><p>Get some extra steps or exercise in.</p></li><li><p>Enjoy the meal without guilt.</p></li><li><p>Get back to your normal plan the next day.</p></li></ul><p>Some days you&#8217;ll eat more, some days less. What matters is the trend over weeks, not perfection on a single day. Similarly, if your energy starts to drop, eat more food. Sometimes, when we are in a deficit, we notice we are having trouble performing or focusing, and we consistently feel drained. In times like this, it is best to eat a bit more until we find the sweet spot where we&#8217;re still in a deficit but can function like we normally would.</p><h5>7. Think in Long Timeframes</h5><p>Don&#8217;t try to lose 25 pounds in three months. That pace is aggressive and could be hard to sustain, especially depending on your current body fat level. A year, for instance, is a better timeframe. That is 2-3 pounds a month, which is steady, manageable, and far more likely to stick. A quick transformation usually doesn&#8217;t last if it requires unsustainable habits. However, if you want an initial motivation hit, you can start aggressively and then move into a maintenance pace that doesn&#8217;t destroy your life.</p><p>Gaining weight, on the other hand, is generally easier since you need to find foods you enjoy and eat slightly more of them.</p><h4>What I Did (Full Transparency)</h4><p>I want to be upfront: my approach was more aggressive than what I&#8217;d recommend for most people. When I was bulking, I didn&#8217;t track anything and just ate however I felt. When I started cutting, I used the app <a href="https://cronometer.com/index.html">Cronometer</a> and connected it to Apple Health so I could see my total daily calorie burn alongside my intake. And I&#8217;ve been logging every single thing I&#8217;ve eaten, without exception, over the past 5 months.</p><p>That level of tracking worked for me, and I genuinely enjoyed being able to tell exactly what I ate on a random Tuesday in December. But it&#8217;s not necessary for everyone, and for some people, that degree of monitoring can become unhealthy or unsustainable. The approach above (rough targets + scale trend + enjoyable foods) will get most people there without logging every bite.</p><h4>An Example Day (Cut)</h4><p>Here&#8217;s roughly what a typical cutting day looked like for me. It&#8217;s an example of what ~1,900&#8211;2,100 calories can look like when you prioritize protein and volume (i.e., lots of filling, lower-calorie foods like fruits and vegetables). I also aimed for ~185&#8211;220g of protein/day based on my body weight at the time and my goal of minimizing muscle loss during the cut.</p><div id="datawrapper-iframe" class="datawrapper-wrap outer" data-attrs="{&quot;url&quot;:&quot;https://datawrapper.dwcdn.net/tkTNd/1/&quot;,&quot;thumbnail_url&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/796590ff-625b-4dc6-b56b-274fe26f6ed3_1220x674.png&quot;,&quot;thumbnail_url_full&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/4da6a5b5-f516-4e98-bb5f-d6a374c39c6b_1220x674.png&quot;,&quot;height&quot;:332,&quot;title&quot;:&quot;Created with Datawrapper&quot;,&quot;description&quot;:&quot;&quot;}" data-component-name="DatawrapperToDOM"><iframe id="iframe-datawrapper" class="datawrapper-iframe" src="https://datawrapper.dwcdn.net/tkTNd/1/" width="730" height="332" frameborder="0" scrolling="no"></iframe><script type="text/javascript">!function(){"use strict";window.addEventListener("message",(function(e){if(void 0!==e.data["datawrapper-height"]){var t=document.querySelectorAll("iframe");for(var a in e.data["datawrapper-height"])for(var r=0;r<t.length;r++){if(t[r].contentWindow===e.source)t[r].style.height=e.data["datawrapper-height"][a]+"px"}}}))}();</script></div><h4>The Bottom Line</h4><p>You don&#8217;t need perfect macros or a perfect meal plan. Pick a goal, track the trend, adjust slowly, and build a menu you actually enjoy. The goal is a way of eating you can maintain so that when you get lean, you stay lean.</p><p>A few extra notes:</p><h5>Cheat Days</h5><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!RJ3B!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F06b4fb27-4bd6-4c4f-8af8-d11ba8f8bc4f_750x750.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!RJ3B!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F06b4fb27-4bd6-4c4f-8af8-d11ba8f8bc4f_750x750.jpeg 424w, https://substackcdn.com/image/fetch/$s_!RJ3B!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F06b4fb27-4bd6-4c4f-8af8-d11ba8f8bc4f_750x750.jpeg 848w, https://substackcdn.com/image/fetch/$s_!RJ3B!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F06b4fb27-4bd6-4c4f-8af8-d11ba8f8bc4f_750x750.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!RJ3B!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F06b4fb27-4bd6-4c4f-8af8-d11ba8f8bc4f_750x750.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!RJ3B!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F06b4fb27-4bd6-4c4f-8af8-d11ba8f8bc4f_750x750.jpeg" width="750" height="750" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/06b4fb27-4bd6-4c4f-8af8-d11ba8f8bc4f_750x750.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:750,&quot;width&quot;:750,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:53068,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://mubbiesnotebook.substack.com/i/188729814?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F06b4fb27-4bd6-4c4f-8af8-d11ba8f8bc4f_750x750.jpeg&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!RJ3B!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F06b4fb27-4bd6-4c4f-8af8-d11ba8f8bc4f_750x750.jpeg 424w, https://substackcdn.com/image/fetch/$s_!RJ3B!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F06b4fb27-4bd6-4c4f-8af8-d11ba8f8bc4f_750x750.jpeg 848w, https://substackcdn.com/image/fetch/$s_!RJ3B!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F06b4fb27-4bd6-4c4f-8af8-d11ba8f8bc4f_750x750.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!RJ3B!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F06b4fb27-4bd6-4c4f-8af8-d11ba8f8bc4f_750x750.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Image Source: <a href="https://ktillustration.co.uk/">Kate Taylor</a></em></p><p>Cheat days work for some people. For me, they didn&#8217;t. When I gave myself a weekly cheat day, I&#8217;d go nuclear and eat 6,000&#8211;7,000 calories, basically undoing a week of progress (I like food a lot).</p><p>What worked better was building a way of eating that works every day, while still leaving room for foods I enjoy. If you like the idea of flexibility, a few alternatives that tend to be easier to manage than a full cheat day are:</p><ul><li><p>Planning treats (for instance, a small dessert every day)</p></li><li><p>A single high-calorie cheat meal instead of eating high-calorie foods for an entire day</p></li><li><p>An approach where your meals are split 80/20, or 90/10, such that most of them are on the plan, and a few are purely for joy</p></li></ul><h5>Weight-loss Medications</h5><p>I&#8217;m not a doctor, but it&#8217;s hard to ignore how common weight-loss medications have become. I do think many people can lose (or gain) weight without medication, but I also know that isn&#8217;t true for everyone, and there are cases where medical support can make a real difference. It&#8217;s also worth noting that these medications work in ways closely related to what we&#8217;ve discussed here. They mimic hormones that signal fullness, reducing appetite and leading to less food intake and, correspondingly, weight loss. In other words, it&#8217;s still an energy balance, just with pharmacological help on the appetite side.</p><p>If you talk with your doctor and they think a medication is appropriate and safe for you, I don&#8217;t think there&#8217;s anything wrong with using that tool. I&#8217;d encourage honesty about it, especially if you&#8217;re sharing advice publicly.</p><p>In general, I think of these meds the same way I think about other &#8220;boosts&#8221; in life. Support can help us gain traction. For instance, I got a boost writing this post from other articles, research, videos, and AI tools like ChatGPT and Claude. These boosts didn&#8217;t entirely replace the work, but they helped me do it more efficiently.</p><p>My only caution is that even with a boost, habits still matter. So, keep protein high, do strength training, and be mindful of potential side effects with your doctor (especially so you don&#8217;t lose more muscle than you need during a cut). Some of the more common medications, like GLP-1 agonists, can accelerate muscle loss alongside fat loss, which makes protein intake and strength training even more important if you&#8217;re using them.</p><h3>Exercise: Move in Ways You&#8217;ll Actually Keep Doing</h3><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!58EK!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F03923288-2980-436a-9a54-ca1a5916053a_750x1000.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!58EK!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F03923288-2980-436a-9a54-ca1a5916053a_750x1000.jpeg 424w, https://substackcdn.com/image/fetch/$s_!58EK!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F03923288-2980-436a-9a54-ca1a5916053a_750x1000.jpeg 848w, https://substackcdn.com/image/fetch/$s_!58EK!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F03923288-2980-436a-9a54-ca1a5916053a_750x1000.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!58EK!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F03923288-2980-436a-9a54-ca1a5916053a_750x1000.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!58EK!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F03923288-2980-436a-9a54-ca1a5916053a_750x1000.jpeg" width="750" height="1000" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/03923288-2980-436a-9a54-ca1a5916053a_750x1000.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1000,&quot;width&quot;:750,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:151028,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://mubbiesnotebook.substack.com/i/188729814?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F03923288-2980-436a-9a54-ca1a5916053a_750x1000.jpeg&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!58EK!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F03923288-2980-436a-9a54-ca1a5916053a_750x1000.jpeg 424w, https://substackcdn.com/image/fetch/$s_!58EK!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F03923288-2980-436a-9a54-ca1a5916053a_750x1000.jpeg 848w, https://substackcdn.com/image/fetch/$s_!58EK!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F03923288-2980-436a-9a54-ca1a5916053a_750x1000.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!58EK!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F03923288-2980-436a-9a54-ca1a5916053a_750x1000.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Image Source: <a href="https://www.redbubble.com/i/greeting-card/Exercise-I-thought-you-said-Extra-Fries-Humorous-Cartoon-Gym-Funny-Workout-Graphic-by-WeirdPunderful/137083569.5MT14">Red Bubble</a></em></p><p>Just like nutrition, the best exercise routine is the one you&#8217;ll actually stick to. This means we do not need a perfect program (such a program actually doesn&#8217;t exist). We also do not need to train like professional athletes, or make training the entirety of our lives. What we need is something sustainable that we can repeat week after week, month after month, ideally for several years.</p><p>Diet drives most of fat loss, but training determines what that fat loss looks like. Two people can lose the same amount of weight, but the one who lifts and stays active will likely retain more muscle, have better posture, and feel stronger. If nutrition is the steering wheel, exercise is the engine.</p><p>But before I share more, let&#8217;s start with a quick start.</p><h5>Quick Start (14 days)</h5><ul><li><p>Lift 2-4x/week (full body is simplest)</p></li><li><p>Do cardio 2x/week (~150 minutes of moderate intensity cardio per week) <em>or</em> hit 7-10k steps/day</p></li><li><p>Pick one fun activity that gets you moving that you can do weekly (good examples are soccer, tennis, dancing, pickleball, flag football, etc.)</p></li><li><p>Track just two things: workouts completed and steps average</p></li><li><p>Don&#8217;t miss twice in a row</p></li><li><p>14 days in, adapt and keep going</p></li></ul><p>That&#8217;s enough to build momentum; everything else is refining.</p><h4>Strength Training</h4><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!-8J8!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc785fb09-6cac-42de-8c50-5424ae12fb2f_500x361.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!-8J8!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc785fb09-6cac-42de-8c50-5424ae12fb2f_500x361.png 424w, https://substackcdn.com/image/fetch/$s_!-8J8!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc785fb09-6cac-42de-8c50-5424ae12fb2f_500x361.png 848w, https://substackcdn.com/image/fetch/$s_!-8J8!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc785fb09-6cac-42de-8c50-5424ae12fb2f_500x361.png 1272w, https://substackcdn.com/image/fetch/$s_!-8J8!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc785fb09-6cac-42de-8c50-5424ae12fb2f_500x361.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!-8J8!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc785fb09-6cac-42de-8c50-5424ae12fb2f_500x361.png" width="500" height="361" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/c785fb09-6cac-42de-8c50-5424ae12fb2f_500x361.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:361,&quot;width&quot;:500,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:22201,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://mubbiesnotebook.substack.com/i/188729814?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc785fb09-6cac-42de-8c50-5424ae12fb2f_500x361.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!-8J8!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc785fb09-6cac-42de-8c50-5424ae12fb2f_500x361.png 424w, https://substackcdn.com/image/fetch/$s_!-8J8!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc785fb09-6cac-42de-8c50-5424ae12fb2f_500x361.png 848w, https://substackcdn.com/image/fetch/$s_!-8J8!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc785fb09-6cac-42de-8c50-5424ae12fb2f_500x361.png 1272w, https://substackcdn.com/image/fetch/$s_!-8J8!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc785fb09-6cac-42de-8c50-5424ae12fb2f_500x361.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Image Source: <a href="https://xkcd.com/">XKCD</a></em></p><p>If you&#8217;re trying to get lean and keep muscle (or build it), strength training is probably the single most important type of exercise for that goal. When you&#8217;re in a calorie deficit, your body is looking for energy wherever it can find it. Lifting sends a clear signal to your body that your muscles are being used, so it should not burn them for fuel. Without that signal, you risk losing muscle along with fat, and the result is a smaller but softer version of yourself.</p><p>The good news is that you don&#8217;t need anything complicated. Once you pick a proven program and stick with it, you are well on your way. Here are a few solid options depending on your schedule:</p><p><strong>2 days/week:</strong></p><ul><li><p>Day 1 and 2: Squat or hinge + push movements + pull movements</p></li></ul><p><strong>3 days/week (full body):</strong></p><ul><li><p>Day A: Squat or leg press + bench press + rows + accessories</p></li><li><p>Day B: Deadlift or RDL + overhead press + pull-ups/lat pulldown + accessories</p></li><li><p>Day C: Repeat A or B with slight variations</p></li></ul><p><strong>4 days/week (upper/lower split):</strong></p><ul><li><p>Upper days: push + pull + shoulders + arms</p></li><li><p>Lower days: squat or hinge movement + calves + core</p></li></ul><p>These are simple guidelines, but there are various ways to approach strength training, and you can explore several options, gradually fine-tuning into what works best for you. Most of the strength and growth come from doing the basics consistently and getting better over time. A few things to keep in mind:</p><ul><li><p><strong>Train hard:</strong> Showing up is step one, but progress and strength usually come from pushing yourself and working most sets close to failure. This could come in the form of progressive overload (gradually increasing weight, reps, or sets over time), or simply pushing yourself a tiny bit more than you did the previous session (for instance, holding the bar up a little longer than the previous sessions when doing a bench press).</p></li><li><p><strong>Form matters:</strong> To reduce the risk of injury, it is helpful to learn and maintain proper form while exercising. Ask others to watch your form and give you feedback, or use YouTube tutorials and guides. If the weight is so heavy that you start to lose form, decrease it and nail the form before progressing. This <a href="https://www.hevyapp.com/exercises/">exercise library</a> from Hevy is an excellent resource for finding different exercises and their correct form.</p></li><li><p><strong>Track your lifts:</strong> In a way most suitable for you, keep a log of your weights and reps. It&#8217;s hard to progressively overload if you don&#8217;t remember what you did last week. You can use an app like <a href="https://stronglifts.com/app/">Stronglifts</a>, or <a href="https://www.strong.app/">Strong</a>, or even just a notes or spreadsheet app on your phone.</p></li></ul><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!e3nc!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffa833d5e-99c7-413f-8cb2-9a508eb2b858_892x766.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!e3nc!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffa833d5e-99c7-413f-8cb2-9a508eb2b858_892x766.png 424w, https://substackcdn.com/image/fetch/$s_!e3nc!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffa833d5e-99c7-413f-8cb2-9a508eb2b858_892x766.png 848w, https://substackcdn.com/image/fetch/$s_!e3nc!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffa833d5e-99c7-413f-8cb2-9a508eb2b858_892x766.png 1272w, https://substackcdn.com/image/fetch/$s_!e3nc!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffa833d5e-99c7-413f-8cb2-9a508eb2b858_892x766.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!e3nc!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffa833d5e-99c7-413f-8cb2-9a508eb2b858_892x766.png" width="892" height="766" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/fa833d5e-99c7-413f-8cb2-9a508eb2b858_892x766.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:766,&quot;width&quot;:892,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:39509,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://mubbiesnotebook.substack.com/i/188729814?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffa833d5e-99c7-413f-8cb2-9a508eb2b858_892x766.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!e3nc!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffa833d5e-99c7-413f-8cb2-9a508eb2b858_892x766.png 424w, https://substackcdn.com/image/fetch/$s_!e3nc!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffa833d5e-99c7-413f-8cb2-9a508eb2b858_892x766.png 848w, https://substackcdn.com/image/fetch/$s_!e3nc!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffa833d5e-99c7-413f-8cb2-9a508eb2b858_892x766.png 1272w, https://substackcdn.com/image/fetch/$s_!e3nc!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffa833d5e-99c7-413f-8cb2-9a508eb2b858_892x766.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Image Source: <a href="https://xkcd.com/">XKCD</a></em></p><p>As a final note on strength training, I&#8217;ve talked to some of my friends who are women about lifting, and a common concern I hear is not wanting to get bulky or look masculine from it. I&#8217;ve heard this enough times that it&#8217;s worth addressing directly. And honestly, the concern is understandable. Gym culture can feel intimidating, and strength training spaces aren&#8217;t always as welcoming or comfortable for women as they should be.</p><p>The short answer: it&#8217;s extremely unlikely to happen. The &#8220;bulky&#8221; look most people picture typically requires levels of testosterone that women&#8217;s bodies don&#8217;t naturally produce. Men generally have much higher testosterone, which is a major driver of the muscle size people associate with a masculine physique. For the vast majority of women, strength training builds muscle in ways that make them stronger, leaner, healthier, and more toned; not bulky.</p><p>And when you do see extreme muscularity, it&#8217;s usually the result of years of highly dedicated training and, in many cases, performance-enhancing drugs&#8212;which, as we covered earlier, come with real tradeoffs and aren&#8217;t something most people should be using.</p><h4>Cardio</h4><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!6swz!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4721c74a-edfa-49eb-bf26-0431254ed87c_750x1000.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!6swz!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4721c74a-edfa-49eb-bf26-0431254ed87c_750x1000.jpeg 424w, https://substackcdn.com/image/fetch/$s_!6swz!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4721c74a-edfa-49eb-bf26-0431254ed87c_750x1000.jpeg 848w, https://substackcdn.com/image/fetch/$s_!6swz!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4721c74a-edfa-49eb-bf26-0431254ed87c_750x1000.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!6swz!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4721c74a-edfa-49eb-bf26-0431254ed87c_750x1000.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!6swz!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4721c74a-edfa-49eb-bf26-0431254ed87c_750x1000.jpeg" width="750" height="1000" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/4721c74a-edfa-49eb-bf26-0431254ed87c_750x1000.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1000,&quot;width&quot;:750,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:74763,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://mubbiesnotebook.substack.com/i/188729814?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4721c74a-edfa-49eb-bf26-0431254ed87c_750x1000.jpeg&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!6swz!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4721c74a-edfa-49eb-bf26-0431254ed87c_750x1000.jpeg 424w, https://substackcdn.com/image/fetch/$s_!6swz!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4721c74a-edfa-49eb-bf26-0431254ed87c_750x1000.jpeg 848w, https://substackcdn.com/image/fetch/$s_!6swz!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4721c74a-edfa-49eb-bf26-0431254ed87c_750x1000.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!6swz!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4721c74a-edfa-49eb-bf26-0431254ed87c_750x1000.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Image Source: <a href="https://www.redbubble.com/i/photographic-print/Avocado-Cartoon-Avo-Cardio-Funny-by-AwesomeArt13/109331062.ZRLK5">Red Bubble</a></em></p><p>Cardio gets a bad reputation in some lifting circles because people believe it kills your muscular gains. However, cardio is worth doing even if your primary goal is to look better. It improves your heart health and strength (the most important muscle in your body), endurance, mood, recovery, and day-to-day energy.</p><p>While strength training is non-negotiable for getting lean and keeping muscle (the focus of this post), I personally think cardio is the most important group of exercises for overall health and longevity. If I could only pick one, I&#8217;d choose cardio. I understand not everyone shares that perspective, but regardless of where you fall, having decent conditioning makes everything else in life easier.</p><p>A good baseline is the classic guideline of aiming for around 150 minutes per week of moderate-intensity cardio. You do not need to start here, though; you can gradually build up to it. And just like strength training, we get better at cardio by challenging ourselves each session to do a little more or go a little harder than before. Over time, the improvements compound.</p><p>We can also think of cardio in two buckets:</p><p><strong>Low-intensity/daily movement</strong></p><ul><li><p>These include walking, taking the stairs, parking farther away, pacing on phone calls, etc. Typically, these do not feel like exercise, but they add up.</p></li><li><p>Aiming for 7&#8211;10k steps/day (or if you want a challenge, 12&#8211;15k steps) is one of the simplest and most effective things you can do.</p></li><li><p>Low-intensity cardio burns calories without spiking hunger the way intense cardio can and generally doesn&#8217;t require recovery time.</p></li></ul><p><strong>Moderate-to-high intensity</strong></p><ul><li><p>Running, cycling, swimming, rowing, sports, etc. Your goal in this bucket is to choose whatever you enjoy.</p></li><li><p>These build real cardiovascular fitness, and you can steadily challenge yourself and improve.</p></li></ul><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!ZhoQ!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5cfaaf4e-24c3-4ba3-b4b9-2ac95d4d3d2e_750x1000.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!ZhoQ!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5cfaaf4e-24c3-4ba3-b4b9-2ac95d4d3d2e_750x1000.jpeg 424w, https://substackcdn.com/image/fetch/$s_!ZhoQ!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5cfaaf4e-24c3-4ba3-b4b9-2ac95d4d3d2e_750x1000.jpeg 848w, https://substackcdn.com/image/fetch/$s_!ZhoQ!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5cfaaf4e-24c3-4ba3-b4b9-2ac95d4d3d2e_750x1000.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!ZhoQ!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5cfaaf4e-24c3-4ba3-b4b9-2ac95d4d3d2e_750x1000.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!ZhoQ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5cfaaf4e-24c3-4ba3-b4b9-2ac95d4d3d2e_750x1000.jpeg" width="750" height="1000" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/5cfaaf4e-24c3-4ba3-b4b9-2ac95d4d3d2e_750x1000.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1000,&quot;width&quot;:750,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:111982,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://mubbiesnotebook.substack.com/i/188729814?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5cfaaf4e-24c3-4ba3-b4b9-2ac95d4d3d2e_750x1000.jpeg&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!ZhoQ!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5cfaaf4e-24c3-4ba3-b4b9-2ac95d4d3d2e_750x1000.jpeg 424w, https://substackcdn.com/image/fetch/$s_!ZhoQ!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5cfaaf4e-24c3-4ba3-b4b9-2ac95d4d3d2e_750x1000.jpeg 848w, https://substackcdn.com/image/fetch/$s_!ZhoQ!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5cfaaf4e-24c3-4ba3-b4b9-2ac95d4d3d2e_750x1000.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!ZhoQ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5cfaaf4e-24c3-4ba3-b4b9-2ac95d4d3d2e_750x1000.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Image Source: <a href="https://www.redbubble.com/i/sticker/Funny-Gym-Motivation-Cute-Turtle-Workout-Cartoon-by-BoggsNicolasArt/24336548.EJUG5">Red Bubble</a></em></p><p>Like we&#8217;ve highlighted throughout this post, enjoyment matters more than anything when choosing the type of cardio to do. If you hate running, don&#8217;t run. Walk, bike, swim, dance, hike, play basketball, join a rec league, skate. The best cardio is the one you&#8217;ll keep doing, especially when motivation wanes.</p><p>A practical starting point is:</p><ul><li><p>2 sessions/week of 20&#8211;40 minutes (plus steps from walking)</p></li><li><p>Daily steps + one weekly hard session from a sport you enjoy</p></li></ul><p>One important note: if you&#8217;re lifting hard and also doing intense cardio, your recovery might start to suffer. In that situation, reduce your cardio intensity before cutting back on lifting. And as much as you can, keep walking.</p><h4>Finding What You Actually Enjoy</h4><p>I know I keep coming back to this, but it&#8217;s because it&#8217;s genuinely the most important piece of fitness advice I can offer. If you hate your workout, you&#8217;ll eventually stop doing it. It doesn&#8217;t matter how &#8220;optimal&#8221; the program is; what matters is your ability to do it consistently. And liking the workout is the first step.</p><ul><li><p>If you like lifting but hate cardio -&gt; keep cardio simple (walking + a sport)</p></li><li><p>If you like cardio but hate the gym -&gt; lift twice a week and keep it short</p></li><li><p>If you get bored easily -&gt; rotate activities, but keep the weekly structure</p></li></ul><p>Sports, in particular, are massively underrated as exercise. They generally don&#8217;t feel like working out because while doing them, you&#8217;re focused on playing, competing, and having fun. For me, soccer has been one of the most consistent forms of cardio in my life because I play with my friends, and I genuinely have fun anytime I&#8217;m on the pitch. I&#8217;ve also found that activities like dancing (choreography, ballet, partner dancing, etc.), yoga, group classes, and martial arts are great options. Doing these activities with friends, in a class, or on a team helps you stay consistent, as you rely less on personal motivation.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!q0X8!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F14fd4040-7280-4f2f-afb8-5d9bc17f5eb3_1920x1280.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!q0X8!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F14fd4040-7280-4f2f-afb8-5d9bc17f5eb3_1920x1280.png 424w, https://substackcdn.com/image/fetch/$s_!q0X8!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F14fd4040-7280-4f2f-afb8-5d9bc17f5eb3_1920x1280.png 848w, https://substackcdn.com/image/fetch/$s_!q0X8!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F14fd4040-7280-4f2f-afb8-5d9bc17f5eb3_1920x1280.png 1272w, https://substackcdn.com/image/fetch/$s_!q0X8!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F14fd4040-7280-4f2f-afb8-5d9bc17f5eb3_1920x1280.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!q0X8!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F14fd4040-7280-4f2f-afb8-5d9bc17f5eb3_1920x1280.png" width="1456" height="971" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/14fd4040-7280-4f2f-afb8-5d9bc17f5eb3_1920x1280.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:971,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:2788729,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://mubbiesnotebook.substack.com/i/188729814?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F14fd4040-7280-4f2f-afb8-5d9bc17f5eb3_1920x1280.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!q0X8!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F14fd4040-7280-4f2f-afb8-5d9bc17f5eb3_1920x1280.png 424w, https://substackcdn.com/image/fetch/$s_!q0X8!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F14fd4040-7280-4f2f-afb8-5d9bc17f5eb3_1920x1280.png 848w, https://substackcdn.com/image/fetch/$s_!q0X8!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F14fd4040-7280-4f2f-afb8-5d9bc17f5eb3_1920x1280.png 1272w, https://substackcdn.com/image/fetch/$s_!q0X8!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F14fd4040-7280-4f2f-afb8-5d9bc17f5eb3_1920x1280.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Image Source: <a href="https://pixabay.com/users/creativecanvasshop-45016655/">Creative Canvas Shop</a></em></p><p>Speaking of the social aspect of training, I recently started going to the gym with my friends instead of going alone, and it has been a tremendous change. The camaraderie has been amazing. For instance, we recently celebrated one of our birthdays at the gym with donuts (cheat meal). We also challenge each other, and we&#8217;re all able to work out harder because we have people to provide extra support and spot each other. Below is a recent picture of some of us at the gym:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!aylL!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F54ab2cb7-4dd2-4713-a499-bbb6e8531dad_1726x2300.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!aylL!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F54ab2cb7-4dd2-4713-a499-bbb6e8531dad_1726x2300.jpeg 424w, https://substackcdn.com/image/fetch/$s_!aylL!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F54ab2cb7-4dd2-4713-a499-bbb6e8531dad_1726x2300.jpeg 848w, https://substackcdn.com/image/fetch/$s_!aylL!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F54ab2cb7-4dd2-4713-a499-bbb6e8531dad_1726x2300.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!aylL!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F54ab2cb7-4dd2-4713-a499-bbb6e8531dad_1726x2300.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!aylL!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F54ab2cb7-4dd2-4713-a499-bbb6e8531dad_1726x2300.jpeg" width="1456" height="1940" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/54ab2cb7-4dd2-4713-a499-bbb6e8531dad_1726x2300.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1940,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:681932,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://mubbiesnotebook.substack.com/i/188729814?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F54ab2cb7-4dd2-4713-a499-bbb6e8531dad_1726x2300.jpeg&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!aylL!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F54ab2cb7-4dd2-4713-a499-bbb6e8531dad_1726x2300.jpeg 424w, https://substackcdn.com/image/fetch/$s_!aylL!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F54ab2cb7-4dd2-4713-a499-bbb6e8531dad_1726x2300.jpeg 848w, https://substackcdn.com/image/fetch/$s_!aylL!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F54ab2cb7-4dd2-4713-a499-bbb6e8531dad_1726x2300.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!aylL!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F54ab2cb7-4dd2-4713-a499-bbb6e8531dad_1726x2300.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Here&#8217;s also something that might sound counterintuitive: it&#8217;s okay to keep your routine boring. Same workouts, same days, same structure, week after week. Boring is sustainable and becomes automatic. You do not need to reinvent your program every month. You only need to keep showing up and pushing a little harder over time.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!0nr5!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F01c0a378-b840-471d-aa1d-ae67c6c871f0_239x307.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!0nr5!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F01c0a378-b840-471d-aa1d-ae67c6c871f0_239x307.jpeg 424w, https://substackcdn.com/image/fetch/$s_!0nr5!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F01c0a378-b840-471d-aa1d-ae67c6c871f0_239x307.jpeg 848w, https://substackcdn.com/image/fetch/$s_!0nr5!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F01c0a378-b840-471d-aa1d-ae67c6c871f0_239x307.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!0nr5!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F01c0a378-b840-471d-aa1d-ae67c6c871f0_239x307.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!0nr5!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F01c0a378-b840-471d-aa1d-ae67c6c871f0_239x307.jpeg" width="239" height="307" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/01c0a378-b840-471d-aa1d-ae67c6c871f0_239x307.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:307,&quot;width&quot;:239,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:28448,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://mubbiesnotebook.substack.com/i/188729814?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F01c0a378-b840-471d-aa1d-ae67c6c871f0_239x307.jpeg&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!0nr5!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F01c0a378-b840-471d-aa1d-ae67c6c871f0_239x307.jpeg 424w, https://substackcdn.com/image/fetch/$s_!0nr5!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F01c0a378-b840-471d-aa1d-ae67c6c871f0_239x307.jpeg 848w, https://substackcdn.com/image/fetch/$s_!0nr5!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F01c0a378-b840-471d-aa1d-ae67c6c871f0_239x307.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!0nr5!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F01c0a378-b840-471d-aa1d-ae67c6c871f0_239x307.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Image Source: <a href="https://www.gocomics.com/">Go Comics</a></em></p><h4>A Final Note on Training Hard</h4><p>Effort matters, and there&#8217;s a real difference between showing up and going through the motions versus actually pushing yourself. The people who make noticeable progress are the ones who consistently bring intensity to their sessions.</p><p>But training hard doesn&#8217;t mean ignoring your body. Recovery is part of the process. And sleep is arguably the most important recovery tool we have, as it&#8217;s when our bodies actually repair and build muscle. A few other recovery basics:</p><ul><li><p><strong>Rest days:</strong> Take 1&#8211;3 per week depending on your program and how you feel. Active recovery (a walk, light stretching) is great on rest days.</p></li><li><p><strong>Deload weeks:</strong> Every 4&#8211;8 weeks, it is helpful to consider a lighter week where you reduce volume or intensity. This lets your body catch up and often leads to better performance in the following weeks.</p></li><li><p><strong>Listen to persistent pain:</strong> Soreness is normal, especially when you train hard. Sharp pain that doesn&#8217;t go away, however, is a signal to back off and address it before things worsen. If pain persists, see a physical therapist or a doctor&#8212;it&#8217;s worth it.</p></li></ul><p>Overtraining and injury are big threats to consistency. And consistency, as we&#8217;ve established, is the whole point. But what happens if you actually get hurt?</p><ul><li><p>You can take a break or train around the injury. For instance, if your arms are injured, you can primarily train your legs or find low-intensity training that lets you keep moving. Back in 2024, I hurt my knee and couldn&#8217;t train or do cardio for about 12 weeks. During that time, I relied on daily &#8220;hurt knee&#8221; exercises that I found on YouTube to train my legs and used a pair of dumbbells to continue training my upper body.</p></li><li><p>When you eventually come back from an injury (or if you haven&#8217;t trained in a while), start really easy and light, and gradually build back up.</p></li></ul><h4>A Note on Aesthetics (and Abs)</h4><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!281D!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F53e7365d-507a-418d-aa4c-bed7091b9765_445x576.gif" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!281D!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F53e7365d-507a-418d-aa4c-bed7091b9765_445x576.gif 424w, https://substackcdn.com/image/fetch/$s_!281D!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F53e7365d-507a-418d-aa4c-bed7091b9765_445x576.gif 848w, https://substackcdn.com/image/fetch/$s_!281D!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F53e7365d-507a-418d-aa4c-bed7091b9765_445x576.gif 1272w, https://substackcdn.com/image/fetch/$s_!281D!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F53e7365d-507a-418d-aa4c-bed7091b9765_445x576.gif 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!281D!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F53e7365d-507a-418d-aa4c-bed7091b9765_445x576.gif" width="445" height="576" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/53e7365d-507a-418d-aa4c-bed7091b9765_445x576.gif&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:576,&quot;width&quot;:445,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:81448,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/gif&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://mubbiesnotebook.substack.com/i/188729814?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F53e7365d-507a-418d-aa4c-bed7091b9765_445x576.gif&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!281D!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F53e7365d-507a-418d-aa4c-bed7091b9765_445x576.gif 424w, https://substackcdn.com/image/fetch/$s_!281D!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F53e7365d-507a-418d-aa4c-bed7091b9765_445x576.gif 848w, https://substackcdn.com/image/fetch/$s_!281D!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F53e7365d-507a-418d-aa4c-bed7091b9765_445x576.gif 1272w, https://substackcdn.com/image/fetch/$s_!281D!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F53e7365d-507a-418d-aa4c-bed7091b9765_445x576.gif 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Image Source: <a href="https://www.glasbergen.com/">Glasbergen Cartoon Services</a></em></p><p>Let&#8217;s be real, a lot of people start training because they want to look better. That&#8217;s a perfectly valid reason, and there&#8217;s no need to pretend otherwise. But it&#8217;s worth understanding how aesthetics actually work, because it&#8217;s not quite what most people expect.</p><p>The biggest factor in how &#8220;defined&#8221; or &#8220;toned&#8221; you look isn&#8217;t which exercises you do; it&#8217;s your body fat percentage. Everyone has abs, for instance. Whether you can see them is almost entirely a function of how much fat is sitting on top of them. You don&#8217;t need to do 500 crunches every day to get a six-pack. You need to get lean enough for them to show, and then have enough core muscle underneath to make them pop.</p><p>This is why nutrition and strength training together matter more than any single exercise. You can do ab workouts every day and never see definition if your body fat is too high. Our bodies also do not spot reduce fat, so doing a lot of core workouts would not reduce belly fat (despite what social media tutorials might suggest). And you can do zero direct ab work and have visible abs if you&#8217;re lean enough and your core gets trained through compound lifts like squats, deadlifts, and overhead presses.</p><p>That said, direct core work still has value &#8212; and not just for aesthetics, but for stability, posture, and injury prevention. A few sets of hanging leg raises, cable crunches, or planks a few times a week is more than enough for most people.</p><p>The same principle applies to the rest of your body. &#8220;Toned arms&#8221; or &#8220;defined shoulders&#8221; are the result of having enough muscle in those areas and being lean enough for that muscle to be visible. The formula is always the same: build the muscle through strength training, reveal it through nutrition.</p><p>One more thing worth saying: the level of leanness where abs are clearly visible (roughly 10&#8211;14% body fat for men, 18&#8211;22% for women) is achievable and maintainable for many people, but it does require consistent attention to diet. The ultra-shredded look you see on magazine covers (sub-8% for men, sub-16% for women) is a different story. That&#8217;s the territory we talked about earlier, where health starts to suffer. As always, the goal is a look you can sustain while still sleeping well, performing well, and enjoying your life.</p><h4>What I Do</h4><p>I want to note that my training regimen is currently on the intense side, but I&#8217;ve built up to this level over several years. If you&#8217;re new to training, I recommend starting easy and working your way up. I&#8217;ve also been training for a race, so my schedule has more running than normal. But for full transparency, here&#8217;s what a typical week looks like for me:</p><div id="datawrapper-iframe" class="datawrapper-wrap outer" data-attrs="{&quot;url&quot;:&quot;https://datawrapper.dwcdn.net/HW4b7/1/&quot;,&quot;thumbnail_url&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/5b7d7f72-1a69-4a4b-8df6-946f355f9230_1220x1398.png&quot;,&quot;thumbnail_url_full&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/34e025ed-0168-447a-8d5c-4b258b601e84_1220x1398.png&quot;,&quot;height&quot;:704,&quot;title&quot;:&quot;Created with Datawrapper&quot;,&quot;description&quot;:&quot;&quot;}" data-component-name="DatawrapperToDOM"><iframe id="iframe-datawrapper" class="datawrapper-iframe" src="https://datawrapper.dwcdn.net/HW4b7/1/" width="730" height="704" frameborder="0" scrolling="no"></iframe><script type="text/javascript">!function(){"use strict";window.addEventListener("message",(function(e){if(void 0!==e.data["datawrapper-height"]){var t=document.querySelectorAll("iframe");for(var a in e.data["datawrapper-height"])for(var r=0;r<t.length;r++){if(t[r].contentWindow===e.source)t[r].style.height=e.data["datawrapper-height"][a]+"px"}}}))}();</script></div><h2>Closing: So What is the Actual Point</h2><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!1xdJ!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F02cf9dac-205c-4875-90d2-6dd318f8767e_200x200.gif" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!1xdJ!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F02cf9dac-205c-4875-90d2-6dd318f8767e_200x200.gif 424w, https://substackcdn.com/image/fetch/$s_!1xdJ!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F02cf9dac-205c-4875-90d2-6dd318f8767e_200x200.gif 848w, https://substackcdn.com/image/fetch/$s_!1xdJ!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F02cf9dac-205c-4875-90d2-6dd318f8767e_200x200.gif 1272w, https://substackcdn.com/image/fetch/$s_!1xdJ!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F02cf9dac-205c-4875-90d2-6dd318f8767e_200x200.gif 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!1xdJ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F02cf9dac-205c-4875-90d2-6dd318f8767e_200x200.gif" width="320" height="320" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/02cf9dac-205c-4875-90d2-6dd318f8767e_200x200.gif&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:200,&quot;width&quot;:200,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:262367,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/gif&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://mubbiesnotebook.substack.com/i/188729814?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F02cf9dac-205c-4875-90d2-6dd318f8767e_200x200.gif&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!1xdJ!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F02cf9dac-205c-4875-90d2-6dd318f8767e_200x200.gif 424w, https://substackcdn.com/image/fetch/$s_!1xdJ!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F02cf9dac-205c-4875-90d2-6dd318f8767e_200x200.gif 848w, https://substackcdn.com/image/fetch/$s_!1xdJ!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F02cf9dac-205c-4875-90d2-6dd318f8767e_200x200.gif 1272w, https://substackcdn.com/image/fetch/$s_!1xdJ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F02cf9dac-205c-4875-90d2-6dd318f8767e_200x200.gif 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>So, getting lean before GTA 6. Is that a real deadline? Not really. Rockstar could always push it back from its currently scheduled release date of <a href="https://www.rockstargames.com/newswire/article/ak3ak31a49a221/grand-theft-auto-vi-is-now-set-to-launch-november-19-2026">November 19, 2026</a>. But the deadline was always arbitrary. The habits are what matter, and the goal is always to be as healthy as possible.</p><p>What I&#8217;ve learned is that none of this requires a dramatic transformation or a perfect plan. It just requires a few simple things done consistently: eating in ways we can sustain, training in ways we enjoy, tracking the trend, adjusting when needed, and giving ourselves long enough timeframes to let it work.</p><p>So if you&#8217;re reading this and feeling like you want to change something about how you treat your health, or perhaps you are just really interested in hot boy or hot girl summer, my recommendation is to pick one thing. Maybe it&#8217;s tracking your weight for two weeks. Maybe it&#8217;s hitting a protein target. Maybe it&#8217;s going for a walk every day. Start there, build the habit, and add from there.</p><p>The goal isn&#8217;t a number on the scale or a particular date. It&#8217;s learning how to care for ourselves in ways that we can keep doing, even as life happens to us. And hey&#8230; if we pull this off, maybe by the time GTA 6 drops we&#8217;ll be fit enough to sit on the couch for 100 hours straight and finish it. That&#8217;s got to count for something; if nothing else, it&#8217;s endurance training.</p><h2>References and Useful Resources</h2><h3>If you only pick 5 (Starter Pack)</h3><ul><li><p><strong>TDEE estimate:</strong> <a href="https://www.calculator.net/tdee-calculator.html">Calculator.net TDEE Calculator</a></p></li><li><p><strong>Food tracking:</strong> <a href="https://cronometer.com/">Cronometer</a></p></li><li><p><strong>Workout tracking:</strong> <a href="https://www.hevyapp.com/">Hevy</a></p></li><li><p><strong>Beginner strength plan:</strong> <a href="https://thefitness.wiki/routines/r-fitness-basic-beginner-routine/">r/Fitness Basic Beginner Routine (Fitness Wiki)</a></p></li><li><p><strong>General guide:</strong> <a href="https://thefitness.wiki/">The Fitness Wiki</a></p></li></ul><div><hr></div><h3>Calculators and Tools</h3><ul><li><p><a href="https://www.sailrabbit.com/bmr/">Sailrabbit BMR Calculator</a></p></li><li><p><a href="https://www.myfitnesspal.com/tools/bmr-calculator">MyFitnessPal BMR Calculator</a></p></li><li><p><a href="https://www.calculator.net/tdee-calculator.html">Calculator.net TDEE Calculator</a></p></li></ul><div><hr></div><h3>Food and Nutrition Tracking</h3><ul><li><p><a href="https://cronometer.com/">Cronometer</a> &#8212; detailed food/activity tracking with micronutrient data</p></li><li><p><a href="https://www.myfitnesspal.com/">MyFitnessPal</a> &#8212; huge food database, great for quick calorie logging</p></li><li><p><a href="https://macrofactorapp.com/">MacroFactor</a> &#8212; adaptive TDEE tracking based on your weight trend (paid)</p></li><li><p><a href="https://www.loseit.com/">Lose It!</a> &#8212; simpler alternative with a clean interface</p></li></ul><div><hr></div><h3>Workout Tracking</h3><ul><li><p><a href="https://www.hevyapp.com/">Hevy</a> &#8212; popular gym logger with social features + exercise library (free tier)</p></li><li><p><a href="https://www.strong.app/">Strong</a> &#8212; clean, minimal workout tracker for lifting (free tier)</p></li><li><p><a href="https://stronglifts.com/app/">StrongLifts 5&#215;5</a> &#8212; app built around the StrongLifts beginner program</p></li><li><p><a href="https://fitbod.me/">Fitbod</a> &#8212; AI-generated workouts that adapt to your equipment and recovery</p></li><li><p><a href="https://www.strava.com/">Strava</a> &#8212; tracking for runs, rides, and outdoor cardio</p></li><li><p><a href="https://www.nike.com/ntc-app">Nike Training Club</a> &#8212; free guided workouts (strength, yoga, HIIT, bodyweight)</p></li></ul><div><hr></div><h3>Exercise Form and Learning</h3><ul><li><p><a href="https://www.hevyapp.com/exercises/">Hevy Exercise Library</a> &#8212; searchable database with form guides</p></li><li><p><a href="https://www.muscleandstrength.com/exercises">Muscle &amp; Strength Exercise Database</a> &#8212; video demos organized by muscle group</p></li><li><p><a href="https://exrx.net/">ExRx.net</a> &#8212; comprehensive exercise encyclopedia</p></li></ul><div><hr></div><h3>Beginner Strength Programs</h3><ul><li><p><a href="https://thefitness.wiki/routines/r-fitness-basic-beginner-routine/">r/Fitness Basic Beginner Routine</a> &#8212; simple barbell program to build the habit</p></li><li><p><a href="https://thefitness.wiki/routines/5-3-1-for-beginners/">5/3/1 for Beginners</a> &#8212; Jim Wendler&#8217;s system adapted for novices</p></li><li><p><a href="https://thefitness.wiki/routines/gzcl-based-programs/">GZCLP</a> &#8212; flexible linear progression program</p></li><li><p><a href="https://thefitness.wiki/routines/strength-training-muscle-building/">r/Fitness Recommended Routines</a> &#8212; curated list of programs for all levels</p></li><li><p><a href="https://www.nerdfitness.com/blog/strength-training-101-where-do-i-start/">Nerd Fitness: Strength Training 101</a> &#8212; approachable guide for absolute beginners</p></li></ul><div><hr></div><h3>Guidelines and Health Authorities</h3><ul><li><p><a href="https://www.heart.org/en/healthy-living/fitness/fitness-basics/aha-recs-for-physical-activity-in-adults">American Heart Association: Physical Activity Recommendations</a></p></li><li><p><a href="https://www.cdc.gov/physical-activity-basics/guidelines/adults.html">CDC: Adult Activity Guidelines Overview</a></p></li><li><p><a href="https://www.who.int/initiatives/behealthy/physical-activity">WHO: Physical Activity Guidelines</a></p></li><li><p><a href="https://health.gov/sites/default/files/2019-09/Physical_Activity_Guidelines_2nd_edition.pdf">Physical Activity Guidelines for Americans (PDF)</a></p></li></ul><div><hr></div><h3>Evidence-Based Training &amp; Nutrition (Articles / Podcasts)</h3><ul><li><p><a href="https://www.strongerbyscience.com/">Stronger By Science</a> &#8212; evidence-based training and nutrition articles</p></li><li><p><a href="https://sbspod.com/">Stronger By Science Podcast</a> &#8212; deep dives on research + practical takeaways</p></li></ul><div><hr></div><h3>YouTube &#8212; Evidence-Based / Educational</h3><ul><li><p><a href="https://www.youtube.com/@JeffNippard">Jeff Nippard</a> &#8212; science-backed breakdowns of training/nutrition</p></li><li><p><a href="https://www.youtube.com/@JeremyEthier">Jeremy Ethier</a> &#8212; biomechanics and evidence-based training</p></li><li><p><a href="https://www.youtube.com/@NatachaOceane">Natacha Oc&#233;ane</a> &#8212; HIIT, nutrition science, fitness experiments</p></li><li><p><a href="https://www.youtube.com/@RenaissancePeriodization">Renaissance Periodization (Dr. Mike Israetel)</a> &#8212; hypertrophy + training science</p></li></ul><blockquote><p><em>Note: Some channels mix evidence with opinion/marketing. Use them as tools, not gospel.</em></p></blockquote><div><hr></div><h3>YouTube &#8212; Form / Practical Coaching (often opinionated, still useful)</h3><ul><li><p><a href="https://www.youtube.com/@athleanx">ATHLEAN-X (Jeff Cavaliere)</a> &#8212; form cues, injury prevention, exercise selection</p></li></ul><div><hr></div><h3>YouTube &#8212; Fitness Commentary and Transparency</h3><ul><li><p><a href="https://www.youtube.com/@GregDoucette">Greg Doucette</a> &#8212; blunt fitness advice + industry commentary</p></li><li><p><a href="https://www.youtube.com/@MorePlatesMoreDates">More Plates More Dates (Derek)</a> &#8212; PED transparency + fitness/entertainment analysis</p></li><li><p><a href="https://www.youtube.com/@SeanNalewanyj">Sean Nalewanyj</a> &#8212; no-nonsense lifting + nutrition advice</p></li><li><p><a href="https://www.youtube.com/@WillTennyson">Will Tennyson</a> &#8212; entertaining food/fitness content with calorie breakdowns</p></li></ul><div><hr></div><h3>YouTube &#8212; Follow-Along Workouts</h3><ul><li><p><a href="https://www.youtube.com/@fitnessblender">Fitness Blender</a> &#8212; free full-length workouts (HIIT, strength, low-impact)</p></li><li><p><a href="https://www.youtube.com/@CarolineGirvan">Caroline Girvan</a> &#8212; structured strength programs</p></li><li><p><a href="https://www.youtube.com/@yogawithadriene">Yoga with Adriene</a> &#8212; accessible yoga for recovery and stress</p></li><li><p><a href="https://www.youtube.com/@MadFit">MadFit</a> &#8212; short home workouts, often music-driven</p></li></ul><div><hr></div><h3>Running</h3><ul><li><p><a href="https://www.youtube.com/@therunexperience">The Run Experience</a> &#8212; running form + plans + beginner guidance</p></li><li><p><a href="https://www.youtube.com/@NickBare">Nick Bare</a> &#8212; hybrid training (lifting + endurance), marathon prep, nutrition</p></li></ul><div><hr></div><h3>Research and Health Resources</h3><ul><li><p><a href="https://pubmed.ncbi.nlm.nih.gov/18424245/">Exposure to idealized physiques and body dissatisfaction (PubMed)</a></p></li><li><p><a href="https://nida.nih.gov/research-topics/anabolic-steroids">Anabolic Steroids and Health Risks (NIDA)</a></p></li><li><p><a href="https://pmc.ncbi.nlm.nih.gov/articles/PMC12694696/">Muscle dysmorphia and social media exposure (PMC)</a></p></li><li><p><a href="https://pubmed.ncbi.nlm.nih.gov/37752011/">RED-S: Relative Energy Deficiency in Sport (PubMed)</a></p></li><li><p><a href="https://thefitness.wiki/">The Fitness Wiki</a> &#8212; community-maintained FAQs + routines + nutrition primers</p></li></ul><div><hr></div><h3>Articles and Interviews (Media / Hollywood Physiques)</h3><ul><li><p><a href="https://variety.com/2022/film/news/zac-efron-baywatch-training-fitness-routine-depression-1235364455/">Zac Efron on his Baywatch transformation (Variety)</a></p></li><li><p><a href="https://www.vulture.com/article/kumail-nanjiani-eternals-profile.html">Kumail Nanjiani&#8217;s Eternals transformation (Vulture)</a></p></li><li><p><a href="https://www.businessinsider.com/kumail-nanjiani-eternals-workout-diet-trainer-2019-12">Kumail Nanjiani on turning fitness into a full-time job (Business Insider)</a></p></li><li><p><a href="https://www.glamour.com/story/chris-hemsworth-says-his-wife-called-his-thor-muscles-too-much">Chris Hemsworth on maintaining a Thor-level physique (Glamour)</a></p></li><li><p><a href="https://economictimes.indiatimes.com/us/life/chris-hemsworths-recent-interviews-highlight-why-recovery-and-simplicity-are-replacing-extreme-fitness-culture/articleshow/126965192.cms">Chris Hemsworth&#8217;s shift toward recovery and sustainability (Economic Times)</a></p></li></ul><div><hr></div><h3>Documentaries and Media</h3><ul><li><p><em><a href="https://www.imdb.com/title/tt1151309/">Bigger, Stronger, Faster</a></em> &#8212; documentary on PED culture in America</p></li><li><p><a href="https://www.youtube.com/watch?v=qN4sknMBzfQ">More Plates More Dates: PED use in fitness and entertainment (YouTube)</a></p></li></ul><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://notebook.mubbie.dev/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Mubbie's Notebook! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[Garbage Collection (More Like Recycling)]]></title><description><![CDATA[How Your Runtime Reclaims and Reuses Memory Behind Your Back]]></description><link>https://notebook.mubbie.dev/p/garbage-collection-more-like-recycling</link><guid isPermaLink="false">https://notebook.mubbie.dev/p/garbage-collection-more-like-recycling</guid><dc:creator><![CDATA[Mubarak Idoko]]></dc:creator><pubDate>Tue, 17 Feb 2026 08:10:28 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!WwQm!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd206c910-1f65-4a40-98cd-b38cb1299853_543x660.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!WwQm!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd206c910-1f65-4a40-98cd-b38cb1299853_543x660.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!WwQm!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd206c910-1f65-4a40-98cd-b38cb1299853_543x660.png 424w, https://substackcdn.com/image/fetch/$s_!WwQm!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd206c910-1f65-4a40-98cd-b38cb1299853_543x660.png 848w, https://substackcdn.com/image/fetch/$s_!WwQm!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd206c910-1f65-4a40-98cd-b38cb1299853_543x660.png 1272w, https://substackcdn.com/image/fetch/$s_!WwQm!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd206c910-1f65-4a40-98cd-b38cb1299853_543x660.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!WwQm!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd206c910-1f65-4a40-98cd-b38cb1299853_543x660.png" width="543" height="660" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/d206c910-1f65-4a40-98cd-b38cb1299853_543x660.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:660,&quot;width&quot;:543,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:30847,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://mubbiesnotebook.substack.com/i/188232203?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd206c910-1f65-4a40-98cd-b38cb1299853_543x660.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!WwQm!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd206c910-1f65-4a40-98cd-b38cb1299853_543x660.png 424w, https://substackcdn.com/image/fetch/$s_!WwQm!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd206c910-1f65-4a40-98cd-b38cb1299853_543x660.png 848w, https://substackcdn.com/image/fetch/$s_!WwQm!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd206c910-1f65-4a40-98cd-b38cb1299853_543x660.png 1272w, https://substackcdn.com/image/fetch/$s_!WwQm!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd206c910-1f65-4a40-98cd-b38cb1299853_543x660.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Image Source: <a href="https://xkcd.com/">XKCD</a></em></p><h2>Introduction</h2><p>When we write code, we create data (values and objects), and that data must be stored somewhere. Most of the time, that &#8220;somewhere&#8221; is memory managed by the operating system and the language runtime. You can think of it as a big address space where your program stores the bits that make up objects: numbers, strings, arrays, structs, class instances, and so on.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://notebook.mubbie.dev/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Mubbie's Notebook! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p>In some (typically lower-level) languages, creating an object often means explicitly allocating memory for it. You have to know how much you need, avoid writing past the space you were given, and, crucially, remember to free that memory when you&#8217;re done. If you don&#8217;t, the program may continue to accumulate unused allocations, resulting in a memory leak. If you free the wrong thing (or use memory after it&#8217;s been freed), you can get nastier failures &#8212; crashes, corrupted data, security vulnerabilities, the whole mess. (If you want examples of how memory bugs can spiral into real-world issues, here are recent write-ups involving vulnerabilities in MongoDB: <a href="https://www.ox.security/blog/attackers-could-exploit-zlib-to-exfiltrate-data-cve-2025-14847/">MongoDB Unauthenticated Attacker Sensitive Memory Leak</a>, <a href="https://doublepulsar.com/merry-christmas-day-have-a-mongodb-security-incident-9537f54289eb">Merry Christmas Day! Have a MongoDB security incident.</a>)</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!gR0D!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F602b57ad-13d6-4cb4-9aae-12419d6492a0_1080x1080.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!gR0D!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F602b57ad-13d6-4cb4-9aae-12419d6492a0_1080x1080.jpeg 424w, https://substackcdn.com/image/fetch/$s_!gR0D!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F602b57ad-13d6-4cb4-9aae-12419d6492a0_1080x1080.jpeg 848w, https://substackcdn.com/image/fetch/$s_!gR0D!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F602b57ad-13d6-4cb4-9aae-12419d6492a0_1080x1080.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!gR0D!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F602b57ad-13d6-4cb4-9aae-12419d6492a0_1080x1080.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!gR0D!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F602b57ad-13d6-4cb4-9aae-12419d6492a0_1080x1080.jpeg" width="1080" height="1080" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/602b57ad-13d6-4cb4-9aae-12419d6492a0_1080x1080.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1080,&quot;width&quot;:1080,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:112158,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://mubbiesnotebook.substack.com/i/188232203?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F602b57ad-13d6-4cb4-9aae-12419d6492a0_1080x1080.jpeg&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!gR0D!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F602b57ad-13d6-4cb4-9aae-12419d6492a0_1080x1080.jpeg 424w, https://substackcdn.com/image/fetch/$s_!gR0D!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F602b57ad-13d6-4cb4-9aae-12419d6492a0_1080x1080.jpeg 848w, https://substackcdn.com/image/fetch/$s_!gR0D!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F602b57ad-13d6-4cb4-9aae-12419d6492a0_1080x1080.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!gR0D!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F602b57ad-13d6-4cb4-9aae-12419d6492a0_1080x1080.jpeg 1456w" sizes="100vw"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Image Source: <a href="https://www.instagram.com/system32comics/">system32comics</a> (Pardon the NSFW reference)</em></p><p>Keeping track of every allocation in a complex program is tedious and error-prone, which is exactly why many modern languages introduced garbage collection. In garbage-collected languages, you allocate memory freely, and the runtime periodically identifies memory that&#8217;s no longer reachable by your program and reclaims it for reuse.</p><p>That sounds like &#8220;taking out the trash.&#8221; However, it&#8217;s often closer to recycling: identifying what&#8217;s still in use, separating it from what isn&#8217;t, and reorganizing memory so new objects can be allocated efficiently. In this article, we&#8217;ll demystify how garbage collection actually works and perhaps, why &#8220;memory recycling&#8221; might be the more honest name. We&#8217;re going to peek under the hood (or into the bin) and see what&#8217;s really going on.</p><h2>The Heap (of Garbage?)</h2><p>Before we get into how garbage collection works, it&#8217;s helpful to know where it works. Most programs use two main regions of memory, the stack and the heap.</p><p>The stack is like a fast, automatic workspace your program uses for things like function calls and local variables. Every time a function runs, it gets a stack frame; when the function returns, that frame is popped off. Memory on the stack is reclaimed immediately and predictably, so it doesn&#8217;t need any special cleanup. Stack allocation is &#8220;automatic&#8221; in the literal sense: entry into and exit from a function determine the lifetime of the memory used by that function call.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Dizs!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff1d23e44-03e6-4b50-a751-1ac1003d8638_1600x1095.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Dizs!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff1d23e44-03e6-4b50-a751-1ac1003d8638_1600x1095.png 424w, https://substackcdn.com/image/fetch/$s_!Dizs!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff1d23e44-03e6-4b50-a751-1ac1003d8638_1600x1095.png 848w, https://substackcdn.com/image/fetch/$s_!Dizs!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff1d23e44-03e6-4b50-a751-1ac1003d8638_1600x1095.png 1272w, https://substackcdn.com/image/fetch/$s_!Dizs!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff1d23e44-03e6-4b50-a751-1ac1003d8638_1600x1095.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Dizs!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff1d23e44-03e6-4b50-a751-1ac1003d8638_1600x1095.png" width="1456" height="996" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f1d23e44-03e6-4b50-a751-1ac1003d8638_1600x1095.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:996,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:73893,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://mubbiesnotebook.substack.com/i/188232203?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff1d23e44-03e6-4b50-a751-1ac1003d8638_1600x1095.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Dizs!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff1d23e44-03e6-4b50-a751-1ac1003d8638_1600x1095.png 424w, https://substackcdn.com/image/fetch/$s_!Dizs!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff1d23e44-03e6-4b50-a751-1ac1003d8638_1600x1095.png 848w, https://substackcdn.com/image/fetch/$s_!Dizs!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff1d23e44-03e6-4b50-a751-1ac1003d8638_1600x1095.png 1272w, https://substackcdn.com/image/fetch/$s_!Dizs!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff1d23e44-03e6-4b50-a751-1ac1003d8638_1600x1095.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Image Source: <a href="https://www.telerik.com/blogs/fundamentals-garbage-collection">Fundamentals of Garbage Collection</a></em></p><p>The heap, on the other hand, is a shared pool of memory used for data that needs to live beyond a single function call, or whose size/lifetime is hard to predict in advance (think objects, strings, arrays, dynamic data structures, and so on). You can allocate heap objects and keep them around by passing references across functions, storing them in other objects, or placing them in long-lived structures.</p><p>And that flexibility is exactly why the heap needs help. Heap allocations don&#8217;t have an obvious &#8220;end of life&#8221; the way stack frames do. In languages without a garbage collector, the programmer is responsible for returning heap memory when it&#8217;s no longer needed. In garbage-collected languages, the runtime takes on that job by periodically scanning the heap, figuring out what is still reachable, and reclaiming space from objects that aren&#8217;t.</p><h2>What is Garbage?</h2><p>It is the runtime&#8217;s job to determine which heap objects are still in use and which can be reclaimed. But how does it make the distinction? It can&#8217;t read the programmer&#8217;s intent, so it doesn&#8217;t know what they plan to do with an object. What it can do is check whether the program can still reach an object. If an object is still reachable by the running program, it&#8217;s alive. If it&#8217;s unreachable, it&#8217;s garbage and can be cleaned up (or the space reclaimed for use by a different object).</p><p>We can think of the program&#8217;s memory as a graph:</p><ul><li><p><strong>Objects</strong> are nodes (strings, arrays, class instances, etc.)</p></li><li><p><strong>References/pointers</strong> are edges between nodes</p></li></ul><p>If you can start from a known &#8220;entry point&#8221; and follow references to an object, then the program could still access it. That object must be kept.</p><p>If there&#8217;s no path to an object, then no code can ever get to it again. It might as well not exist, so the runtime is free to reclaim its memory.</p><h3>The Roots: Where Tracking Begins</h3><p>Garbage collectors start from a small set of &#8220;definitely alive&#8221; references called roots. The exact types of roots vary by language and runtime, but typically include:</p><ul><li><p>Local variables on thread stacks (things currently in scope)</p></li><li><p>Global or static variables</p></li><li><p>CPU registers</p></li><li><p>References held by the runtime itself (e.g., JIT/compiler metadata)</p></li></ul><p>You can think of roots as places the program can directly &#8220;grab&#8221; data from at any moment.</p><h3>Tracing the object graph</h3><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!oixV!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9b67b121-e00b-46bf-a77b-b2c0df161a92_662x441.gif" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!oixV!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9b67b121-e00b-46bf-a77b-b2c0df161a92_662x441.gif 424w, https://substackcdn.com/image/fetch/$s_!oixV!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9b67b121-e00b-46bf-a77b-b2c0df161a92_662x441.gif 848w, https://substackcdn.com/image/fetch/$s_!oixV!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9b67b121-e00b-46bf-a77b-b2c0df161a92_662x441.gif 1272w, https://substackcdn.com/image/fetch/$s_!oixV!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9b67b121-e00b-46bf-a77b-b2c0df161a92_662x441.gif 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!oixV!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9b67b121-e00b-46bf-a77b-b2c0df161a92_662x441.gif" width="662" height="441" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/9b67b121-e00b-46bf-a77b-b2c0df161a92_662x441.gif&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:441,&quot;width&quot;:662,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:8848,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/gif&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://mubbiesnotebook.substack.com/i/188232203?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9b67b121-e00b-46bf-a77b-b2c0df161a92_662x441.gif&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!oixV!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9b67b121-e00b-46bf-a77b-b2c0df161a92_662x441.gif 424w, https://substackcdn.com/image/fetch/$s_!oixV!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9b67b121-e00b-46bf-a77b-b2c0df161a92_662x441.gif 848w, https://substackcdn.com/image/fetch/$s_!oixV!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9b67b121-e00b-46bf-a77b-b2c0df161a92_662x441.gif 1272w, https://substackcdn.com/image/fetch/$s_!oixV!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9b67b121-e00b-46bf-a77b-b2c0df161a92_662x441.gif 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Image Source: <a href="https://rebelsky.cs.grinnell.edu/Courses/CS302/99S/Presentations/GC/">Introduction to Garbage Collection - Grinnell College</a></em></p><p>From the roots, the GC traces outward:</p><ol><li><p>Look at every root reference.</p></li><li><p>Mark the object it points to as alive.</p></li><li><p>Follow that object&#8217;s references to other objects.</p></li><li><p>Repeat until there&#8217;s nothing new to visit.</p></li></ol><p>At the end of this traversal, the GC has effectively partitioned the heap into two sets:</p><ul><li><p><strong>Reachable (alive)</strong>: the program can still get to these objects.</p></li><li><p><strong>Unreachable (garbage)</strong>: nothing points to them anymore, so the memory they occupy can be reclaimed.</p></li></ul><h3>A tiny example</h3><p>Imagine this situation:</p><ul><li><p>A root points to object <code>X</code></p></li><li><p><code>X</code> points to <code>Y</code></p></li><li><p><code>Y</code> points to <code>Z</code></p></li></ul><p>So the GC can reach <code>X -&gt; Y -&gt; Z</code>, and all three are alive.</p><p>Now, suppose the code drops the last reference to <code>X</code> (e.g., a function returns or a variable is overwritten). If <code>X</code> is no longer reachable from any root, then <code>Y</code> and <code>Z</code> become unreachable too, even if they still point to each other.</p><p>The garbage collector doesn&#8217;t care whether objects reference each other. It only cares whether the program can reach them from the roots. This also enables tracing to handle cycles naturally. Two objects can be locked in an eternal embrace (like the <a href="https://www.atlasobscura.com/places/lovers-of-valdaro">Lovers of Valdarao</a>), but if nothing reachable points to them, the GC can still collect them.</p><p>Now that we know what garbage is, let&#8217;s look at the different strategies runtimes use to find and collect it.</p><h2>Strategies for Garbage Collection</h2><p>There are multiple ways to take out the trash (or run a recycling program). Over the decades, language designers have developed several strategies for finding and reclaiming unreachable objects, and many real-world runtimes use hybrid approaches. Below are some of the most common methods.</p><h3>Reference Counting: Keeping a Tally</h3><p>In this method, each object maintains a counter of the number of references pointing to it.</p><ul><li><p>When we create a new reference to an object, its count goes up.</p></li><li><p>When a reference goes away (a variable is overwritten, a scope ends), the count goes down.</p></li><li><p>When the count hits zero, the object is immediately collectible, because nothing can reach it anymore.</p></li></ul><p>For instance:</p><pre><code><code>x -&gt; [A] (refCount = 1)
x = null
[A] (refCount = 0) -&gt; reclaim A
</code></code></pre><p>The appeal is simplicity and immediacy: objects are cleaned up the moment they are no longer in use, with no need to pause the program for a large collection phase. Languages like <a href="https://docs.python.org/3/c-api/refcounting.html">Python</a> and <a href="https://www.php.net/manual/en/features.gc.refcounting-basics.php">PHP</a> use reference counting at the core of their memory management.</p><p>The tradeoff here is circular references. If object <code>A</code> points to <code>B</code> and <code>B</code> points back to <code>A</code>, both counters stay at 1 even if nothing else in the program can reach either of them. The memory &#8220;leaks&#8221; unless the runtime has a secondary mechanism (like <a href="https://docs.python.org/3/library/gc.html">Python&#8217;s cycle detector</a>) to catch these cases.</p><p>There&#8217;s also overhead to consider. Every assignment, every function call, and every time a reference is copied or dropped, the runtime must update the counter. In reference-heavy code, the bookkeeping can add up.</p><h3>Mark-and-Sweep (Tracing GC)</h3><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!JAXn!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe0523d43-4c21-4191-9a6e-c26eaee7e6da_420x321.gif" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!JAXn!,w_424,c_limit,f_webp,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe0523d43-4c21-4191-9a6e-c26eaee7e6da_420x321.gif 424w, https://substackcdn.com/image/fetch/$s_!JAXn!,w_848,c_limit,f_webp,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe0523d43-4c21-4191-9a6e-c26eaee7e6da_420x321.gif 848w, https://substackcdn.com/image/fetch/$s_!JAXn!,w_1272,c_limit,f_webp,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe0523d43-4c21-4191-9a6e-c26eaee7e6da_420x321.gif 1272w, https://substackcdn.com/image/fetch/$s_!JAXn!,w_1456,c_limit,f_webp,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe0523d43-4c21-4191-9a6e-c26eaee7e6da_420x321.gif 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!JAXn!,w_1456,c_limit,f_auto,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe0523d43-4c21-4191-9a6e-c26eaee7e6da_420x321.gif" width="420" height="321" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e0523d43-4c21-4191-9a6e-c26eaee7e6da_420x321.gif&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:321,&quot;width&quot;:420,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Animation of the Naive Mark and Sweep Garbage Collector Algorithm&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Animation of the Naive Mark and Sweep Garbage Collector Algorithm" title="Animation of the Naive Mark and Sweep Garbage Collector Algorithm" srcset="https://substackcdn.com/image/fetch/$s_!JAXn!,w_424,c_limit,f_auto,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe0523d43-4c21-4191-9a6e-c26eaee7e6da_420x321.gif 424w, https://substackcdn.com/image/fetch/$s_!JAXn!,w_848,c_limit,f_auto,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe0523d43-4c21-4191-9a6e-c26eaee7e6da_420x321.gif 848w, https://substackcdn.com/image/fetch/$s_!JAXn!,w_1272,c_limit,f_auto,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe0523d43-4c21-4191-9a6e-c26eaee7e6da_420x321.gif 1272w, https://substackcdn.com/image/fetch/$s_!JAXn!,w_1456,c_limit,f_auto,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe0523d43-4c21-4191-9a6e-c26eaee7e6da_420x321.gif 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Image Source: <a href="https://commons.wikimedia.org/wiki/File:Animation_of_the_Naive_Mark_and_Sweep_Garbage_Collector_Algorithm.gif">M17, CC0, via Wikimedia Commons</a></em></p><p>Mark-and-sweep takes the reachability approach we described in the previous section and turns it into a two-phase algorithm.</p><ul><li><p><strong>Mark phase</strong>: Starting from the roots, the GC traverses the object graph and marks every reachable object as alive.</p></li><li><p><strong>Sweep phase</strong>: The GC walks through the entire heap. Any object that wasn&#8217;t marked is unreachable, so its memory is reclaimed. Marked objects then have their marks cleared in preparation for the next cycle.</p></li></ul><pre><code><code>Root -&gt; A -&gt; B

Heap:  [A]   [B]  [C] [D]
Mark:  keep  keep  -   - 
Sweep: reclaim C and D
</code></code></pre><p>The big advantage over reference counting is that mark-and-sweep handles cycles naturally, because it only cares whether an object is reachable from a root.</p><p>The tradeoff is that a full tracing pass can be disruptive. In a basic mark-and-sweep implementation, the program often pauses while the GC traces and sweeps the heap. The larger the heap, the more work there is to do, and the more noticeable the pause. Modern collectors mitigate this with incremental and concurrent techniques that do more of the work alongside the running program, but the fundamental tension between thoroughness and responsiveness remains.</p><h3>Generational Collection: Most Objects Die Young</h3><p>Generational collection is built on an empirical observation&#8212;the generational hypothesis: most objects have very short lifetimes. A temporary string built during a function call, an iterator, an intermediate calculation&#8230; these objects are created, used briefly, and become garbage almost immediately. A smaller fraction of objects (configuration, caches, long-lived data structures) stick around much longer.</p><p>Generational collectors exploit this by dividing the heap into regions, typically called generations:</p><ul><li><p><strong>Young generation (nursery)</strong>: Where new objects are allocated. This region is collected frequently because most of its contents are expected to die quickly. Since the region is small, these collections are fast.</p></li><li><p><strong>Old generation (tenured)</strong>: Objects that survive one or more young generation collections get promoted here. This region is larger and is collected less often, since its objects have already proven likely to persist.</p></li></ul><pre><code><code>New objects -&gt; Young (collected often) -&gt; survivors -&gt; Old (collected rarely)
</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!RjFl!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F815e4396-000d-406b-8ceb-04504594286a_742x513.gif" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!RjFl!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F815e4396-000d-406b-8ceb-04504594286a_742x513.gif 424w, https://substackcdn.com/image/fetch/$s_!RjFl!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F815e4396-000d-406b-8ceb-04504594286a_742x513.gif 848w, https://substackcdn.com/image/fetch/$s_!RjFl!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F815e4396-000d-406b-8ceb-04504594286a_742x513.gif 1272w, https://substackcdn.com/image/fetch/$s_!RjFl!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F815e4396-000d-406b-8ceb-04504594286a_742x513.gif 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!RjFl!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F815e4396-000d-406b-8ceb-04504594286a_742x513.gif" width="742" height="513" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/815e4396-000d-406b-8ceb-04504594286a_742x513.gif&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:513,&quot;width&quot;:742,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:6484,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/gif&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://mubbiesnotebook.substack.com/i/188232203?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F815e4396-000d-406b-8ceb-04504594286a_742x513.gif&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!RjFl!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F815e4396-000d-406b-8ceb-04504594286a_742x513.gif 424w, https://substackcdn.com/image/fetch/$s_!RjFl!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F815e4396-000d-406b-8ceb-04504594286a_742x513.gif 848w, https://substackcdn.com/image/fetch/$s_!RjFl!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F815e4396-000d-406b-8ceb-04504594286a_742x513.gif 1272w, https://substackcdn.com/image/fetch/$s_!RjFl!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F815e4396-000d-406b-8ceb-04504594286a_742x513.gif 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Image Source: <a href="https://www.cs.cornell.edu/courses/cs6120/2019fa/blog/unified-theory-gc/">The CS 6120 Course Blog - Cornell University</a></em></p><p>The tradeoff is that we must track cross-generational references. If an old object points to a young object, the GC must not accidentally collect the young one during a &#8220;young-only&#8221; collection. So the runtime does bookkeeping (often via a write barrier and a remembered set) to remember &#8220;old &#8594; young&#8221; pointers. That tracking adds overhead, but it&#8217;s usually worth it because it avoids frequent scanning of the entire heap.</p><p>Many production collectors use some form of generational collection (often combined with concurrent or incremental techniques to reduce pause times). Examples include the <a href="https://www.datadoghq.com/blog/understanding-java-gc/">JVM&#8217;s generational collectors</a>, <a href="https://learn.microsoft.com/en-us/dotnet/standard/garbage-collection/fundamentals">.NET&#8217;s GC</a>, and JavaScript engines like <a href="https://medium.com/@Faysal00009/garbage-collection-gc-works-in-v8-d188cf959895">V8</a>.</p><p>Real-world collectors rarely use a single strategy in isolation. Modern GCs mix and match: copying and compacting collectors relocate surviving objects to reduce fragmentation; incremental and concurrent collectors interleave GC work with program execution to reduce pause times; and region-based collectors (like <a href="https://docs.oracle.com/en/java/javase/17/gctuning/garbage-first-g1-garbage-collector1.html">Java&#8217;s G1</a>) divide the heap into independently collectible chunks and prioritize the ones with the most garbage. Some runtimes also try to avoid GC work entirely when possible via escape analysis; they prove that certain objects don&#8217;t outlive a function and allocate them on the stack instead, so the collector never has to touch them.</p><p>At the far end of the spectrum is the &#8220;no GC at runtime&#8221; approach: languages like Rust enforce ownership rules at compile time and free memory deterministically, without a runtime collector. The takeaway is that garbage collection isn&#8217;t a single algorithm. It&#8217;s a toolbox, and most production runtimes are creative hybrids tuned for different tradeoffs.</p><h2>The Cost of Recycling</h2><p>Garbage collection saves the programmer from having to manage memory themselves, but it doesn&#8217;t make memory management free (even though we never have to call <code>free()</code>). It shifts the cost from the code to the runtime, and that cost can show up in a few ways.</p><h3>Pause Times</h3><p>This is the most visible cost. When the GC runs, it may need to pause your program&#8212;or at least slow it down. In a basic stop-the-world collector, everything freezes while the GC traces and sweeps. These pauses can range from microseconds to tens of milliseconds (and, in extreme cases, longer), depending on heap size, the number of live objects, and the collector&#8217;s design.</p><p>For a batch job or a CLI tool, you might never notice. For a game rendering at 60 FPS, a multiplayer server, or a trading system, even a few milliseconds in the wrong place can be a real problem. This is why so much GC research focuses on reducing, hiding, or distributing pause times. Concurrent collectors, incremental passes, and region-based collection exist largely to address this.</p><h3>Throughput Overhead</h3><p>Even when the GC isn&#8217;t pausing your program, it&#8217;s still consuming resources. Tracing the object graph, maintaining write barriers for generational collectors, and copying or compacting live objects all consume CPU time that could otherwise be spent on your application logic. (And in runtimes that use reference counting/ARC, reference updates add overhead too.)</p><p>The overhead varies widely. A well-tuned collector might use only a small percentage of total CPU time. A poorly tuned one&#8212;or one dealing with a pathological allocation pattern&#8212;can eat significantly more. The general rule is that GC trades some raw throughput for the convenience (and safety) of not managing memory yourself.</p><h3>Memory Overhead</h3><p>Garbage collectors need headroom to work efficiently. If the heap is nearly full, the GC has to run more frequently, which increases pause times and CPU usage. Most collectors perform best when the heap has some breathing room, which means your program may use more memory than it strictly needs at any given moment.</p><p>Some strategies incur additional memory costs on top of this. Copying collectors need space to copy live objects into. Generational collectors maintain remembered sets to track cross-generational references. Reference counting adds metadata to track counts. None of these is enormous individually, but they add up, especially in memory-constrained environments, and especially when fragmentation forces the runtime to keep extra slack space around.</p><h3>Unpredictability</h3><p>Perhaps the subtlest cost is timing: you don&#8217;t control exactly when the GC runs, and you don&#8217;t control exactly how long it takes. You can influence it through tuning and allocation patterns, but ultimately, the runtime decides when to collect and how much work to do. That can make GC-related performance issues harder to reproduce, profile, and reason about than many other bottlenecks.</p><p>In manually managed languages, freeing memory is explicit and predictable: you pay the cost exactly where you wrote the <code>free()</code> call. With GC, that cost is deferred and amortized in ways that can be hard to connect back to the allocation behavior that triggered it.</p><h3>So, is it worth it?</h3><p>For most applications, yes&#8212;overwhelmingly. The bugs that manual memory management introduces (use-after-free, double-free, leaks) are often far more expensive in practice than the overhead a modern GC imposes. But &#8220;most applications&#8221; isn&#8217;t all applications, and understanding what you&#8217;re trading away helps you make informed decisions about when GC is the right fit and when you might want more control.</p><h2>Conclusion: Better Than Recycling</h2><p>We&#8217;ve been calling garbage collection a recycling program, and the metaphor holds up surprisingly well. The runtime traces what&#8217;s still reachable, separates it from what isn&#8217;t, and reclaims the leftovers so they can be put to work again.</p><p>But here&#8217;s where the metaphor breaks down&#8212;and in the best possible way. Real-world recycling degrades material. Paper loses fiber. Plastic weakens. Every cycle produces something a little worse than what came before. Reclaimed memory has no such problem. A freed byte is identical to a fresh one. There&#8217;s no wear, no downgrade, no loss of quality. The runtime hands it back in perfect condition, ready to become whatever your program needs next.</p><p>So the next time your program hums along without you writing a single <code>malloc()</code> or <code>free()</code>, take a moment to appreciate the quiet, efficient system working behind the scenes. It&#8217;s not just taking out the trash; it&#8217;s running a recycling program that never loses fidelity. And it&#8217;s doing it while you&#8217;re not looking.</p><p>Working on this blog post has been a lovely learning experience, and I thought it would be fun to write a small garbage collection library for C to harden the concepts. If you are interested in learning along, feel free to look at the repo and contribute. I put together a roadmap (with some help from Claude) and will walk through it and learn as we go. Find the repo here: <a href="https://github.com/mubbie/garbagec">garbagec</a>.</p><h1>References</h1><ul><li><p><a href="https://www.heroku.com/blog/incremental-gc/">Incremental Garbage Collection in Ruby 2.2 &#8212; Heroku</a></p></li><li><p><a href="https://journal.stuffwithstuff.com/2013/12/08/babys-first-garbage-collector/">Baby&#8217;s First Garbage Collector &#8212; Bob Nystrom</a></p></li><li><p><a href="https://gchandbook.org/">The Garbage Collection Handbook &#8212; gchandbook.org</a></p></li><li><p><a href="https://www.hboehm.info/gc/">Boehm-Demers-Weiser GC &#8212; Hans Boehm</a></p></li><li><p><a href="https://craftinginterpreters.com/garbage-collection.html">Crafting Interpreters, Ch. 26: Garbage Collection &#8212; Bob Nystrom</a></p></li><li><p><a href="https://maplant.com/2020-04-25-Writing-a-Simple-Garbage-Collector-in-C.html">Writing a Simple Garbage Collector in C &#8212; Matt Plant</a>- <a href="https://langdev.stackexchange.com/questions/24/what-different-types-of-garbage-collection-are-there-and-what-benefits-do-they">What different types of garbage collection are there? &#8212; Language Dev Stack Exchange</a></p></li><li><p><a href="https://rebelsky.cs.grinnell.edu/Courses/CS302/99S/Presentations/GC/">Garbage Collection &#8212; Grinnell College CS302</a></p></li><li><p><a href="https://www.telerik.com/blogs/fundamentals-garbage-collection">Fundamentals of Garbage Collection &#8212; Telerik</a></p></li><li><p><a href="https://learn.microsoft.com/en-us/archive/blogs/abhinaba/back-to-basics-generational-garbage-collection">Back to Basics: Generational Garbage Collection &#8212; Microsoft</a></p></li><li><p><a href="https://www.oracle.com/webfolder/technetwork/tutorials/obe/java/gc01/index.html">Java Garbage Collection Overview &#8212; Oracle</a></p></li><li><p><a href="https://blog.brownplt.org/2013/02/19/teaching-gc.html">Teaching Garbage Collection &#8212; Brown PLT</a></p></li><li><p><a href="https://www.heroku.com/blog/incremental-gc/">Incremental GC &#8212; Heroku</a></p></li><li><p><a href="https://www.cs.cornell.edu/courses/cs6120/2019fa/blog/unified-theory-gc/">A Unified Theory of Garbage Collection &#8212; Cornell CS6120</a></p></li><li><p><a href="https://medium.com/free-code-camp/an-animated-guide-to-how-garbage-collection-algorithms-work-46ccdba2b216">An Animated Guide to How Garbage Collection Algorithms Work &#8212; freeCodeCamp</a></p></li><li><p><a href="https://medium.com/@andrew_johnson_4/memory-management-strategies-garbage-collection-reference-counting-and-beyond-4206afc6aee0">Memory Management Strategies: Garbage Collection, Reference Counting, and Beyond &#8212; Andrew Johnson</a></p></li><li><p><a href="https://www.cs.cornell.edu/courses/cs4120/2022sp/notes.html?id=gc">Garbage Collection &#8212; Cornell CS4120</a></p></li><li><p><a href="https://www.geeksforgeeks.org/python/garbage-collection-python/">Garbage Collection in Python &#8212; GeeksforGeeks</a></p></li><li><p><a href="https://docs.python.org/3/extending/extending.html#reference-counts">Reference Counts &#8212; Python Docs (Extending Python)</a></p></li><li><p><a href="https://stackoverflow.com/questions/10962393/how-does-pythons-garbage-collector-detect-circular-references">How does Python&#8217;s garbage collector detect circular references? &#8212; Stack Overflow</a></p></li><li><p><a href="https://docs.python.org/3/c-api/refcounting.html">Reference Counting &#8212; Python C API Docs</a></p></li><li><p><a href="https://medium.com/@threehappyer/deep-understanding-of-garbage-collection-principles-algorithms-and-optimization-strategies-3887b0074fa1">Deep Understanding of Garbage Collection: Principles, Algorithms, and Optimization Strategies &#8212; threehappyer</a></p></li><li><p><a href="https://incusdata.com/blog/generational-garbage-collection-and-heap-memory">Generational Garbage Collection and Heap Memory &#8212; Incus Data</a></p></li><li><p><a href="https://users.cs.northwestern.edu/~stamourv/teaching/321-F19/21a-generational-gc.pdf">Generational GC &#8212; Northwestern CS321</a></p></li><li><p><a href="https://github.com/Neo23x0/mongobleed-detector">MongoBleed Detector &#8212; Neo23x0 (GitHub)</a></p></li><li><p><a href="https://learn.microsoft.com/en-us/dotnet/standard/garbage-collection/fundamentals">Fundamentals of Garbage Collection &#8212; Microsoft .NET Docs</a></p></li><li><p><a href="https://dev.java/learn/jvm/tool/garbage-collection/intro/">Introduction to Garbage Collection &#8212; dev.java</a></p></li><li><p><a href="https://www.ibm.com/think/topics/garbage-collection-java">Garbage Collection in Java &#8212; IBM</a></p></li><li><p><a href="https://alibabatech.medium.com/how-does-garbage-collection-work-in-java-cf4e31343e43">How Does Garbage Collection Work in Java &#8212; Alibaba Tech</a></p></li><li><p><a href="https://www.cs.odu.edu/~zeil/cs330/f13/Public/garbageCollection/garbageCollection-htmlsu5.html">Garbage Collection &#8212; ODU CS330</a></p></li><li><p><a href="https://animeshgaitonde.medium.com/garbage-collection-algorithm-mark-sweep-ed874272702d">Garbage Collection Algorithm: Mark-Sweep &#8212; Animesh Gaitonde</a></p></li><li><p><a href="https://www.geeksforgeeks.org/java/mark-and-sweep-garbage-collection-algorithm/">Mark and Sweep Garbage Collection Algorithm &#8212; GeeksforGeeks</a></p></li><li><p><a href="https://aerospike.com/blog/understanding-garbage-collection/">Understanding Garbage Collection &#8212; Aerospike</a></p></li><li><p><a href="https://medium.com/@naikofficial56/understanding-garbage-collection-b76d9959d333">Understanding Garbage Collection &#8212; Naik</a></p></li><li><p><a href="https://www.geeksforgeeks.org/java/garbage-collection-in-java/">Garbage Collection in Java &#8212; GeeksforGeeks</a></p></li></ul><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://notebook.mubbie.dev/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Mubbie's Notebook! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[Add Salt to the Password for Taste 🧂😉]]></title><description><![CDATA[Why Seasoning is Essential in Security]]></description><link>https://notebook.mubbie.dev/p/add-salt-to-the-password-for-taste</link><guid isPermaLink="false">https://notebook.mubbie.dev/p/add-salt-to-the-password-for-taste</guid><dc:creator><![CDATA[Mubarak Idoko]]></dc:creator><pubDate>Sun, 30 Mar 2025 15:55:19 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!AbBa!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feeefc2ae-9f57-488d-bd6b-84a17fb23ef4_512x383.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<blockquote><p><em>&#8220;From the earliest times, salt has been a symbol of lasting alliances, sacred rituals, and even rebellion.&#8221;</em> &#8212; <a href="https://www.markkurlansky.com/">Mark Kurlansky</a>, <em><a href="https://www.markkurlansky.com/books/salt-a-world-history/">Salt: A World History</a></em></p></blockquote><p>Salt once shaped empires, sparked wars, and preserved entire civilizations. It helped our ancestors store food during long journeys and harsh winters. <em>In Salt: A World History</em>, Mark Kurlansky traces the remarkable influence of this humble mineral, describing how it carved trade routes, powered economies, and quietly shaped the course of history.</p><p>Salt still preserves in our modern, digital world&#8212;not food this time, but something just as vital: our online identities. Without salting, even the most complex passwords can be cracked in minutes, leaving personal data exposed and vulnerable.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://notebook.mubbie.dev/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Mubbie's Notebook! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p>In this post, we&#8217;ll explore how a simple pinch of salt can disrupt even the most sophisticated attacks. If that sounds mysterious or technical, don&#8217;t worry &#8212; we&#8217;ll break it down gently. Think of it like a recipe: no dish is complete without a bit of salt, and no password system is secure without it, either.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!AbBa!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feeefc2ae-9f57-488d-bd6b-84a17fb23ef4_512x383.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!AbBa!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feeefc2ae-9f57-488d-bd6b-84a17fb23ef4_512x383.png 424w, https://substackcdn.com/image/fetch/$s_!AbBa!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feeefc2ae-9f57-488d-bd6b-84a17fb23ef4_512x383.png 848w, https://substackcdn.com/image/fetch/$s_!AbBa!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feeefc2ae-9f57-488d-bd6b-84a17fb23ef4_512x383.png 1272w, https://substackcdn.com/image/fetch/$s_!AbBa!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feeefc2ae-9f57-488d-bd6b-84a17fb23ef4_512x383.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!AbBa!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feeefc2ae-9f57-488d-bd6b-84a17fb23ef4_512x383.png" width="512" height="383" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/eeefc2ae-9f57-488d-bd6b-84a17fb23ef4_512x383.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:383,&quot;width&quot;:512,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:37171,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://mubbiesnotebook.substack.com/i/160190742?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feeefc2ae-9f57-488d-bd6b-84a17fb23ef4_512x383.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!AbBa!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feeefc2ae-9f57-488d-bd6b-84a17fb23ef4_512x383.png 424w, https://substackcdn.com/image/fetch/$s_!AbBa!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feeefc2ae-9f57-488d-bd6b-84a17fb23ef4_512x383.png 848w, https://substackcdn.com/image/fetch/$s_!AbBa!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feeefc2ae-9f57-488d-bd6b-84a17fb23ef4_512x383.png 1272w, https://substackcdn.com/image/fetch/$s_!AbBa!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feeefc2ae-9f57-488d-bd6b-84a17fb23ef4_512x383.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Image Source: <a href="https://xkcd.com/">XKCD</a></em></p><h2>The Problem with Passwords</h2><p>Passwords are one of the oldest tools we have for identification and authentication. If we trace their <a href="https://marketing.pinecc.com/blog/the-history-of-passwords">history</a>, we can go all the way back to the Roman army, where soldiers used <em>watchwords</em> to prove they belonged to a particular <a href="https://www.dashlane.com/a-brief-history-of-passwords">unit</a>. Fast forward a bit, and we get the secret codes whispered at <a href="https://thescotchworld.com/blog/f/the-secret-password-to-enter-the-speakeasy">speakeasies</a> during Prohibition &#8212; the price of admission for a sip of forbidden liquor. The first digital password was <a href="https://www.smh.com.au/national/scientist-who-introduced-the-computer-password-20190717-p527zf.html">introduced at MIT</a> in 1961 by <a href="https://www.nae.edu/29551/Dr-Fernando-J-Corbato">Fernando J. Corbat&#243;</a>, a pioneering computer scientist who wanted to increase access to shared machines while keeping users&#8217; data private.</p><p>Passwords have stuck around since then, but they&#8217;ve also become one of the weakest links in our digital defenses. On a human level, most of us reuse the same password across multiple accounts or choose ones that are far too easy to guess (<em>password123</em>, <em>iloveyou</em>, etc.). Even when we try to be clever, the truth is &#8212; humans aren&#8217;t great at randomness. And hackers know that.</p><p>Worse still, some systems continue to store passwords in plain text. Yes, in plain text &#8212; as recently as 2019, <a href="https://krebsonsecurity.com/2019/03/facebook-stored-hundreds-of-millions-of-user-passwords-in-plain-text-for-years/">Meta (the parent company of Facebook)</a> discovered it had stored over 600 million user passwords in searchable plain text files dating back years. In 2021, a <a href="https://www.wordfence.com/blog/2021/11/godaddy-breach-plaintext-passwords/">GoDaddy breach</a> exposed the plain-text passwords of 1.2 million users. Storing passwords in plain text is exactly as bad as it sounds. It&#8217;s like writing down your deepest secrets in a diary and leaving it unlocked on a public bench. If anyone gains access, they can read everything. To fix that, developers use <a href="https://supertokens.com/blog/password-hashing-salting">hashing</a>, which turns passwords into scrambled, fixed-length codes that are difficult to reverse. For example, instead of storing this:</p><div id="datawrapper-iframe" class="datawrapper-wrap outer" data-attrs="{&quot;url&quot;:&quot;https://datawrapper.dwcdn.net/jhq4Y/1/&quot;,&quot;thumbnail_url&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/c07514b5-a409-47b6-a150-73081fb2891b_1260x660.png&quot;,&quot;thumbnail_url_full&quot;:&quot;&quot;,&quot;height&quot;:268,&quot;title&quot;:&quot;| Created with Datawrapper&quot;,&quot;description&quot;:&quot;Create interactive, responsive &amp; beautiful charts &#8212; no code required.&quot;}" data-component-name="DatawrapperToDOM"><iframe id="iframe-datawrapper" class="datawrapper-iframe" src="https://datawrapper.dwcdn.net/jhq4Y/1/" width="730" height="268" frameborder="0" scrolling="no"></iframe><script type="text/javascript">!function(){"use strict";window.addEventListener("message",(function(e){if(void 0!==e.data["datawrapper-height"]){var t=document.querySelectorAll("iframe");for(var a in e.data["datawrapper-height"])for(var r=0;r<t.length;r++){if(t[r].contentWindow===e.source)t[r].style.height=e.data["datawrapper-height"][a]+"px"}}}))}();</script></div><p>We use a hashing function to transform it into this:</p><div id="datawrapper-iframe" class="datawrapper-wrap outer" data-attrs="{&quot;url&quot;:&quot;https://datawrapper.dwcdn.net/q64qb/1/&quot;,&quot;thumbnail_url&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/7356a5b2-9619-4eac-a400-c8525818e378_1260x660.png&quot;,&quot;thumbnail_url_full&quot;:&quot;&quot;,&quot;height&quot;:268,&quot;title&quot;:&quot;| Created with Datawrapper&quot;,&quot;description&quot;:&quot;Create interactive, responsive &amp; beautiful charts &#8212; no code required.&quot;}" data-component-name="DatawrapperToDOM"><iframe id="iframe-datawrapper" class="datawrapper-iframe" src="https://datawrapper.dwcdn.net/q64qb/1/" width="730" height="268" frameborder="0" scrolling="no"></iframe><script type="text/javascript">!function(){"use strict";window.addEventListener("message",(function(e){if(void 0!==e.data["datawrapper-height"]){var t=document.querySelectorAll("iframe");for(var a in e.data["datawrapper-height"])for(var r=0;r<t.length;r++){if(t[r].contentWindow===e.source)t[r].style.height=e.data["datawrapper-height"][a]+"px"}}}))}();</script></div><p>This way, even if an attacker gets the data, they see only hashes &#8212; not the actual passwords. When a user logs in, the password they enter is hashed, and the system compares it to the stored hash.</p><p>But hashing isn&#8217;t bulletproof. If two users choose the same password, their hashes will be identical &#8212; making it easier for attackers to spot patterns. Hackers also use <a href="https://www.strongdm.com/what-is/rainbow-table-attack">rainbow tables</a> , which are massive precomputed lists of common passwords and their corresponding hashes. And brute-force attacks like <a href="https://www.kaspersky.com/resource-center/definitions/what-is-a-dictionary-attack">dictionary attacks</a> can try billions of combinations per second. The more predictable the system &#8212; or the hashing function &#8212; the easier it is for attackers to win.</p><p>So how do we throw them off the scent? How do we make even predictable passwords harder to crack?</p><p>That&#8217;s where <strong>salt</strong> comes in.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!aorx!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F538ee19b-c613-4f68-a013-b8e8319c5ac6_1640x1630.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!aorx!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F538ee19b-c613-4f68-a013-b8e8319c5ac6_1640x1630.jpeg 424w, https://substackcdn.com/image/fetch/$s_!aorx!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F538ee19b-c613-4f68-a013-b8e8319c5ac6_1640x1630.jpeg 848w, https://substackcdn.com/image/fetch/$s_!aorx!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F538ee19b-c613-4f68-a013-b8e8319c5ac6_1640x1630.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!aorx!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F538ee19b-c613-4f68-a013-b8e8319c5ac6_1640x1630.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!aorx!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F538ee19b-c613-4f68-a013-b8e8319c5ac6_1640x1630.jpeg" width="1456" height="1447" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/538ee19b-c613-4f68-a013-b8e8319c5ac6_1640x1630.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1447,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:326730,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://mubbiesnotebook.substack.com/i/160190742?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F538ee19b-c613-4f68-a013-b8e8319c5ac6_1640x1630.jpeg&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!aorx!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F538ee19b-c613-4f68-a013-b8e8319c5ac6_1640x1630.jpeg 424w, https://substackcdn.com/image/fetch/$s_!aorx!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F538ee19b-c613-4f68-a013-b8e8319c5ac6_1640x1630.jpeg 848w, https://substackcdn.com/image/fetch/$s_!aorx!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F538ee19b-c613-4f68-a013-b8e8319c5ac6_1640x1630.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!aorx!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F538ee19b-c613-4f68-a013-b8e8319c5ac6_1640x1630.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h2>So... What is a Salt?</h2><p>In the world of password security, a <strong>salt</strong> is a random string of characters added to a password <em>before</em> it&#8217;s hashed. It doesn&#8217;t have to be long or fancy &#8212; though a long enough salt almost eliminates the risk of a rainbow table attack. This tiny addition completely changes the outcome of the hash, even if two users pick the exact same password.</p><p>Think of it like a secret spice in a recipe. Two chefs might start with the same dish, but if one adds cinnamon and the other adds chili, you&#8217;ll end up with very different flavors. That&#8217;s what salt does: it makes every &#8220;dish&#8221; &#8212; in this case, every password hash &#8212; unique.</p><p>Let&#8217;s break it down with an example.</p><p>Suppose two users both choose the same (very strong!) password: <code>password</code>.</p><p>If we hash it without any salt, they&#8217;ll get the exact same result:</p><pre><code><code>Hash("password") &#8594; $2y$10$LYkedKLZX3qDb06Hd17zWuybj9EhqUWKFjOjqSRBKF6q3rE3ldcsq</code></code></pre><p>Now, let&#8217;s say we add a unique salt for each user:</p><pre><code><code>User1: Salt = X8g72!
Hash("X8g72!password") &#8594; $2y$10$DebUSiinkd2GvJZ0uqgsFOvvfDClW.kvnZ7R3g/DLmMh/XySy00hu</code></code></pre><pre><code>User2: Salt = Lz91#k
Hash("Lz91#kpassword") &#8594; $2y$10$mIzd3Z5y.dwyTVD.EpCeV.vZOp8dPUSzY3SRt.Whrj.o8kDAIDhaq</code></pre><p>Even though both users chose the same password, their final hashes are completely different. That means a hacker can&#8217;t easily tell they started from the same input. And because salts are generated randomly, rainbow tables become practically useless &#8212; an attacker would have to compute a new table for every possible salt, which is computationally impractical.</p><p>Using the earlier example from the hashing section, we can now see how salting changes what&#8217;s stored in the database. First, here&#8217;s how we build the salted password:</p><div id="datawrapper-iframe" class="datawrapper-wrap outer" data-attrs="{&quot;url&quot;:&quot;https://datawrapper.dwcdn.net/oqW1E/1/&quot;,&quot;thumbnail_url&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f4d66cf5-b333-4886-803f-be7d2685ea3f_1260x660.png&quot;,&quot;thumbnail_url_full&quot;:&quot;&quot;,&quot;height&quot;:247,&quot;title&quot;:&quot;| Created with Datawrapper&quot;,&quot;description&quot;:&quot;Create interactive, responsive &amp; beautiful charts &#8212; no code required.&quot;}" data-component-name="DatawrapperToDOM"><iframe id="iframe-datawrapper" class="datawrapper-iframe" src="https://datawrapper.dwcdn.net/oqW1E/1/" width="730" height="247" frameborder="0" scrolling="no"></iframe><script type="text/javascript">!function(){"use strict";window.addEventListener("message",(function(e){if(void 0!==e.data["datawrapper-height"]){var t=document.querySelectorAll("iframe");for(var a in e.data["datawrapper-height"])for(var r=0;r<t.length;r++){if(t[r].contentWindow===e.source)t[r].style.height=e.data["datawrapper-height"][a]+"px"}}}))}();</script></div><p>And here&#8217;s how we safely store both the salt and the resulting hash:</p><div id="datawrapper-iframe" class="datawrapper-wrap outer" data-attrs="{&quot;url&quot;:&quot;https://datawrapper.dwcdn.net/f2lvT/3/&quot;,&quot;thumbnail_url&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/5049737a-3a24-405c-a371-a90005e712a0_1260x660.png&quot;,&quot;thumbnail_url_full&quot;:&quot;&quot;,&quot;height&quot;:257,&quot;title&quot;:&quot;| Created with Datawrapper&quot;,&quot;description&quot;:&quot;Create interactive, responsive &amp; beautiful charts &#8212; no code required.&quot;}" data-component-name="DatawrapperToDOM"><iframe id="iframe-datawrapper" class="datawrapper-iframe" src="https://datawrapper.dwcdn.net/f2lvT/3/" width="730" height="257" frameborder="0" scrolling="no"></iframe><script type="text/javascript">!function(){"use strict";window.addEventListener("message",(function(e){if(void 0!==e.data["datawrapper-height"]){var t=document.querySelectorAll("iframe");for(var a in e.data["datawrapper-height"])for(var r=0;r<t.length;r++){if(t[r].contentWindow===e.source)t[r].style.height=e.data["datawrapper-height"][a]+"px"}}}))}();</script></div><p>By storing the salt alongside the hash, systems can reliably re-hash a password during login for comparison without compromising security. The salt itself doesn&#8217;t need to be secret. It just needs to be unique and unpredictable.</p><p>It&#8217;s important to emphasize, however, that <a href="https://auth0.com/blog/adding-salt-to-hashing-a-better-way-to-store-passwords/">salting</a> doesn&#8217;t make passwords stronger. It only makes attacks harder &#8212; and that distinction matters.</p><h2>Common Mistakes</h2><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!S3l4!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa148e32c-5322-42e9-b4e4-0c8db30035b5_1480x1202.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!S3l4!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa148e32c-5322-42e9-b4e4-0c8db30035b5_1480x1202.png 424w, https://substackcdn.com/image/fetch/$s_!S3l4!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa148e32c-5322-42e9-b4e4-0c8db30035b5_1480x1202.png 848w, https://substackcdn.com/image/fetch/$s_!S3l4!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa148e32c-5322-42e9-b4e4-0c8db30035b5_1480x1202.png 1272w, https://substackcdn.com/image/fetch/$s_!S3l4!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa148e32c-5322-42e9-b4e4-0c8db30035b5_1480x1202.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!S3l4!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa148e32c-5322-42e9-b4e4-0c8db30035b5_1480x1202.png" width="1456" height="1183" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a148e32c-5322-42e9-b4e4-0c8db30035b5_1480x1202.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1183,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:214445,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://mubbiesnotebook.substack.com/i/160190742?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa148e32c-5322-42e9-b4e4-0c8db30035b5_1480x1202.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!S3l4!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa148e32c-5322-42e9-b4e4-0c8db30035b5_1480x1202.png 424w, https://substackcdn.com/image/fetch/$s_!S3l4!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa148e32c-5322-42e9-b4e4-0c8db30035b5_1480x1202.png 848w, https://substackcdn.com/image/fetch/$s_!S3l4!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa148e32c-5322-42e9-b4e4-0c8db30035b5_1480x1202.png 1272w, https://substackcdn.com/image/fetch/$s_!S3l4!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa148e32c-5322-42e9-b4e4-0c8db30035b5_1480x1202.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Image Source: <a href="https://xkcd.com/">XKCD</a></em></p><blockquote><p>"You are the salt of the earth. But if the salt loses its saltiness, how can it be made salty again? It is no longer good for anything, except to be thrown out and trampled underfoot." - Jesus, <em>Matthew 5:13</em></p></blockquote><p>Like any good recipe, salting only works if you do it right. <a href="https://stackoverflow.com/questions/24415950/is-it-an-good-idea-of-using-password-itself-as-an-salt">One of the biggest mistakes</a> is reusing the same salt for every user &#8212; which completely defeats the purpose. If everyone gets the same seasoning, all the hashes for identical passwords will still look the same. That&#8217;s no better than unsalted hashing. Salts must be unique per user &#8212; and ideally unique per password reset &#8212; to offer real protection.</p><p>Another common pitfall is using salts that are <strong>too short</strong>, <strong>predictable</strong>, or <strong>not truly random</strong> (we can talk about generating secure random values in a follow-up post). A salt like <code>123456</code> or <code>admin</code> isn&#8217;t fooling anyone &#8212; certainly not a hacker with a rainbow table and some spare time. Ideally, a good salt should come from a strong random number generator, be at least 16 characters long, and draw from a broad character set. You can dig deeper in <a href="https://stackoverflow.com/questions/184112/what-is-the-optimal-length-for-user-password-salt">this Stack Overflow conversation</a> on optimal salt lengths.</p><p>Other frequent missteps include forgetting to store the salt or storing it insecurely. While the salt doesn&#8217;t need to be hidden, it <em>does</em> need to be reliably retrievable. If you lose or corrupt it, you cannot re-hash and verify a user&#8217;s password correctly&#8212;it&#8217;s like losing the recipe for your signature dish.</p><p>And finally, one of the most unfortunate (and surprisingly common) mistakes is hashing without salting. (You can find examples in the reference links below.) This still shows up in legacy systems or rushed codebases &#8212; and it leaves users dangerously exposed to the kinds of attacks we&#8217;ve already discussed. Modern systems should always salt and hash passwords with a strong algorithm like <a href="https://www.argon2.com/">Argon2</a>, or <a href="https://nordvpn.com/blog/what-is-bcrypt">bcrypt</a>. Even though limitations in bcrypt contributed to the recent <a href="https://trust.okta.com/security-advisories/okta-ad-ldap-delegated-authentication-username/">Okta security vulnerability</a>, it&#8217;s still widely used &#8212; and I have some thoughts on Okta Security coming soon, so stay tuned).</p><p>For practical implementation tips, I also highly recommend the <a href="https://cheatsheetseries.owasp.org/cheatsheets/Password_Storage_Cheat_Sheet.html">OWASP Password Storage Cheat Sheet</a>.</p><h2>Bonus: Salt Alone Isn't Enough (Use Pepper too)</h2><p>Salt is powerful &#8212; but it&#8217;s not a magic shield. While it protects against attacks like rainbow tables and ensures every password hash is unique, it&#8217;s just one part of a broader security recipe.</p><p>Some systems add another secret ingredient: a <strong>pepper</strong>. Like salt, a pepper is a string added to the password before hashing &#8212; but unlike salt, the pepper is kept secret and shared across all users. Think of it as a house spice blend only the kitchen staff knows. Even if attackers access the database, they still need the pepper to recreate the hashes.</p><p>That said, pepper comes with tradeoffs. Because it must be stored securely (usually in the application code or an environment variable), managing it introduces additional complexity. As with any ingredient, there&#8217;s ongoing debate&#8212;<a href="https://blog.ircmaxell.com/2012/04/properly-salting-passwords-case-against.html">some security experts</a> argue that pepper doesn&#8217;t always add meaningful protection and may not be worth the added risk.</p><p>Then there&#8217;s the matter of <em>how</em> we hash. Not all algorithms are created equal. General-purpose functions like SHA-256 are fast &#8212; which is excellent for performance, but unfortunately, it&#8217;s also great for attackers. That&#8217;s why we use key-stretching algorithms like <a href="https://nordvpn.com/blog/what-is-bcrypt">bcrypt</a>, <a href="https://en.wikipedia.org/wiki/Scrypt">scrypt</a>, or <a href="https://www.argon2.com/">Argon2</a>, which are intentionally slow. These algorithms increase the cost of each password guess, making brute-force and dictionary attacks much less practical.</p><p>And, of course, password storage is just one layer of defense. A secure system should also include rate limiting (to prevent automated guessing or bot-like behavior), multi-factor authentication (MFA) (so a stolen password alone isn&#8217;t enough), and regular audits of how passwords and credentials are managed.</p><p>Security is layered. Salt is essential, but it can&#8217;t carry the weight alone. It works best when combined with solid algorithms, thoughtful design, and strong overall hygiene. Like seasoning a meal, security is not just about one ingredient&#8212;balance, technique, and attention to detail.</p><h2>Conclusion: Security Recipe Card</h2><blockquote><p>As a bonus, I created the hashes in the examples above using one of the common key-stretching algorithms. If you can figure out which one, let me know. I&#8217;d be curious to learn how you did it.</p></blockquote><p>Salting might seem like a quirky detail in the vast world of cybersecurity, but as we&#8217;ve seen, it&#8217;s one of the simplest and most powerful tools we have for protecting passwords. By adding randomness to each hash, salts break patterns, frustrate attackers, and help ensure that even identical passwords don&#8217;t leave identical traces.</p><p>For developers, salting should be a non-negotiable part of your password storage process. And for the curious reader &#8212; whether you&#8217;re learning, building, or just staying security-conscious &#8212; it&#8217;s worth digging into how your favorite platforms handle password protection. Do they use proper salting? Do they mention bcrypt or Argon2? Is MFA available? These are questions worth asking.</p><p>Password security doesn&#8217;t have to be complicated &#8212; but it <em>does</em> have to be thoughtful. So yes: salt your food, and your passwords.</p><p>Finally, while this post focused on password security, my next post will take a deeper look at digital identity &#8212; and how it shapes, protects, and sometimes complicates our lives online. Hope to see you there.</p><p>Till then, stay salty, stay safe. &#129474;&#128524;</p><h2>References and Resources to Learn More</h2><ul><li><p><a href="https://krebsonsecurity.com/2023/10/hackers-stole-access-tokens-from-oktas-support-unit/">Hackers Stole Access Tokens from Okta&#8217;s Support Unit</a></p></li><li><p><a href="https://www.portnox.com/blog/cyber-attacks/unpacking-the-okta-data-breach/">Unpacking the Okta Data Breach</a></p></li><li><p><a href="https://security.stackexchange.com/questions/61489/is-salted-md5-or-salted-sha-considered-secure">Is salted MD5 or salted SHA considered secure?</a></p></li><li><p><a href="https://svanas.medium.com/why-an-unsalted-md5-hash-is-bad-practice-6a0d7d017856">Why an unsalted MD5 hash is bad practice</a></p></li><li><p><a href="https://youtu.be/8ZtInClXe1Q?feature=shared">How NOT to Store Passwords! - Computerphile</a></p></li><li><p><a href="https://www.reddit.com/r/explainlikeimfive/comments/tgn650/eli5_what_does_it_mean_if_a_password_is_stored_as/">ELI5: What does it mean if a password is stored as unsalted MD5 hash?</a></p></li><li><p><a href="https://www.quora.com/What-does-it-mean-if-a-password-is-stored-as-an-unsalted-MD5-hash">What does it mean if a password is stored as an unsalted MD5 hash?</a></p></li><li><p><a href="https://psono.com/blog/evolution-of-password-hashing">The Evolution of Password Hashing</a></p></li><li><p><a href="https://stackoverflow.com/questions/10992262/legacy-app-with-md5-hashes-how-to-add-salt-and-sha1">Legacy app with md5 hashes: how to add salt and SHA1?</a></p></li><li><p><a href="https://nordvpn.com/blog/what-is-bcrypt">What is bcrypt and how does it work?</a></p></li><li><p><a href="https://trust.okta.com/security-advisories/okta-ad-ldap-delegated-authentication-username/">Okta AD/LDAP Delegated Authentication - Username Above 52 Characters Security Advisory - Nov 1, 2024</a></p></li><li><p><a href="https://medium.com/@rajat29gupta/how-bcrypts-limitations-contributed-to-okta-s-vulnerability-a-lesson-for-developers-39425c644ed5">How Bcrypt&#8217;s Limitations Contributed to Okta&#8217;s Vulnerability: A Lesson for Developers</a></p></li><li><p><a href="https://stackoverflow.com/questions/24415950/is-it-an-good-idea-of-using-password-itself-as-an-salt">Is it an good idea of Using password itself as an salt</a></p></li><li><p><a href="https://stackoverflow.com/questions/16891729/best-practices-salting-peppering-passwords">Best Practices: Salting &amp; peppering passwords?</a></p></li><li><p><a href="https://markilott.medium.com/password-storage-basics-2aa9e1586f98">Password Hashing and Storage Basics</a></p></li><li><p><a href="https://www.techtarget.com/searchsecurity/definition/salt">Password Salting</a></p></li><li><p><a href="https://news.ycombinator.com/item?id=2005017">Interesting Conversation from Y Combinator News</a></p></li><li><p><a href="https://auth0.com/blog/adding-salt-to-hashing-a-better-way-to-store-passwords/">Adding Salt to Hashing: A Better Way to Store Passwords</a></p></li><li><p><a href="https://proton.me/blog/what-is-rainbow-table-attack">What is a rainbow table attack and how to prevent it?</a></p></li><li><p><a href="https://sqlity.net/en/2309/salt/">Salt &#8211; Preventing Rainbow Attacks against Password Stores</a></p></li><li><p><a href="https://optimalidm.com/resources/blog/what-is-salt-hashing/">Salt Hashing and How It Can Lower The Chances of Exposing Login Credentials</a></p></li><li><p><a href="https://www.beyondidentity.com/resource/the-history-and-future-of-passwords">The History and Future of Passwords</a></p></li><li><p><a href="https://www.wired.com/2012/01/computer-password/">The World's First Computer Password? It Was Useless Too</a></p></li><li><p><a href="https://marketing.pinecc.com/blog/the-history-of-passwords">(Part I of III) The History of Passwords</a></p></li><li><p><a href="https://thescotchworld.com/blog/f/the-secret-password-to-enter-the-speakeasy">The Secret Password to Enter the Speakeasy</a></p></li><li><p><a href="https://appleinsider.com/articles/24/09/27/meta-stored-600-million-facebook-and-instagram-passwords-in-plain-text">Meta stored 600 million Facebook and Instagram passwords in plain text</a></p></li><li><p><a href="https://www.dashlane.com/a-brief-history-of-passwords">A Brief History of Passwords</a></p></li><li><p><a href="https://krebsonsecurity.com/2019/03/facebook-stored-hundreds-of-millions-of-user-passwords-in-plain-text-for-years/">Facebook Stored Hundreds of Millions of User Passwords in Plain Text for Years</a></p></li></ul><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://notebook.mubbie.dev/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Mubbie's Notebook! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[Big as the Super Bowl: A Basic Introduction to Football (Oops, I mean American Football) 🏈]]></title><description><![CDATA[What&#8217;s Going On Out There? A Beginner&#8217;s Guide to American Football]]></description><link>https://notebook.mubbie.dev/p/big-as-the-super-bowl-a-basic-introduction</link><guid isPermaLink="false">https://notebook.mubbie.dev/p/big-as-the-super-bowl-a-basic-introduction</guid><dc:creator><![CDATA[Mubarak Idoko]]></dc:creator><pubDate>Sun, 09 Feb 2025 18:01:36 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd4457653-5b56-4d48-98d9-13ca513efde3_2114x1880.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!DF6v!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6f016228-ad1b-426d-bbcc-8ea992aad915_339x536.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!DF6v!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6f016228-ad1b-426d-bbcc-8ea992aad915_339x536.png 424w, https://substackcdn.com/image/fetch/$s_!DF6v!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6f016228-ad1b-426d-bbcc-8ea992aad915_339x536.png 848w, https://substackcdn.com/image/fetch/$s_!DF6v!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6f016228-ad1b-426d-bbcc-8ea992aad915_339x536.png 1272w, https://substackcdn.com/image/fetch/$s_!DF6v!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6f016228-ad1b-426d-bbcc-8ea992aad915_339x536.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!DF6v!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6f016228-ad1b-426d-bbcc-8ea992aad915_339x536.png" width="339" height="536" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/6f016228-ad1b-426d-bbcc-8ea992aad915_339x536.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:536,&quot;width&quot;:339,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Which Sport Are They Arguing About?&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Which Sport Are They Arguing About?" title="Which Sport Are They Arguing About?" srcset="https://substackcdn.com/image/fetch/$s_!DF6v!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6f016228-ad1b-426d-bbcc-8ea992aad915_339x536.png 424w, https://substackcdn.com/image/fetch/$s_!DF6v!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6f016228-ad1b-426d-bbcc-8ea992aad915_339x536.png 848w, https://substackcdn.com/image/fetch/$s_!DF6v!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6f016228-ad1b-426d-bbcc-8ea992aad915_339x536.png 1272w, https://substackcdn.com/image/fetch/$s_!DF6v!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6f016228-ad1b-426d-bbcc-8ea992aad915_339x536.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Image Source: <a href="https://xkcd.com/">XKCD</a></em></p><h2>Introduction: Touchdown?</h2><p><em>&#8220;Touchdown!&#8221;</em> I remember shouting with everyone else during my first homecoming in college as I watched Dartmouth demolish Yale in <a href="https://dartmouthsports.com/news/2019/10/12/football-homecoming-a-festive-affair-in-42-10-victory-191012">a 42-10 win</a>. I didn&#8217;t fully understand the sport. Still, I knew that when a player in green managed to get the ball into the Yale end zone, it was a touchdown.</p><p>At the time, I figured that while I didn&#8217;t quite grasp the rules, I enjoyed all the fanfare surrounding American football (I&#8217;ll mostly call it &#8220;football&#8221; from now on for ease&#8212;I know, I know, the Nigerian in me is resisting this). The energy was infectious, and I wanted to learn how to play. I casually joked about it over the phone with my mom. Naturally, she showed great concern, reminding me to focus on the real reason I went to school and not get caught up in <a href="https://www.newyorker.com/culture/annals-of-inquiry/exactly-how-dangerous-is-football">a sport as dangerous as football</a>.</p><p>Speaking of interesting encounters between Africans like me and their mums, my friend <a href="https://students.dartmouth.edu/writing-center/people/chukwuka-odigbo">Chukwuka</a> recently wrote a brilliant article about &#8220;African Mom Jokes&#8221; and how they can sometimes go too far, reinforcing harmful stereotypes and distorting reality. In his piece, he calls for more nuanced and respectful portrayals of African mums in media, especially in short-form comedy videos. It&#8217;s brilliant writing, and you can read it <a href="https://republic.com.ng/december-24-january-25/african-mother-jokes/">here</a>.</p><p>My curiosity about football faded as schoolwork piled up, forcing me to focus and abandon my pipe dream of a football career. So, as you might have guessed, I never thoroughly learned the sport. But a few months ago, a friend and mentor at work asked if I&#8217;d like to join her flag football team. She knew I could run and figured I&#8217;d pick up the rest of the skills. I accepted. I can finally say, <em>Mama, I made it</em>&#8212;even if I play a much less intense version of the sport. You can read about my adventures during my first season in my <a href="https://mubbie.github.io/2024/12/31/reflecting-on-2024-what-really-happened.html">2024 reflection blog post</a>.</p><p>My first game? All I had to do was run and chase people&#8212;that part was easy. But I was still pretty clueless. So, over the next week, I read several articles, watched countless videos, and learned a lot about football&#8212;from its history to the leagues, the teams, the legends, and even <a href="https://www.theatlantic.com/business/archive/2015/03/americas-socialist-sports-league-the-nfl/388330/">the NFL&#8217;s &#8220;socialist&#8221; revenue-sharing model</a>.</p><p>As we approach <a href="https://www.nfl.com/super-bowl/event-info/">Super Bowl LIX</a>, I know you might be interested in many random things. If you&#8217;re a Swiftie, you might only be looking forward to seeing her dance and cheer on her boyfriend. Maybe you&#8217;re hoping for an electrifying halftime performance from Kendrick Lamar, given his incredible year and recent Grammy wins. Or perhaps you want to hang out with friends, bring beer (or not&#8212;<em>mummy, I know you&#8217;re reading this</em>), and watch the ads.</p><p>But if you&#8217;re interested in the game itself&#8212;how it works, how teams score, what the rules are&#8212;this blog post should help. After reading it, I suspect you won&#8217;t be as lost as I was at the many football games I attended in college. Keep in mind that the focus is exclusively on the game. Ultimately, I will link plenty of resources to learn more about other fascinating aspects of football.</p><p>And if you happen to be in Seattle and want to watch the Super Bowl with a friendly group, I&#8217;m hosting a watch party&#8212;feel free to contact me for more details.</p><h2>The Basics of American Football</h2><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!-Viq!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd4457653-5b56-4d48-98d9-13ca513efde3_2114x1880.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!-Viq!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd4457653-5b56-4d48-98d9-13ca513efde3_2114x1880.jpeg 424w, https://substackcdn.com/image/fetch/$s_!-Viq!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd4457653-5b56-4d48-98d9-13ca513efde3_2114x1880.jpeg 848w, https://substackcdn.com/image/fetch/$s_!-Viq!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd4457653-5b56-4d48-98d9-13ca513efde3_2114x1880.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!-Viq!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd4457653-5b56-4d48-98d9-13ca513efde3_2114x1880.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!-Viq!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd4457653-5b56-4d48-98d9-13ca513efde3_2114x1880.jpeg" width="1456" height="1295" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/d4457653-5b56-4d48-98d9-13ca513efde3_2114x1880.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1295,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:468597,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!-Viq!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd4457653-5b56-4d48-98d9-13ca513efde3_2114x1880.jpeg 424w, https://substackcdn.com/image/fetch/$s_!-Viq!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd4457653-5b56-4d48-98d9-13ca513efde3_2114x1880.jpeg 848w, https://substackcdn.com/image/fetch/$s_!-Viq!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd4457653-5b56-4d48-98d9-13ca513efde3_2114x1880.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!-Viq!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd4457653-5b56-4d48-98d9-13ca513efde3_2114x1880.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Image Source: <a href="https://www.cartoonstock.com/">Cartoon Stock</a></em></p><p>American football is one of those sports that looks like absolute chaos until you understand the method behind the madness. Big guys in pads crash into each other, the game stops every few seconds, and yet, <a href="https://news.gallup.com/poll/610046/football-retains-dominant-position-favorite-sport.aspx">millons of people swear by it</a>. If you&#8217;re here, you&#8217;ve probably wondered: <em>What is happening?</em> Well, at its core, football is a strategic battle for territory, where teams fight (not literally, though sometimes it feels like it) to advance the ball down the field and score points. Once you grasp the fundamentals, though, everything- even the weird rules- starts making sense.</p><h3>The Goal: Move the Ball, Score Points</h3><p>The entire point of football is to get the ball (or egg, as some of my friends call it&#8212;it&#8217;s actually an <a href="https://time.com/5515951/football-shape-history/">oblong sphere</a> called &#8220;<a href="https://www.profootballhof.com/the-duke-official-nfl-game-football-322701r4380/">The Duke</a>.&#8221; All official balls are handcrafted by <a href="https://www.wilson.com/en-us/product/the-duke-nfl-football-wf10011">Wilson Sporting Goods</a>) into the opponent&#8217;s end zone and score more points than the other team. The offense (the team with the ball) has four tries or plays&#8212;called <a href="https://www.dazn.com/en-US/news/american-football/what-are-downs-in-american-footballwhat-are-downs-in-american-football/nmn70wqrfjyp18physnwdfofg">downs</a>&#8212;to move at least 10 yards. If they succeed, they reset to another four downs and keep advancing. If they fail, they either punt the ball (kick it downfield to push the opponent farther from their end zone) or go for it on fourth down and risk turning it over. Meanwhile, the defense is there to disrupt, tackle, and take the ball back.</p><p>The <a href="https://operations.nfl.com/the-rules/nfl-video-rulebook/scoring-plays/">points</a> come in a few flavors:</p><ul><li><p><strong>Touchdown (6 points)</strong>: Run or catch the ball in the opponent&#8217;s end zone.</p></li><li><p><strong>Extra Point (1 or 2 points)</strong>: After a touchdown, the team can kick for 1 point or run a short play to get the ball into the opponent&#8217;s end zone for 2 points.</p></li><li><p><strong>Field Goal (3 points)</strong>: Sometimes, a team gets close to the end zone but can&#8217;t score a touchdown&#8212;maybe the defense is too strong, or there&#8217;s not enough time left for more plays. In these situations, the team can kick the ball through the uprights for three points rather than risking a turnover on fourth down.</p></li><li><p><strong>Safety (2 points)</strong>: Rare but exciting, this occurs when the defensive team forces the offense into their own end zone. This can happen in a few ways:</p><ul><li><p>The offensive ball carrier is tackled in their own end zone.</p></li><li><p>A <strong><a href="https://www.dazn.com/en-US/news/american-football/what-is-a-fumble-in-american-football/to2g39xs355h1xoiyurxbvpco">fumble</a></strong> or <strong><a href="https://www.youtube.com/watch?v=kyTdZHo8SLw">bad snap</a></strong> causes the ball to roll out of the back of the offense&#8217;s end zone.</p></li><li><p>The quarterback commits <strong><a href="https://operations.nfl.com/the-rules/nfl-video-rulebook/intentional-grounding/">intentional grounding</a></strong> in the end zone (throws the ball away under pressure with no receiver nearby).</p></li><li><p>A <strong><a href="https://theplayoffs.news/en/nfl-blocked-punt-rules-what-are-the-nfl-rules-for-a-blocked-punt/">blocked punt or kick</a></strong> bounces back into the end zone and goes out of bounds.</p></li></ul><p>When a safety occurs, the defense is awarded 2 points, and the team that gave up the safety must kick the ball away from their 20-yard line, handing possession to the opponent.</p></li></ul><h3>The Field: A 100-Yard Chessboard</h3><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!FWZT!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F878c7e70-26a6-4ef9-a0ba-c2c3216957e7_340x600.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!FWZT!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F878c7e70-26a6-4ef9-a0ba-c2c3216957e7_340x600.png 424w, https://substackcdn.com/image/fetch/$s_!FWZT!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F878c7e70-26a6-4ef9-a0ba-c2c3216957e7_340x600.png 848w, https://substackcdn.com/image/fetch/$s_!FWZT!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F878c7e70-26a6-4ef9-a0ba-c2c3216957e7_340x600.png 1272w, https://substackcdn.com/image/fetch/$s_!FWZT!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F878c7e70-26a6-4ef9-a0ba-c2c3216957e7_340x600.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!FWZT!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F878c7e70-26a6-4ef9-a0ba-c2c3216957e7_340x600.png" width="340" height="600" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/878c7e70-26a6-4ef9-a0ba-c2c3216957e7_340x600.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:600,&quot;width&quot;:340,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:54380,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!FWZT!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F878c7e70-26a6-4ef9-a0ba-c2c3216957e7_340x600.png 424w, https://substackcdn.com/image/fetch/$s_!FWZT!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F878c7e70-26a6-4ef9-a0ba-c2c3216957e7_340x600.png 848w, https://substackcdn.com/image/fetch/$s_!FWZT!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F878c7e70-26a6-4ef9-a0ba-c2c3216957e7_340x600.png 1272w, https://substackcdn.com/image/fetch/$s_!FWZT!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F878c7e70-26a6-4ef9-a0ba-c2c3216957e7_340x600.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Image Source: <a href="https://entertainment.howstuffworks.com/football.htm">How Stuff Works</a></em></p><p>The game is played on a <a href="https://www.networldsports.com/buyers-guides/football-field-dimensions-guide?">100-yard field (plus two 10-yard end zones)</a>. Every 10 yards is marked with bold white numbers - 10, 20, 30, all the way to the 50-yard line at the center of the pitch. In the metric system, 10 yards is about 9.14 meters. The ball&#8217;s position dictates where the next play starts, and there are lighter 5-yard lines and tiny white hash marks to ensure precise placement. Finally, the big yellow goalposts are where kickers (more on them later) become heroes or villains.</p><h3>The Game Flow</h3><p>Football is a game of constant shifts between <strong>offense, defense, and special teams</strong>:</p><ul><li><p><strong>Offense:</strong> The unit trying to score, led by the quarterback (think of them as the team&#8217;s general).</p></li><li><p><strong>Defense:</strong> The squad trying to stop the offense&#8212;tackling, intercepting passes, and causing chaos.</p></li><li><p><strong>Special Teams:</strong> The often-overlooked unit handling kickoffs, punts, and field goals.</p></li></ul><p>Every game consists of four quarters (15 minutes each) plus halftime. It starts with a kickoff, and from there, teams trade possessions, moving the ball by either running (carrying the ball) or passing (throwing it downfield).</p><p>The offense loses possession when there&#8217;s a turnover, which can happen in a few ways:</p><ul><li><p><strong>Interceptions:</strong> When a defensive player catches the quarterback&#8217;s pass.</p></li><li><p><strong>Fumbles:</strong> When the ball carrier loses control, the defense recovers.</p></li><li><p><strong>Turnover on Downs:</strong> When a team fails to gain 10 yards and doesn&#8217;t punt, handing the ball to the opponent.</p></li></ul><p>Teams on defense can also gain an advantage through <strong><a href="https://www.dazn.com/en-US/news/american-football/what-is-a-sack-in-american-football-what-is-the-biggest-sack-ever/irci19b2l9y612wdg9rd0rg9i">sacks</a></strong>, which means tackling the quarterback behind the line of scrimmage before they can throw the ball. Sacks can cause a loss of yardage, kill offensive momentum, or even lead to a turnover.</p><h3>Penalties and Game Management</h3><p>Referees throw yellow flags for <a href="https://gorout.com/football-penalties/">rule violations</a>, pushing teams forward or backward. Some common penalties include:</p><ul><li><p><strong>Offsides and False Starts:</strong> Jumping ahead before the play begins.</p></li><li><p><strong>Holding:</strong> Illegally grabbing an opponent.</p></li><li><p><strong>Pass Interference:</strong> Preventing a receiver from catching the ball.</p></li><li><p><strong>Personal Fouls:</strong> Late hits or unnecessary roughness (yes, that&#8217;s a thing in football).</p></li></ul><p>Teams strategically use <a href="https://www.dazn.com/en-US/news/american-football/what-is-a-timeout-in-american-football-and-how-do-coaches-use-them/1nk5k66hml77112jfsif28buzr">timeouts</a>, the <a href="https://operations.nfl.com/learn-the-game/nfl-basics/terms-glossary/glossary-terms-list/two-minute-warning/">two-minute warning</a>, and <a href="https://en.as.com/nfl/this-is-how-teams-stop-the-clock-in-nfl-games-what-are-the-rules-regarding-out-of-bounds-n/">clock management</a> to control the pace of the game. If time runs out and the score is tied? Overtime. And trust me, the NFL has robust rules for handling overtime, which you can read about <a href="https://operations.nfl.com/the-rules/nfl-overtime-rules/">here</a>.</p><p>Now that we understand the basics, let&#8217;s examine positions and player roles&#8212;because knowing who does what is just as important as understanding how the game flows.</p><h2>Positions and Roles</h2><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!YNsN!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F57ec34d9-b798-4610-8b83-879b5365e06c_640x480.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!YNsN!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F57ec34d9-b798-4610-8b83-879b5365e06c_640x480.png 424w, https://substackcdn.com/image/fetch/$s_!YNsN!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F57ec34d9-b798-4610-8b83-879b5365e06c_640x480.png 848w, https://substackcdn.com/image/fetch/$s_!YNsN!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F57ec34d9-b798-4610-8b83-879b5365e06c_640x480.png 1272w, https://substackcdn.com/image/fetch/$s_!YNsN!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F57ec34d9-b798-4610-8b83-879b5365e06c_640x480.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!YNsN!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F57ec34d9-b798-4610-8b83-879b5365e06c_640x480.png" width="640" height="480" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/57ec34d9-b798-4610-8b83-879b5365e06c_640x480.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:480,&quot;width&quot;:640,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:48326,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!YNsN!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F57ec34d9-b798-4610-8b83-879b5365e06c_640x480.png 424w, https://substackcdn.com/image/fetch/$s_!YNsN!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F57ec34d9-b798-4610-8b83-879b5365e06c_640x480.png 848w, https://substackcdn.com/image/fetch/$s_!YNsN!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F57ec34d9-b798-4610-8b83-879b5365e06c_640x480.png 1272w, https://substackcdn.com/image/fetch/$s_!YNsN!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F57ec34d9-b798-4610-8b83-879b5365e06c_640x480.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Image Source: <a href="https://shakerite.com/">The Shakerite</a></em></p><p>As we&#8217;ve learned initially, teams play offense or defense in football. Similarly, the <a href="https://www.underarmour.com/en-us/t/playbooks/football/football-positions-guide/">positions</a> and roles are divided into offensive and defensive positions, each contributing distinctly to helping their team gain an advantage on the field.</p><h3>Offensive Positions</h3><p>The offense&#8217;s primary objective is to advance the ball down the field and score points. The 11 offensive players are divided into two main groups: the offensive line and the backs and receivers.</p><h4>Offensive Line</h4><p>The offensive line (O-line) consists of five players whose primary responsibility is to protect the quarterback and create lanes for the running back.</p><ul><li><p><strong>Center (C):</strong> Snaps the ball to the quarterback at the start of a play and immediately gets to work blocking defenders. Often, the center is the brain of the O-line, calling out adjustments to plays based on the defense&#8217;s setup.</p></li><li><p><strong>Guards (LG/RG):</strong> Positioned on either side of the center, they block defensive players, opening holes for the running back and keeping pass rushers away.</p></li><li><p><strong>Tackles (LT/RT):</strong> Lining up outside the guards, tackles protect the edges. The left tackle is crucial because they guard the quarterback&#8217;s blind side (think <em>The Blind Side</em> movie). They must be quick on their feet, strong, and highly skilled to hold off elite pass rushers.</p></li></ul><h4>Backs and Receivers</h4><p>These players are responsible for advancing the ball through running and passing plays.</p><ul><li><p><strong>Quarterback (QB):</strong> The team&#8217;s leader, the play-caller, and often the player that gets all the credit (and all the blame) after plays. The quarterback receives the ball from the center and can pass, handoff, or run the ball. They read the defense and may change plays at the line of scrimmage, a process known as calling an audible.</p></li><li><p><strong>Running Backs (RB):</strong> Typically positioned behind the quarterback, running backs primarily carry the ball on running plays but can also catch passes. The main types are:</p><ul><li><p><strong>Halfback (HB):</strong> Usually the primary ball carrier, known for speed and agility.</p></li><li><p><strong>Fullback (FB):</strong> Generally larger and stronger, fullbacks lead block for the halfback and occasionally carry the ball in short-yardage situations.</p></li></ul></li><li><p><strong>Wide Receivers (WR):</strong> These players line up near the sidelines and are the primary targets for passing plays. They run specific routes to get open for passes and may also block running plays.</p></li><li><p><strong>Tight End (TE)</strong> (Fun fact: This is the position that Taylor Swift&#8217;s boyfriend, Travis Kelce, plays, and that the popular sports media personality and NFL Hall of Fame inductee, Shannon Sharpe, played). Positioned next to the offensive line, tight ends serve dual roles as blockers and pass-catchers. Their versatility makes them valuable in both the running and passing games.</p></li></ul><h3>Defensive Positions</h3><p>The defense&#8217;s primary objective is to prevent the offense from scoring by tackling ball carriers, defending against passes, and creating turnovers.</p><h4>Defensive Line</h4><p>These players line up directly on the line of scrimmage and engage the offensive line. They are the first line of defense.</p><ul><li><p><strong>Defensive Tackles (DT):</strong> Located at the center of the defensive line, their primary goal is to stop running plays up the middle and pressure the quarterback on passing plays.</p></li><li><p><strong>Defensive Ends (DE):</strong> Positioned on the edges of the defensive line, they are usually quick and strong and attempt to contain plays by rushing towards the quarterback (<em>sacks, baby!</em>) and stopping outside runs.</p></li></ul><h4>Linebackers</h4><p>Linebackers stand behind the defensive line and are versatile players involved in both run defense and pass coverage.</p><ul><li><p><strong>Middle Linebacker (MLB):</strong> Often considered the &#8220;quarterback of the defense,&#8221; the MLB directs defensive alignments. It is heavily involved in stopping the run and covering short to intermediate pass routes.</p></li><li><p><strong>Outside Linebackers (OLB):</strong> Depending on the defensive scheme, OLBs may focus on covering receivers, supporting run defense, or blitzing the quarterback.</p></li></ul><h4>Defensive Backs</h4><p>Also known as the secondary, these players focus on defending against passing plays and providing support on running plays.</p><ul><li><p><strong>Cornerbacks (CB):</strong> Typically covering the offense&#8217;s wide receivers, cornerbacks aim to prevent successful passes by deflecting or intercepting the ball.</p></li><li><p><strong>Safeties:</strong> Positioned deeper in the defensive backfield, safeties provide a last line of defense against deep passes and runs.</p><ul><li><p><strong>Free Safety (FS):</strong> The last line of defense, often patrolling deep downfield to prevent big plays.</p></li><li><p><strong>Strong Safety (SS):</strong> A hybrid linebacker-safety who helps cover tight ends and running backs in passing situations.</p></li></ul></li></ul><h3>Special Teams</h3><p>Special teams units handle all kicking plays, including kickoffs, punts, field goals, and extra points. Players on special teams have specialized roles that are crucial in determining field position and scoring opportunities.</p><ul><li><p><strong>Kicker (K):</strong> Responsible for kickoffs, field goals, and extra point attempts.</p></li><li><p><strong>Punter (P):</strong> Handles punts, aiming to pin the opposing team deep in their own territory.</p></li><li><p><strong>Long Snapper (LS):</strong> Specializes in snapping the ball over longer distances, typically for punts and field goal attempts.</p></li><li><p><strong>Kick Returner (KR) and Punt Returner (PR):</strong> Tasked with catching kickoffs and punts, respectively, and advancing the ball as far as possible to set up a favorable field position.</p></li></ul><p>For a visual explanation of these positions and their roles, you might find this video helpful: <a href="https://www.youtube.com/watch?v=KA_EFlU0CWY">SPORTS 101 // Guide to American Football Positions</a>.</p><h2>Strategies and Tactics</h2><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!XL5e!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd56df29c-5568-4244-81c8-c889e4cbaf03_740x280.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!XL5e!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd56df29c-5568-4244-81c8-c889e4cbaf03_740x280.png 424w, https://substackcdn.com/image/fetch/$s_!XL5e!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd56df29c-5568-4244-81c8-c889e4cbaf03_740x280.png 848w, https://substackcdn.com/image/fetch/$s_!XL5e!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd56df29c-5568-4244-81c8-c889e4cbaf03_740x280.png 1272w, https://substackcdn.com/image/fetch/$s_!XL5e!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd56df29c-5568-4244-81c8-c889e4cbaf03_740x280.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!XL5e!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd56df29c-5568-4244-81c8-c889e4cbaf03_740x280.png" width="740" height="280" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/d56df29c-5568-4244-81c8-c889e4cbaf03_740x280.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:280,&quot;width&quot;:740,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Super Bowl&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Super Bowl" title="Super Bowl" srcset="https://substackcdn.com/image/fetch/$s_!XL5e!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd56df29c-5568-4244-81c8-c889e4cbaf03_740x280.png 424w, https://substackcdn.com/image/fetch/$s_!XL5e!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd56df29c-5568-4244-81c8-c889e4cbaf03_740x280.png 848w, https://substackcdn.com/image/fetch/$s_!XL5e!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd56df29c-5568-4244-81c8-c889e4cbaf03_740x280.png 1272w, https://substackcdn.com/image/fetch/$s_!XL5e!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd56df29c-5568-4244-81c8-c889e4cbaf03_740x280.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Image Source: <a href="https://xkcd.com/">XKCD</a></em></p><p>Football isn&#8217;t just about brute strength and speed; it&#8217;s a complex chess match where strategy and tactics play pivotal roles. Coaches and players meticulously plan and execute plays to outmaneuver their opponents, making the game as intellectually engaging as it is physically demanding. Let&#8217;s delve into the strategic elements that define this sport.</p><h3>Offensive Strategies</h3><p>The offense aims to advance the ball and score points, employing various strategies to keep the defense off balance.</p><p><strong>1. Play Calling and <a href="https://a.espncdn.com/nfl/preview02/columns/pasquarelli_len/1423809.html">Game Planning</a></strong></p><p>Before each game, teams develop a game plan to exploit the opponent&#8217;s weaknesses and leverage their own strengths. This plan includes a selection of plays designed for various situations, such as short-yardage gains, long-distance passes, or <a href="https://www.viqtorysports.com/what-is-the-red-zone-in-football-explained/">red-zone</a> scoring opportunities. Coaches script the opening plays to set the tone and gather information on the defense&#8217;s tendencies.</p><p><strong>2. Formations and Personnel Packages</strong></p><p>Offensive formations dictate the alignment of players on the field. Common formations include:</p><ul><li><p><strong><a href="https://www.football-tutorials.com/i-formation-offense-101/">I-Formation:</a></strong> Features a fullback and a halfback lined up directly behind the quarterback, ideal for powering running plays.</p></li><li><p><strong><a href="https://americanfootball.fandom.com/wiki/Shotgun_Formation">Shotgun Formation:</a></strong> This formation positions the quarterback several yards behind the center, providing a better vantage point for passing plays.</p></li><li><p><strong><a href="https://www.xsosfootball.com/singleback-formation-sets/">Singleback Formation:</a></strong> Utilizes a lone running back, allowing for a balanced attack with multiple receiving options.</p></li></ul><p><a href="https://www.viqtorysports.com/what-does-21-11-personnel-mean-in-football/">Personnel packages</a> refer to the combination of running backs, tight ends, and wide receivers on the field. For example, a &#8220;21&#8221; personnel package includes two running backs and one tight end. Varying these packages keeps the defense guessing and can create mismatches.</p><p><strong>3. Passing vs. Running Plays</strong></p><p>Balancing passing and running plays is crucial. A strong running game can force the defense to commit more players to the line of scrimmage, opening up opportunities for play-action passes. Conversely, an effective passing attack can spread the defense, creating running lanes.</p><p><strong>4. Tempo and No-Huddle Offense</strong></p><p>Altering the tempo of play can disrupt the defense&#8217;s rhythm. A <a href="https://dictionary.cambridge.org/us/dictionary/english/no-huddle">no-huddle offense</a>, where the team quickly lines up and executes plays without huddling, can tire defenders and limit their ability to substitute players, potentially exploiting mismatches.</p><h3>Defensive Strategies</h3><p>The defense aims to prevent the offense from advancing the ball and scoring, using various schemes and tactics to counter offensive plays.</p><p><strong>1. Defensive Alignments and Formations</strong></p><p>Defensive formations are designed to counter specific offensive strategies. Common alignments include:</p><ul><li><p><strong><a href="https://throwdeeppublishing.com/blogs/football-glossary/the-4-3-defense-the-complete-guide?">4-3 Defense:</a></strong> Four defensive linemen and three linebackers, providing a balanced approach to stopping both the run and the pass.</p></li><li><p><strong><a href="https://bleacherreport.com/articles/2007958-nfl-101-the-basics-of-the-3-4-defensive-front">3-4 Defense:</a></strong> Three defensive linemen and four linebackers, offering greater flexibility in blitz packages and pass coverage.</p></li></ul><p><strong>2. Man-to-Man vs. Zone Coverage</strong></p><p>In pass defense, teams employ:</p><ul><li><p><strong>Man-to-Man Coverage:</strong> Each defender is responsible for covering a specific offensive player, allowing for tight coverage but susceptible to <a href="https://www.milehighreport.com/mhr-film-study/2013/12/10/5195218/nfl-rules-clarification-pick-plays">pick plays.</a></p></li><li><p><strong>Zone Coverage:</strong> Defenders cover designated areas of the field, which can be effective against passing attacks but may leave gaps if not executed properly.</p></li></ul><p><strong>3. Blitzing</strong></p><p>A <a href="https://www.reddit.com/r/NFLNoobs/comments/mx1obk/whats_a_blitz/">blitz</a> involves sending additional defenders, such as linebackers or defensive backs, to pressure the quarterback. While this can lead to sacks or hurried throws, it also leaves fewer players in coverage, increasing the risk of big plays by the offense.</p><p><strong>4. Turnover Creation</strong></p><p>Defenses aim to create turnovers through interceptions and forced fumbles. Strategies include disguising coverages to confuse the quarterback and employing aggressive tackling techniques to dislodge the ball.</p><h3>Special Teams Strategies</h3><p><strong>1. Kickoff and Punt Coverage:</strong> The objective is to limit the opposing team's return yardage. This involves strategic kick placement and disciplined coverage lanes to corral the <a href="https://operations.nfl.com/learn-the-game/nfl-basics/terms-glossary/glossary-terms-list/puntkick-returner/">returner.</a></p><p><strong>2. Return Strategies:</strong> Return teams design blocking schemes to create lanes for the returner, aiming to gain an advantageous field position or score. Decisions on whether to attempt a return or signal for a fair catch are based on factors like hang time and coverage speed. Keep in mind, however, that the NFL regularly changes the rules of the game to keep things fresh and interesting. Hence, this information might be outdated, especially given the <a href="https://www.youtube.com/watch?v=umTd77tHAgI">recent change to the kickoff rules.</a></p><p><strong>3. Field Goal and Punt Fakes:</strong> Occasionally, teams will attempt fake field goals or punts to catch the defense off guard, aiming to convert a first down or score. These high-risk, high-reward plays are typically used in critical situations.</p><h3>In-Game Adjustments</h3><p>Football is dynamic, and successful teams make real-time adjustments based on the game&#8217;s flow.</p><p><strong>1. Halftime Adjustments:</strong> Coaches analyze first-half performance, identifying what&#8217;s working and what&#8217;s not. They may alter their game plan, adjust play-calling tendencies, or implement new strategies to exploit observed weaknesses in the opponent.</p><p><strong><a href="https://www.reddit.com/r/footballstrategy/comments/191u4v6/how_do_qbs_know_which_play_to_audible_to/">2. Audibles:</a></strong> Quarterbacks have the authority to change the play at the line of scrimmage based on the defensive alignment. This ability to &#8220;call an audible&#8221; allows the offense to adapt to unexpected defensive strategies.</p><p><strong>3. Clock Management:</strong> Managing the game clock is a critical strategic element, especially in close games. Teams may use timeouts, hurry-up offenses, or deliberate slow play to control the clock.</p><p>Understanding these strategies provides a deeper appreciation for the complexity and excitement of American football. It&#8217;s a game where every decision can influence the outcome, making it a thrilling spectacle for fans and a challenging endeavor for players and coaches alike. To understand more of the strategy details you might find these videos and resources helpful: <a href="https://www.youtube.com/watch?v=ll_Y51XjWs0">Football Plays, Positions, Strategy &amp; Tactics for Beginners</a>, <a href="https://www.smartfootball.com/">Smart Football</a>, <a href="https://www.youtube.com/@BrettKollmann/playlists">Breakdowns by Brett Kollmann</a>.</p><h2>Conclusion</h2><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!jYXB!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffb00767b-0f1e-48fd-b819-f23a085edd4b_398x406.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!jYXB!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffb00767b-0f1e-48fd-b819-f23a085edd4b_398x406.png 424w, https://substackcdn.com/image/fetch/$s_!jYXB!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffb00767b-0f1e-48fd-b819-f23a085edd4b_398x406.png 848w, https://substackcdn.com/image/fetch/$s_!jYXB!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffb00767b-0f1e-48fd-b819-f23a085edd4b_398x406.png 1272w, https://substackcdn.com/image/fetch/$s_!jYXB!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffb00767b-0f1e-48fd-b819-f23a085edd4b_398x406.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!jYXB!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffb00767b-0f1e-48fd-b819-f23a085edd4b_398x406.png" width="398" height="406" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/fb00767b-0f1e-48fd-b819-f23a085edd4b_398x406.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:406,&quot;width&quot;:398,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Super Bowl Watch Party&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Super Bowl Watch Party" title="Super Bowl Watch Party" srcset="https://substackcdn.com/image/fetch/$s_!jYXB!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffb00767b-0f1e-48fd-b819-f23a085edd4b_398x406.png 424w, https://substackcdn.com/image/fetch/$s_!jYXB!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffb00767b-0f1e-48fd-b819-f23a085edd4b_398x406.png 848w, https://substackcdn.com/image/fetch/$s_!jYXB!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffb00767b-0f1e-48fd-b819-f23a085edd4b_398x406.png 1272w, https://substackcdn.com/image/fetch/$s_!jYXB!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffb00767b-0f1e-48fd-b819-f23a085edd4b_398x406.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Image Source: <a href="https://xkcd.com/">XKCD</a></em></p><p>We&#8217;ve covered a lot&#8212;from a bit about football rules to the positions, strategies, and tactics that make it all make sense. If your brain is feeling overloaded, that&#8217;s normal. Football is a live-action strategy game with 300-pound linemen and commercial breaks every five minutes.</p><p>The next time you watch a game, you&#8217;ll know why everyone yells at the TV. You&#8217;ll recognize when a quarterback calls an audible, when a defense is setting up for a blitz, and when a kicker is probably about to ruin someone&#8217;s night. Maybe you&#8217;ll even impress your friends by casually explaining what a <a href="https://throwdeeppublishing.com/blogs/football-glossary/what-is-cover-2-in-football?">Cover 2 defense</a> is (make sure to say it with confidence).</p><p>And if none of this has convinced you that football is fantastic, well&#8212;there are still the halftime show, the snacks, and the ads, so you&#8217;ve got something to look forward to.</p><p>Now, grab your wings, find a comfy seat, and enjoy the Super Bowl madness or just the halftime show. And if you still don&#8217;t get what&#8217;s happening? Just cheer when everyone else does. Trust me, it works. &#127944;&#128514;</p><h2>References and Resources to Learn More</h2><ul><li><p><a href="https://www.nike.com/a/how-to-play-football">What&#8217;s Actually Going On Out There? A Beginner&#8217;s Guide to American Football</a></p></li><li><p><a href="https://www.youtube.com/watch?v=o3Bzqm_0A4E">A Beginner&#8217;s Guide to American Football (NFL); rules, regulations, divisions &amp; more</a></p></li><li><p><a href="https://www.youtube.com/watch?v=ovdbrdCIP7U&amp;t=562s">NFL Throwback: How EVERY Team Got Its Name &amp; Identity!</a></p></li><li><p><a href="https://www.youtube.com/watch?v=FGzxlY_7ZyY">The Entire History of the NFL</a></p></li><li><p><a href="https://www.youtube.com/watch?v=6pxu3s2VTQE">How the NFL used &#8216;socialism&#8217; to get rich</a></p></li><li><p><a href="https://www.youtube.com/watch?v=vh5jaFpbXUQ">The ENTIRE History of the Super Bowl!</a></p></li><li><p><a href="https://www.youtube.com/watch?v=ztSiem1XU54">The OFFICIAL History of NFL Rules!</a></p></li><li><p><a href="https://www.youtube.com/watch?v=6vmJZBtXDuU">Rules Of American Football EXPLAINED FOR BEGINNERS</a></p></li><li><p><a href="https://operations.nfl.com/learn-the-game/nfl-basics/rookies-guide/">Rookie&#8217;s Guide</a></p></li><li><p><a href="https://www.youtube.com/watch?v=uM9iLQJzMO0">SPORTS 101 // Guide to American Football</a></p></li><li><p><a href="https://www.youtube.com/watch?v=xcG6bIChHQk">Learn American Football in 5 Minutes</a></p></li><li><p><a href="https://www.dazn.com/en-US/news/american-football/what-are-the-rules-of-american-football-how-does-nfl-work/15irpm1m3p2r16z4rrmij1uit">What are the rules of American football? How does NFL work?</a></p></li><li><p><a href="https://operations.nfl.com/the-rules/nfl-rulebook/">NFL Rulebook</a></p></li><li><p><a href="https://turftank.com/us/academy/the-rules-of-football/">[Quick Guide] What are the rules of football?</a></p></li><li><p><a href="https://culturalmixology.com/a-beginners-guide-to-american-football/">A Beginner&#8217;s Guide to American Football</a></p></li><li><p><a href="https://scores24.live/en/articles/knowledge-base/understanding-american-football-and-soccer">Understanding American Football and Soccer</a></p></li><li><p><a href="https://www.dazn.com/en-US/news/american-football/offensive-and-defensive-football-positions-explained-what-are-they-and-why-are-there-two-different-teams/1mm2oaotqslhy18hga4bj9ujbk">Offensive and defensive football positions explained: What are they and why are there two different teams</a></p></li><li><p><a href="https://www.newworldencyclopedia.org/entry/Football_(American)">Football (American)</a></p></li><li><p><a href="https://proofreadingpal.com/proofreading-pulse/grammar/quick-guide-to-grammatically-correct-nfl-lingo-part-1-of-4/">How to Understand NFL Lingo, Part 1 of 3</a></p></li><li><p><a href="https://proofreadingpal.com/proofreading-pulse/grammar/quick-guide-to-grammatically-correct-nfl-lingo-part-2-of-4/">How to Understand NFL Lingo, Part 2 of 3</a></p></li><li><p><a href="https://proofreadingpal.com/proofreading-pulse/grammar/how-to-understand-nfl-lingo-part-3-of-3/">How to Understand NFL Lingo, Part 3 of 3</a></p></li></ul><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://notebook.mubbie.dev/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Mubbie's Notebook! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[Reflecting on 2024]]></title><description><![CDATA[What Really Happened?]]></description><link>https://notebook.mubbie.dev/p/reflecting-on-2024</link><guid isPermaLink="false">https://notebook.mubbie.dev/p/reflecting-on-2024</guid><dc:creator><![CDATA[Mubarak Idoko]]></dc:creator><pubDate>Thu, 02 Jan 2025 04:52:34 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe35d6b96-8c1a-41b0-b0fe-bea742640271_5568x4872.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!p3Vg!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8f5841dc-9368-43ea-a1f4-d0150597bae6_1980x1979.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!p3Vg!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8f5841dc-9368-43ea-a1f4-d0150597bae6_1980x1979.jpeg 424w, https://substackcdn.com/image/fetch/$s_!p3Vg!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8f5841dc-9368-43ea-a1f4-d0150597bae6_1980x1979.jpeg 848w, https://substackcdn.com/image/fetch/$s_!p3Vg!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8f5841dc-9368-43ea-a1f4-d0150597bae6_1980x1979.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!p3Vg!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8f5841dc-9368-43ea-a1f4-d0150597bae6_1980x1979.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!p3Vg!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8f5841dc-9368-43ea-a1f4-d0150597bae6_1980x1979.jpeg" width="500" height="499.6565934065934" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/8f5841dc-9368-43ea-a1f4-d0150597bae6_1980x1979.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1455,&quot;width&quot;:1456,&quot;resizeWidth&quot;:500,&quot;bytes&quot;:625756,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!p3Vg!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8f5841dc-9368-43ea-a1f4-d0150597bae6_1980x1979.jpeg 424w, https://substackcdn.com/image/fetch/$s_!p3Vg!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8f5841dc-9368-43ea-a1f4-d0150597bae6_1980x1979.jpeg 848w, https://substackcdn.com/image/fetch/$s_!p3Vg!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8f5841dc-9368-43ea-a1f4-d0150597bae6_1980x1979.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!p3Vg!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8f5841dc-9368-43ea-a1f4-d0150597bae6_1980x1979.jpeg 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>2024 New Year Fireworks: Seattle Center</em></p><h2>Introduction</h2><p>I&#8217;ll admit it&#8212;I&#8217;m not the best at telling my own story. While I thrive at spotlighting the work of others, sharing my own journey often feels clumsy or incomplete. But as 2024 ends, I&#8217;m challenging myself to pause, reflect, and celebrate the big and small moments that defined my year.</p><p>Join me as I recount the highlights, setbacks, and lessons that made 2024 unforgettable. In the paragraphs ahead, I&#8217;ll take you through my adventures in sports and physical activity, professional milestones, relationships, community-building, and a few personal favorites that shaped my year. Finally, I&#8217;ll share what I look forward to as we enter 2025. Let&#8217;s dive into the year that was!</p><h2>Physical Activity: Lifting Weights, Chasing Wins, and The Art of Running in the Rain</h2><p>On a chilly, grey January 1st, 2024, I laced up my running shoes and stepped out into the Seattle mist for a one-mile run. My goal for the year was simple: run one mile every day (except Saturdays, with a 5K on Sundays) and hit or surpass 366 miles by year&#8217;s end. If I stuck with it, I figured I&#8217;d build the strength and consistency to start training for a half marathon by 2026.</p><p>So, how did it go? Well, I didn&#8217;t quite make 366 miles. Instead, I logged just over 300&#8212;thanks to a 12-week break after a stress fracture in my knee from soccer. But here&#8217;s the surprising part: despite the setback, I completed a grueling half marathon. And not just any race&#8212;it was a <a href="https://nwtrailruns.com/">NorthWest Trail Run</a>, complete with relentless rain, slick mud, freezing cold, and punishing elevation changes. With no proper training, I finished at a 10:30/mi pace, running straight through and stopping only four times for quick energy gels. It wasn&#8217;t pretty, but I embraced the challenge and loved every bit of it. Beyond that, I hit a few personal running milestones that I&#8217;m proud of: a best 5K time of 28:08 and my fastest average pace of 7:14/mi over a two-mile run.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!oI9m!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F70e003ba-bd34-49af-aa39-6412ba958360_2795x2801.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!oI9m!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F70e003ba-bd34-49af-aa39-6412ba958360_2795x2801.jpeg 424w, https://substackcdn.com/image/fetch/$s_!oI9m!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F70e003ba-bd34-49af-aa39-6412ba958360_2795x2801.jpeg 848w, https://substackcdn.com/image/fetch/$s_!oI9m!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F70e003ba-bd34-49af-aa39-6412ba958360_2795x2801.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!oI9m!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F70e003ba-bd34-49af-aa39-6412ba958360_2795x2801.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!oI9m!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F70e003ba-bd34-49af-aa39-6412ba958360_2795x2801.jpeg" width="551" height="552.1353021978022" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/70e003ba-bd34-49af-aa39-6412ba958360_2795x2801.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1459,&quot;width&quot;:1456,&quot;resizeWidth&quot;:551,&quot;bytes&quot;:1561337,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!oI9m!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F70e003ba-bd34-49af-aa39-6412ba958360_2795x2801.jpeg 424w, https://substackcdn.com/image/fetch/$s_!oI9m!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F70e003ba-bd34-49af-aa39-6412ba958360_2795x2801.jpeg 848w, https://substackcdn.com/image/fetch/$s_!oI9m!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F70e003ba-bd34-49af-aa39-6412ba958360_2795x2801.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!oI9m!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F70e003ba-bd34-49af-aa39-6412ba958360_2795x2801.jpeg 1456w" sizes="100vw"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Running a Half Marathon</em></p><p>What made me happiest was seeing some of my friends&#8212;who weren&#8217;t big on running&#8212;join me. A few had teased me about &#8220;chasing nothing,&#8221; so watching them embrace the joys and inevitable aches of running was incredibly rewarding. I couldn&#8217;t be more pleased&#8212;they finally get it. &#128524;</p><p>Running wasn&#8217;t the only activity that kept me moving this year. Soccer played a big role, too. I joined a Seattle Recreational Adult League team in late 2023, holding down the center forward position throughout 2024. Watching our team grow from underdogs to contenders by December was exhilarating. I also joined a flag football team for the fall season&#8212;a completely new sport for me. Not only did I learn the game, but I started following it on TV&#8212;something my younger self would never have believed! We made it to the playoffs, narrowly missing the semifinals, but the friendships and memories made it all worth it.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!5UjT!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F50ebe46d-caa3-42a0-a2e1-3f5e5ff65de9_3765x2116.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!5UjT!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F50ebe46d-caa3-42a0-a2e1-3f5e5ff65de9_3765x2116.jpeg 424w, https://substackcdn.com/image/fetch/$s_!5UjT!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F50ebe46d-caa3-42a0-a2e1-3f5e5ff65de9_3765x2116.jpeg 848w, https://substackcdn.com/image/fetch/$s_!5UjT!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F50ebe46d-caa3-42a0-a2e1-3f5e5ff65de9_3765x2116.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!5UjT!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F50ebe46d-caa3-42a0-a2e1-3f5e5ff65de9_3765x2116.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!5UjT!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F50ebe46d-caa3-42a0-a2e1-3f5e5ff65de9_3765x2116.jpeg" width="1456" height="818" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/50ebe46d-caa3-42a0-a2e1-3f5e5ff65de9_3765x2116.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:818,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:1258860,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!5UjT!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F50ebe46d-caa3-42a0-a2e1-3f5e5ff65de9_3765x2116.jpeg 424w, https://substackcdn.com/image/fetch/$s_!5UjT!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F50ebe46d-caa3-42a0-a2e1-3f5e5ff65de9_3765x2116.jpeg 848w, https://substackcdn.com/image/fetch/$s_!5UjT!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F50ebe46d-caa3-42a0-a2e1-3f5e5ff65de9_3765x2116.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!5UjT!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F50ebe46d-caa3-42a0-a2e1-3f5e5ff65de9_3765x2116.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>With my Soccer Team</em></p><p>One standout moment was a charity soccer match organized by a friend to raise funds for kids in Nigeria to attend school. It was 90 minutes of fierce competition, vibrant Afrobeats, and playful trash-talking&#8212;an unforgettable blend of fun and purpose. It inspired me, and I hope to participate in more activities like this in 2025 that combine enjoyment with a larger impact.</p><p>I also discovered pickleball, a fantastic (and forgiving) alternative to tennis, which still challenges me. Dancing was another unexpected highlight. I took classes in Bachata, Afrobeats and Amapiano, picking up a few moves to show off at parties and dance socials. Dancing brought joy, rhythm, and a sense of vibrancy to my year. At the gym, I focused on powerlifting with the <a href="https://stronglifts.com/stronglifts-5x5/">StrongLifts 5x5 program</a>, emphasizing core lifts like squats, deadlifts, bench presses, barbell rows, and overhead presses. This classic regimen, utilized by legends like <a href="https://gymtalk.com/reg-park-5x5-routine/">Reg Park</a> and <a href="https://muscleevo.net/did-arnold-do-5x5/">Arnold Schwarzenegger</a>, was a cornerstone of my training, with a clear focus on developing strength.</p><p>Toward the end of the year, I shifted to a more hypertrophy-focused program&#8212;<a href="https://functional-bodybuilding.com/">Marcus Filly&#8217;s Functional Bodybuilding</a>&#8212;which combines strength training with conditioning to reduce burnout and minimize the risk of injury. I got this recommendation from a <a href="https://www.instagram.com/umacodes/">friend</a>, and it&#8217;s been a refreshing change thus far. I&#8217;ll continue with it in 2025 and potentially explore StrongLifts&#8217; Hypertrophy focused workout program, the <a href="https://stronglifts.com/stronglifts-5x5/plus/">Stronglifts 5&#215;5 Plus: Upper-body Hypertrophy Program</a>.</p><p>Finally, there was skydiving. To celebrate my birthday, I took my first jump&#8212;a thrilling mix of exhilaration and sheer terror. Every second was unforgettable, and I loved it more than I could have imagined. I&#8217;m already planning at least two jumps in 2025 (it&#8217;s bloody expensive, though&#8212;holla at me if you know where to get discounts) and hope to convince a few friends to join me (though they&#8217;re not exactly eager&#8212;yet). Who knows? Maybe one day, I&#8217;ll even work toward earning a skydiving license.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!wogh!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe35d6b96-8c1a-41b0-b0fe-bea742640271_5568x4872.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!wogh!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe35d6b96-8c1a-41b0-b0fe-bea742640271_5568x4872.jpeg 424w, https://substackcdn.com/image/fetch/$s_!wogh!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe35d6b96-8c1a-41b0-b0fe-bea742640271_5568x4872.jpeg 848w, https://substackcdn.com/image/fetch/$s_!wogh!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe35d6b96-8c1a-41b0-b0fe-bea742640271_5568x4872.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!wogh!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe35d6b96-8c1a-41b0-b0fe-bea742640271_5568x4872.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!wogh!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe35d6b96-8c1a-41b0-b0fe-bea742640271_5568x4872.jpeg" width="596" height="521.5" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e35d6b96-8c1a-41b0-b0fe-bea742640271_5568x4872.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1274,&quot;width&quot;:1456,&quot;resizeWidth&quot;:596,&quot;bytes&quot;:5838568,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!wogh!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe35d6b96-8c1a-41b0-b0fe-bea742640271_5568x4872.jpeg 424w, https://substackcdn.com/image/fetch/$s_!wogh!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe35d6b96-8c1a-41b0-b0fe-bea742640271_5568x4872.jpeg 848w, https://substackcdn.com/image/fetch/$s_!wogh!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe35d6b96-8c1a-41b0-b0fe-bea742640271_5568x4872.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!wogh!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe35d6b96-8c1a-41b0-b0fe-bea742640271_5568x4872.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Skydiving</em></p><p>Amid all this activity, my trusty watch tells me I logged 4,396,500 steps&#8212;an average of over 12,000 steps a day. But beyond the stats, 2024 reminded me of the profound connection between physical movement and mental clarity. Exercise wasn&#8217;t just a way to stay fit; it became my lifeline, a creative fuel, and the spark that kept me alive and more engaged with the world.</p><h2>Professional Life: Putting Out Fires, Building Dreams, and Learning Through the Grind</h2><p>The start of 2024 was a whirlwind of engineering work as I helped tackle fires at my job. Our company had been caught in the crosshairs of a large-scale nation-state hack, leaving critical systems vulnerable. The team worked tirelessly to fortify our systems, ensuring resilience against future attacks. The work was both challenging and rewarding, though it often came at a personal cost. There were nights when I stayed in the office until ungodly hours, running on fumes and pushing through burnout. My roommates frequently teased me about my relentless work ethic, and they weren&#8217;t wrong&#8212;it wasn&#8217;t great for my well-being. Still, I genuinely enjoyed the intensity and the tangible impact of the work. By the end of the fiscal year, my efforts were recognized with high commendations from my manager and a well-earned promotion. In 2025, I&#8217;m determined to continue working hard but with a healthier balance, prioritizing sleep, consistent meals, and sustainable habits, and focus to avoid the burnout I experienced this year.</p><p>Since stepping into my new role, I&#8217;ve faced a different kind of challenge: maintaining the same level of impact. As I feared, it sometimes feels like I&#8217;ve set an impossibly high bar with my earlier efforts, leaving me struggling to keep up. But growth often stems from discomfort, and I&#8217;m embracing the learning curve, determined to evolve and improve each day.</p><p>Beyond my 9-to-5, I launched this blog&#8212;a space to explore and share my thoughts, ideas, and learnings. This year, I wrote on various topics, including technology, sports, and politics. Writing has become my go-to method for deepening my understanding; explaining concepts to others not only helps me retain what I learn but also clarifies my thinking. In 2025, I&#8217;m eager to expand my horizons, learn even more, and turn those lessons into an even greater number of blog posts than in 2024. I hope you&#8217;ll be part of this journey, offering your insights and ideas along the way.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://notebook.mubbie.dev/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://notebook.mubbie.dev/subscribe?"><span>Subscribe now</span></a></p><p>One of my personal highlights this year was finally passing my professional engineering exams after an earlier stumble. This milestone, combined with reading more books than ever before and exploring diverse, often uncomfortable ideas, made 2024 a deep dive into knowledge. The more I learn, the more I realize how much I don&#8217;t know&#8212;a humbling yet invigorating revelation. My goal for 2025 is simple: to guzzle up as much knowledge and learning as possible.</p><p>Much of my year revolved around Lena, the startup I&#8217;ve been building with an incredible team. Lena&#8217;s mission is ambitious yet deeply needed: to transform education through low-tech learning and school management solutions, starting with schools in Nigeria. While we aimed to launch in 2024, we pushed the timeline to 2025. We weren&#8217;t satisfied that we had built something truly impactful for the schools we want to serve.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!h2R5!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2210792a-d402-4ba6-9756-507ee344b90d_5712x4284.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!h2R5!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2210792a-d402-4ba6-9756-507ee344b90d_5712x4284.jpeg 424w, https://substackcdn.com/image/fetch/$s_!h2R5!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2210792a-d402-4ba6-9756-507ee344b90d_5712x4284.jpeg 848w, https://substackcdn.com/image/fetch/$s_!h2R5!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2210792a-d402-4ba6-9756-507ee344b90d_5712x4284.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!h2R5!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2210792a-d402-4ba6-9756-507ee344b90d_5712x4284.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!h2R5!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2210792a-d402-4ba6-9756-507ee344b90d_5712x4284.jpeg" width="580" height="435" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/2210792a-d402-4ba6-9756-507ee344b90d_5712x4284.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1092,&quot;width&quot;:1456,&quot;resizeWidth&quot;:580,&quot;bytes&quot;:2206738,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!h2R5!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2210792a-d402-4ba6-9756-507ee344b90d_5712x4284.jpeg 424w, https://substackcdn.com/image/fetch/$s_!h2R5!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2210792a-d402-4ba6-9756-507ee344b90d_5712x4284.jpeg 848w, https://substackcdn.com/image/fetch/$s_!h2R5!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2210792a-d402-4ba6-9756-507ee344b90d_5712x4284.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!h2R5!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2210792a-d402-4ba6-9756-507ee344b90d_5712x4284.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Lena Team Meeting</em></p><p>This setback wasn&#8217;t easy&#8212;especially with our runway shrinking fast. But perseverance paid off. Representing the team, I pitched Lena at <a href="https://www.founderslive.com/prime-time-pitch-challenge">Founders Live</a> and <a href="https://www.founderslive.com/the-feed-container/prime-time-2024-wrap-up">secured $5,000 in funding</a>. Thanks to our disciplined financial management, this funding buys us several months to refine our work. I&#8217;m incredibly proud of how the team has grown this year, with every member stepping up and delivering their best.</p><p>I can&#8217;t wait to see Lena make its mark, helping students in Nigeria and beyond unlock their potential. Our dream is to start with Nigeria, expand across Africa, and eventually serve communities worldwide that need accessible, low-tech educational tools. You can learn more about Lena and our vision on our <a href="https://lena.africa/">website</a>. 2024 was a year of hard lessons and big dreams for Lena, and 2025 promises to be the year we truly take flight.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!65Cx!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F29dea01c-da2c-41a5-a3f1-0fd5a1c3435c_4032x3024.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!65Cx!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F29dea01c-da2c-41a5-a3f1-0fd5a1c3435c_4032x3024.jpeg 424w, https://substackcdn.com/image/fetch/$s_!65Cx!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F29dea01c-da2c-41a5-a3f1-0fd5a1c3435c_4032x3024.jpeg 848w, https://substackcdn.com/image/fetch/$s_!65Cx!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F29dea01c-da2c-41a5-a3f1-0fd5a1c3435c_4032x3024.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!65Cx!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F29dea01c-da2c-41a5-a3f1-0fd5a1c3435c_4032x3024.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!65Cx!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F29dea01c-da2c-41a5-a3f1-0fd5a1c3435c_4032x3024.jpeg" width="443" height="590.5652472527472" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/29dea01c-da2c-41a5-a3f1-0fd5a1c3435c_4032x3024.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1941,&quot;width&quot;:1456,&quot;resizeWidth&quot;:443,&quot;bytes&quot;:1208674,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!65Cx!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F29dea01c-da2c-41a5-a3f1-0fd5a1c3435c_4032x3024.jpeg 424w, https://substackcdn.com/image/fetch/$s_!65Cx!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F29dea01c-da2c-41a5-a3f1-0fd5a1c3435c_4032x3024.jpeg 848w, https://substackcdn.com/image/fetch/$s_!65Cx!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F29dea01c-da2c-41a5-a3f1-0fd5a1c3435c_4032x3024.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!65Cx!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F29dea01c-da2c-41a5-a3f1-0fd5a1c3435c_4032x3024.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Testing Lena's Mobile Applications</em></p><h2>Relationships and Community: Strengthening Bonds, Building Bridges, and Learning from Mistakes</h2><p>After graduating college, one of my biggest fears was that it would be incredibly challenging to make and maintain friendships in the so-called &#8220;real world.&#8221; Thankfully, that hasn&#8217;t been entirely true. While I miss the ease of meeting and connecting with people in college, I&#8217;ve come to appreciate the deliberateness and intentionality relationships require outside that bubble.</p><p>A highlight of this year was celebrating the graduations of some of my closest friends. These are the same friends with whom I studied late into the night during the chaos of the COVID-19 pandemic, often from 9 PM to 3 or 4 AM, over Zoom. We didn&#8217;t attend the same schools and were scattered across the country, but we stayed connected, supporting each other through victories, heartbreaks, and challenges. Seeing their growth and celebrating their achievements in Austin and Nashville was deeply fulfilling. Though we don&#8217;t talk as much now, our bond remains strong, and we prioritise being present for each other&#8217;s milestones&#8212;a habit we hadn&#8217;t cultivated while in college.</p><p>Locally, I&#8217;ve found joy in helping to build a small but tight-knit community in Seattle, where we go out for fun activities and hang out most weekends. Time outside work also allowed me to connect with people through soccer, pickleball, dance socials, and other activities. I&#8217;ve grown closer to my roommates, who generously let me host game nights at our house. This year, I hosted two big game nights (one drew over 80 people!), my soccer team for snacks and games, and a pirate-themed Christmas party complete with a treasure hunt for Santa&#8217;s lost &#8220;Parcel of Eternal Happiness.&#8221; To my surprise, the party (and hunt) was a massive success. I was particularly proud of our giving tree, which collected supplies, toys, and gift cards for a local Seattle charity supporting women and children experiencing homelessness. Special shoutout to my friend, <a href="https://www.instagram.com/4tune_tellar/">Fortune</a>, for being Santa, the Captain of the North Pole Fleet, during the party. In 2025, I hope to host even more events that bring people together for fun and meaningful causes.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!hO-D!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbb8e5a70-df20-4a3d-8e8d-314545fb8d0c_3313x3523.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!hO-D!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbb8e5a70-df20-4a3d-8e8d-314545fb8d0c_3313x3523.jpeg 424w, https://substackcdn.com/image/fetch/$s_!hO-D!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbb8e5a70-df20-4a3d-8e8d-314545fb8d0c_3313x3523.jpeg 848w, https://substackcdn.com/image/fetch/$s_!hO-D!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbb8e5a70-df20-4a3d-8e8d-314545fb8d0c_3313x3523.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!hO-D!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbb8e5a70-df20-4a3d-8e8d-314545fb8d0c_3313x3523.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!hO-D!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbb8e5a70-df20-4a3d-8e8d-314545fb8d0c_3313x3523.jpeg" width="520" height="552.8571428571429" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/bb8e5a70-df20-4a3d-8e8d-314545fb8d0c_3313x3523.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1548,&quot;width&quot;:1456,&quot;resizeWidth&quot;:520,&quot;bytes&quot;:582648,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!hO-D!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbb8e5a70-df20-4a3d-8e8d-314545fb8d0c_3313x3523.jpeg 424w, https://substackcdn.com/image/fetch/$s_!hO-D!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbb8e5a70-df20-4a3d-8e8d-314545fb8d0c_3313x3523.jpeg 848w, https://substackcdn.com/image/fetch/$s_!hO-D!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbb8e5a70-df20-4a3d-8e8d-314545fb8d0c_3313x3523.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!hO-D!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbb8e5a70-df20-4a3d-8e8d-314545fb8d0c_3313x3523.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Group Picture from Issa Game Night: Round 2</em></p><p>That said, I did drop the ball on one community-building effort this year. I had formed a partnership with a local club to host events but failed to follow through with proper plans. They were enthusiastic and welcoming, and I didn&#8217;t treat that relationship with the respect it deserved. I plan to reconnect in 2025 and make amends by delivering on those opportunities.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!xcJP!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F832c0a85-bf5e-4a02-b292-19681e6ac85f_5120x3413.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!xcJP!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F832c0a85-bf5e-4a02-b292-19681e6ac85f_5120x3413.jpeg 424w, https://substackcdn.com/image/fetch/$s_!xcJP!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F832c0a85-bf5e-4a02-b292-19681e6ac85f_5120x3413.jpeg 848w, https://substackcdn.com/image/fetch/$s_!xcJP!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F832c0a85-bf5e-4a02-b292-19681e6ac85f_5120x3413.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!xcJP!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F832c0a85-bf5e-4a02-b292-19681e6ac85f_5120x3413.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!xcJP!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F832c0a85-bf5e-4a02-b292-19681e6ac85f_5120x3413.jpeg" width="589" height="392.801510989011" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/832c0a85-bf5e-4a02-b292-19681e6ac85f_5120x3413.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:971,&quot;width&quot;:1456,&quot;resizeWidth&quot;:589,&quot;bytes&quot;:1112382,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!xcJP!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F832c0a85-bf5e-4a02-b292-19681e6ac85f_5120x3413.jpeg 424w, https://substackcdn.com/image/fetch/$s_!xcJP!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F832c0a85-bf5e-4a02-b292-19681e6ac85f_5120x3413.jpeg 848w, https://substackcdn.com/image/fetch/$s_!xcJP!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F832c0a85-bf5e-4a02-b292-19681e6ac85f_5120x3413.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!xcJP!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F832c0a85-bf5e-4a02-b292-19681e6ac85f_5120x3413.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Treasure Hunters Teasing Out Clues from Santa at Christmas Under the Blag Flag</em></p><p>The highlight of my year, however, was when my parents visited Seattle. Spending time with them was a gift. As they approach new milestones, including my mom&#8217;s 60th birthday, I&#8217;m inspired by their unwavering energy, ambition, and commitment to learning. They&#8217;re still working toward new goals, transitioning into the next phase of their lives, and leading by example. Our relationship has grown significantly over the years. I&#8217;ve moved past the anger I once held, stemming from childhood traumas I attributed to their parenting. With time, I&#8217;ve come to see them as flawed, human, and deeply loving&#8212;parents who did their best with the knowledge they had. Today, I respect them more than ever and cherish the sacrifices they made for me and my sisters.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!tHLP!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7ba2af80-2115-4619-9ea6-707a9ba21fdd_3025x3024.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!tHLP!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7ba2af80-2115-4619-9ea6-707a9ba21fdd_3025x3024.jpeg 424w, https://substackcdn.com/image/fetch/$s_!tHLP!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7ba2af80-2115-4619-9ea6-707a9ba21fdd_3025x3024.jpeg 848w, https://substackcdn.com/image/fetch/$s_!tHLP!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7ba2af80-2115-4619-9ea6-707a9ba21fdd_3025x3024.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!tHLP!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7ba2af80-2115-4619-9ea6-707a9ba21fdd_3025x3024.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!tHLP!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7ba2af80-2115-4619-9ea6-707a9ba21fdd_3025x3024.jpeg" width="563" height="563" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/7ba2af80-2115-4619-9ea6-707a9ba21fdd_3025x3024.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1456,&quot;width&quot;:1456,&quot;resizeWidth&quot;:563,&quot;bytes&quot;:1433864,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!tHLP!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7ba2af80-2115-4619-9ea6-707a9ba21fdd_3025x3024.jpeg 424w, https://substackcdn.com/image/fetch/$s_!tHLP!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7ba2af80-2115-4619-9ea6-707a9ba21fdd_3025x3024.jpeg 848w, https://substackcdn.com/image/fetch/$s_!tHLP!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7ba2af80-2115-4619-9ea6-707a9ba21fdd_3025x3024.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!tHLP!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7ba2af80-2115-4619-9ea6-707a9ba21fdd_3025x3024.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Dinner with my Friends, Cousin and Parents</em></p><p>Still, I have room for growth. This year, I let certain emotional triggers get the best of me, at times unfairly channeling that intensity toward those closest to me. It&#8217;s something I&#8217;m not proud of, and I deeply regret the hurt it caused. I&#8217;m committed to addressing these patterns and am actively using every tool at my disposal to improve. In 2025, I aspire to be a better roommate, friend, partner, son, brother, and teammate&#8212;to bring more empathy, patience, and kindness into every relationship in my life. Steve Jobs once said, &#8220;Some years you win, some years you build character.&#8221; For me, 2024 was undoubtedly a year of building character that challenged me to grow, reflect, and strive toward being a better version of myself. And in 2025, the work continues.</p><h2>My Favorite Things from 2024</h2><p>As I mentioned earlier, 2024 was a year of exploration&#8212;a time to immerse myself in art, music, literature, and more from various sources. I&#8217;d love to share some of the works that deeply resonated with me this year. You&#8217;ll likely notice a strong bias toward World War II history, a subject that has always fascinated me with its rich stories, complexities, and lessons. It&#8217;s a personal passion that fuels much of my curiosity. This year, I also found myself drawn to country music, discovering its ability to tell heartfelt and compelling stories. These selections aren&#8217;t necessarily new releases from 2024, but they&#8217;re the ones that made a lasting impact on me. I hope you enjoy this list and perhaps find a few recommendations that spark your own interest.</p><ul><li><p><strong>Favorite Songs (10)</strong>: <a href="https://open.spotify.com/playlist/03Ae4fyAIW14z02u54WfMw?si=68af2ca0aabc4689">Spotify Playlist</a></p><ul><li><p>Tennessee Whiskey - Chris Stapleton</p></li><li><p>Eye Clear - Victor AD, Bella Shmurda</p></li><li><p>Wonderwall - Oasis</p></li><li><p>Tshwala Bam - TitoM, Yuppe, S.N.E, EeQue</p></li><li><p>Tell Somebody - Young Fathers</p></li><li><p>Talladega - Eric Church</p></li><li><p>January 9th - Black Sherif</p></li><li><p>Where the Wild Things Are - Luke Combs</p></li><li><p>Unonzani? - SunniChi</p></li><li><p>Learning to Fly - Tom Petty and The Heartbreakers</p></li></ul></li><li><p><strong>Favorite Albums (10)</strong></p><ul><li><p><a href="https://open.spotify.com/album/18NOKLkZETa4sWwLMIm0UZ?si=eVKM71VjRAyihuyQiAPT1w">Utopia</a> - Travis Scott (2023)</p></li><li><p><a href="https://open.spotify.com/album/4mAhdh996uW5SnnFKXUmC0?si=dhQZUS20Rvu55wqvkDE11g">Random Access Memories (10th Anniversary Edition)</a> - Daft Punk (2023)</p></li><li><p><a href="https://open.spotify.com/album/6BzxX6zkDsYKFJ04ziU5xQ?si=V5B4--evSemIN4qem7TIOw">Cowboy Carter</a> - Beyonc&#233; (2024)</p></li><li><p><a href="https://open.spotify.com/track/6f49kbOuQSOsStBpyGvQfA?si=6924cb64e5aa4ea4">A Head Full of Dreams</a> - Coldplay (2015)</p></li><li><p><a href="https://open.spotify.com/album/6vVOpqIXPbM9vZWzesdTax?si=OLer9SQXRQOxr1t-AB_TxQ">Ultra 85</a> - Logic (2024)</p></li><li><p><a href="https://open.spotify.com/album/4BbsHmXEghoPPevQjPnHXx?si=dfyFr3STQUu0k1HqZsyIKw">F-1 Trillion</a> - Post Malone (2024)</p></li><li><p><a href="https://open.spotify.com/album/1U0Z7QjSzlg3gMeUOuUldz?si=XydKtccwT-uN2hKdvNH_ZA">The Great American Bar Scene</a> - Zach Bryan (2024)</p></li><li><p><a href="https://open.spotify.com/album/0mxle2p72zngkE9p4KAE0A?si=zrJXmD6tQ0CH_qPEJDkMAA">adedamola</a> - Fireboy (2024)</p></li><li><p><a href="https://open.spotify.com/album/1Mhn9VosyjtWn4dMPFlna6?si=5D08EX2CQJSTetcH-GyKQw">The Stranger (Legacy Edition)</a> - Billy Joel (1977)</p></li><li><p><a href="https://open.spotify.com/album/5dhb5ZpYSm2gH8OCxAKTn1?si=Rm6fvCYoQYWwSkL6DJ2OfA">MICHEAL (Deluxe)</a> - Killer Mike (2023)</p></li></ul></li><li><p><strong>Favorite Movies (5)</strong></p><ul><li><p><a href="https://www.imdb.com/title/tt1684562/">The Fall Guy</a> (2024): A comedy starring Ryan Gosling and Emily Blunt, offering a behind-the-scenes look at the stunt performers who make blockbuster movies possible. The theme song, <a href="https://open.spotify.com/track/38VwdKSfQLDLR1UvA6piCX?si=0730d994fc004e2c">Unknown Stuntman</a> by Blake Shelton is a gem.</p></li><li><p><a href="https://www.rottentomatoes.com/m/hit_man_2023">Hit Man</a> (2023): Glen Powell and Adria Arjona shine in this film based on the true story of a college professor working with the Houston police in the 1990s as a fake hitman to <a href="https://www.biography.com/movies-tv/a60991423/is-hit-man-based-on-a-true-story">help prosecute murder solicitation cases</a>.</p></li><li><p><a href="https://www.imdb.com/title/tt4669788/">On The Basis of Sex</a> (2018): A moving portrayal of Ruth Bader Ginsburg&#8217;s groundbreaking fight against sex-based discrimination in the 1970s.</p></li><li><p><a href="https://www.imdb.com/title/tt5177120/">The Ministry of Ungentlemanly Warfare</a> (2024): A hilarious Guy Ritchie film that tells the story of elite soldiers executing a covert strike against German forces in Africa during World War II.</p></li><li><p><a href="https://www.imdb.com/title/tt29623480/">The Wild Robot</a> (2024): A heartwarming animated adaptation of <a href="https://en.wikipedia.org/wiki/Peter_Brown_(illustrator)">Peter Brown&#8217;s</a> novel, following Roz, a robot stranded on a remote island, as she learns to survive and connect with the world around her.</p></li></ul></li></ul><p>Honorable movie mention goes to <a href="https://www.imdb.com/title/tt24458622/">The Six Triple Eight</a> (2024). Released toward the end of the year, this compelling and inspiring film tells the story of the Black women in the Women&#8217;s Army Corps who played a crucial role in ensuring timely mail delivery during World War II. Their perseverance and dedication in the face of adversity make this a powerful and unforgettable tribute to their contributions.</p><ul><li><p><strong>Favorite Books (10)</strong></p><ul><li><p><a href="https://press.stripe.com/poor-charlies-almanack">Poor Charlie&#8217;s Almanack: The Essential Wit and Wisdom of Charles T. Munger</a> - Peter D. Kaufman</p></li><li><p><a href="https://a.co/d/5Sf5S8a">The Field Guide to Understanding &#8216;Human Error&#8217;</a> - Sidney Dekker</p></li><li><p><a href="https://a.co/d/doxUgEX">The Value of Others: Understanding the Economic Model of Relationships to Get (and Keep) More of What You Want in the Sexual Marketplace</a> - Orion Taraban (This controversial and politically incorrect book offers bold insights into relationships and human behavior. While divisive, it made the list for the intriguing perspectives it brings to the table).</p></li><li><p><a href="https://a.co/d/27txX75">Flyboys: A True Story of Courage</a> - James Bradley</p></li><li><p><a href="https://a.co/d/1vEqaoP">Slow Productivity: The Lost Art of Accomplishment Without Burnout</a> - Cal Newport</p></li><li><p><a href="https://a.co/d/1Su1b1M">The Art of Racing in the Rain: A Novel</a> - Garth Stein</p></li><li><p><a href="https://www.goodreads.com/book/show/12158480-why-nations-fail">Why Nations Fails</a> - Daron Acemo&#287;lu, James A. Robinson</p></li><li><p><a href="https://www.goodreads.com/book/show/4442.The_Road_Less_Traveled_Beyond">The Road Less Traveled and Beyond: Spiritual Growth in an Age of Anxiety</a> - M. Scott Peck</p></li><li><p><a href="https://a.co/d/bPCl4wK">Never Split the Difference: Negotiating As If Your Life Depended On It</a> - Chris Voss with Tahl Raz</p></li><li><p><a href="https://a.co/d/0R4VALr">How to Lie with Statistics</a> - Darrell Huff, Irving Geis</p></li></ul></li></ul><p>Honorable book mentions go to <em><a href="https://a.co/d/8wJ1Lh6">How to Build a Car: The Autobiography of the World&#8217;s Greatest Formula 1 Designer</a></em> by Adrian Newey, <em><a href="https://a.co/d/12b6OIt">Surely You&#8217;re Joking, Mr. Feynman! (Adventures of a Curious Character)</a></em> by Richard Feynman, <em><a href="https://a.co/d/3tb0UX0">Deep Work: Rules for Focused Success in a Distracted World</a></em> by Cal Newport, and <em><a href="https://a.co/d/dd90Mz5">Stolen Focus: Why You Can&#8217;t Pay Attention&#8212;and How to Think Deeply Again</a></em> by Johann Hari. While these weren&#8217;t first-time reads for me in 2024, I found myself returning to them throughout the year for their compelling insights.</p><p>A more controversial mention is Henry Ford&#8217;s <em><a href="https://a.co/d/hp4kylw">My Life and Work</a></em>. The book offers fascinating insights into Ford&#8217;s business philosophy and the strategies that built one of history&#8217;s most iconic automobile companies. However, its ideas are undeniably dated in many areas, and it takes a problematic turn with overt antisemitism. This led me to explore Ford&#8217;s troubling history regarding antisemitism, segregation, and his opposition to unions. <a href="https://www.history.com/news/henry-ford-antisemitism-worker-treatment">You can read more here</a>. While the book contains valuable lessons, I recommend approaching it critically, applying only its timeless principles while acknowledging its serious flaws.</p><p>Finally, my standout non-book mention goes to my <em><a href="https://a.co/d/8mISu64">Amazon Kindle Paperwhite Signature Edition (32 GB)</a></em>. Gifted to me for my birthday, it&#8217;s easily the best present I&#8217;ve ever received. Lightweight with a battery that seems to last forever, it has been my go-to for reading and listening to audiobooks without distractions. I can&#8217;t recommend it enough.</p><ul><li><p><strong>Favorite TV Shows (5)</strong></p><ul><li><p><a href="https://www.imdb.com/title/tt2640044/">Masters of the Air</a> (2024)</p></li><li><p><a href="https://www.imdb.com/title/tt0185906/">Band of Brothers</a> (2001) - I&#8217;ll consider this the best TV show I have ever seen.</p></li><li><p><a href="https://www.imdb.com/title/tt2442560/">Peaky Blinders</a> (2013 - 2022) - Still watching</p></li><li><p><a href="https://www.imdb.com/title/tt0455275/">Prison Break</a> (2005 - 2017) - Still watching</p></li><li><p><a href="https://www.imdb.com/title/tt0374463/">The Pacific</a> (2010)</p></li></ul></li></ul><p>I&#8217;ll be the first to admit that I&#8217;m not a big TV or movie watcher. These shows stood out to me as compelling stories worth recommending, even though I haven&#8217;t finished a couple of them yet. This list is a great place to start if you&#8217;re into engaging narratives and rich storytelling.</p><ul><li><p><strong>Favorite Documentaries (5)</strong></p><ul><li><p><a href="https://www.imdb.com/title/tt6587094/">Five Came Back</a> (2017)</p></li><li><p><a href="https://www.imdb.com/title/tt32331294/">Hitler and the Nazis: Evil on Trial</a> (2024)</p></li><li><p><a href="https://www.imdb.com/title/tt21837726/">The Redeem Team</a> (2022)</p></li><li><p><a href="https://www.imdb.com/title/tt29333646/">Get Gotti</a> (2023)</p></li><li><p><a href="https://www.imdb.com/title/tt14452572/">Journey of an African Colony: The Making of Nigeria</a> (2019)</p></li></ul></li><li><p><strong>Favorite Podcasts (5)</strong></p><ul><li><p><a href="https://open.spotify.com/show/4rOoJ6Egrf8K2IrywzwOMk?si=b01fad49a089442b">The Joe Rogan Experience</a> - Joe Rogan</p></li><li><p><a href="https://open.spotify.com/show/7Fj0XEuUQLUqoMZQdsLXqp?si=98f6780e8e4749e5">Acquired</a> - Ben Gilbert and David Rosenthal</p></li><li><p><a href="https://open.spotify.com/show/0e9lFr3AdJByoBpM6tAbxD?si=c45d3885f540451c">Deep Questions with Cal Newport</a> - Cal Newport</p></li><li><p><a href="https://open.spotify.com/show/3oB5noYIwEB2dMAREj2F7S?si=0dbd932577bd4849">The Ezra Klein Show</a> - Ezra Klein</p></li><li><p><a href="https://open.spotify.com/show/7uhrWlDvxzy9hLoW0EYf0b?si=1a4f7dd9e8794587">Patrick Boyle: On Finance</a> - Patrick Boyle</p></li></ul></li><li><p><strong>Favorite Instrumentals (5)</strong>: <a href="https://open.spotify.com/playlist/12MiTt6GKJFJyYEucn8yTy?si=b16e303a2a49432f">Spotify Playlist</a></p><ul><li><p>This Is It - Blake Neely (Soundtrack, Masters of the Air)</p></li><li><p>Soar (Main Title Theme from &#8216;Masters of the Air&#8217;) - Blake Neely (Soundtrack, Masters of the Air)</p></li><li><p>What I Know - Adrian Walter</p></li><li><p>Main Titles (You&#8217;ve Been Called Back to Top Gun) - Harold Faltermeyer, Lady Gaga, Hans Zimmer, Lorne Balfe (Soundtrack, Top Gun: Maverick)</p></li><li><p>Main Titles from the HBO Miniseries Band of Brothers - London Metropolitan Orchestra, Michael Kamen (Soundtrack, Band of Brothers)</p></li></ul></li><li><p><strong>Favorite Apps (5)</strong></p><ul><li><p><a href="https://ticktick.com/">TickTick</a> - Tasks, todo list, and schedule management</p></li><li><p><a href="https://www.monarchmoney.com/">Monarch Money</a> - Budgeting, planning, and financial management</p></li><li><p><a href="https://cronometer.com/">Cronometer</a> - Nutrition tracking</p></li><li><p><a href="https://stronglifts.com/">StrongLifts</a> - Weighlifting and tracking for the Stronglifts 5 by 5 program</p></li><li><p><a href="https://readup.org/">Readup</a> - Read interesting articles</p></li></ul></li></ul><h2>What am I Looking Forward to in 2025</h2><p>As 2025 approaches, I&#8217;ve been mulling over several goals. I&#8217;ve already mentioned some; I&#8217;m still fine-tuning others to ensure they&#8217;re realistic and meaningful. I aim to dedicate more time to deep, focused work, learning, and personal projects. I desire to read at least 24 books (two per month), become a more effective communicator and storyteller, build consistent habits aligned with my aspirations, and maintain a sense of optimism&#8212;living with a positive mindset, laughter and a smile, even when challenges arise. Physically, I plan to focus on hypertrophy training and light running early in the year, shifting toward heavy running and training for a half-marathon personal record in the fall.</p><p>But enough about me&#8212;2025 promises to bring plenty of exciting things. Here&#8217;s what I&#8217;m most looking forward to:</p><ul><li><p><strong>Books</strong></p><ul><li><p><a href="https://sites.prh.com/sourcecodebybillgates?ref=PRH00C389225AD2&amp;aid=48303&amp;linkid=PRH00C389225AD2">Source Code</a> by <strong>Bill Gates</strong>: A personal account of Gates&#8217; childhood, early passions, and the experiences that shaped him into a transformative leader.</p></li><li><p><a href="https://www.penguinrandomhouse.com/books/786139/hope-by-pope-francis/">Hope: The Autobiography</a> by <strong>Pope Francis</strong>: Tracing the Pope&#8217;s journey from his roots in Italy to his profound impact on the world today.</p></li><li><p><a href="https://a.co/d/9mhQXja">Changing My Mind</a> by <strong>Julian Barnes</strong>: Exploring what it takes to change our minds, challenging assumptions and exploring the science and art behind such transformations.</p></li><li><p><a href="https://a.co/d/9GUnbzi">Dream Count: A Novel</a> by <strong>Chimamanda Ngozi Adichie</strong>: A compelling story about four women navigating love, longing, and pain. Adichie&#8217;s storytelling mastery makes this a highly anticipated read.</p></li><li><p><a href="https://a.co/d/iPUfzHX">An Untitled Memoir</a> by the &#8220;All Night Long&#8221; singer, <strong>Lionel Richie</strong>: The legendary singer recounts his life, from growing up in Alabama to becoming a global music icon.</p></li><li><p><a href="https://books.google.com/books/about/This_is_For_Everyone.html?id=hXwpEQAAQBAJ">This is For Everyone</a> by <strong>Tim Berners-Lee</strong>. In my recent blog post about URL Encoding, I wrote briefly about Berners-Lee and his work creating the World Wide Web, HTTP, HTML, and URLs, which form the foundation of our current digital and communication landscape. In this book, the inventor of the World Wide Web tells the story of his groundbreaking invention and its global impact.</p></li><li><p><a href="https://amzn.asia/d/5ULlmK2">1929: Inside the Crash</a> by <strong>Andrew Ross Sorkin</strong>: A meticulously researched account of Wall Street&#8217;s most severe crash and the ensuing Great Depression.</p></li><li><p><a href="https://a.co/d/6YNVPSE">The Next Day: Transitions, Change, and Moving Forward</a> by <strong>Melinda French Gates</strong>: A rare glimpse into pivotal moments in Gates&#8217; life and the lessons she&#8217;s learned.</p></li><li><p><a href="https://a.co/d/68VVGpk">Matriarch: A Memoir</a> by <strong>Tina Knowles</strong>: Beyonc&#233; and Solange&#8217;s mother shares her journey, highlighting the power of Black motherhood and resilience.</p></li></ul></li><li><p><strong>Movies</strong></p><ul><li><p><a href="https://www.imdb.com/title/tt9603208/">Mission: Impossible - The Final Reckoning</a></p></li><li><p><a href="https://www.imdb.com/title/tt1757678/">Avatar: Fire and Ash</a></p></li><li><p><a href="https://www.imdb.com/title/tt16311594/">F1</a></p></li><li><p><a href="https://www.imdb.com/title/tt11378946/">Michael</a></p></li><li><p><a href="https://www.imdb.com/title/tt31036941/">Jurassic World Rebirth</a></p></li><li><p><a href="https://www.imdb.com/title/tt10365912/">Becoming Led Zeppelin</a></p></li><li><p><a href="https://www.imdb.com/title/tt5822536/">Paddington in Peru</a></p></li></ul></li><li><p><strong>Music</strong></p><ul><li><p><a href="https://www.billboard.com/music/music-news/davido-5ive-album-announcement-funds-single-odumodublvck-chike-1235846033/">5ive</a> by Davido (March 14, 2025)</p></li><li><p><a href="https://www.billboard.com/music/music-news/burna-boy-no-sign-of-weakness-album-announcement-bundle-by-bundle-single-1235859561/">No Sign of Weakness</a> by Burna Boy</p></li><li><p>Possible new music from Cardi B and Rihanna</p></li><li><p>A hopeful release of J. Cole&#8217;s long-anticipated <a href="https://www.xxlmag.com/j-cole-the-fall-off-album-details/">The Fall Off</a></p></li></ul></li><li><p><strong>Video Games</strong></p></li></ul><p>I&#8217;m incredibly excited for <a href="https://store.playstation.com/en-us/concept/10005449">Split Fiction</a> by <a href="https://www.hazelight.se/">Hazelight Studio</a> (March 6, 2025), a co-op game following two writers trapped in their own stories. As a fan of story-driven adventure games, I also hope for more news about Naughty Dog&#8217;s <a href="https://www.naughtydog.com/blog/intergalactic_the_heretic_prophet_announcement">Intergalactic</a>.</p><ul><li><p><strong>Other Goals</strong></p></li></ul><p>In addition to the exciting releases and plans already mentioned, I have a few broader goals for 2025. I aim to deepen my cybersecurity knowledge and cultivate technical skills and expertise that align with my interests and aspirations in business, leadership, and entrepreneurship. On a personal level, I want to focus on building more profound, meaningful relationships and continuing to improve my emotional intelligence and resilience.</p><p>When it comes to reading, I&#8217;m looking forward to delving into timeless works like <a href="https://a.co/d/9c5X5NL">Mere Christianity</a> by C. S. Lewis&#8212;purely for the joy of it&#8212;and revisiting classics like <a href="https://a.co/d/jiiPAbe">A Farewell to Arms</a> by <a href="https://www.imdb.com/name/nm0002133/">Ernest Hemingway</a>. I also plan to explore books like <a href="https://a.co/d/8gxFXHN">Hit Refresh</a> by <a href="https://news.microsoft.com/exec/satya-nadella/">Satya Nadella</a>, among others that I&#8217;ll undoubtedly discover as the year unfolds. Depending on what captivates me, I&#8217;ll share more about these in my reflections at the end of 2025.</p><p>Another area of interest is the blog <a href="https://hardcoresoftware.learningbyshipping.com/">Hardcore Software: Learning by Shipping</a> by <a href="https://www.linkedin.com/in/sinofsky/">Steven Sinofsky</a>. Sinofsky&#8217;s insights into the challenges and triumphs of leading massive software projects&#8212;like Microsoft Office, Windows 7, and Windows 8&#8212;are invaluable for anyone striving to set ambitious goals and execute them effectively. I hope to glean valuable lessons for shipping products on time and achieving ambitious outcomes.</p><p>As the year progresses, I look forward to discovering new books, projects, and experiences that inspire growth, spark creativity, and enrich my understanding of the world.</p><h2>Closing</h2><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Q06c!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6072e413-b47c-4511-96ff-7450c6786589_289x430.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Q06c!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6072e413-b47c-4511-96ff-7450c6786589_289x430.png 424w, https://substackcdn.com/image/fetch/$s_!Q06c!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6072e413-b47c-4511-96ff-7450c6786589_289x430.png 848w, https://substackcdn.com/image/fetch/$s_!Q06c!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6072e413-b47c-4511-96ff-7450c6786589_289x430.png 1272w, https://substackcdn.com/image/fetch/$s_!Q06c!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6072e413-b47c-4511-96ff-7450c6786589_289x430.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Q06c!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6072e413-b47c-4511-96ff-7450c6786589_289x430.png" width="289" height="430" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/6072e413-b47c-4511-96ff-7450c6786589_289x430.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:430,&quot;width&quot;:289,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Thank You&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Thank You" title="Thank You" srcset="https://substackcdn.com/image/fetch/$s_!Q06c!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6072e413-b47c-4511-96ff-7450c6786589_289x430.png 424w, https://substackcdn.com/image/fetch/$s_!Q06c!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6072e413-b47c-4511-96ff-7450c6786589_289x430.png 848w, https://substackcdn.com/image/fetch/$s_!Q06c!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6072e413-b47c-4511-96ff-7450c6786589_289x430.png 1272w, https://substackcdn.com/image/fetch/$s_!Q06c!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6072e413-b47c-4511-96ff-7450c6786589_289x430.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>2024 was a year of adventure, growth, and unforgettable memories. I&#8217;m grateful for the incredible people&#8212;friends, family, colleagues, and teammates&#8212;who made it all possible. Thank you, the reader, for taking the time to walk through my reflections. Here&#8217;s to a fantastic 2025 filled with joy, success, and Oscar-worthy moments. Godspeed.</p>]]></content:encoded></item><item><title><![CDATA[URL (or Percent) Encoding]]></title><description><![CDATA[Why URLs Speak in Code]]></description><link>https://notebook.mubbie.dev/p/url-or-percent-encoding</link><guid isPermaLink="false">https://notebook.mubbie.dev/p/url-or-percent-encoding</guid><dc:creator><![CDATA[Mubarak Idoko]]></dc:creator><pubDate>Fri, 27 Dec 2024 23:30:59 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/f17831fd-0fc8-4df2-9336-7a4d0ad0f9ca_1315x536.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!hoTp!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa0f05932-e426-43b7-ad3a-e3811b4a2037_658x268.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!hoTp!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa0f05932-e426-43b7-ad3a-e3811b4a2037_658x268.png 424w, https://substackcdn.com/image/fetch/$s_!hoTp!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa0f05932-e426-43b7-ad3a-e3811b4a2037_658x268.png 848w, https://substackcdn.com/image/fetch/$s_!hoTp!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa0f05932-e426-43b7-ad3a-e3811b4a2037_658x268.png 1272w, https://substackcdn.com/image/fetch/$s_!hoTp!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa0f05932-e426-43b7-ad3a-e3811b4a2037_658x268.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!hoTp!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa0f05932-e426-43b7-ad3a-e3811b4a2037_658x268.png" width="658" height="268" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a0f05932-e426-43b7-ad3a-e3811b4a2037_658x268.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:268,&quot;width&quot;:658,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Pooh Recursion&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Pooh Recursion" title="Pooh Recursion" srcset="https://substackcdn.com/image/fetch/$s_!hoTp!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa0f05932-e426-43b7-ad3a-e3811b4a2037_658x268.png 424w, https://substackcdn.com/image/fetch/$s_!hoTp!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa0f05932-e426-43b7-ad3a-e3811b4a2037_658x268.png 848w, https://substackcdn.com/image/fetch/$s_!hoTp!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa0f05932-e426-43b7-ad3a-e3811b4a2037_658x268.png 1272w, https://substackcdn.com/image/fetch/$s_!hoTp!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa0f05932-e426-43b7-ad3a-e3811b4a2037_658x268.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Image Source: <a href="https://xkcd.com/1700/">XKCD</a></em></p><h1>Introduction</h1><p>Have you ever clicked on a link or typed a web address only to see something strange in the URL? Maybe it looked like this:</p><pre><code><code>https://internet.com/explore/search?query=what+is+a+good+application+of+N%C3%A4ive+Bayes+in+deep+learning
</code></code></pre><p>when your search query was: <code>what is a good application of N&#228;ive Bayes in deep learning</code>. Or perhaps you encountered something like this:</p><pre><code><code>https://internet.com/travel/hotels/courtyard%20by%20marriot%20D%C3%BCsseldorf</code></code></pre><p>when you were looking for Marriot hotels in <a href="https://www.visitduesseldorf.de/en">D&#252;sseldorf, Germany</a>.</p><p>What are all those <code>%</code> signs and numbers? Are they some kind of secret code? In this blog post, we&#8217;re going to unravel the mystery behind these symbols and take a deep dive into URL encoding, ASCII, and the fascinating story of URLs themselves.</p><h2>What are URLs?</h2><p>A <a href="https://youtu.be/nLYlurfEDSI?si=rfE66BMSYoGhrxa7">URL (Uniform Resource Locator)</a> is the cornerstone of how we navigate the web. Simply put, a URL is an address that tells your browser where to find a specific resource, such as a webpage, an image, or a file. You can think of it as a digital version of a friend&#8217;s home address&#8212;it ensures that when you need something from your friend, you know precisely where to go to receive the article reliably.</p><p>A typical URL would look something like this:</p><pre><code><code>https://www.internet.com:8080/path/to/resource?query=parameter#fragment
</code></code></pre><p>Here&#8217;s the breakdown:</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!tbmQ!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8b570f8c-b779-4bf6-a592-26af2fc0d51c_1068x100.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!tbmQ!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8b570f8c-b779-4bf6-a592-26af2fc0d51c_1068x100.png 424w, https://substackcdn.com/image/fetch/$s_!tbmQ!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8b570f8c-b779-4bf6-a592-26af2fc0d51c_1068x100.png 848w, https://substackcdn.com/image/fetch/$s_!tbmQ!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8b570f8c-b779-4bf6-a592-26af2fc0d51c_1068x100.png 1272w, https://substackcdn.com/image/fetch/$s_!tbmQ!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8b570f8c-b779-4bf6-a592-26af2fc0d51c_1068x100.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!tbmQ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8b570f8c-b779-4bf6-a592-26af2fc0d51c_1068x100.png" width="1068" height="100" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/8b570f8c-b779-4bf6-a592-26af2fc0d51c_1068x100.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:100,&quot;width&quot;:1068,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:13197,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!tbmQ!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8b570f8c-b779-4bf6-a592-26af2fc0d51c_1068x100.png 424w, https://substackcdn.com/image/fetch/$s_!tbmQ!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8b570f8c-b779-4bf6-a592-26af2fc0d51c_1068x100.png 848w, https://substackcdn.com/image/fetch/$s_!tbmQ!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8b570f8c-b779-4bf6-a592-26af2fc0d51c_1068x100.png 1272w, https://substackcdn.com/image/fetch/$s_!tbmQ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8b570f8c-b779-4bf6-a592-26af2fc0d51c_1068x100.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p><em>Image Source: <a href="https://en.wikipedia.org/wiki/File:URI_syntax_diagram.svg">Wikipedia</a></em></p><ul><li><p><strong>Protocol/URI Scheme</strong>(<code>https://</code>): Specifies how your browser should communicate with the internet server. Common protocols include <code>http</code>/<code>https</code> (secure <code>http</code>), <code>ftp</code> (file transfer), <code>mailto</code> (email address) and more. While network protocols are not the focus of this blog post, you can learn more about them in these articles: <a href="https://www.geeksforgeeks.org/types-of-network-protocols-and-their-uses/">Types of Network Protocols and Their Uses</a>, <a href="https://www.cloudflare.com/learning/network-layer/what-is-a-protocol/">What is a network protocol?</a>, <a href="https://www.iana.org/assignments/uri-schemes/uri-schemes.xhtml">Uniform Resource Identifier (URI) Schemes</a></p></li><li><p><strong>Domain</strong>(<code>www.internet.com</code>): Identifies the server hosting the internet resource. This is typically a human-readable name that maps to an IP address via DNS (Domain Name System). For a given domain, you can easily look up the corresponding IP address in DNS. For instance, on my local machine, I can use the <code>host</code> command or the <code>nslookup</code> utility to take a look at the IP addresses for Google servers. Public tools like <a href="https://dnschecker.org/">DNS Checker</a> and <a href="https://mxtoolbox.com/SuperTool.aspx">MX Toolbox</a> are also handy for peeking at DNS records for domains.</p></li><li><p><strong>Port</strong>(<code>:8080</code>): Optional and specifies which port the server should use. The default for <code>http</code> is 80, and for <code>https</code> it&#8217;s 443. Other port numbers and the corresponding protocols are <code>21</code> for <code>ftp</code>, and <code>22</code> for <code>ssh</code>, etc. The port essentially specifies which application or service on a server to connect to via the URL. If the URL is your friend&#8217;s home address, the port number can be thought of as your friend&#8217;s room.</p></li><li><p><strong>Path</strong>(<code>/path/to/resource</code>): Indicates the specific location of the resource on the server. It&#8217;s like the folders and files on your computer.</p></li><li><p><strong><a href="https://www.branch.io/glossary/query-parameters/">Query</a></strong><a href="https://www.branch.io/glossary/query-parameters/">(</a><code>?query=parameter</code><a href="https://www.branch.io/glossary/query-parameters/">)</a>: A set of key-value pairs used to pass information to the server. For example, a search query when we want to learn about N&#228;ive Bayes or a user&#8217;s preferences when making a request from the server.</p></li><li><p><strong><a href="https://medium.com/@dhanukasn/understanding-query-parameters-and-uri-fragments-in-urls-f6c52034b634">Fragment</a></strong><a href="https://medium.com/@dhanukasn/understanding-query-parameters-and-uri-fragments-in-urls-f6c52034b634">(</a><code>#fragment</code><a href="https://medium.com/@dhanukasn/understanding-query-parameters-and-uri-fragments-in-urls-f6c52034b634">)</a>: Refers to a specific section within the resource. For instance, it could be specific lines in a text file, a particular section or a bookmark on a webpage.</p></li></ul><h2>Where Did URLs Come From?</h2><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!aAhF!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc7da5861-593d-4aa8-8082-11156abe3ee1_1615x1036.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!aAhF!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc7da5861-593d-4aa8-8082-11156abe3ee1_1615x1036.jpeg 424w, https://substackcdn.com/image/fetch/$s_!aAhF!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc7da5861-593d-4aa8-8082-11156abe3ee1_1615x1036.jpeg 848w, https://substackcdn.com/image/fetch/$s_!aAhF!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc7da5861-593d-4aa8-8082-11156abe3ee1_1615x1036.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!aAhF!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc7da5861-593d-4aa8-8082-11156abe3ee1_1615x1036.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!aAhF!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc7da5861-593d-4aa8-8082-11156abe3ee1_1615x1036.jpeg" width="1456" height="934" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/c7da5861-593d-4aa8-8082-11156abe3ee1_1615x1036.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:934,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:197229,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!aAhF!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc7da5861-593d-4aa8-8082-11156abe3ee1_1615x1036.jpeg 424w, https://substackcdn.com/image/fetch/$s_!aAhF!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc7da5861-593d-4aa8-8082-11156abe3ee1_1615x1036.jpeg 848w, https://substackcdn.com/image/fetch/$s_!aAhF!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc7da5861-593d-4aa8-8082-11156abe3ee1_1615x1036.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!aAhF!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc7da5861-593d-4aa8-8082-11156abe3ee1_1615x1036.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Image Source: <a href="https://www.home.cern/science/computing/birth-web">CERN</a></em></p><p>In 1992, <a href="https://www.w3.org/People/Berners-Lee/">Tim Berners-Lee</a> introduced the concept of URLs alongside the HTTP protocol and HTML as a way for researchers to share and access documents easily.</p><p>Berners-Lee has already proposed the ideas of the <a href="https://www.w3.org/History/1989/proposal.html">World Wide Web</a>. However, for this network to function, it needed a standardized way to identify and locate resources. To address this need, he proposed the idea of the <a href="http://1997.webhistory.org/www.lists/www-talk.1991/0018.html">URL</a> to serve as a &#8220;document identifier.&#8221; The URL became one of the three core components of the web, alongside <strong>HTML</strong> (for structuring documents) and <strong>HTTP</strong> (for transferring them).</p><p>Initially, URLs were simple and primarily used to point to static files hosted on servers. <a href="https://blog.cloudflare.com/the-history-of-the-url/">Over time</a>, they evolved alongside the web into a versatile system supporting dynamic content, user input, and even encrypted communication. Throughout this evolution, the central principle of universality&#8212;the idea that URLs should work on any device and in any context&#8212;has stood the test of time.</p><h2>ASCII and Its Role in URL Encoding</h2><p>To understand the &#8220;strange&#8221; encodings we see in URLs, we need to look back at the history of <a href="https://www.britannica.com/topic/ASCII">ASCII</a>. The American Standard Code for Information Interchange (ASCII) was developed in the <a href="https://www.ascii-code.com/timeline">1960s</a> as a standardized way for computers to represent text characters. Before ASCII, there were numerous incompatible encoding systems, which made it challenging for different systems to communicate. ASCII changed that by providing a universal 7-bit character set, which could represent 128 unique characters.</p><p>This <a href="https://www.ascii-code.com/">128-character set</a> included:</p><ul><li><p><strong>Printable characters:</strong> Uppercase (<code>A-Z</code>), lowercase (<code>a-z</code>), digits (<code>0-9</code>), and symbols like <code>@</code>, <code>#</code>, and <code>$</code>, etc.</p></li><li><p><strong>Control characters:</strong> Instructions for managing text streams, such as newline (<code>\n</code>) and tab (<code>\t</code>).</p></li></ul><p>ASCII&#8217;s simplicity and universality made it the foundation for early computer systems and networks, including the internet. However, its biggest limitation was its inability to represent non-English characters, like <code>&#233;</code>, <code>&#223;</code>, or <code>&#20013;</code>, as well as other writing systems like Cyrillic, Arabic, and Chinese. The biggest reason for this limitation is because, at the time it was invented, memory and processing power were incredibly expensive; hence, every bit mattered. By sticking to 7-bits and, thus, 128 characters,&nbsp;<a href="https://randomtechnicalstuff.blogspot.com/2009/05/unicode-and-oracle.html">ASCII struck a balance between functionality and efficiency</a>. It was small enough to fit into the limited storage and memory of the time yet comprehensive enough to provide a range of characters to work with. Likewise, it was a light-weight, simple, easy-to-implement solution and universal (at least for English-speaking developers).</p><h3>Expanded Character Sets (Beyond ASCII)</h3><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!wdhc!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3a55cc06-6a60-41f6-a027-e0cb8c89b2e6_500x283.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!wdhc!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3a55cc06-6a60-41f6-a027-e0cb8c89b2e6_500x283.png 424w, https://substackcdn.com/image/fetch/$s_!wdhc!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3a55cc06-6a60-41f6-a027-e0cb8c89b2e6_500x283.png 848w, https://substackcdn.com/image/fetch/$s_!wdhc!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3a55cc06-6a60-41f6-a027-e0cb8c89b2e6_500x283.png 1272w, https://substackcdn.com/image/fetch/$s_!wdhc!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3a55cc06-6a60-41f6-a027-e0cb8c89b2e6_500x283.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!wdhc!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3a55cc06-6a60-41f6-a027-e0cb8c89b2e6_500x283.png" width="500" height="283" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/3a55cc06-6a60-41f6-a027-e0cb8c89b2e6_500x283.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:283,&quot;width&quot;:500,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Standards&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Standards" title="Standards" srcset="https://substackcdn.com/image/fetch/$s_!wdhc!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3a55cc06-6a60-41f6-a027-e0cb8c89b2e6_500x283.png 424w, https://substackcdn.com/image/fetch/$s_!wdhc!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3a55cc06-6a60-41f6-a027-e0cb8c89b2e6_500x283.png 848w, https://substackcdn.com/image/fetch/$s_!wdhc!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3a55cc06-6a60-41f6-a027-e0cb8c89b2e6_500x283.png 1272w, https://substackcdn.com/image/fetch/$s_!wdhc!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3a55cc06-6a60-41f6-a027-e0cb8c89b2e6_500x283.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Image Source: <a href="https://xkcd.com/1700/">XKCD</a></em></p><p>As the internet connected the world, the need for a broader character set became apparent. This led to the development of <a href="https://www.translationroyale.com/the-history-of-unicode/">Unicode</a>, which could represent virtually every character in <a href="https://youtu.be/MijmeoH9LT4?feature=shared">every language</a>. <a href="https://home.unicode.org/">Unicode</a> works with <a href="https://youtu.be/GMF2Z1EZHXk?si=5Q2JBozHR_LY3UAJ">multiple encodings</a>, such as UTF-8, UTF-16, and UTF-32 (You can read more about them here: <a href="https://javarevisited.blogspot.com/2015/02/difference-between-utf-8-utf-16-and-utf.html">Difference between UTF-8, UTF-16 and UTF-32 Character Encoding? Example</a>)</p><p><strong>UTF-8</strong> is the most widely used encoding on the web today. It is backwards-compatible with ASCII, meaning that all ASCII characters retain their original binary values, while non-ASCII characters are represented using additional bytes. For example:</p><ul><li><p>The ASCII character <code>A</code> remains <code>01000001</code> in binary under UTF-8.</p></li><li><p>The Unicode character <code>&#233;</code> is represented as <code>11000011 10101001</code> in UTF-8.</p></li></ul><p>Despite Unicode&#8217;s dominance in modern text representation, URLs remain constrained to ASCII due to backward compatibility and simplicity. Early internet protocols, including URLs, were built on ASCII. Changing this foundation would disrupt countless systems and applications.</p><p>To address this, the solution was <strong>percent-encoding</strong>, or <strong>URL encoding</strong>, which allows characters outside the ASCII range to be safely represented in URLs.</p><h2>URL Encoding</h2><p>URL encoding ensures that any character&#8212;whether it&#8217;s <a href="https://www.ietf.org/rfc/rfc1738.txt#:~:text=Other%20characters%20are%20unsafe%20because,be%20encoded%20within%20a%20URL.">unsafe</a>, <a href="https://www.ibm.com/docs/en/cics-ts/6.x?topic=concepts-reserved-excluded-characters">reserved</a>, or <a href="https://rbutterworth.nfshost.com/Tables/compose/">non-ASCII</a>&#8212;can be safely transmitted in a URL. Here&#8217;s how it works:</p><ol><li><p><strong>Identity Characters to Encode:</strong></p><ul><li><p><strong>Reserved Characters:</strong> Characters with special meanings in URLs (e.g., <code>?</code> to start a query string, <code>&amp;</code> to separate parameters, <code>/</code> to separate path components, etc.) must be encoded when used outside their context.</p></li><li><p><strong>Unsafe Characters:</strong> Characters like <code>spaces</code>, <code>&lt;</code>, <code>&gt;</code>, <code>{</code>, <code>}</code>, etc., are unsafe because gateways and transport agents might modify them. Encoding prevents such misinterpretation.</p></li><li><p><strong>Non-ASCII Characters:</strong> These characters, which fall outside the ASCII set, must be encoded for compatibility across systems.</p></li></ul></li><li><p><strong>Convert Characters to Hexadecimal ASCII:</strong></p><ul><li><p>Each character is replaced with a <code>%</code> followed by its two-digit hexadecimal value. (Use this handy <a href="https://www.w3schools.com/tags/ref_urlencode.ASP">URL Encoding Reference</a>) mapping characters to their hexadecimal values.</p></li></ul></li></ol><h3>Details Examples of URL Encoding</h3><p><strong>Reserved/Unsafe Characters in Query Strings</strong></p><pre><code><code>Original: https://internet.com/search?q=C++&amp;C Programming
Encoded:  https://internet.com/search?q=C%2B%2B%26C%20Programming</code></code></pre><p>Here,</p><ul><li><p><code>+</code> becomes <code>%2B</code> (reserved character).</p></li><li><p><code>&amp;</code> becomes <code>%26</code> (reserved character).</p></li><li><p><code>Space</code> (<code> </code>) becomes <code>%20</code> (unsafe character).</p></li></ul><p><strong>Non-ASCII Characters</strong></p><pre><code><code>Original: https://internet.com/profile?name=G&#252;nter Hern&#225;ndez Fran&#231;ois
Encoded:  https://internt.com/profile?name=G%C3%BCnter%20Hern%C3%A1ndez%20Fran%C3%A7ois</code></code></pre><p>In this case,</p><ul><li><p><code>&#252;</code> is encoded as <code>%C3%BC</code>.</p></li><li><p><code>&#225;</code> is encoded as <code>%C3%A1</code>.</p></li><li><p><code>&#231;</code> is encoded as <code>%C3%A7</code>.</p></li><li><p><code>Space</code> is encoded as <code>%20</code>.</p></li></ul><p>Below are examples of encodings for some reserved characters:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!ZvN9!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa5a3b0e1-10b9-4d45-beea-8e689f2057f5_1514x932.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!ZvN9!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa5a3b0e1-10b9-4d45-beea-8e689f2057f5_1514x932.png 424w, https://substackcdn.com/image/fetch/$s_!ZvN9!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa5a3b0e1-10b9-4d45-beea-8e689f2057f5_1514x932.png 848w, https://substackcdn.com/image/fetch/$s_!ZvN9!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa5a3b0e1-10b9-4d45-beea-8e689f2057f5_1514x932.png 1272w, https://substackcdn.com/image/fetch/$s_!ZvN9!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa5a3b0e1-10b9-4d45-beea-8e689f2057f5_1514x932.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!ZvN9!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa5a3b0e1-10b9-4d45-beea-8e689f2057f5_1514x932.png" width="1456" height="896" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a5a3b0e1-10b9-4d45-beea-8e689f2057f5_1514x932.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:896,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:104790,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!ZvN9!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa5a3b0e1-10b9-4d45-beea-8e689f2057f5_1514x932.png 424w, https://substackcdn.com/image/fetch/$s_!ZvN9!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa5a3b0e1-10b9-4d45-beea-8e689f2057f5_1514x932.png 848w, https://substackcdn.com/image/fetch/$s_!ZvN9!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa5a3b0e1-10b9-4d45-beea-8e689f2057f5_1514x932.png 1272w, https://substackcdn.com/image/fetch/$s_!ZvN9!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa5a3b0e1-10b9-4d45-beea-8e689f2057f5_1514x932.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>And correspondingly, for some non-ASCII Unicode characters:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!J2Tb!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F77a992ee-b6b9-4fdd-8423-85ff4752b234_1508x1082.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!J2Tb!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F77a992ee-b6b9-4fdd-8423-85ff4752b234_1508x1082.png 424w, https://substackcdn.com/image/fetch/$s_!J2Tb!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F77a992ee-b6b9-4fdd-8423-85ff4752b234_1508x1082.png 848w, https://substackcdn.com/image/fetch/$s_!J2Tb!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F77a992ee-b6b9-4fdd-8423-85ff4752b234_1508x1082.png 1272w, https://substackcdn.com/image/fetch/$s_!J2Tb!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F77a992ee-b6b9-4fdd-8423-85ff4752b234_1508x1082.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!J2Tb!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F77a992ee-b6b9-4fdd-8423-85ff4752b234_1508x1082.png" width="1456" height="1045" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/77a992ee-b6b9-4fdd-8423-85ff4752b234_1508x1082.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1045,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:172898,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!J2Tb!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F77a992ee-b6b9-4fdd-8423-85ff4752b234_1508x1082.png 424w, https://substackcdn.com/image/fetch/$s_!J2Tb!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F77a992ee-b6b9-4fdd-8423-85ff4752b234_1508x1082.png 848w, https://substackcdn.com/image/fetch/$s_!J2Tb!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F77a992ee-b6b9-4fdd-8423-85ff4752b234_1508x1082.png 1272w, https://substackcdn.com/image/fetch/$s_!J2Tb!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F77a992ee-b6b9-4fdd-8423-85ff4752b234_1508x1082.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h1>Conclusion</h1><p>URL encoding is a critical mechanism that allows URLs to safely transmit a wide range of data while maintaining compatibility with the internet&#8217;s ASCII-based foundation. So, the next time you see <code>%20</code> or <code>%C3%A9</code> in a URL, don&#8217;t panic&#8212;it&#8217;s just the internet&#8217;s way of speaking a language that devices all around the globe can understand.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://notebook.mubbie.dev/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Mubbie's Notebook! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><h2>References</h2><p>While I have cited a handful of sources in this blog post, below are some other resources that I used to write it and that can be useful for your further learning.</p><ul><li><p><a href="https://www.w3schools.com/tags//ref_urlencode.asp">HTML URL Encoding Reference</a></p></li><li><p><a href="https://www.w3schools.com/charsets/ref_html_ascii.asp">HTML ASCII Reference</a></p></li><li><p><a href="https://datatracker.ietf.org/doc/html/rfc3492">Punycode: A Bootstring encoding of Unicode for Internationalized Domain Names in Applications (IDNA)</a></p></li><li><p><a href="https://thehistoryoftheweb.com/history-of-the-url/">What Happens When You Enter a URL In Your Browser of Choice</a></p></li><li><p><a href="https://www.home.cern/science/computing/birth-web">The birth of the Web</a></p></li><li><p><a href="https://datatracker.ietf.org/doc/html/rfc3986">Uniform Resource Identifier (URI): Generic Syntax</a></p></li><li><p><a href="https://docs.mapp.com/docs/url-encoding-and-what-characters-are-valid-in-a-uri">URL Encoding and what characters are valid in a URI</a></p></li><li><p><a href="https://logosconcarne.com/2021/11/15/the-blessing-of-unicode/">The Blessing of Unicode</a></p></li><li><p><a href="https://www.ibm.com/docs/en/cics-ts/6.x?topic=concepts-reserved-excluded-characters">Reserved and excluded characters</a></p></li><li><p><a href="https://www.geeksforgeeks.org/types-of-network-protocols-and-their-uses/">Types of Network Protocols and Their Uses</a></p></li><li><p><a href="https://www.cloudflare.com/learning/network-layer/what-is-a-protocol/">What is a network protocol?</a></p></li><li><p><a href="https://techtarget.com/searchnetworking/definition/URL">What is a URL (Uniform Resource Locator)?</a></p></li><li><p><a href="https://www.ibm.com/docs/en/cics-ts/6.x?topic=concepts-components-url">The components of a URL</a></p></li><li><p><a href="https://www.iana.org/assignments/uri-schemes/uri-schemes.xhtml">Uniform Resource Identifier (URI) Schemes</a></p></li><li><p><a href="https://geeksforgeeks.org/how-domain-name-is-transferred-in-ip-address/">How domain name is transferred in IP address?</a></p></li><li><p><a href="https://www.geeksforgeeks.org/difference-between-domain-name-and-url/">Difference Between Domain Name and URL</a></p></li><li><p><a href="https://hostarmada.com/kb/domain-and-dns/what-is-difference-between-website-domain-url/">What is the difference between a website, domain name and a URL?</a></p></li><li><p><a href="https://www.techtarget.com/searchnetworking/definition/port-number">port number</a></p></li><li><p><a href="https://www.akamai.com/glossary/what-are-ports">What Are Ports?</a></p></li><li><p><a href="https://www.geeksforgeeks.org/difference-between-ip-address-and-port-number/">Difference Between IP Address and Port Number</a></p></li><li><p><a href="https://medium.com/@dhanukasn/understanding-query-parameters-and-uri-fragments-in-urls-f6c52034b634">Query Parameters and URI Fragments in URLs</a></p></li><li><p><a href="https://blog.cloudflare.com/the-history-of-the-url/">The History of the URL</a></p></li><li><p><a href="http://1997.webhistory.org/www.lists/www-talk.1991/0018.html">Document identifiers</a></p></li><li><p><a href="https://www.rfc-editor.org/rfc/rfc805.txt">Computer Mail Meeting Notes</a></p></li><li><p><a href="https://www.welcometothejungle.com/en/articles/btc-url-internet">How The URL Was Built</a></p></li><li><p><a href="https://w3.org/History/1989/proposal.html">Information Management: A Proposal</a></p></li><li><p><a href="https://www.ascii-code.com/timeline">Timeline of ASCII History</a></p></li><li><p><a href="https://www.translationroyale.com/the-history-of-unicode/">Unicode: The Journey From Standardizing Texts to Emojis</a></p></li></ul>]]></content:encoded></item><item><title><![CDATA[Recursion: In Computer Science]]></title><description><![CDATA[Recursion (Noun): See recursion.]]></description><link>https://notebook.mubbie.dev/p/recursionhtml</link><guid isPermaLink="false">https://notebook.mubbie.dev/p/recursionhtml</guid><dc:creator><![CDATA[Mubarak Idoko]]></dc:creator><pubDate>Wed, 23 Oct 2024 00:00:00 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2469be7-c53c-4f7b-9a3a-9aaac024b97e_506x516.gif" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!e9fB!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2469be7-c53c-4f7b-9a3a-9aaac024b97e_506x516.gif" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!e9fB!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2469be7-c53c-4f7b-9a3a-9aaac024b97e_506x516.gif 424w, https://substackcdn.com/image/fetch/$s_!e9fB!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2469be7-c53c-4f7b-9a3a-9aaac024b97e_506x516.gif 848w, https://substackcdn.com/image/fetch/$s_!e9fB!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2469be7-c53c-4f7b-9a3a-9aaac024b97e_506x516.gif 1272w, https://substackcdn.com/image/fetch/$s_!e9fB!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2469be7-c53c-4f7b-9a3a-9aaac024b97e_506x516.gif 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!e9fB!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2469be7-c53c-4f7b-9a3a-9aaac024b97e_506x516.gif" width="506" height="516" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e2469be7-c53c-4f7b-9a3a-9aaac024b97e_506x516.gif&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:516,&quot;width&quot;:506,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:4611478,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/gif&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!e9fB!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2469be7-c53c-4f7b-9a3a-9aaac024b97e_506x516.gif 424w, https://substackcdn.com/image/fetch/$s_!e9fB!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2469be7-c53c-4f7b-9a3a-9aaac024b97e_506x516.gif 848w, https://substackcdn.com/image/fetch/$s_!e9fB!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2469be7-c53c-4f7b-9a3a-9aaac024b97e_506x516.gif 1272w, https://substackcdn.com/image/fetch/$s_!e9fB!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2469be7-c53c-4f7b-9a3a-9aaac024b97e_506x516.gif 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Image Source: <a href="https://medium.com/@williambdale/recursion-the-pros-and-cons-76d32d75973a">Recursion: The Pros and Cons</a> </em><br>Original creator unknown</p><h1>Introduction</h1><p>When I was in elementary school, I lived in a dormitory with my classmates, and we all had daily chores. These chores ranged from sweeping to mopping and other tasks to keep our hostels and school tidy. Back then, I wasn&#8217;t exactly a fan of cleaning. I saw beauty in disorder and only did my duties to avoid trouble. However, one item always captivated me: the RoyalMop bucket.</p><p>At first glance, it was just an ordinary blue mop bucket, like any other. But what fascinated me was the label on the side. The label showed a picture of the mop bucket&#8212;including the label itself. This meant the image on the label contained another image of the mop bucket, which in turn had another label, and so on. In theory, this created an infinite loop of mop bucket images, spiraling deeper and deeper into itself.</p><p>I was mesmerized by this design. The bucket&#8217;s label was like a window into an endless series of smaller and smaller buckets, each one a reflection of the larger one. It was a simple object, yet it held an infinite pattern within it&#8212;so each time I saw it, I couldn&#8217;t help but pause and stare.</p><p>Years later, I found myself thinking about that mop bucket when learning about recursion in computer science. Like the label on that bucket, recursion involves a process that repeats within itself, potentially ad infinitum. It&#8217;s the same concept: something self-referential, infinitely repeatable. While searching for resources while writing this blog post, I stumbled upon images of the same RoyalMop bucket that had fascinated me years ago. The quality of the image may not be high-definition, but the recursive design still shines through.</p><p>Take a look for yourself. Notice how the label depicts the bucket, and within that, another label, and so on. It&#8217;s a real-world example of what happens under the hood of recursive implementations in computer science.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!eGmp!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95f5436d-53a1-498f-8b9a-54ac293b70bb_1392x1012.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!eGmp!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95f5436d-53a1-498f-8b9a-54ac293b70bb_1392x1012.jpeg 424w, https://substackcdn.com/image/fetch/$s_!eGmp!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95f5436d-53a1-498f-8b9a-54ac293b70bb_1392x1012.jpeg 848w, https://substackcdn.com/image/fetch/$s_!eGmp!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95f5436d-53a1-498f-8b9a-54ac293b70bb_1392x1012.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!eGmp!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95f5436d-53a1-498f-8b9a-54ac293b70bb_1392x1012.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!eGmp!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95f5436d-53a1-498f-8b9a-54ac293b70bb_1392x1012.jpeg" width="1392" height="1012" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/95f5436d-53a1-498f-8b9a-54ac293b70bb_1392x1012.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1012,&quot;width&quot;:1392,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:125332,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!eGmp!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95f5436d-53a1-498f-8b9a-54ac293b70bb_1392x1012.jpeg 424w, https://substackcdn.com/image/fetch/$s_!eGmp!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95f5436d-53a1-498f-8b9a-54ac293b70bb_1392x1012.jpeg 848w, https://substackcdn.com/image/fetch/$s_!eGmp!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95f5436d-53a1-498f-8b9a-54ac293b70bb_1392x1012.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!eGmp!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95f5436d-53a1-498f-8b9a-54ac293b70bb_1392x1012.jpeg 1456w" sizes="100vw"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!gNub!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88b02915-0e56-4128-a25e-a789fab07594_526x314.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!gNub!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88b02915-0e56-4128-a25e-a789fab07594_526x314.png 424w, https://substackcdn.com/image/fetch/$s_!gNub!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88b02915-0e56-4128-a25e-a789fab07594_526x314.png 848w, https://substackcdn.com/image/fetch/$s_!gNub!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88b02915-0e56-4128-a25e-a789fab07594_526x314.png 1272w, https://substackcdn.com/image/fetch/$s_!gNub!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88b02915-0e56-4128-a25e-a789fab07594_526x314.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!gNub!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88b02915-0e56-4128-a25e-a789fab07594_526x314.png" width="526" height="314" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/88b02915-0e56-4128-a25e-a789fab07594_526x314.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:314,&quot;width&quot;:526,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:189029,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!gNub!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88b02915-0e56-4128-a25e-a789fab07594_526x314.png 424w, https://substackcdn.com/image/fetch/$s_!gNub!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88b02915-0e56-4128-a25e-a789fab07594_526x314.png 848w, https://substackcdn.com/image/fetch/$s_!gNub!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88b02915-0e56-4128-a25e-a789fab07594_526x314.png 1272w, https://substackcdn.com/image/fetch/$s_!gNub!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88b02915-0e56-4128-a25e-a789fab07594_526x314.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Image Source: <a href="https://celplas.com/product/mopping-bucket/">Celplas Mopping Bucket</a></em></p><h1>Recursion in Computer Science</h1><p>Now, let&#8217;s jump from my elementary school days to the world of integrated circuits, machine code, and programming. In this context, recursion is a programming technique where a function calls itself to solve smaller instances of the same problem.</p><p>A recursive approach works by breaking a larger problem into smaller, more manageable pieces, each of which is a simpler version of the original task. For example, imagine you have a function that can print a single character, and your task is to print the phrase <code>hello world</code>. You can break this problem into smaller chunks: <code>h</code>, <code>e</code>, <code>l</code>, and so on. The function can then handle each character one by one until the entire phrase is printed.</p><p>This way, recursion simplifies complex tasks by tackling them piece by piece&#8212;just as that infinite series of mop bucket images breaks down into smaller and smaller reflections of itself.</p><p>In Python, this concept could be implemented using a function <code>print_one_character</code> to print a single character:</p><pre><code>def print_one_character(char):
    # This function prints a single character
    print(char, end="")
</code></pre><p>We can then use this function in a recursive function, <code>print_string_recursively</code>, which continues calling <code>print_one_character</code> until all the characters in the phrase are printed:</p><pre><code>def print_string_recursively(string):
    # If the string is empty, stop the recursion (we are done printing)
    if len(string) == 0:
        return
    else:
        # Call `print_one_character` to print the first character of the string
        print_one_character(string[0])
        
        # Recursively call `print_string_recursively` on the remaining part of the string
        # For example, after printing `h`, the function is called on 'ello world' for `e` to be printed next and so on
        print_string_recursively(string[1:])
</code></pre><p>Using this simple premise of breaking a problem down into smaller, similar subproblems, recursion becomes an invaluable tool, especially in problems like searching through file directories, sorting data with algorithms like merge sort, or working with hierarchical structures like trees. Its ability to handle self-similar, nested tasks with elegance and simplicity makes it indispensable in many fields of computer science, from data processing to AI algorithms.</p><h2>Key Components of Recursion</h2><p>A recursive implementation relies on two critical components: the <code>base case</code> and the corresponding <code>recursive case</code>. The <code>base case</code> is crucial because, while recursion allows a function to repeat indefinitely, we typically want it to stop once the problem is solved. The <code>base case</code> defines the condition under which the recursive function stops calling itself, preventing infinite recursion. Without a <code>base case</code>, the function would continue to call itself indefinitely, eventually causing a stack overflow (we&#8217;ll dive into that later &#128521;).</p><p>Here&#8217;s an example using a factorial function:</p><pre><code>def factorial(n):
    if n == 0:  # Base case
        return 1
    else:
        return n * factorial(n - 1)  # Recursive case
</code></pre><p>In this example, the <code>base case</code> occurs when n == 0. At this point, recursion stops, and the function returns 1. Every recursive function needs at least one <code>base case</code> to ensure the recursion eventually halts.</p><p>On the other hand, the <code>recursive case</code> is where the function calls itself with a modified input&#8212;typically a smaller or simpler version of the original problem. In the factorial example, the <code>recursive case</code> is n * factorial(n - 1). Each time the function calls itself, it reduces the problem by decrementing n by 1, gradually moving toward the <code>base case</code>. This recursive structure breaks the problem into smaller parts, eventually converging on the <code>base case</code>.</p><p>The interaction between the <code>base case</code> and the <code>recursive case</code> ensures that recursion solves progressively smaller subproblems and then combines the results when the <code>base case</code> is reached. For example, if we calculate factorial(4), the execution would look like this:</p><pre><code>factorial(4): return 4 * factorial(3)
    factorial(3): return 3 * factorial(2)
        factorial(2): return 2 * factorial(1)
            factorial(1): return 1 * factorial(0)
</code></pre><p>Here, our <code>base case</code>, <code>factorial(0) ", yields </code>1<code>. Once we hit this final result, we combine it with the previous results. </code>factorial(1)<code> computes </code>1 * 1 = 1<code>, which we then use to compute </code>factorial(2)<code> as </code>2 * 1 = 2<code>. Next, we compute </code>factorial(3)<code> as </code>3 * 2 = 6<code>, and finally, we compute </code>factorial(4)<code> as </code>4 * 6 = 24`, giving us the final combined result.</p><h2>Another Example: Fibonacci Sequence</h2><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!ClIW!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F99ab7fd1-093d-486d-91bb-fcabde92e43d_851x526.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!ClIW!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F99ab7fd1-093d-486d-91bb-fcabde92e43d_851x526.jpeg 424w, https://substackcdn.com/image/fetch/$s_!ClIW!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F99ab7fd1-093d-486d-91bb-fcabde92e43d_851x526.jpeg 848w, https://substackcdn.com/image/fetch/$s_!ClIW!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F99ab7fd1-093d-486d-91bb-fcabde92e43d_851x526.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!ClIW!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F99ab7fd1-093d-486d-91bb-fcabde92e43d_851x526.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!ClIW!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F99ab7fd1-093d-486d-91bb-fcabde92e43d_851x526.jpeg" width="440" height="271.96239717978847" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/99ab7fd1-093d-486d-91bb-fcabde92e43d_851x526.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:526,&quot;width&quot;:851,&quot;resizeWidth&quot;:440,&quot;bytes&quot;:55693,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!ClIW!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F99ab7fd1-093d-486d-91bb-fcabde92e43d_851x526.jpeg 424w, https://substackcdn.com/image/fetch/$s_!ClIW!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F99ab7fd1-093d-486d-91bb-fcabde92e43d_851x526.jpeg 848w, https://substackcdn.com/image/fetch/$s_!ClIW!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F99ab7fd1-093d-486d-91bb-fcabde92e43d_851x526.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!ClIW!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F99ab7fd1-093d-486d-91bb-fcabde92e43d_851x526.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!AOj_!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff0f08c08-17aa-4257-b257-eea1168ff8c0_1280x853.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!AOj_!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff0f08c08-17aa-4257-b257-eea1168ff8c0_1280x853.png 424w, https://substackcdn.com/image/fetch/$s_!AOj_!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff0f08c08-17aa-4257-b257-eea1168ff8c0_1280x853.png 848w, https://substackcdn.com/image/fetch/$s_!AOj_!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff0f08c08-17aa-4257-b257-eea1168ff8c0_1280x853.png 1272w, https://substackcdn.com/image/fetch/$s_!AOj_!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff0f08c08-17aa-4257-b257-eea1168ff8c0_1280x853.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!AOj_!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff0f08c08-17aa-4257-b257-eea1168ff8c0_1280x853.png" width="438" height="291.8859375" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f0f08c08-17aa-4257-b257-eea1168ff8c0_1280x853.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:853,&quot;width&quot;:1280,&quot;resizeWidth&quot;:438,&quot;bytes&quot;:1653806,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!AOj_!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff0f08c08-17aa-4257-b257-eea1168ff8c0_1280x853.png 424w, https://substackcdn.com/image/fetch/$s_!AOj_!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff0f08c08-17aa-4257-b257-eea1168ff8c0_1280x853.png 848w, https://substackcdn.com/image/fetch/$s_!AOj_!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff0f08c08-17aa-4257-b257-eea1168ff8c0_1280x853.png 1272w, https://substackcdn.com/image/fetch/$s_!AOj_!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff0f08c08-17aa-4257-b257-eea1168ff8c0_1280x853.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p></p><p><em>Image Sources: <a href="https://www2.nau.edu/lrm22/lessons/fibonacci/fibonacci.html">Fibonacci Numbers</a>, <a href="https://www.qetutoring.com/fibonacci-sequence.html">Exploring the Fascinating World of the Fibonacci Sequence</a></em></p><p>Here&#8217;s another example of a recursive implementation: the Fibonacci sequence, which is a common use case of recursion in programming.</p><p>The Fibonacci sequence is a series of numbers where each number is the sum of the two preceding ones. The sequence typically starts as: <code>0, 1, 1, 2, 3, 5, 8, 13...</code></p><p>The Fibonacci sequence can be defined recursively, because each Fibonacci number is the sum of the two preceding numbers, except the first two numbers in the sequence: <code>fibonacci(0) = 0</code> and <code>fibonacci(1) = 1</code>. These two serve as our base cases. Here&#8217;s the function definition below:</p><pre><code># recursive fibonacci function
def fibonacci(n):
    if n == 0:  # Base case 1
        return 0
    elif n == 1:  # Base case 2
        return 1
    else:
        return fibonacci(n - 1) + fibonacci(n - 2)  # Recursive case
</code></pre><p>Now, let&#8217;s evaluate the cases:</p><ol><li><p>Base Cases:</p><ul><li><p>The base cases stop the recursion from going on indefinitely. We know that the first two numbers in the Fibonacci sequence are predefined as <code>fibonacci(0) = 0</code> and <code>fibonacci(1) = 1</code>.</p></li><li><p>When <code>n</code> reaches either <code>0</code> or <code>1</code>, the function will return <code>0</code> or <code>1</code> respectively, stopping further recursion for that branch.</p></li><li><p>We could also simplify the base case by returning <code>n</code> when <code>n == 0 or n == 1</code> or <code>n &lt; 2</code>. However, in this example, we explicitly define two base cases for clarity.</p></li></ul></li><li><p>Recursive Case</p><ul><li><p>The recursive case is where the function calls itself. For all <code>n &gt; 1</code>, the function calls itself twice: <code>fibonacci(n - 1)</code> and <code>fibonacci(n - 2)</code>, summing these two calls to get the `n&#8217;th Fibonacci number.</p></li><li><p>This recursive structure reflects how the Fibonacci sequence is built, as each number in the sequence is the sum of the previous two numbers.</p></li></ul></li></ol><p>Let&#8217;s break down the execution:</p><p>What if we want to compute <code>fibonacci(3)</code>:</p><ol><li><p>Intiail call: <code>fibonacci(3)</code></p><ul><li><p>Since <code>n</code> is not <code>0</code> or <code>1</code>, we enter the recursive case: <code>fibonacci(3) = fibonacci(2) + fibonacci(1)</code>.</p></li></ul></li><li><p>Evaluate <code>fibonacci(2)</code>:</p><ul><li><p>Similarly, <code>fibonacci(2) triggers the recursive case: </code>fibonacci(2) = fibonacci(1) + fibonacci(0).`</p></li></ul></li><li><p>Base cases <code>fibonacci(1) and </code>fibonacci(0)`:</p><ul><li><p><code>fibonacci(1)</code> hits the base case and returns <code>1</code>.</p></li><li><p><code>fibonacci(0)</code> also hits the base case and returns <code>0</code>.</p></li></ul></li><li><p>Unwinding the recursion:</p><ul><li><p>Now, we combine the results, starting from the base cases:</p><ul><li><p><code>fibonacci(2) = 1 + 0 = 1</code>.</p></li><li><p>And finally, <code>fibonacci(3) = fibonacci(2) + fibonacci(1) = 1 + 1 = 2</code>.</p></li></ul></li></ul></li></ol><p>The final result of <code>fibonacci(5)</code> is <code>5</code>.</p><h2>Real-world Applications of Recursion</h2><p>Recursion has various real-world applications across multiple domains, from sorting algorithms to tree data structure and dynamic programming. I&#8217;ll discuss some of these applications in detail below:</p><h3>Divide and Conquer Algorithms</h3><p>Divide and conquer algorithms are almost inherently recursive, as the logic is to &#8220;divide&#8221; a problem into smaller subproblems, which are easier to solve, and then &#8220;conquer&#8221; each subproblem recursively before combining the results to get the final solution. Two popular examples of divide and conquer algorithms are <code>merge sort</code> and <code>quick sort</code>:</p><p><strong>Merge Sort:</strong> This algorithm divides an unsorted list into two halves, recursively sorts each half, and then merges the sorted halves. For example, if we need to sort a list of numbers, merge sort recursively splits the list in half until it reaches sublists of size 1, which are inherently sorted, and then merges them. Below is a good graphic on how this algorithm proceeds:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Tzq8!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F86b55e66-e9a7-4fda-917b-588e784d8d5c_520x400.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Tzq8!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F86b55e66-e9a7-4fda-917b-588e784d8d5c_520x400.png 424w, https://substackcdn.com/image/fetch/$s_!Tzq8!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F86b55e66-e9a7-4fda-917b-588e784d8d5c_520x400.png 848w, https://substackcdn.com/image/fetch/$s_!Tzq8!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F86b55e66-e9a7-4fda-917b-588e784d8d5c_520x400.png 1272w, https://substackcdn.com/image/fetch/$s_!Tzq8!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F86b55e66-e9a7-4fda-917b-588e784d8d5c_520x400.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Tzq8!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F86b55e66-e9a7-4fda-917b-588e784d8d5c_520x400.png" width="520" height="400" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/86b55e66-e9a7-4fda-917b-588e784d8d5c_520x400.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:400,&quot;width&quot;:520,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:48386,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Tzq8!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F86b55e66-e9a7-4fda-917b-588e784d8d5c_520x400.png 424w, https://substackcdn.com/image/fetch/$s_!Tzq8!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F86b55e66-e9a7-4fda-917b-588e784d8d5c_520x400.png 848w, https://substackcdn.com/image/fetch/$s_!Tzq8!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F86b55e66-e9a7-4fda-917b-588e784d8d5c_520x400.png 1272w, https://substackcdn.com/image/fetch/$s_!Tzq8!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F86b55e66-e9a7-4fda-917b-588e784d8d5c_520x400.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Image Source: <a href="https://www.linkedin.com/pulse/understanding-merge-sort-algorithm-java-source-code-faraz-ahmed-synmc/">Understanding Merge Sort Algorithm with Java Source Code</a></em></p><p><strong>Quick Sort:</strong> This algorithm works by selecting a &#8220;pivot&#8221; element from a list of items, partitioning the remaining elements into two sublists based on whether they are less than or greater than the pivot, and then recursively applying the same process to the sublists. Once the base case (an empty or single-element list) is reached, the recursion unwinds, and the fully sorted list is returned. This recursive partitioning enables quicksort to handle large datasets efficiently.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!01L4!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F34eaa227-1d0a-4b96-86db-2cdcafb0f8d5_1080x608.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!01L4!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F34eaa227-1d0a-4b96-86db-2cdcafb0f8d5_1080x608.jpeg 424w, https://substackcdn.com/image/fetch/$s_!01L4!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F34eaa227-1d0a-4b96-86db-2cdcafb0f8d5_1080x608.jpeg 848w, https://substackcdn.com/image/fetch/$s_!01L4!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F34eaa227-1d0a-4b96-86db-2cdcafb0f8d5_1080x608.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!01L4!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F34eaa227-1d0a-4b96-86db-2cdcafb0f8d5_1080x608.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!01L4!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F34eaa227-1d0a-4b96-86db-2cdcafb0f8d5_1080x608.jpeg" width="1080" height="608" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/34eaa227-1d0a-4b96-86db-2cdcafb0f8d5_1080x608.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:608,&quot;width&quot;:1080,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:56139,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!01L4!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F34eaa227-1d0a-4b96-86db-2cdcafb0f8d5_1080x608.jpeg 424w, https://substackcdn.com/image/fetch/$s_!01L4!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F34eaa227-1d0a-4b96-86db-2cdcafb0f8d5_1080x608.jpeg 848w, https://substackcdn.com/image/fetch/$s_!01L4!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F34eaa227-1d0a-4b96-86db-2cdcafb0f8d5_1080x608.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!01L4!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F34eaa227-1d0a-4b96-86db-2cdcafb0f8d5_1080x608.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Image Source: <a href="https://www.enjoyalgorithms.com/blog/quick-sort-algorithm">Quick Sort Algorithm</a></em></p><h3>Tree Traversals</h3><p>Recursion is also a powerful tool for traversing tree structures such as <a href="https://www.geeksforgeeks.org/introduction-to-binary-tree/">binary trees</a>, <a href="https://www.tutorialspoint.com/data_structures_algorithms/binary_search_tree.htm">binary search trees</a>, and <a href="https://www.ibm.com/topics/decision-trees">decision trees</a>. In tree traversal, each node in a tree has a similar structure, consisting of a value and links to its child nodes. Recursion is ideal for this task, as it allows the traversal function to explore nodes in a specific order. The base case will be an instance where a node has no children, while the recursive case involves calling the traversal function on the children of the node&#8212;thus moving through the tree. It is pretty elegant how tree traversals are implemented recursively. You can read more about them in these articles: <a href="https://builtin.com/software-engineering-perspectives/tree-traversal">4 Types of Tree Traversal Algorithms</a>, <a href="https://medium.com/@nikhil.cse16/navigating-trees-in-depth-look-at-traversal-algorithms-8f013d8c8127">Navigating Trees: In-Depth Look at Traversal Algorithms</a>.</p><h3>Dynamic Programming</h3><p>In <a href="https://www.geeksforgeeks.org/dynamic-programming/">dynamic programming</a>, recursion is often combined with <a href="https://www.geeksforgeeks.org/what-is-memoization-a-complete-tutorial/">memoization</a> to solve problems more efficiently by avoiding redundant computation. In cases where recursion might be inefficient due to repeated calculation of the same subproblem, dynamic programming offers an optimized approach by storing the results of expensive function calls and reusing them when needed.</p><p>A classic example of recusion and memoization is the Fibonacci sequence. In a na&#239;ve recursive implementation of the Fibonacci sequence, the function repeatedly recalculates the same Fibonacci numbers, leading to exponential time complexity. For example, to calculate <code>fibonacci(5)</code>, the recursive function calculates <code>fibonacci(4)</code> and <code>fibonacci(3)</code>, but to compute <code>fibonacci(4)</code>, it again calculates <code>fibonacci(3)</code>, creating a lot of redundant work.</p><p>To optimize this, memoization stores the result of each Fibonacci number once it&#8217;s computed, so the function doesn&#8217;t have to recompute it in future calls. Here&#8217;s an optimized version using recursion and memoization:</p><pre><code>def fibonacci(n, memo={}):
    if n in memo:
        return memo[n]
    if n == 0 or n == 1:
        return n
    else:
        memo[n] = fibonacci(n - 1, memo) + fibonacci(n - 2, memo)
        return memo[n]
</code></pre><p>By storing the results of subproblems in the dictionary (<code>memo</code>), this version of the Fibonacci function ensures that each Fibonacci number is only computed once, reducing the time complexity from exponential to linear.</p><p>Recursion and memoization are frequently used in a wide range of dynamic programming problems such as <a href="https://www.geeksforgeeks.org/0-1-knapsack-problem-dp-10/">knapsack problems</a>, <a href="https://www.geeksforgeeks.org/edit-distance-dp-5/">minimum edit distance (used in spell checkers or DNA sequence alignment)</a>, and <a href="https://www.enjoyalgorithms.com/blog/longest-common-subsequence">longest common subsequence (used in version control systems)</a>. In each case, recursion breaks the problem into overlapping subproblems, and memoization ensures that these subproblems are not recomputed, greatly enhancing efficiency.</p><h3>Other Application</h3><p>Beyond the abovementioned ones, recursion is used in numerous other real-world applications. Some examples include <a href="https://www.simplilearn.com/tutorials/data-structure-tutorial/backtracking-algorithm">backtracking algorithms</a> (used in Sudoku, Maze solvers, etc.), data structure operations such as linked lists or trie data structures, web crawlers (used in search engines), expression evaluations (such as parsing nested parentheses and multiple operations in mathematical expressions), pathfinding algorithms, network protocols, robotics and simulations, image processing, social networks, and many more.</p><h2>Common Pitfalls in Recursion</h2><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!MeWw!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F083c0ace-1905-475d-9fbe-ea7740881c2e_684x716.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!MeWw!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F083c0ace-1905-475d-9fbe-ea7740881c2e_684x716.png 424w, https://substackcdn.com/image/fetch/$s_!MeWw!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F083c0ace-1905-475d-9fbe-ea7740881c2e_684x716.png 848w, https://substackcdn.com/image/fetch/$s_!MeWw!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F083c0ace-1905-475d-9fbe-ea7740881c2e_684x716.png 1272w, https://substackcdn.com/image/fetch/$s_!MeWw!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F083c0ace-1905-475d-9fbe-ea7740881c2e_684x716.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!MeWw!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F083c0ace-1905-475d-9fbe-ea7740881c2e_684x716.png" width="684" height="716" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/083c0ace-1905-475d-9fbe-ea7740881c2e_684x716.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:716,&quot;width&quot;:684,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:296486,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!MeWw!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F083c0ace-1905-475d-9fbe-ea7740881c2e_684x716.png 424w, https://substackcdn.com/image/fetch/$s_!MeWw!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F083c0ace-1905-475d-9fbe-ea7740881c2e_684x716.png 848w, https://substackcdn.com/image/fetch/$s_!MeWw!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F083c0ace-1905-475d-9fbe-ea7740881c2e_684x716.png 1272w, https://substackcdn.com/image/fetch/$s_!MeWw!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F083c0ace-1905-475d-9fbe-ea7740881c2e_684x716.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Image Source: <a href="https://www.smbc-comics.com/comic/recursion">SMBC Comics: Recursion</a></em></p><p>While recursion is a powerful tool extensively used in programming, it comes with its own set of challenges and pitfalls. The most common issues that arise with recursive algorithms are <strong><a href="https://stackoverflow.com/">stack overflow</a></strong> (not the popular Q&amp;A website for developers&#8212;even though I mischievously linked it above &#128520;) and <strong>efficiency drawbacks</strong>.</p><h3>Stack Overflow</h3><p>Before diving into stack overflow, let&#8217;s understand how the call stack works. Think of the call stack as a stack of plates in a kitchen. When you wash dishes, each time you finish cleaning a plate, you place it on top of the stack. As you keep washing more plates, you continue stacking them on top. When you&#8217;re done, you take the top plate off first, then the next, and so on&#8212;removing them in reverse order. This is exactly how the call stack works in programming: each new function call gets &#8220;stacked&#8221; on top of the previous one, and when a function completes, it is &#8220;popped&#8221; off the stack in a last-in, first-out (LIFO) manner. You can read more about the call stack in <a href="https://medium.com/@ryanfarney/breaking-down-the-call-stack-e68b5633fbad">this article</a>.</p><p>Now, imagine writing this blog post. I started by creating an outline of the concepts I wanted to cover, breaking each central idea into sections I could flesh out. I tackled each section individually, starting with the <strong>Introduction</strong>. Once I finished a section, I set it aside (popped it off my mental &#8220;stack&#8221;) and moved on to the next section. Each time I finished one section, I could remove it from my mental stack and focus on the next one.</p><p>But what if I tried to write the entire blog all at once without breaking it down? Imagine trying to tackle every section and paragraph simultaneously without giving each part my entire focus. My mind would get cluttered with all these unfinished pieces. I&#8217;d eventually get overwhelmed because my &#8220;mental stack&#8221; would become too full. This is similar to what happens in programming when too many function calls are stacked on top of each other due to deep or infinite recursion.</p><p>In the case of recursion, a new &#8220;task&#8221; is added to the call stack each time a function calls itself, just like focusing on each section of the blog. Each recursive call represents a piece of the problem the function is trying to solve. As the program finishes working on a recursive call (just like completing a section), it removes it from the stack and moves on to the previous function that called it.</p><p>If there&#8217;s no clear base case in the recursive function, or if the input size is too large, the call stack keeps growing without a way to reduce it. This is like trying to write more and more sections of the blog without finishing any of them. Eventually, I run out of focus and capacity to keep track of what I&#8217;m working on. That&#8217;s a stack overflow. Essentially, too many function calls consume memory on the system&#8217;s call stack, and the stack exceeds its limit, causing an error.</p><p>For example, consider a recursive function without a base case:</p><pre><code>def infinite_recursion(n):
    print(n)
    return infinite_recursion(n + 1)  # No base case to stop the recursion
</code></pre><p>In the above code, the function <code>infinite_recursion</code> keeps calling itself indefinitely, consuming memory on the stack until the program crashes with a stack overflow error. This is why defining a clear and reachable base case is critical in any recursive function.</p><p>Even with a proper base case, deep recursion can cause a stack overflow if the input size is too large. For instance, computing large values in the Fibonacci sequence using a na&#239;ve recursive implementation can result in deep recursive calls that exhaust the stack:</p><pre><code>def fibonacci(n):
    if n == 0 or n == 1:  # Base cases
        return n
    return fibonacci(n - 1) + fibonacci(n - 2)
</code></pre><p>For large values of <code>n</code>, such as fibonacci(2000), the above function will make an enormous number of recursive calls, leading to stack overflow due to the depth of recursion.</p><h3>Efficiency</h3><p>Another concern with recursion is its efficiency. Recursive solutions can be less efficient than iterative solutions due to the overhead of repeated function calls. Each recursive call adds an entry to the call stack, which consumes memory and takes time to set up. This overhead can significantly impact performance, especially for problems with deep or highly repetitive recursive calls.</p><p>For example, a simple loop can often achieve the same result as a recursive function with less memory usage and faster execution time. Let&#8217;s compare two implementations of factorial:</p><h4>Recursive Factorial</h4><pre><code>def factorial_recursive(n):
    if n == 0:
        return 1
    return n * factorial_recursive(n - 1)
</code></pre><h4>Iterative Factorial</h4><pre><code>def factorial_iterative(n):
    result = 1
    for i in range(1, n + 1):
        result *= i
    return result
</code></pre><p>The iterative approach avoids the overhead of function calls and potential stack overflow, making it more memory-efficient. However, recursion offers a cleaner, more intuitive approach in some cases, especially when working with problems with a natural recursive structure (like tree traversals).</p><p>The choice between recursion and iteration often depends on the complexity of the problem and the size of the input. For example, while recursion is elegant and simple for problems like tree traversal or divide-and-conquer algorithms, iterative solutions might be more suitable for scenarios with high memory constraints or large datasets.</p><p>These are good articles to learn more about efficiency as related to recursions: <a href="https://medium.com/background-thread/why-recursion-is-less-efficient-than-a-loop-programming-word-of-the-day-514a5fdf3fc">Why Recursion Is Less Efficient Than a Loop &#8212; Programming Word of the Day</a>, <a href="https://guillaumebogard.dev/posts/recursion-performance/">Performance of recursive functions (and when not to use them)</a></p><h2>Tail Recursion Optimization</h2><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!UtRE!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa6a4bc6a-4d51-48c4-9964-7a513bacf6a7_1325x784.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!UtRE!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa6a4bc6a-4d51-48c4-9964-7a513bacf6a7_1325x784.png 424w, https://substackcdn.com/image/fetch/$s_!UtRE!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa6a4bc6a-4d51-48c4-9964-7a513bacf6a7_1325x784.png 848w, https://substackcdn.com/image/fetch/$s_!UtRE!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa6a4bc6a-4d51-48c4-9964-7a513bacf6a7_1325x784.png 1272w, https://substackcdn.com/image/fetch/$s_!UtRE!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa6a4bc6a-4d51-48c4-9964-7a513bacf6a7_1325x784.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!UtRE!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa6a4bc6a-4d51-48c4-9964-7a513bacf6a7_1325x784.png" width="1325" height="784" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a6a4bc6a-4d51-48c4-9964-7a513bacf6a7_1325x784.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:784,&quot;width&quot;:1325,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:242853,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!UtRE!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa6a4bc6a-4d51-48c4-9964-7a513bacf6a7_1325x784.png 424w, https://substackcdn.com/image/fetch/$s_!UtRE!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa6a4bc6a-4d51-48c4-9964-7a513bacf6a7_1325x784.png 848w, https://substackcdn.com/image/fetch/$s_!UtRE!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa6a4bc6a-4d51-48c4-9964-7a513bacf6a7_1325x784.png 1272w, https://substackcdn.com/image/fetch/$s_!UtRE!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa6a4bc6a-4d51-48c4-9964-7a513bacf6a7_1325x784.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Image Source: <a href="https://stackoverflow.com/questions/78979492/optimization-of-tail-recursion-in-r">Optimization of tail recursion in R</a></em></p><p>Tail recursion is a specific type of recursion in which the recursive call is the last operation in the function. This seemingly minor distinction is quite powerful because it enables some programming languages to optimize recursive calls to prevent stack overflow and reduce memory usage. This optimization is known as Tail Call Optimization (TCO).</p><h3>What is Tail Recursion?</h3><p>In a normal recursive function, each recursive call creates a new stack frame that holds information about the current function&#8217;s execution context (local variables, return address, etc.). As recursive calls accumulate, each call leaves behind an unresolved task in the stack, leading to an ever-growing stack. This is why, in deep recursion, you often encounter stack overflow errors&#8212;the call stack grows beyond its limit.</p><p>However, in a tail-recursive function, the recursive call is the very last operation that the function performs. When a recursive call is the last thing a function does, there&#8217;s no need to keep the current stack frame. This allows the language or compiler to reuse the same stack frame for the next call, essentially transforming the recursion into an iteration under the hood.</p><h4>Example: Tail Recursion vs. Normal Recursion</h4><p>Let&#8217;s compare a simple recursive function to its tail-recursive version. Consider a function that calculates the sum of the first <code>n</code> numbers.</p><pre><code>def sum_normal(n):
    if n == 0:  # Base case
        return 0
    return n + sum_normal(n - 1)  # Not a tail call because of the addition after the call
</code></pre><p>In this example, after the recursive call <code>sum_normal(n - 1) "is made, the function still needs to add </code>n<code> to the result. This creates a chain of unresolved additions that each need their own stack frame. For large values of </code>n`, this chain can quickly lead to a stack overflow.</p><p>Now, let&#8217;s rewrite this function using tail recursion.</p><pre><code>def sum_tail_recursive(n, accumulator=0):
    if n == 0:  # Base case
        return accumulator
    else:
        return sum_tail_recursive(n - 1, accumulator + n)  # Tail call
</code></pre><p>In this version, the recursive call <code>sum_tail_recursive</code> is the very last thing that happens in the function. All the necessary work (adding <code>n</code> to the accumulator) is done before the recursive call. There&#8217;s no further computation needed once the recursive call returns. This is the hallmark of a tail-recursive function.</p><h3>How Tail Call Optimization Works</h3><p>In a tail-recursive function, once the final recursive call is made, the current stack frame is no longer used. In languages that support Tail Call Optimization (TCO), the compiler can recognize that it doesn&#8217;t need to keep the current stack frame around. Instead, it can reuse the current stack frame for the next recursive call, effectively converting the recursion into an iterative process without needing additional memory.</p><p>Since TCO allows the compiler to reuse the current stack frame instead of creating a new one for each recursive call, the call stack size doesn&#8217;t grow with each recursive call. This prevents stack overflow, even if the function makes many recursive calls.</p><p>For example, in a <a href="https://www.linkedin.com/advice/0/what-tail-recursive-function-how-can-you-use-functional-usggc">language with TCO support</a> (like Scheme, Haskell, Scala, and Clojure), a tail-recursive function like the one above will consume a constant amount of stack space, regardless of the depth of recursion. O, even if a function is written in a tail-recursive form, it won&#8217;t receive the same stack-saving optimizations as in other languages.</p><h3>Visualizing Tail Recursion vs. Normal Recursion</h3><p>Imagine you&#8217;re trying to count the number of steps on a staircase:</p><ul><li><p><strong>Normal Recursion</strong>: With a non-tail-recursive approach, every time you take a step, you leave a &#8220;marker&#8221; behind so you can retrace your steps on the way back. For instance, if you walk up 100 steps, you&#8217;ll leave 100 markers. When you reach the top, you have to return to each step to pick up your markers in reverse order. This is similar to normal recursion&#8212;every recursive call leaves behind some unfinished work (an unresolved operation) that needs to be revisited later. This ongoing &#8220;memory&#8221; of unfinished tasks builds up in the call stack, leading to potential stack overflow.</p></li><li><p><strong>Tail Recursion</strong>: Now imagine a different approach where you don&#8217;t leave any markers behind. Instead, at each step, you update a running count and move to the next step without needing to remember where you&#8217;ve been. When you reach the top, you already have the final count&#8212;there&#8217;s no need to retrace your steps. This is how tail recursion works: each recursive call performs its work completely before moving on without leaving unresolved operations behind on the stack. This efficiency prevents the stack from growing, allowing you to handle large recursions without running out of memory.</p></li></ul><h1>Conclusion</h1><p>I hope you enjoyed reading this blog post and learned something new. For the closing, let&#8217;s play a little game that might keep you staring at this page forever. Have fun &#128517;</p><pre><code>def conclusion():
    print("Recursion is great for breaking down problems into smaller parts. But if you forget a base case, you might be stuck here forever&#8230;")
    conclusion()  # Oops, we did it!
</code></pre><h1>References</h1><p>While I have cited a handful of sources in this blog post, below are some other resources that I used to write it and that can be useful for your further learning.</p><ul><li><p><a href="https://projectpython.net/chapter12/">Project Python: Recursion</a></p></li><li><p><a href="https://medium.com/@williambdale/recursion-the-pros-and-cons-76d32d75973a">Recursion: The Pros and Cons</a></p></li><li><p><a href="https://levelup.gitconnected.com/how-to-think-recursively-solving-recursion-problems-in-4-steps-95a6d07aa866">How to Think Recursively | Solving Recursion Problems in 4 Steps</a></p></li><li><p><a href="https://www2.nau.edu/lrm22/lessons/fibonacci/fibonacci.html">Fibonacci Numbers</a></p></li><li><p><a href="https://www.geeksforgeeks.org/merge-sort/">Merge Sort &#8211; Data Structure and Algorithms Tutorials</a></p></li><li><p><a href="https://www.interviewcake.com/concept/java/memoization">Memoization</a></p></li><li><p><a href="https://www.simplilearn.com/tutorials/data-structure-tutorial/backtracking-algorithm">What is Backtracking Algorithm? Types, Examples &amp; its Application</a></p></li><li><p><a href="https://dev.to/himankbhalla/tail-call-optimization-what-it-is-and-why-it-matters-k4n">Tail Call Optimization: What it is? and Why it Matters?</a></p></li><li><p><a href="https://tiagodev.wordpress.com/2013/03/31/tail-recursive-algorithms/">Tail-recursive algorithms</a></p></li><li><p><a href="https://www.geeksforgeeks.org/tail-call-optimisation-in-c/">Tail Call Optimisation in C</a></p></li><li><p><a href="https://www.geeksforgeeks.org/tail-recursion/">What is Tail Recursion</a></p></li><li><p><a href="https://www.youtube.com/watch?v=Q83nN97LVOU">This is a Better Way to Understand Recursion</a></p></li><li><p><a href="https://www.youtube.com/watch?v=ngCos392W4w">5 Simple Steps for Solving Any Recursive Problem</a></p></li><li><p><a href="https://users.cs.utah.edu/~germain/PPS/Topics/recursion.html">Recursion</a></p></li><li><p><a href="https://web.mit.edu/6.005/www/fa15/classes/10-recursion/">Reading 10: Recursion</a></p></li><li><p><a href="https://realpython.com/python-recursion/">Recursion in Python: An Introduction</a></p></li><li><p><a href="https://introcs.cs.princeton.edu/java/23recursion/">Recursion</a></p></li><li><p><a href="https://www.baeldung.com/cs/recursion-looping">Recursion and Looping</a></p></li><li><p><a href="https://hackernoon.com/recursion-vs-looping-in-python-9261442f70a5">Recursion vs. Looping in Python</a></p></li><li><p><a href="https://medium.com/@be.content23/introduction-in-the-programming-world-mastering-different-techniques-for-iterating-over-data-is-cfe943e6b875">Different Techniques for Iterating over Data</a></p></li><li><p><a href="https://www.geeksforgeeks.org/difference-between-recursion-and-iteration/">Difference between Recursion and Iteration</a></p></li><li><p><a href="https://measurethat.net/Benchmarks/Show/2455/2/recursion-vs-iteration">Benchmark: Recursion vs Iteration</a></p></li><li><p><a href="https://wordsandbuttons.online/cheap_trick_to_speed_up_recursion_in_cpp.html">A cheap trick to speed up recursion in C++</a></p></li><li><p><a href="https://levelup.gitconnected.com/optimizing-recursive-algorithms-techniques-to-reduce-space-complexity-191d84934467">Optimizing Recursive Algorithms: Techniques to Reduce Space Complexity</a></p></li></ul>]]></content:encoded></item><item><title><![CDATA[Left and Right]]></title><description><![CDATA[How Politics Took Sides]]></description><link>https://notebook.mubbie.dev/p/left-and-right-how-politics-took-sideshtml</link><guid isPermaLink="false">https://notebook.mubbie.dev/p/left-and-right-how-politics-took-sideshtml</guid><dc:creator><![CDATA[Mubarak Idoko]]></dc:creator><pubDate>Sun, 08 Sep 2024 00:00:00 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!9EqN!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0ee386ea-f52f-4ff0-8288-e66b3992602b_1350x900.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!9EqN!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0ee386ea-f52f-4ff0-8288-e66b3992602b_1350x900.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!9EqN!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0ee386ea-f52f-4ff0-8288-e66b3992602b_1350x900.jpeg 424w, https://substackcdn.com/image/fetch/$s_!9EqN!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0ee386ea-f52f-4ff0-8288-e66b3992602b_1350x900.jpeg 848w, https://substackcdn.com/image/fetch/$s_!9EqN!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0ee386ea-f52f-4ff0-8288-e66b3992602b_1350x900.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!9EqN!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0ee386ea-f52f-4ff0-8288-e66b3992602b_1350x900.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!9EqN!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0ee386ea-f52f-4ff0-8288-e66b3992602b_1350x900.jpeg" width="1350" height="900" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/0ee386ea-f52f-4ff0-8288-e66b3992602b_1350x900.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:900,&quot;width&quot;:1350,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:322431,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!9EqN!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0ee386ea-f52f-4ff0-8288-e66b3992602b_1350x900.jpeg 424w, https://substackcdn.com/image/fetch/$s_!9EqN!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0ee386ea-f52f-4ff0-8288-e66b3992602b_1350x900.jpeg 848w, https://substackcdn.com/image/fetch/$s_!9EqN!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0ee386ea-f52f-4ff0-8288-e66b3992602b_1350x900.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!9EqN!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0ee386ea-f52f-4ff0-8288-e66b3992602b_1350x900.jpeg 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Image Source: <a href="https://www.scotworkusa.com/negotiation-blog/2022/is-it-taboo-to-talk-politics/">ScotWork USA</a></em></p><p>Politics is one of the most divisive topics in modern conversations. Many suggest avoiding political discussions altogether, especially in the workplace, as highlighted in articles like <a href="https://www.forbes.com/sites/tracybrower/2024/03/03/4-compelling-reasons-to-never-talk-politics-at-work/">4 Compelling Reasons To Never Talk Politics At Work</a> and <a href="https://www.chattnewschronicle.com/commentary/the-perils-and-pitfalls-of-discussing-politics-with-family-and-friends/">The perils and pitfalls of discussing politics with family and friends</a>. Others argue that <a href="https://education.virginia.edu/news-stories/democracy-talking-more-important-agreeing">open dialogue is essential for democracy</a>, <a href="https://www.vox.com/first-person/2017/8/22/16171270/partisanship-politics-discussion-family">emphasizing the importance of talking&#8212;even when we disagree</a>. Research also shows that <a href="https://www.pewresearch.org/journalism/2020/02/05/a-sore-subject-almost-half-of-americans-have-stopped-talking-politics-with-someone/">nearly half of Americans have stopped talking politics with someone</a>, and <a href="https://www.pewresearch.org/short-reads/2021/11/23/republicans-and-democrats-alike-say-its-stressful-to-talk-politics-with-people-who-disagree/">both Democrats and Republicans report that talking about politics with people who disagree is stressful</a>, underscoring how difficult these conversations can be.</p><p>So why am I writing about politics? For me, it all began with a friend who is deeply politically engaged. Our conversations were often dominated by his political opinions. I usually let him speak because I found these discussions to be learning opportunities. One day, however, he shared a strong take on an issue that I believed was far more nuanced, which led to a debate. I quickly realized that while I disagreed with him, I lacked sufficient knowledge to push back effectively. This prompted me to dive into political history&#8212;not just to challenge him but also to understand the roots of our disagreements.</p><p>Ironically, my quest to &#8220;prove him wrong&#8221; deepened my interest in politics, particularly in how political systems evolved into what they are today. I figured sharing some of this history would create an engaging blog post. And what better time to explore political history than during a U.S. Presidential election year?</p><p>Over time, my friend and I found that we agreed on more than we initially thought&#8212;our debates helped us reach that understanding. In our case, talking about politics brought us closer rather than dividing us further. But that&#8217;s besides the point. A larger question loomed in my mind: Why are political conversations so polarized? Why is there a divide between &#8220;left&#8221; and &#8220;right&#8221; in the first place? In this post, I&#8217;ll explore the origins and evolution of left and right-wing politics. My goal is to provide some historical context, allowing you, the reader, to understand better these ideologies and how they shape today&#8217;s political landscape.</p><p>It&#8217;s important to note that the ideologies and history discussed in this article are primarily relevant to Western countries. In other parts of the world, such as Nigeria, where I&#8217;m from, politics often takes on different shapes and forms that may not be represented here.</p><p>With that said, let&#8217;s delve into the history of left and right-wing politics.</p><h2>It Started in France</h2><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!P0WH!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7229d069-cda3-4bce-95b3-46bf3e155024_640x478.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!P0WH!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7229d069-cda3-4bce-95b3-46bf3e155024_640x478.jpeg 424w, https://substackcdn.com/image/fetch/$s_!P0WH!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7229d069-cda3-4bce-95b3-46bf3e155024_640x478.jpeg 848w, https://substackcdn.com/image/fetch/$s_!P0WH!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7229d069-cda3-4bce-95b3-46bf3e155024_640x478.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!P0WH!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7229d069-cda3-4bce-95b3-46bf3e155024_640x478.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!P0WH!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7229d069-cda3-4bce-95b3-46bf3e155024_640x478.jpeg" width="640" height="478" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/7229d069-cda3-4bce-95b3-46bf3e155024_640x478.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:478,&quot;width&quot;:640,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:105367,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!P0WH!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7229d069-cda3-4bce-95b3-46bf3e155024_640x478.jpeg 424w, https://substackcdn.com/image/fetch/$s_!P0WH!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7229d069-cda3-4bce-95b3-46bf3e155024_640x478.jpeg 848w, https://substackcdn.com/image/fetch/$s_!P0WH!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7229d069-cda3-4bce-95b3-46bf3e155024_640x478.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!P0WH!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7229d069-cda3-4bce-95b3-46bf3e155024_640x478.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Image Source: <a href="https://constitutingamerica.org/90day-aer-american-founding-observations-of-the-french-revolution-that-influenced-the-united-states-constitution-and-governing-guest-essayist-daniel-a-cotter/">American Founding Observations of the French Revolution That Influenced the United States Constitution and Governing</a></em></p><p>Like <a href="https://thechampagnecompany.com/blog/history-of-champagne.html">champagne</a>, the <a href="https://www.metricmetal.com/history-of-the-metric-system/">metric system</a>, and <a href="https://uark.pressbooks.pub/movingpictures/chapter/a-brief-history-of-cinema/">cinema</a>, the political terms &#8220;left-wing&#8221; and &#8220;right-wing&#8221; also <a href="https://jspp.psychopen.eu/index.php/jspp/article/view/4807/4807.html">originated in France</a>&#8212;specifically during the <a href="https://www.rmg.co.uk/stories/topics/french-revolution">French Revolution</a>. In 1789, France, under the absolute rule of King Louis XVI, was on the verge of collapse. The country faced a massive national debt and a dire economic situation. Compounding the issue, the wealthiest members of society paid very little in taxes. As calls for political reform grew louder, the King convened the Estates General, a representative national body that had not met since 1614. The <a href="https://youtu.be/9HZUZwUTOEo?si=ClvJSmWq1N2FnyJZ">Estate-General</a> consisted of 300 representatives from the First Estate (the clergy), 300 from the Second Estate (the nobility), and 600 from the Third Estate (the commoners).</p><p>When they gathered at Versailles, the nobility and clergy sat on the King&#8217;s right while the commoners sat on his left. The goal of the meeting was to draft a new constitution to address the mounting crisis.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!uOfM!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F26150a5d-aafb-4b04-a8ef-c852caf4bef9_600x397.gif" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!uOfM!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F26150a5d-aafb-4b04-a8ef-c852caf4bef9_600x397.gif 424w, https://substackcdn.com/image/fetch/$s_!uOfM!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F26150a5d-aafb-4b04-a8ef-c852caf4bef9_600x397.gif 848w, https://substackcdn.com/image/fetch/$s_!uOfM!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F26150a5d-aafb-4b04-a8ef-c852caf4bef9_600x397.gif 1272w, https://substackcdn.com/image/fetch/$s_!uOfM!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F26150a5d-aafb-4b04-a8ef-c852caf4bef9_600x397.gif 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!uOfM!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F26150a5d-aafb-4b04-a8ef-c852caf4bef9_600x397.gif" width="600" height="397" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/26150a5d-aafb-4b04-a8ef-c852caf4bef9_600x397.gif&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:397,&quot;width&quot;:600,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:151584,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/gif&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!uOfM!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F26150a5d-aafb-4b04-a8ef-c852caf4bef9_600x397.gif 424w, https://substackcdn.com/image/fetch/$s_!uOfM!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F26150a5d-aafb-4b04-a8ef-c852caf4bef9_600x397.gif 848w, https://substackcdn.com/image/fetch/$s_!uOfM!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F26150a5d-aafb-4b04-a8ef-c852caf4bef9_600x397.gif 1272w, https://substackcdn.com/image/fetch/$s_!uOfM!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F26150a5d-aafb-4b04-a8ef-c852caf4bef9_600x397.gif 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Image Source: <a href="https://www.lowimpact.org/posts/the-left-vs-right-battle-1-the-meaning-of-left-and-right">The left vs right battle: 1. the meaning of left and right</a></em></p><p>In the newly recognized National Assembly, the more revolutionary members who sought radical changes sat on the left side of the president. They advocated for the overthrow of the monarchy and the establishment of a republic. This group became known as the left wing. On the right side of the Assembly, supporters of the monarchy and the existing social order took their seats. They were more conservative, favoring moderate reforms and the preservation of religious and aristocratic traditions. This group became known as the right wing.</p><p>Thus, broadly speaking, the terms &#8220;left-wing&#8221; and &#8220;right-wing&#8221; came to represent <a href="https://allriot.com/blog/the-origins-or-left-right-wing-politics">two ideological groups</a>: the right wing, which favors conservatism and the preservation of existing societal structures, and the left wing, which advocates for more radical changes and societal reform.</p><h2>Going Around the World</h2><p>After the French Revolution, the ideological divide between the left and right quickly spread beyond France&#8217;s borders. In the early 19th century, Europe was a hotbed of political and social change, and the concepts of &#8220;left-wing&#8221; and &#8220;right-wing&#8221; became essential tools for understanding the growing tensions. The <a href="https://www.oxfordreference.com/display/10.1093/acref/9780191737848.timeline.0001">Napoleonic Wars</a> (1803&#8211;1815) <a href="https://origins.osu.edu/review/global-reach-napoleonic-wars">accelerated this spread</a>, as Napoleon&#8217;s expansionist campaigns brought revolutionary ideas, including concepts of citizenship and equal rights, to countries across Europe. As monarchies were restored after Napoleon&#8217;s defeat, the terms left and right solidified: the left symbolized the drive for republicanism, equality, and the dismantling of feudal systems, while the right represented the desire to return to the status quo, preserving monarchies, aristocratic privileges, and church power.</p><h3>Mid-19th Century: The Rise of Social Movements</h3><p>By the mid-19th century, <a href="https://pressbooks.nscc.ca/worldhistory/chapter/chapter-2-the-industrial-revolution-new/">industrialization</a> had transformed Europe, creating a growing divide between the wealthy elites and the <a href="https://www.erih.net/how-it-started/the-industrial-revolution-in-europe">burgeoning working class</a>. Left-wing ideas gained further traction during this period, especially with Karl Marx&#8217;s <a href="https://www.history.com/this-day-in-history/marx-publishes-manifesto">Communist Manifesto</a> in 1848. Marx&#8217;s call for a classless society and the abolition of private property became a rallying cry for many labor movements, aligning with the left&#8217;s push for workers&#8217; rights, social equality, and government intervention to address economic disparities. The revolutions of 1848, also known as the &#8220;<a href="https://althistory.fandom.com/wiki/Springtime_of_Nations">Springtime of Nations</a>,&#8221; saw uprisings across Europe as people demanded constitutional governance, freedom of speech, and economic reforms. Though most of these revolutions were unsuccessful, they left an indelible mark on European politics, cementing the left as the voice of the working class and reformers.</p><p>On the other side, the right wing became more deeply associated with the defense of property rights, monarchies, and the interests of the upper classes. Conservatives viewed the rapid social changes brought about by industrialization with suspicion, fearing that upheavals could lead to instability. In response to the revolutionary wave, conservative leaders like <a href="https://www.britannica.com/biography/Klemens-von-Metternich">Austria&#8217;s Prince Metternich</a> and later, <a href="https://www.britannica.com/biography/Otto-von-Bismarck">Otto von Bismarck</a> in Germany, sought to maintain political order by suppressing socialist movements while enacting limited reforms to appease the masses. Bismarck&#8217;s <a href="https://www.smithsonianmag.com/history/bismarck-tried-end-socialisms-grip-offering-government-healthcare-180964064/">creation of a welfare state</a>, for example, was designed to undermine support for socialist parties by addressing workers&#8217; needs without fundamentally altering the capitalist system.</p><h3>Late 19th Century: Left and Right Take on New Dimensions</h3><p>In the late 19th century, the left-right divide continued to evolve, particularly as Europe expanded its global influence through <a href="https://www.britannica.com/topic/Western-colonialism">colonization</a>. The left, still championing the rights of the working class, began to incorporate ideas about national liberation and anti-imperialism. Many <a href="https://www.currentaffairs.org/news/2017/09/a-quick-reminder-of-why-colonialism-was-bad">left-wing groups supported independence movements in colonies</a>, seeing the struggles of colonized peoples as an extension of their fight against oppression. Conversely, the right became closely associated with <a href="https://www.britannica.com/topic/history-of-Europe/Cultural-nationalism">nationalism and imperialism</a>, advocating for expanding European empires to bolster national pride and economic power.</p><p>The formation of political parties based on these ideologies became a defining feature of late 19th-century politics. In the United Kingdom, for example, <a href="https://labour.org.uk/about-us/labours-legacy/">the Labour Party</a> emerged as a voice for workers, aligning with the left&#8217;s push for social and economic reform. Around the same period, <a href="https://www.gosportconservatives.org/brief-history-conservative-party">the Conservative Party</a> solidified its position as the defender of traditional institutions, private property, and national interests.</p><h3>Early 20th Century: The Ideological Clash Intensifies</h3><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!MYcW!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88282a7e-0342-4686-8972-298eb3bc4f8a_1537x945.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!MYcW!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88282a7e-0342-4686-8972-298eb3bc4f8a_1537x945.jpeg 424w, https://substackcdn.com/image/fetch/$s_!MYcW!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88282a7e-0342-4686-8972-298eb3bc4f8a_1537x945.jpeg 848w, https://substackcdn.com/image/fetch/$s_!MYcW!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88282a7e-0342-4686-8972-298eb3bc4f8a_1537x945.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!MYcW!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88282a7e-0342-4686-8972-298eb3bc4f8a_1537x945.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!MYcW!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88282a7e-0342-4686-8972-298eb3bc4f8a_1537x945.jpeg" width="1456" height="895" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/88282a7e-0342-4686-8972-298eb3bc4f8a_1537x945.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:895,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:1248437,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!MYcW!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88282a7e-0342-4686-8972-298eb3bc4f8a_1537x945.jpeg 424w, https://substackcdn.com/image/fetch/$s_!MYcW!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88282a7e-0342-4686-8972-298eb3bc4f8a_1537x945.jpeg 848w, https://substackcdn.com/image/fetch/$s_!MYcW!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88282a7e-0342-4686-8972-298eb3bc4f8a_1537x945.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!MYcW!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88282a7e-0342-4686-8972-298eb3bc4f8a_1537x945.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Image Source: <a href="https://jacobin.com/2017/11/the-russian-revolution-at-100">The Russian Revolution at 100</a></em></p><p>The early 20th century saw the left-right divide take on an even greater significance, especially in the wake of World War I. <a href="https://www.history.com/topics/european-history/russian-revolution">The Russian Revolution of 1917</a>, which led to the establishment of the world&#8217;s first communist state, was a pivotal moment for the left-wing movement globally. The revolution inspired leftist movements around the world to pursue similar aims&#8212;namely, the overthrow of capitalist systems in favor of socialist or communist alternatives. Throughout Europe, left-wing parties gained popularity, particularly in countries suffering from economic hardship and political instability following the war.</p><p>Meanwhile, the right wing in Europe became more polarized. Traditional conservative parties continued defending capitalism and social hierarchies, but far-right movements emerged, rejecting socialism and liberal democracy. The rise of fascism in <a href="https://www.britannica.com/place/Italy/The-Fascist-era">Italy under Mussolini</a> and <a href="https://www.ushmm.org/learn/holocaust/aftermath-of-world-war-i-and-the-rise-of-nazism-1918-1933">Nazism in Germany under Hitler</a> represented the <a href="https://wienerholocaustlibrary.org/exhibition/this-fascist-life-radical-right-movements-in-interwar-europe/">extreme right</a>. These movements sought to establish authoritarian regimes based on ultranationalism, militarism, and the rejection of socialist principles. Mussolini and Hitler capitalized on widespread disillusionment with post-war democracy and economic instability, offering a radical alternative to the left&#8217;s vision of classless, egalitarian societies.</p><p>The 1930s, therefore, became a period of intense ideological conflict, with left-wing communism and socialism clashing with right-wing fascism and conservatism. The <a href="https://alba-valb.org/lesson/spanish-civil-war-summary/">Spanish Civil War</a> (1936&#8211;1939) was a microcosm of this broader global struggle, with left-wing republicans and anarchists fighting against the right-wing Nationalists, who were backed by fascist Italy and Nazi Germany. Ultimately, the Nationalists won, establishing a dictatorship under <a href="https://www.biography.com/political-figures/francisco-franco">Francisco Franco</a>, but the Spanish Civil War foreshadowed the more significant conflicts.</p><h3>World War II and the Cold War</h3><p><a href="https://www.history.com/topics/world-war-ii">World War II</a> (1939&#8211;1945) marked the peak of the ideological struggle between left and right. The war pitted the fascist right, led by Nazi Germany, Fascist Italy, and Imperial Japan, against the Allied powers, which included both right-leaning capitalist democracies like the United States and left-leaning communist states like the Soviet Union. Although the right-wing fascists were defeated, the ideological clash between capitalism and communism didn&#8217;t end with the war.</p><p>The <a href="https://www.history.com/topics/cold-war/cold-war-history">Cold War</a> (1947&#8211;1991) that followed World War II was dominated by the left-right ideological battle on a global scale. The left, led by the Soviet Union, sought to spread communism, advocating for state control of the economy, the abolition of private property, and a classless society. The right, led by the United States and its Western allies, championed capitalism, individual freedoms, and democratic governance. The Cold War saw proxy conflicts fought in countries like <a href="https://www.britannica.com/event/Korean-War">Korea</a>, <a href="https://www.pritzkermilitary.org/explore/vietnam-war/history-vietnam">Vietnam</a>, and Afghanistan, as the two ideologies vied for dominance.</p><p>During this period, the right wing in Western democracies, particularly in the United States and Western Europe, became strongly associated with free-market capitalism and opposition to communism. Conservative leaders, such as <a href="https://www.gov.uk/government/history/past-prime-ministers/margaret-thatcher">Margaret Thatcher</a> in the UK and <a href="https://millercenter.org/president/reagan">Ronald Reagan</a> in the U.S., advocated for deregulation, lower taxes, and a reduction in the role of government in economic affairs. They portrayed their policies as a defense against the perceived threats of left-wing socialism and communism.</p><p>On the left, many socialist and social democratic parties in Europe distanced themselves from Soviet-style communism, instead advocating for a mixed economy where the state would provide social welfare programs, healthcare, and education while still maintaining capitalist markets. This form of &#8220;<a href="https://youtu.be/OvJ8YDma7Wk">social democracy</a>&#8221; took root in countries like Sweden, Norway, and Denmark, where strong welfare states and capitalist economies coexisted.</p><h3>Post-Cold War: New Conflicts and Populism</h3><p>After the Cold War, <a href="https://europe.unc.edu/iron-curtain/history/the-fall-of-the-soviet-union/">the collapse of the Soviet Union</a> marked the triumph of capitalism and liberal democracy, but the ideological battle between left and right was far from over. In the 1990s, many left-leaning parties in Western countries shifted toward the center, adopting what became known as the &#8220;<a href="https://www.britannica.com/topic/third-way">Third Way</a>.&#8221; Leaders like <a href="https://clintonwhitehouse4.archives.gov/textonly/WH/EOP/OP/html/Hope.html">Bill Clinton</a> in the U.S. and <a href="https://www.gov.uk/government/history/past-prime-ministers/tony-blair">Tony Blair</a> in the UK embraced free-market economics while maintaining social safety nets, merging aspects of both left and right ideologies.</p><p>Meanwhile, <a href="https://www.investopedia.com/terms/n/neoliberalism.asp">neoliberalism</a>&#8212;characterized by deregulation, free trade, and globalization&#8212;gained momentum, particularly among right-wing parties. However, this economic liberalization led to growing inequality, discontent among the working class, and an erosion of traditional industries. As a result, populist movements began to rise in both the left and right.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!WF1T!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F79b4158b-ef12-491d-88dd-b88f2a297950_800x445.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!WF1T!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F79b4158b-ef12-491d-88dd-b88f2a297950_800x445.jpeg 424w, https://substackcdn.com/image/fetch/$s_!WF1T!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F79b4158b-ef12-491d-88dd-b88f2a297950_800x445.jpeg 848w, https://substackcdn.com/image/fetch/$s_!WF1T!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F79b4158b-ef12-491d-88dd-b88f2a297950_800x445.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!WF1T!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F79b4158b-ef12-491d-88dd-b88f2a297950_800x445.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!WF1T!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F79b4158b-ef12-491d-88dd-b88f2a297950_800x445.jpeg" width="800" height="445" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/79b4158b-ef12-491d-88dd-b88f2a297950_800x445.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:445,&quot;width&quot;:800,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:60064,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!WF1T!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F79b4158b-ef12-491d-88dd-b88f2a297950_800x445.jpeg 424w, https://substackcdn.com/image/fetch/$s_!WF1T!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F79b4158b-ef12-491d-88dd-b88f2a297950_800x445.jpeg 848w, https://substackcdn.com/image/fetch/$s_!WF1T!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F79b4158b-ef12-491d-88dd-b88f2a297950_800x445.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!WF1T!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F79b4158b-ef12-491d-88dd-b88f2a297950_800x445.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Image Source: <a href="https://corporateeurope.org/en/2020/01/post-brexit-eu-uk-trade-deal-based-ceta-would-be-bad-news">Post-Brexit EU-UK</a></em></p><p>On the right, populist leaders capitalized on frustrations with globalization, immigration, and perceived political elites. Figures like <a href="https://www.bbc.com/news/world-us-canada-35318432">Donald Trump</a> in the U.S. and the <a href="https://guides.loc.gov/brexit">Brexit movement</a> in the UK emphasized nationalism, promising to protect national sovereignty and return jobs to domestic workers. Meanwhile, on the left, movements like <a href="https://time.com/6117696/occupy-wall-street-10-years-later/">Occupy Wall Street</a> and figures such as <a href="https://www.sanders.senate.gov/about-bernie/">Bernie Sanders</a> pushed back against corporate power, income inequality, and the influence of the wealthy elite, arguing for more extensive government intervention in the economy. The rise of populism and increasing polarization has also redefined the political landscape. The right continues to advocate for economic deregulation and nationalism, while the left calls for expanded social programs and environmental protections.</p><h2>Conclusion: The Modern Left, Right, and Beyond</h2><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!YonR!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F381ddc59-df44-4eba-87ce-964b527d5973_1796x1800.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!YonR!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F381ddc59-df44-4eba-87ce-964b527d5973_1796x1800.png 424w, https://substackcdn.com/image/fetch/$s_!YonR!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F381ddc59-df44-4eba-87ce-964b527d5973_1796x1800.png 848w, https://substackcdn.com/image/fetch/$s_!YonR!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F381ddc59-df44-4eba-87ce-964b527d5973_1796x1800.png 1272w, https://substackcdn.com/image/fetch/$s_!YonR!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F381ddc59-df44-4eba-87ce-964b527d5973_1796x1800.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!YonR!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F381ddc59-df44-4eba-87ce-964b527d5973_1796x1800.png" width="1456" height="1459" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/381ddc59-df44-4eba-87ce-964b527d5973_1796x1800.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1459,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:639278,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!YonR!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F381ddc59-df44-4eba-87ce-964b527d5973_1796x1800.png 424w, https://substackcdn.com/image/fetch/$s_!YonR!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F381ddc59-df44-4eba-87ce-964b527d5973_1796x1800.png 848w, https://substackcdn.com/image/fetch/$s_!YonR!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F381ddc59-df44-4eba-87ce-964b527d5973_1796x1800.png 1272w, https://substackcdn.com/image/fetch/$s_!YonR!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F381ddc59-df44-4eba-87ce-964b527d5973_1796x1800.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Image Source: <a href="https://www.reddit.com/r/PoliticalCompassMemes/comments/fzx0fp/very_detailed_political_compass/">Reddit -&gt; Very Details Political Compass</a></em></p><p>The terms &#8220;left&#8221; and &#8220;right,&#8221; born from the French Revolution, continue to shape the world today, but they no longer define the full complexity of political ideologies. While the left pushes for progressive reforms, as exemplified by Obama&#8217;s &#8220;<a href="https://www.washingtonpost.com/blogs/the-fix/post/president-obama-a-man-of-many-slogans/2012/07/10/gJQAf8UlaW_blog.html">Change</a>,&#8221; and the right advocates for a return to tradition, as in Trump&#8217;s &#8220;<a href="https://www.presidency.ucsb.edu/documents/2024-republican-party-platform">Make America Great Again</a>,&#8221; politics is far more nuanced. Centrism, libertarianism, social democracy, and environmentalism are just a few examples of the many ideologies people turn to in shaping their vision for society. Some experts argue that the traditional definitions of right and left make little sense in today&#8217;s landscape. This <a href="https://hiddenforces.io/podcasts/rise-of-the-new-right-2024-u-s-elections-henry-olsen/">Hidden Forces podcast discussion</a> with <a href="https://eppc.org/author/henry_olsen/">Henry Olsen</a> a columnist that provides commentary on American politics is an excellent example of such discussion. Understanding these diverse ideas as we navigate modern politics can help us better grasp the complexity of today&#8217;s political landscape.</p><p>Finally, in the upcoming 2024 Presidential Elections, the right-wing candidate, Donald Trump, is running on a platform that emphasizes securing the U.S. border, deporting illegal immigrants, and boosting domestic manufacturing to make America more self-reliant. He focuses on lowering taxes, ending inflation, and positioning the U.S. as the world&#8217;s dominant energy producer. Trump advocates for strengthening the military, protecting Social Security without cuts, and combating what he refers to as &#8220;radical gender ideology&#8221; in schools. He also supports secure elections through measures like voter ID and paper ballots. Overall, his platform promotes strong national defense, economic independence, and a focus on traditional values and freedoms. You can read more about Trump&#8217;s platform <a href="https://www.donaldjtrump.com/platform">here</a>. On the other hand, the left-wing candidate, Kamala Harris, is running on the Democratic Party platform that revolves around building economic growth for working families, expanding access to affordable healthcare, and tackling the climate crisis through clean energy investments. It prioritizes social justice by defending reproductive rights, addressing racial and gender inequities, and protecting LGBTQ+ rights. The platform also calls for stronger gun safety laws, law enforcement reform, and greater access to education, including lowering student debt and expanding universal pre-K and affordable childcare. Ultimately, it seeks to promote equity, environmental sustainability, and comprehensive social reforms. You can read the DNC Platform for 2024 <a href="https://democrats.org/news/dnc-releases-2024-party-platform-to-be-voted-on-at-convention/">here</a>.</p><h2>Bonus: The Story Behind Red and Blue in U.S. Politics and the Origins of the Donkey and Elephant Symbols</h2><p>Interestingly, the association of red and blue with U.S. political parties is a relatively recent development. Before the 2000 U.S. Presidential election, there was no consistent color scheme for Democrats and Republicans. In fact, throughout much of the 20th century, news outlets used varying color assignments, often reversing what we know today.</p><p>The 2000 election, a prolonged battle over the results between George W. Bush and Al Gore, solidified the red and blue divide. Major TV networks consistently used blue for Democrats and red for Republicans in their electoral maps, and the color scheme stuck. This is somewhat unusual compared to other countries, where red signifies left-wing or socialist parties, and blue is often associated with conservative movements. Nonetheless, in the U.S., blue has come to symbolize the Democratic Party and red the Republican Party&#8212;creating a lasting visual shorthand for America&#8217;s political divide. These videos provide some useful context into this history: <a href="https://www.youtube.com/watch?v=lgz3p4cEXZU">Why red means Republican and blue means Democrat</a>, <a href="https://www.youtube.com/watch?v=pNBgQjHIPY8">America 101: Why Red for Republicans and Blue for Democrats? | History</a>, and <a href="https://www.youtube.com/watch?v=WMb22djtY0c">Why Red is Republican &amp; Blue is Democrat: States &amp; Party Colors | Democrat &amp; Republican History</a>.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!kQtI!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0ebe6dfd-6a7f-4a3b-8bbd-e7eca585b0d3_1110x1670.webp" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!kQtI!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0ebe6dfd-6a7f-4a3b-8bbd-e7eca585b0d3_1110x1670.webp 424w, https://substackcdn.com/image/fetch/$s_!kQtI!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0ebe6dfd-6a7f-4a3b-8bbd-e7eca585b0d3_1110x1670.webp 848w, https://substackcdn.com/image/fetch/$s_!kQtI!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0ebe6dfd-6a7f-4a3b-8bbd-e7eca585b0d3_1110x1670.webp 1272w, https://substackcdn.com/image/fetch/$s_!kQtI!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0ebe6dfd-6a7f-4a3b-8bbd-e7eca585b0d3_1110x1670.webp 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!kQtI!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0ebe6dfd-6a7f-4a3b-8bbd-e7eca585b0d3_1110x1670.webp" width="352" height="529.5855855855856" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/0ebe6dfd-6a7f-4a3b-8bbd-e7eca585b0d3_1110x1670.webp&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1670,&quot;width&quot;:1110,&quot;resizeWidth&quot;:352,&quot;bytes&quot;:570704,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/webp&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!kQtI!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0ebe6dfd-6a7f-4a3b-8bbd-e7eca585b0d3_1110x1670.webp 424w, https://substackcdn.com/image/fetch/$s_!kQtI!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0ebe6dfd-6a7f-4a3b-8bbd-e7eca585b0d3_1110x1670.webp 848w, https://substackcdn.com/image/fetch/$s_!kQtI!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0ebe6dfd-6a7f-4a3b-8bbd-e7eca585b0d3_1110x1670.webp 1272w, https://substackcdn.com/image/fetch/$s_!kQtI!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0ebe6dfd-6a7f-4a3b-8bbd-e7eca585b0d3_1110x1670.webp 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Image Source: <a href="https://www.cnn.com/style/article/why-democrats-are-donkeys-republicans-are-elephants-artsy/index.html">Why Democrats are donkeys and Republicans are elephants</a></em></p><p>As for the donkey and elephant, these iconic symbols have deeper historical roots. The donkey first became associated with the Democratic Party in the 1828 presidential campaign of <a href="https://www.whitehouse.gov/about-the-white-house/presidents/andrew-jackson/">Andrew Jackson</a>, when his opponents called him a &#8220;jackass.&#8221; Instead of shying away from the insult, Jackson embraced the image, and it stuck. The elephant came to symbolize the Republican Party thanks to a <a href="https://www.rarenewspapers.com/view/597224">political cartoon</a> by <a href="https://thomasnast.com/">Thomas Nast</a> published in <a href="https://www.cnn.com/style/article/why-democrats-are-donkeys-republicans-are-elephants-artsy/index.html">Harper&#8217;s Weekly in 1874</a>. The cartoon depicted the Republican vote as an elephant, solidifying its association with the party over time. You can learn more in this video: <a href="https://www.youtube.com/watch?v=vWobTSngE0w">Two Minute Explainer: Why are Republicans elephants and Democrats donkeys?</a>.</p><h3>References</h3><p>While I have cited several sources in this blog post, below are some other resources that I used to write it and that can be useful for your further learning.</p><ul><li><p><a href="https://www.youtube.com/watch?v=JlQ5fGECmsA&amp;t=46s">The Political Spectrum Explained In 4 Minutes</a></p></li><li><p><a href="https://time.com/5673239/left-right-politics-origins/">What to Know About the Origins of &#8216;Left&#8217; and &#8216;Right&#8217; in Politics, From the French Revolution to the 2020 Presidential Race</a></p></li><li><p><a href="https://www.unifrog.org/know-how/understanding-the-political-spectrum">Understanding the political spectrum</a></p></li><li><p><a href="https://www.ssa.gov/history/ottob.html">Otto von Bismarck</a></p></li><li><p><a href="https://www.labrujulaverde.com/en/2020/04/whats-the-origin-of-the-right-and-left-terms-in-politics/">What&#8217;s the origin of the right and left terms in politics?</a></p></li><li><p><a href="https://www.rarenewspapers.com/view/597224?imagelist=1">Thomas Nast&#8217;s first Republican elephant print</a></p></li><li><p><a href="https://www.youtube.com/watch?v=0DLjzp645is">Political Spectrum Explained | What is the Political Spectrum? | Left Vs Right</a></p></li><li><p><a href="https://www.youtube.com/watch?v=BjQHuBvdyNg">Political Spectrums Explained &#8212; Why is there a left-wing and right wing?</a></p></li><li><p><a href="https://www.youtube.com/watch?v=CcXVtQMpqT4">What&#8217;s the deal with left and right in politics?&#8239;| Politics Explained (Easily) | ABC News</a></p></li><li><p><a href="https://www.youtube.com/watch?v=9cz4ikFcwMY">Every Political Ideology Explained in 8 Minutes</a></p></li><li><p><a href="https://www.youtube.com/watch?v=j_k_k-bHigM">Political Ideology: Crash Course Government and Politics #35</a></p></li><li><p><a href="https://www.youtube.com/watch?v=XJA3EhyVPc0">The Political Spectrum</a></p></li><li><p><a href="https://www.youtube.com/watch?v=B3uevocEy3c">How we know what Left and Right actually mean: who&#8217;s who, 1789-1917</a></p></li><li><p><a href="https://www.history.com/news/how-did-the-political-labels-left-wing-and-right-wing-originate">Where Did the Terms &#8216;Left Wing&#8217; and &#8216;Right Wing&#8217; Come From?</a></p></li><li><p><a href="https://www.youtube.com/watch?v=lTTvKwCylFY">The French Revolution: Crash Course World History #29</a></p></li><li><p><a href="https://www.youtube.com/watch?v=NOJV9-24rIY">Left Wing, Centre and Right Wing Explained | Conservatives, Labour &amp; Liberal Democrats Summarised!</a></p></li><li><p><a href="https://thehistoryofrome.typepad.com/revolutions_podcast/2014/07/31-the-three-estates-.html">The Three Estates</a></p></li><li><p><a href="https://www.slowboring.com/p/a-history-and-defense-of-left-vs">A history (and defense) of left vs right</a></p></li><li><p><a href="https://www.presidency.ucsb.edu/documents/2024-democratic-party-platform">2024 Democratic Party Platform</a></p></li><li><p><a href="https://projects.fivethirtyeight.com/kamala-harris-poll-quiz-2024/">Can You Guess How Americans Feel About Harris&#8217;s Platform?</a></p></li><li><p><a href="https://www.youtube.com/watch?v=zqllxbPWKNI">The Napoleonic Wars - OverSimplified (Part 1)</a></p></li><li><p><a href="https://www.youtube.com/watch?v=mY3SEMTROas">The Napoleonic Wars - OverSimplified (Part 2)</a></p></li><li><p><a href="https://origins.osu.edu/review/global-reach-napoleonic-wars">The Global Reach of the Napoleonic Wars</a></p></li><li><p><a href="https://www.erih.net/how-it-started/the-industrial-revolution-in-europe">THE INDUSTRIAL REVOLUTION IN EUROPE</a></p></li><li><p><a href="https://www.youtube.com/watch?v=CDR1zwy9h2Q">Talking About Politics: LEFT WING &amp; RIGHT WING</a></p></li></ul>]]></content:encoded></item><item><title><![CDATA[A Basic Introduction to Tactics in Soccer]]></title><description><![CDATA[The goal is to score &#9917;]]></description><link>https://notebook.mubbie.dev/p/a-basic-introduction-to-tactics-in-soccerhtml</link><guid isPermaLink="false">https://notebook.mubbie.dev/p/a-basic-introduction-to-tactics-in-soccerhtml</guid><dc:creator><![CDATA[Mubarak Idoko]]></dc:creator><pubDate>Tue, 13 Aug 2024 00:00:00 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1ac14caa-52d7-4405-9137-bcc0aaa62e2a_3419x2464.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!bKhN!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1ac14caa-52d7-4405-9137-bcc0aaa62e2a_3419x2464.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!bKhN!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1ac14caa-52d7-4405-9137-bcc0aaa62e2a_3419x2464.jpeg 424w, https://substackcdn.com/image/fetch/$s_!bKhN!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1ac14caa-52d7-4405-9137-bcc0aaa62e2a_3419x2464.jpeg 848w, https://substackcdn.com/image/fetch/$s_!bKhN!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1ac14caa-52d7-4405-9137-bcc0aaa62e2a_3419x2464.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!bKhN!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1ac14caa-52d7-4405-9137-bcc0aaa62e2a_3419x2464.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!bKhN!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1ac14caa-52d7-4405-9137-bcc0aaa62e2a_3419x2464.jpeg" width="1456" height="1049" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/1ac14caa-52d7-4405-9137-bcc0aaa62e2a_3419x2464.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1049,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:7207524,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!bKhN!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1ac14caa-52d7-4405-9137-bcc0aaa62e2a_3419x2464.jpeg 424w, https://substackcdn.com/image/fetch/$s_!bKhN!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1ac14caa-52d7-4405-9137-bcc0aaa62e2a_3419x2464.jpeg 848w, https://substackcdn.com/image/fetch/$s_!bKhN!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1ac14caa-52d7-4405-9137-bcc0aaa62e2a_3419x2464.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!bKhN!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1ac14caa-52d7-4405-9137-bcc0aaa62e2a_3419x2464.jpeg 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Image Source: <a href="https://www.cartoonmovement.com/cartoon/football-tactics">Cartoon Movement | Gatis Sluka</a></em></p><p>I&#8217;ll start this post with a light-hearted apology to my dear friends and other readers who, upon seeing the title, are already rolling their eyes. &#8220;Soccer? What do you mean? It&#8217;s football!&#8221; I hear your cries and trust me; I get it. After all, I grew up in Nigeria, where the word &#8220;football&#8221; is as sacred as jollof rice at a family gathering. But bear with me&#8212;I have my reasons. Back in my secondary school days, we played a lot of football&#8212;or, as we liked to call it, soccer. Yes, you read that right. We were the kids who thought we were too cool for &#8220;football.&#8221; I mean, we even refused to call <em>akara</em> or <em>kosai</em> by the names everyone else used, insisting on the far more sophisticated <em>&#8220;Bean Cake.&#8221;</em> So, when my friends wanted to hit the pitch, they didn&#8217;t say, &#8220;Let&#8217;s go play some football.&#8221; No way! They&#8217;d say, &#8220;Let&#8217;s go tap soccer!&#8221; It was a whole vibe. So, for nostalgia&#8217;s sake&#8212;and maybe because I now live in America, where &#8220;soccer&#8221; reigns supreme&#8212;I&#8217;ll be sticking with &#8220;soccer&#8221; for this post. But rest assured, my football-loving heart is still very much intact.</p><p>Now, onto the main event: why am I writing about tactics in soccer? I&#8217;m no tactical genius, but I&#8217;ve been playing in a Division 3 league, and let&#8217;s say I&#8217;m itching for more wins. We&#8217;ve got some incredible folks on our team, but when we stack up against other squads, the odds aren&#8217;t always in our favor. So, what&#8217;s a desperate player to do? Dive headfirst into the world of soccer tactics, of course! I&#8217;ve been reading, researching, and obsessing over formations, marking strategies, and every other tactical tidbit I can find to help my team squeeze out that extra edge and, hopefully, leave the other teams in the dust. It also helps that, at various times, our team captain and coach have referred to me as the Assistant Coach (though sometimes I&#8217;m just the assistant to the assistant coach&#8212;but you get the picture). My team has all the right personnel; hence, I am optimistic that slight adjustments to playing style and approach will propel us to several victories. So, should we go all-in with a high-intensity <code>gegenpressing</code> strategy (that&#8217;ll be hard to keep up)? Stick to long balls? Or maybe build up from the back like the pros do? And what about formations&#8212;4-4-2, 4-3-3, 4-2-3-1? The options are endless!</p><p>As I write this, I&#8217;m also reminded of my final year in secondary school, when I spent countless hours playing Football Manager with my close friend, Bamshak, and my roommate, Dama. We would obsess over tactics, trying to determine how to gain an advantage. Admittedly, much of the game was about playing the market to build the right squad, but how you put that squad together, and the game plan mattered just as much. For old-time&#8217;s sake, below is a picture of me and Bamshak. You can probably guess what we were discussing. Let me help you&#8212;we were playing Football Manager on a Saturday (we went to boarding school) when we lost power (in Nigeria, frequent power outages were the norm). So, we finally decided to step outside and ended up sitting by the basketball court, discussing tactics and how to maximize our chances of winning. What a wonderful time that was.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!YpIM!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5dbadaf1-56b8-4eda-a084-730f0f77fe5d_4608x3456.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!YpIM!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5dbadaf1-56b8-4eda-a084-730f0f77fe5d_4608x3456.jpeg 424w, https://substackcdn.com/image/fetch/$s_!YpIM!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5dbadaf1-56b8-4eda-a084-730f0f77fe5d_4608x3456.jpeg 848w, https://substackcdn.com/image/fetch/$s_!YpIM!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5dbadaf1-56b8-4eda-a084-730f0f77fe5d_4608x3456.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!YpIM!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5dbadaf1-56b8-4eda-a084-730f0f77fe5d_4608x3456.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!YpIM!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5dbadaf1-56b8-4eda-a084-730f0f77fe5d_4608x3456.jpeg" width="1456" height="1092" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/5dbadaf1-56b8-4eda-a084-730f0f77fe5d_4608x3456.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1092,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:5965995,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!YpIM!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5dbadaf1-56b8-4eda-a084-730f0f77fe5d_4608x3456.jpeg 424w, https://substackcdn.com/image/fetch/$s_!YpIM!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5dbadaf1-56b8-4eda-a084-730f0f77fe5d_4608x3456.jpeg 848w, https://substackcdn.com/image/fetch/$s_!YpIM!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5dbadaf1-56b8-4eda-a084-730f0f77fe5d_4608x3456.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!YpIM!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5dbadaf1-56b8-4eda-a084-730f0f77fe5d_4608x3456.jpeg 1456w" sizes="100vw"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p></p><p>As I&#8217;ve already said, I&#8217;m no expert, but I&#8217;m learning as I go, and I want to share some of what I&#8217;ve uncovered. In this post, I&#8217;ll dive into tactical divisions of the pitch, phases of play, positional play, marking strategies, and a few other exciting things I have learned about tactics in soccer. So, stick around, enjoy the read, and share your thoughts on different vital tactics and considerations in soccer. And as an excellent introduction to the positions players take on the pitch, check out this <a href="https://www.youtube.com/watch?v=HgSJdoO5CeI">video</a> as well as <a href="https://www.youtube.com/watch?v=RNvcFG6LX1o">this one</a> to get a quick overview of formations.</p><h2>Basic Soccer Pitch Zones</h2><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!GwYg!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8dac8d07-7e9c-4b1f-82d1-b009689788a1_850x259.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!GwYg!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8dac8d07-7e9c-4b1f-82d1-b009689788a1_850x259.png 424w, https://substackcdn.com/image/fetch/$s_!GwYg!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8dac8d07-7e9c-4b1f-82d1-b009689788a1_850x259.png 848w, https://substackcdn.com/image/fetch/$s_!GwYg!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8dac8d07-7e9c-4b1f-82d1-b009689788a1_850x259.png 1272w, https://substackcdn.com/image/fetch/$s_!GwYg!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8dac8d07-7e9c-4b1f-82d1-b009689788a1_850x259.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!GwYg!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8dac8d07-7e9c-4b1f-82d1-b009689788a1_850x259.png" width="850" height="259" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/8dac8d07-7e9c-4b1f-82d1-b009689788a1_850x259.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:259,&quot;width&quot;:850,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:95246,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!GwYg!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8dac8d07-7e9c-4b1f-82d1-b009689788a1_850x259.png 424w, https://substackcdn.com/image/fetch/$s_!GwYg!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8dac8d07-7e9c-4b1f-82d1-b009689788a1_850x259.png 848w, https://substackcdn.com/image/fetch/$s_!GwYg!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8dac8d07-7e9c-4b1f-82d1-b009689788a1_850x259.png 1272w, https://substackcdn.com/image/fetch/$s_!GwYg!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8dac8d07-7e9c-4b1f-82d1-b009689788a1_850x259.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Image Source: <a href="https://doi.org/10.1038/s41598-024-62480-7">Scientific Reports Journal</a></em></p><p>The soccer pitch is commonly divided into zones to better understand and strategize play. The two most basic ways to divide the pitch are the 4-zone division, with dividing lines running from sideline to sideline, and the 5-channel division, with dividing lines running between the end lines.</p><h3>4-Zone Division</h3><p>The 4-zone division mirrors the progression of play, starting from the goalkeeper and advancing toward the opposition&#8217;s goal. The zones are as follows: <code>Starting (Build) Zone</code>, <code>Progression Zone</code>, <code>Unbalanced (Penetrate) Zone</code>, and <code>Goal (Finish) Zone</code>. These zones aren&#8217;t fixed to specific areas of the pitch but shift depending on the opposition&#8217;s shape. Typically, each zone begins just behind the opposition&#8217;s line of defense.</p><p>This division ties into the &#8220;phases of play&#8221; in soccer, which include <code>in possession</code>, <code>out of possession</code>, <code>transitions</code>, and <code>set-pieces</code>. I&#8217;ll focus on the in-possession phase here. It usually starts from the back, with the team in possession occupying the Build Zone. The team pushes the ball up the pitch, often at a high tempo with quick, short passes, offering support to the ball carrier. After bypassing the opposition&#8217;s first line of press (where the opposition applies immediate pressure to regain possession), the team enters the Progression Zone, attempting to break through the opposition&#8217;s block and move toward the Goal Zone. The Progression and Unbalanced Zones are often considered a single unit, making up the middle third of the pitch. In these zones, the team aims to advance into the final third, usually sending the ball to wingers or strikers in the Unbalanced Zone to create scoring opportunities in the Goal Zone. Some tactics might skip the first two zones entirely, with the goalkeeper sending long balls directly into the Unbalanced and Goal Zones&#8212;a common strategy in long-ball tactics. Teams employ various techniques to advance through these zones, such as forming triangles to create clear passing options.</p><h3>5-Channel Division</h3><p>The 5-channel division divides the pitch into the <code>wings (outside right and left lanes)</code>, <code>half-spaces (inside right and left lanes)</code>, and the <code>center lane</code>. Typically, one attacking player occupies each channel, maintaining a presence across the pitch. The players at the back use this structure to advance the ball forward, creating opportunities to score by exploiting the channels.</p><h3>Other Division Methods</h3><p>Beyond these basic methods, more sophisticated ways to divide a soccer pitch exist. One such method is the 18-zone division of the pitch, as shown in the image below:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!brw7!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a83ec9d-b7a7-4eaa-b4cc-585e5ccde460_850x723.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!brw7!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a83ec9d-b7a7-4eaa-b4cc-585e5ccde460_850x723.png 424w, https://substackcdn.com/image/fetch/$s_!brw7!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a83ec9d-b7a7-4eaa-b4cc-585e5ccde460_850x723.png 848w, https://substackcdn.com/image/fetch/$s_!brw7!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a83ec9d-b7a7-4eaa-b4cc-585e5ccde460_850x723.png 1272w, https://substackcdn.com/image/fetch/$s_!brw7!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a83ec9d-b7a7-4eaa-b4cc-585e5ccde460_850x723.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!brw7!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a83ec9d-b7a7-4eaa-b4cc-585e5ccde460_850x723.png" width="850" height="723" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/4a83ec9d-b7a7-4eaa-b4cc-585e5ccde460_850x723.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:723,&quot;width&quot;:850,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:555275,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!brw7!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a83ec9d-b7a7-4eaa-b4cc-585e5ccde460_850x723.png 424w, https://substackcdn.com/image/fetch/$s_!brw7!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a83ec9d-b7a7-4eaa-b4cc-585e5ccde460_850x723.png 848w, https://substackcdn.com/image/fetch/$s_!brw7!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a83ec9d-b7a7-4eaa-b4cc-585e5ccde460_850x723.png 1272w, https://substackcdn.com/image/fetch/$s_!brw7!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a83ec9d-b7a7-4eaa-b4cc-585e5ccde460_850x723.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Image Source: <a href="https://doi.org/10.1038/s41598-024-62480-7">Frontiers of Psychology</a></em></p><p>This more detailed division helps players better understand their roles and positions, allowing them to adapt based on the opposition&#8217;s strategy. Ideally, no more than two players should occupy the same zone simultaneously to cover the pitch&#8217;s full depth and width. Zone 14 is considered the most dangerous in this division because most through balls and critical passes tend to originate from here. Controlling this zone has been proven to increase the chances of scoring goals. It is considered a vital distribution zone and the prime spot for sending balls into zone 17, where <a href="https://www.americansocceranalysis.com/home/2021/3/11/where-goals-come-from-putting-balls-into-the-box">most goals are scored from</a>. You can learn more about the importance of zone 14 in these articles: <a href="https://leochanperformanceanalysis.blogspot.com/2013/08/what-is-zone-14-in-football.html">What is &#8220;Zone 14&#8221; in football?</a>, <a href="https://totalfootballanalysis.com/article/create-chances-zone-14-tactical-analysis-tactics">How to create chances through Zone 14</a> and this video: <a href="https://youtu.be/Zs4iMmRrw80">Why is Zone 14 Important in Football?</a>.</p><p>Even more intricate is Pep Guardiola&#8217;s 20-zone system, which optimizes for positional play and ensures that every player knows where they need to be and when. While I won&#8217;t delve deeply into this system here (a few words cannot do justice to the zoning strategies used by the soccer genius Pep Guardiola), here are some excellent resources to explore: <a href="https://youtu.be/jVE3Sqatdlg">How Pep Sees Football Differently | What Separates Pep Guardiola | Pep Guardiola&#8217;s 20 Zone System</a>, <a href="https://www.theguardian.com/football/2018/apr/16/tactics-pep-guardiola-manchester-city-title">Vulnerable channels and 20 zones: the tactics behind Guardiola&#8217;s title win</a>. Even in Pep&#8217;s tactics, zone 14 remains crucial, offering midfielders the best opportunities to generate goals.</p><p>Now that we understand how the pitch can be divided let&#8217;s explore the phases of play in a soccer game.</p><h2>Phases of Play</h2><p>The phases of play in soccer can be divided into four main categories: <code>In Possession (Attack)</code>, <code>Out of Possession (Defense)</code>, <code>Transitions</code>, and <code>Set Pieces</code>. When a team is in the In Possession phase, they progress through the pitch, starting with the build-up from the back, moving into the progression phase through the middle, and finally reaching the attack phase in the final third of the pitch. In this final stage, the team focuses on creating and executing goal-scoring opportunities.</p><p>For each of these three <code>In Possession</code> stages, there is a corresponding <code>Out of Possession</code> stage that mirrors it, defined by the ball&#8217;s location on the pitch. A team may be in a high block stage when pressing the opposing team as they attempt to build up play. In the high block stage, the team maintains a high defensive line and a compact shape to win the ball back. If the pressing line is broken, the team reshapes and falls back into a mid-block stage, where the defensive line stays relatively high to prevent the opposition from advancing toward their goal. Finally, in the low block stage, the team adopts a more intensive and deliberate defensive approach, maintaining a compact shape to prevent the opposition from making dangerous attempts near the goal.</p><p>Teams are generally either In Possession or Out of Possession, and the moments when the ball changes hands constitute the <code>Transitions</code> phase. This can be an out-to-in transition (defense to attack) or an in-to-out transition (attack to defense). These moments of transition are very brief but crucial. If a team loses the ball, they must quickly decide whether to initiate a counter-press to win it back immediately or to delay the opposition&#8217;s ball carrier while rapidly falling back into a defensive shape. Conversely, the team that has just regained possession must decide whether to counterattack immediately if the opposition is unbalanced or to transition the ball out of pressure to reestablish possession and build up to an attack.</p><p>Finally, the Set Pieces phase occurs during free kicks, corner kicks, penalties, throw-ins, and sometimes kickoffs. Every attacking set piece has a corresponding defensive setup. Set pieces are critical moments in the game, as they determine how a team positions itself and prepares to defend or take control of the ball to launch an attack.</p><h2>Optimizing Tactics: Some Strategies and Methods</h2><p>Now that we have a basic understanding of pitch divisions and the phases of play in a soccer game, we can dive into some intriguing tactical nuggets that teams use to optimize their chances on the pitch. First, we&#8217;ll explore some defensive strategies before moving on to broader team tactics that shape the game.</p><h3>Defending Tactics: Keeping the Opposition at Bay</h3><h4>Man vs. Zonal Marking</h4><p>Defending is an art in soccer, and marking is one of its most crucial elements. Teams often choose between man and zonal marking depending on their defensive philosophy. In man marking, defenders are tasked with shadowing specific opponents, ensuring that the opposing team&#8217;s key players are tightly marked. This can be incredibly effective against star players who can turn the game on its head with a single moment of brilliance. On the other hand, zonal marking focuses on covering areas of the pitch rather than individual players. This approach helps maintain the team&#8217;s shape and prevents gaps from opening up in the defense. A great example of zonal marking can be found in the <a href="https://jobsinfootball.com/blog/tactics/what-is-catenaccio/">Italian team&#8217;s famous catenaccio system</a>, which is built around a tight, organized defense that prioritizes space over players. Both systems have their merits, and teams often use a combination of the two to adapt to different situations on the pitch. While reading and writing this post, I stumbled across various resources, particularly about the Italian catenaccio system. You can watch <a href="https://www.youtube.com/watch?v=R_y4aQ8kSEY">this video</a> to see Italy&#8217;s beautiful defensive organization and movement in Euro 2016.</p><h4>High Defensive Line</h4><p>Another critical defensive tactic, especially in modern soccer, is playing with a high defensive line. This strategy involves pushing the defense further up the pitch, effectively compressing the space available for the opposition to play in. It&#8217;s a hallmark of teams that like to dominate possession and press aggressively, like J&#252;rgen Klopp&#8217;s Liverpool or Pep Guardiola&#8217;s Manchester City. Learn about their tactics in <a href="https://www.youtube.com/watch?v=lkxXePQul0M">this video</a>. The high line is a double-edged sword; it can suffocate an opponent&#8217;s build-up play, but it also leaves space behind that can be exploited by quick forwards. One spectacular failure of this tactic is in this poor-quality but helpful <a href="https://www.youtube.com/watch?v=MXLg9xTOR1k">video</a> of Borussia Dortmund taking advantage of FC Bayern Munich&#8217;s incredibly high defensive line.</p><h4>Parking the Bus</h4><p>At the opposite end of the spectrum, we have the infamous tactic of parking the bus. This ultra-defensive approach involves setting up deep in one&#8217;s own half, with many players behind the ball to frustrate the opposition. Jos&#233; Mourinho&#8217;s Chelsea utilized this tactic at various times in their title-winning 2014-15 Premier League season, maintaining a low block defensive position and preventing opposing teams from penetrating. You can learn about their tactics in this <a href="https://www.youtube.com/watch?v=MfG9QOXaPAE&amp;t=64s">video</a> or <a href="https://www.youtube.com/watch?v=y2GtU37jnMA">this</a> analysis of a Chelsea vs Barcelona game.</p><h3>Team Tactics: Shaping the Game</h3><h4>Total Football</h4><p>Now, let&#8217;s move on to broader team tactics that have revolutionized the game. Total Football, pioneered by the Dutch in the 1970s, is all about fluidity and versatility <a href="https://www.youtube.com/watch?v=4-pbT0gLd3I">(for instance, in the 1974 World Cup)</a>. In this system, players are not confined to specific positions. Instead, they move freely across the pitch, with the understanding that another player will cover their position. This requires immense technical skill and tactical awareness. Johan Cruyff&#8217;s Ajax and the Dutch national team were the epitome of Total Football, with players like Ruud Krol and Johan Neeskens seamlessly switching roles to create a dynamic and unpredictable attack. Fictionally, <a href="https://www.youtube.com/watch?v=0ygsSTMRo-Y">AFC Richmond deployed this tactic</a> in the Apple TV+ Series: Ted Lasso (strongly recommend).</p><h4>Positional Play</h4><p>In contrast to the fluidity of Total Football, positional play&#8212;often associated with Pep Guardiola&#8212;emphasizes structure and discipline. Players are expected to occupy specific zones on the pitch, ensuring the team maintains its shape and effectively controls space. This approach allows for better ball circulation and quick pressing when possession is lost. Guardiola&#8217;s Manchester City squad have become masters of positional play, using their precise passing and spatial awareness to dominate games and create scoring opportunities.</p><h4>Tiki-Taka</h4><p>Building on the principles of positional play, tiki-taka is a style that prioritizes short, quick passes and movement to keep possession and patiently break down the opposition&#8217;s defense. Popularized by Pep Guardiola&#8217;s Barcelona and later adopted by the Spanish national team, tiki-taka is a mesmerizing blend of precision and patience. The 2010 World Cup-winning Spanish team is perhaps the best example of tiki-taka in action, where players like Xavi, Iniesta, and Busquets dictated the tempo, slowly but surely wearing down their opponents before delivering the killer blow. Learn more about it in this <a href="https://www.youtube.com/watch?v=sR67JvLNn9U&amp;t=261s">video</a>.</p><h4>Build-Up Play</h4><p>Central to many of these tactics is the concept of build-up play. This involves carefully moving the ball from the back through the midfield and into the attack, often through a series of short, controlled passes. Build-up play is designed to maintain possession and create openings in the opposition&#8217;s defense. It&#8217;s a systematic approach, contrasting with the more direct styles that rely on long balls or quick transitions. Teams like Manchester City under Guardiola or Barcelona under Guardiola and Luis Enrique have perfected build-up play, using it to draw opponents out of position before striking with lethal efficiency.</p><h4>Gegenpressing</h4><p>Finally, we come to <code>gegenpressing</code>, a tactic that combines intense pressing with quick transitions. When a team loses possession, they immediately press the opposition to win the ball back, often in advanced positions. This strategy, championed by J&#252;rgen Klopp at Borussia Dortmund and Liverpool, is about quickly regaining control and catching the opponent off guard. The 2019 Champions League semi-final between Liverpool and Barcelona is a masterclass in <code>gegenpressing</code>, with Liverpool&#8217;s relentless pressure forcing Barcelona into mistakes and leading to one of the most dramatic comebacks in football history. See an analysis of that game <a href="https://www.youtube.com/watch?v=zbtz7v-hiSk&amp;t=54s">here</a>.</p><p>Each tactic has its own place in the rich tapestry of soccer strategy. Whether it&#8217;s the fluid dynamism of Total Football, the meticulous precision of tiki-taka, or the relentless intensity of <code>gegenpressing</code>, these methods help teams optimize their performance and outmaneuver their opponents on the pitch. Understanding these strategies enhances our appreciation of the game and provides valuable insights into how the world&#8217;s best teams consistently find ways to win.</p><h2>Closing</h2><p>Writing this post has been an absolute joy&#8212;I&#8217;ve loved diving deep into the tactics that make soccer so fascinating. It&#8217;s been a rewarding journey, from revisiting old memories to discovering new strategies. I focused on the parts I found most interesting, but there&#8217;s so much more to explore. I hope you keep digging deeper into this beautiful game.</p><p>Thanks for reading! I&#8217;d love to hear your thoughts and any tactics that have caught your eye. Until next time, keep enjoying the beautiful game! &#9917;</p><h3>References</h3><p>And resources to learn more from:</p><ul><li><p><a href="https://www.coachesvoice.com/cv/formations-football-tactics-explained-best-most-used/">Formations: football tactics explained</a></p></li><li><p><a href="https://bleacherreport.com/articles/1360111-man-marking-or-zonal-outlining-the-arguments-for-both-defensive-approaches">Man Marking or Zonal? Outlining the Arguments for Both Defensive Approaches</a></p></li><li><p><a href="https://jobsinfootball.com/blog/tactics/what-is-catenaccio/">What Is Catenaccio?</a></p></li><li><p><a href="https://bleacherreport.com/articles/2451650-key-tactical-decisions-that-took-chelsea-to-the-premier-league-title">Key Tactical Decisions That Took Chelsea to the Premier League Title</a></p></li><li><p><a href="https://www.youtube.com/watch?v=3aquVwSOQ3s">Klopp&#8217;s Tactics Behind The Greatest Season | Liverpool&#8217;s 2019/20 Tactics | How Klopp Improved LFC |</a></p></li><li><p><a href="https://youtube.com/playlist?list=PLWYJXDKS21OE6Sje-oOr_cpI01kF505kL&amp;si=c_XU7mx62VtT0O8F">Formations Explained</a></p></li><li><p><a href="https://youtube.com/playlist?list=PLWYJXDKS21OGVHJDAFL2wExNAkqvYYK3C&amp;si=ff3DVJjCLYFsV6Ji">Tifo Football Encyclopedia</a></p></li><li><p><a href="https://youtube.com/playlist?list=PLWYJXDKS21OE39KTymISkCrgCckZh2_sD&amp;si=auxFCdlZQuDut8uE">Tactics Explained | Tifo Football</a></p></li><li><p><a href="https://youtube.com/playlist?list=PLJF7aT_2oEpKNVFldYqQtQ0eo2jGXmCvL&amp;feature=shared">Fundamentals of Football</a></p></li><li><p><a href="https://youtube.com/playlist?list=PLJF7aT_2oEpLAE58Xon1lJg3mLJTEF0Q5&amp;feature=shared">Formation Principles</a></p></li><li><p><a href="https://youtube.com/playlist?list=PLJF7aT_2oEpJVL_8H_YKYtbNv6qVNyfVA&amp;feature=shared">Player Principles</a></p></li></ul>]]></content:encoded></item><item><title><![CDATA[Broadcasting in Spark 📣]]></title><description><![CDATA[And a small introduction to Distributed Systems]]></description><link>https://notebook.mubbie.dev/p/broadcasting-in-sparkhtml</link><guid isPermaLink="false">https://notebook.mubbie.dev/p/broadcasting-in-sparkhtml</guid><dc:creator><![CDATA[Mubarak Idoko]]></dc:creator><pubDate>Sun, 04 Aug 2024 00:00:00 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/f8b92ade-e3df-4aa8-97cc-fcf2d57a09a5_1200x774.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!_Pra!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa46f649b-8d92-4892-a207-0e7752091d97_1200x774.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!_Pra!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa46f649b-8d92-4892-a207-0e7752091d97_1200x774.jpeg 424w, https://substackcdn.com/image/fetch/$s_!_Pra!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa46f649b-8d92-4892-a207-0e7752091d97_1200x774.jpeg 848w, https://substackcdn.com/image/fetch/$s_!_Pra!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa46f649b-8d92-4892-a207-0e7752091d97_1200x774.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!_Pra!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa46f649b-8d92-4892-a207-0e7752091d97_1200x774.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!_Pra!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa46f649b-8d92-4892-a207-0e7752091d97_1200x774.jpeg" width="1200" height="774" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a46f649b-8d92-4892-a207-0e7752091d97_1200x774.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:774,&quot;width&quot;:1200,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Distributed Systems&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Distributed Systems" title="Distributed Systems" srcset="https://substackcdn.com/image/fetch/$s_!_Pra!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa46f649b-8d92-4892-a207-0e7752091d97_1200x774.jpeg 424w, https://substackcdn.com/image/fetch/$s_!_Pra!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa46f649b-8d92-4892-a207-0e7752091d97_1200x774.jpeg 848w, https://substackcdn.com/image/fetch/$s_!_Pra!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa46f649b-8d92-4892-a207-0e7752091d97_1200x774.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!_Pra!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa46f649b-8d92-4892-a207-0e7752091d97_1200x774.jpeg 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Image Source: <a href="https://wizardzines.com/">wizard zines</a></em></p><h2>Introduction</h2><p>You might have started reading this blog post with some curiosity. For one, the title might have left more questions than answers unless you&#8217;re well-versed in big data analytics or distributed systems. Let&#8217;s begin by introducing the concept of distributed systems in computing. From there, we&#8217;ll explore <code>broadcasting</code> in these systems and finally dive into the specifics of <code>broadcasting</code> in Spark. I hope you enjoy the journey.</p><h3>Distributed Computing Systems</h3><p>Imagine you love to cook, and your friends always rave about your dishes. Encouraged by their compliments, you decide to open your restaurant. Initially, you&#8217;re the only chef handling everything yourself. But as word spreads, business booms and you quickly realize you can&#8217;t manage it alone. You hire more chefs and expand your kitchen to keep up with demand.</p><p>Now, on a busy evening, your kitchen is abuzz with activity. Each chef works at a different station&#8212;one handling appetizers, another on main courses, and so on. Together, they ensure that every dish is prepared perfectly and served on time. This setup is much like a distributed system in computing:</p><ul><li><p><strong>Chefs as <code>Nodes</code></strong>: Each chef in your kitchen is like a <code>node</code> in a distributed system, working independently yet contributing to the same larger goal.</p></li><li><p><strong>Division of Labor/Stations as Subsystems</strong>: Different dishes are prepared at different stations, just as <code>tasks</code> in a distributed system are divided among various <code>nodes.</code></p></li><li><p><strong>Coordination</strong>: As the head chef, you ensure that all stations work in sync, much like how a distributed system <code>coordinates</code> the work of its <code>nodes</code> to produce the final <code>output.</code></p></li><li><p><strong><code>Parallel</code> Processing</strong>: Multiple dishes are prepared simultaneously at different stations, just as tasks are processed in <code>parallel</code> across multiple <code>nodes</code> in a distributed system, improving speed and efficiency.</p></li><li><p><strong>Fault Tolerance</strong>: If a chef burns a dish, the kitchen adapts without disrupting the entire operation. Similarly, a distributed system continues to function smoothly even if one or more <code>nodes</code> fail.</p></li></ul><p>Just as your restaurant thrives by distributing the workload across multiple chefs, distributed computing systems efficiently handle large tasks by dividing them across multiple computers. The benefits of distributed computing are tremendous, many of which you can read about in this <a href="https://aws.amazon.com/what-is/distributed-computing">AWS Article</a>, this <a href="https://www.ibm.com/docs/en/txseries/8.2?topic=overview-what-is-distributed-computing">IBM Article</a>, or this <a href="https://www.geeksforgeeks.org/what-is-distributed-computing/">Geeks for Geeks Post</a>. Now, onto <code>broadcasting.</code></p><h3>Broadcasting (As it applies to Distributed Computing)</h3><p>After several months of running your restaurant smoothly with a trusted team of chefs, you take a well-deserved break. Your travels take you to Europe, where one of your stops is the historic Bletchley Park in Milton Keynes, renowned for its pivotal role in World War II. Bletchley Park was where brilliant minds, including Sir Alan Turing, Gordon Welchman, Joan Clarke, and many others, worked tirelessly to crack the German Enigma code. The complexity of these codes meant that a single person, or even a small team, couldn&#8217;t break them quickly enough to be effective. So, the <a href="https://www.gchq.gov.uk/section/history/our-origins-and-wwi">Government Code &amp; Cypher School (GC&amp;CS)</a> assembled a large team of experts, creating what was effectively a distributed system.</p><p>At Bletchley Park, each codebreaker worked simultaneously on different parts of the problem, much like <code>nodes</code> in a distributed computing network. But before they could begin their work, they needed to be equipped with critical information&#8212;cipher keys, known plaintexts, and the latest intelligence. This process of equipping every codebreaker with the necessary data is akin to <code>broadcasting</code> in distributed computing. Once they had this information, they could work independently, much like how <code>nodes</code> process tasks in <code>parallel.</code> The distributed system at Bletchley Park, powered by the efficient <code>broadcasting</code> of information, was crucial in breaking the Enigma code and contributing significantly to the Allied victory.</p><p>In distributed computing, <code>broadcasting</code> refers to the process of sending a piece of data to all <code>nodes</code> in a <code>cluster,</code> allowing them to use the data locally without requiring repeated network communication. This approach minimizes communication overhead and enables more efficient computation, much like how the codebreakers at Bletchley Park worked more effectively with the information they were given.</p><h2>Broadcasting in Spark</h2><p><a href="https://spark.apache.org/">Apache Spark</a> is a powerful open-source distributed computing system designed for fast data processing on large-scale datasets. It is widely used in big data analytics because it performs complex computations quickly and efficiently across a <code>cluster</code> of computers. Spark builds upon the <a href="https://hadoop.apache.org/">Hadoop</a> ecosystem and can work seamlessly with the <a href="https://hadoop.apache.org/docs/r1.2.1/hdfs_design.html">Hadoop Distributed File System (HDFS)</a>. HDFS is a distributed storage system that allows Spark to store and access large datasets across multiple <code>nodes</code> in a <code>cluster.</code> This distributed storage capability is crucial for handling massive volumes of data, enabling Spark to process them in <code>parallel</code> across many machines.</p><p>However, when working with large datasets and complex computations, efficient data sharing across the <code>nodes</code> becomes essential. This is where the concept of <code>broadcasting</code> comes into play. In Spark, <code>broadcasting</code> is a mechanism that allows a small dataset or a piece of data to be efficiently shared with all the <code>nodes</code> in the <code>cluster.</code> Instead of sending the same data multiple times to different <code>nodes,</code> Spark <code>broadcasts</code> the data once to all <code>nodes.</code> Each <code>node</code> then stores a local copy of the <code>broadcasted</code> data, allowing it to access the data quickly without repeatedly fetching it from the driver or another central location. Let&#8217;s consider <code>join</code> operations in Spark as an example of how this works.</p><h4>Shuffling: The Default Approach for Joins</h4><p>In distributed computing, particularly in Spark, one of the critical operations is <code>joining</code> datasets. Spark uses a technique called <code>shuffling</code> when performing certain operations on datasets, such as <code>joins,</code> grouping, and aggregations. Shuffling redistributes the data across different <code>nodes</code> in a Spark <code>cluster,</code> grouping data elements that need to be processed together on the same <code>node.</code> For instance, in a <code>join</code> operation, shuffling ensures that matching keys from different datasets are brought together in the same partition, allowing the <code>join</code> to be executed.</p><p>While shuffling is effective in ensuring that data is correctly aligned for operations like <code>joins,</code> it comes with significant downsides, mainly when dealing with large datasets:</p><ul><li><p><strong>Increased Network Traffic</strong>: Shuffling involves redistributing data across the network, which can substantially increase network traffic. This can be particularly problematic for large datasets, where the volume of data being transferred can become a bottleneck.</p></li><li><p><strong>High I/O</strong>: As data is shuffled, it often needs to be written to and read from the disk, increasing disk I/O operations. This further slows the computation, especially if the disks are not fast enough to handle the load.</p></li><li><p><strong>Resource Intensity</strong>: Shuffling is resource-intensive, requiring significant computational power and memory. This can lead to longer processing times and increased costs, especially in cloud environments where resources are billed based on usage.</p></li></ul><h4>Broadcasting: A More Efficient Alternative</h4><p>To mitigate the downsides of shuffling, especially for <code>join</code> operations involving a large dataset and a smaller one, Spark employs the concept of <code>broadcasting.</code> <code>Broadcasting</code> is particularly useful when one of the datasets in a <code>join</code> operation is small enough to fit into the memory of each <code>node.</code> Instead of shuffling both datasets to bring matching keys together, Spark <code>broadcasts</code> the smaller dataset to all <code>nodes</code> in the <code>cluster.</code> Here&#8217;s how it works:</p><p>Imagine Spark needs to <code>join</code> a large dataset with a much smaller one. The large dataset is already distributed across the <code>cluster's</code> <code>nodes.</code> If Spark used shuffling, it would have to redistribute the data in large and small datasets, grouping matching entries together. This would involve significant network transfer and could be highly inefficient.</p><p>Instead, with <code>broadcasting,</code> Spark sends a single copy of the smaller dataset to each <code>node.</code> Each <code>node</code> then performs the <code>join</code> locally, using its portion of the large dataset and the <code>broadcasted</code> small dataset. This approach yields advantages in reduced network traffic (large amounts of data are not shuffled across the network; only the small dataset is <code>broadcasted,</code> resulting in a reduction in the amount of data that needs to be transferred), faster computation (as each <code>node</code> can perform the <code>join</code> operation locally without needing to wait for data from other <code>nodes</code> and without the need for extension disk I/O, as the data is already in memory), efficient resource utilization (as the need for shuffling is eliminated, <code>broadcasting</code> reduces the strain on computational and memory resources; reducing the overall cost of running Spark jobs).</p><h3>More on Broadcasting in Spark</h3><p>It is vital to appropriately leverage <code>broadcasting</code> to truly make Spark computations more efficient. When performing operations such as <code>joins</code> or aggregations, where a small dataset needs to be applied to a large one, using Spark&#8217;s <code>Broadcast</code> variables can significantly improve performance. Spark automatically distributes these <code>broadcast</code> variables to all the <code>nodes,</code> which remain cached in memory on each <code>node,</code> allowing for fast access. Developers can create <code>broadcast</code> variables using the <a href="https://spark.apache.org/docs/3.1.3/api/python/reference/api/pyspark.SparkContext.broadcast.html"><code>SparkContext.broadcast()</code></a> method, ensuring the data is distributed efficiently across the <code>cluster.</code> You can learn more about using <code>broadcasting</code> in spark operations with these articles: <a href="https://medium.com/@ARishi/broadcast-variables-in-spark-work-like-they-sound-c08097b80ac4">Broadcast variables in spark work like they sound</a>, <a href="https://medium.com/@Prashank.jauhari/understanding-broadcast-variables-in-apache-spark-8233d35726fc">Understanding <code>Broadcast</code> Variables In Apache Spark</a>.</p><h3>Automatic Broadcasts and the Spark Broadcast Threshold in Spark</h3><p>Spark further simplifies the use of <code>broadcasting</code> by automatically determining when to <code>broadcast</code> small datasets during certain operations like <code>joins.</code> By default, Spark automatically <code>broadcasts</code> any dataset that is smaller than a predefined threshold, known as the <code>broadcast</code> threshold. This threshold is controlled by the configuration parameter <code>spark.sql.autoBroadcastJoinThreshold</code>, which is set to 10 MB by default (and maxes out at 8GB). When a dataset falls below this size, Spark will automatically <code>broadcast</code> it to all <code>nodes</code> in the <code>cluster</code> without requiring explicit instructions from the developer. This automatic <code>broadcasting</code> is particularly useful because it optimizes performance without the need for manual intervention, allowing Spark to handle <code>joins</code> more efficiently by avoiding unnecessary shuffling.</p><p>Despite the performance improvements from <code>broadcasting,</code> it&#8217;s essential to be mindful of the <code>broadcast</code> threshold and how <code>broadcasting</code> is used in general. While <code>broadcasting</code> small datasets can significantly improve performance, attempting to <code>broadcast</code> datasets that are too large can lead to memory issues, as each <code>node</code> must store the entire <code>broadcasted</code> dataset in memory. If a dataset exceeds the <code>broadcast</code> threshold and is still small enough to benefit from <code>broadcasting,</code> the threshold can be adjusted by setting the <code>spark.sql.autoBroadcastJoinThreshold</code> parameter to a higher value. Conversely, if <code>broadcasting</code> is not desirable for certain operations, this threshold can be lowered to prevent automatic <code>broadcasts.</code> Understanding and tuning this threshold allows developers to strike the right balance between leveraging Spark&#8217;s automatic optimizations and effectively managing the resources available in their <code>cluster.</code></p><h3>Conclusion</h3><p><code>Broadcasting</code> in Spark is a powerful tool for optimizing distributed computations, mainly when dealing with large datasets and complex operations like <code>joins.</code> By minimizing network traffic and reducing the need for shuffling, <code>broadcasting</code> can significantly improve the efficiency and speed of your Spark applications. Understanding when and how to use <code>broadcasting</code> and tuning the <code>broadcast</code> threshold is crucial for maximizing the performance of your Spark jobs. With these insights, you can make more informed decisions that enhance the effectiveness of your distributed data processing.</p><h3>References</h3><p>And resources to learn more from:</p><ul><li><p><a href="https://artsandculture.google.com/story/the-women-of-bletchley-park-bletchley-park/qgVxQIAxvdB-JA">The Women of Bletchley Park</a></p></li><li><p><a href="https://spark.apache.org/docs/1.5.1/api/java/org/apache/spark/broadcast/Broadcast.html"><code>Class Broadcast&lt;T&gt;</code></a></p></li><li><p><a href="https://books.japila.pl/apache-spark-internals/broadcast-variables/"><code>Broadcast</code> Variables</a></p></li><li><p><a href="https://youtu.be/irn2Ow4QhWM?si=9q0tg2AnXsH-h82q">Video on Spark <code>Broadcast</code> Variables</a></p></li><li><p><a href="https://www.youtube.com/watch?v=uituvF5KS80">Coding Example of <code>Broadcasting</code> in PySpark</a></p></li><li><p><a href="https://spark.apache.org/docs/latest/sql-performance-tuning.html">Spark Performance Tuning</a></p></li><li><p><a href="https://medium.com/@ashwin_kumar_/broadcast-join-in-spark-e128a7c21b94"><code>Broadcast</code> <code>join</code> in Spark (including how to configure Spark auto <code>broadcast</code>)</a></p></li><li><p><a href="https://oindrila-chakraborty88.medium.com/usage-of-broadcast-variable-in-joins-in-apache-spark-4c3f07aed4be">Usage of &#8220;<code>Broadcast</code> Variable&#8221; in &#8220;Joins&#8221; in &#8220;Apache Spark&#8221;</a></p></li><li><p><a href="https://medium.com/@ghoshsiddharth25/apache-spark-join-strategies-deep-dive-26bf7e85db28"><code>Join</code> Strategies in Apache Spark&#8212; Deep Dive</a></p></li><li><p><a href="https://faun.pub/primer-on-spark-join-strategy-134e7340f7a6">Primer on Spark <code>Join</code> strategy</a></p></li></ul>]]></content:encoded></item><item><title><![CDATA[Traffic Jams]]></title><description><![CDATA[Why do we get stuck in them?]]></description><link>https://notebook.mubbie.dev/p/traffic-jamshtml</link><guid isPermaLink="false">https://notebook.mubbie.dev/p/traffic-jamshtml</guid><dc:creator><![CDATA[Mubarak Idoko]]></dc:creator><pubDate>Sun, 28 Jul 2024 00:00:00 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/7c918424-b907-40c2-a36f-5376b84c3517_322x334.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!P9pm!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff8ae4dbb-bdf1-41f1-8c2c-e10673a0e6b8_322x334.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!P9pm!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff8ae4dbb-bdf1-41f1-8c2c-e10673a0e6b8_322x334.png 424w, https://substackcdn.com/image/fetch/$s_!P9pm!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff8ae4dbb-bdf1-41f1-8c2c-e10673a0e6b8_322x334.png 848w, https://substackcdn.com/image/fetch/$s_!P9pm!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff8ae4dbb-bdf1-41f1-8c2c-e10673a0e6b8_322x334.png 1272w, https://substackcdn.com/image/fetch/$s_!P9pm!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff8ae4dbb-bdf1-41f1-8c2c-e10673a0e6b8_322x334.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!P9pm!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff8ae4dbb-bdf1-41f1-8c2c-e10673a0e6b8_322x334.png" width="322" height="334" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f8ae4dbb-bdf1-41f1-8c2c-e10673a0e6b8_322x334.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:334,&quot;width&quot;:322,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Sign Combo&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Sign Combo" title="Sign Combo" srcset="https://substackcdn.com/image/fetch/$s_!P9pm!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff8ae4dbb-bdf1-41f1-8c2c-e10673a0e6b8_322x334.png 424w, https://substackcdn.com/image/fetch/$s_!P9pm!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff8ae4dbb-bdf1-41f1-8c2c-e10673a0e6b8_322x334.png 848w, https://substackcdn.com/image/fetch/$s_!P9pm!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff8ae4dbb-bdf1-41f1-8c2c-e10673a0e6b8_322x334.png 1272w, https://substackcdn.com/image/fetch/$s_!P9pm!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff8ae4dbb-bdf1-41f1-8c2c-e10673a0e6b8_322x334.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>Image Source: <a href="https://xkcd.com/">XKCD</a></em></p><p><em><a href="https://open.spotify.com/playlist/4xrpRKZEZjlLW6ULkZcM7l?si=i5iyww4dTLO_jr2ols5XkQ&amp;pi=u--2OggpItT1Wz">Accompanying Spotify Playlist (because &#8220;Traffic Jams&#8221;)</a></em></p><p>&#8220;Why, why? But why is this happening?&#8221; This was my exact thought when I landed at the Seattle airport on a seemingly ordinary Wednesday afternoon. My maps app lit up with bright red and yellow lines, showing the major highways into the city&#8212;I-5, I-190, SR 520&#8212;choked with traffic. I wasn&#8217;t thrilled, to say the least. I knew I could take alternate routes like Highway 99 or 509, but that didn&#8217;t quell my burning curiosity. It also didn&#8217;t help that on my flight over; I read a Komo News report about how INRIX, the location and traffic data analytics company, found that the average Seattle driver lost 58 hours in traffic jams in 2023, making the city home to the 27th-worst traffic in the world (you can read about the findings and methods <a href="https://komonews.com/news/local/seattle-traffic-inrix-global-scorecard-report-washington-king-county-commute-rush-hour-world-united-states-ranking-world-patterns-driving-gas-cost-work-metro-bus-train-transit">here</a>). So why was there so much traffic? It couldn&#8217;t be a car crash; what were the odds of massive pile-ups on three highways on a sunny Wednesday afternoon? Road work didn&#8217;t seem likely either, as that typically happens at night or on weekends. And it wasn&#8217;t rush hour. So, what was causing the gridlock? I wanted to find out.</p><p>Typically, traffic jams occur when sections of the roadway are blocked off, or obstructions on the road require drivers to use alternate routes. For instance, when there is a car accident, traffic might be rerouted, or when there is construction work, cars are diverted to different routes. Other instances include inclement weather, requiring drivers to proceed cautiously; rush hour, where there is a sudden and massive increase in the number of cars on the road; or saturation, which in traffic engineering means the number of vehicles on the road has exceeded its capacity, causing a jam to build up. However, while these are reasonable explanations for traffic jams, they don&#8217;t quite explain instances where there is a traffic jam with no apparent cause. Or cases where a jam builds up and dissipates without a clear reason for its start or end. This brings us to the concept of phantom traffic.</p><p>To introduce phantom traffic, I will start by sharing a recent conversation with my skip manager at work. He talked about participating in STP, a 200+ mile bike ride from Seattle to Portland. This multi-day cycling event draws thousands of riders willing to brave the challenge. You can learn more about STP <a href="https://strambecco.com/event/seattle-to-portland-stp/">here</a>. Now, back to my skip manager. Because this is a long event, conserving energy and using all available advantages is crucial. Participants take advantage of the draft effect, where a rider in front forces through the air, creating a wake or slipstream that allows riders behind to move at the same speed with much less effort. However, this process is complicated, as my skip manager highlighted.</p><p>If a rider in front needs to brake, simply braking would endanger the riders behind, following closely at the same speed. Sudden braking can take them by surprise, cause an immediate crash, or cause them to react suddenly in a manner that endangers their and other&#8217;s safety. To avoid this, the rider in front communicates the need to brake to the person behind, who then passes the message down the line. This ensures that everyone is prepared, and the rider in front can brake while each rider behind reacts accordingly without running into anyone. For this system to work, all riders must be in sync, moving and slowing down or speeding up at the same rate.</p><p>We see a similar effect when driving on a highway with several cars moving at roughly the same speed. If all drivers maintain their speed and roughly the same spacing from each other, traffic flows steadily. But say one driver abruptly slows down (even if just slightly); each driver behind notices and reacts, but they brake a little more strongly as they were not fully prepared for the event. This creates a chain reaction, with a wave of slowing vehicles propagating through the roadway. Vehicles slow down to avoid a collision, and when situations are safe, they accelerate back up to normal speed. This causes a traffic jam, and vehicles enter the jam faster than vehicles can accelerate out of it; hence, the jam continues until the rate at which vehicles enter the jam becomes low enough for the vehicles leaving the jam to restore normal flow. And as human behavior is imperfect, these traffic jams will continue as we utilize our roadways.</p><p>Typically, this effect is not observed on roads where the density of cars is low. In those cases, cars can quickly adjust to abrupt changes in speed and maintain a smooth traffic flow. However, as the number of cars increases to a critical mass, we start to see this effect and the corresponding stop-and-go traffic jams.</p><p>To model this effect, I took inspiration from the work done by researchers and people who have studied traffic, and I built a phantom traffic simulator to accompany the blog post. You can find it in this <a href="https://github.com/mubbie/phantom-traffic-jam-simulation">Github Repository</a>. You can fork the repo and play around with the simulator, tweaking it, perhaps to see how things change when you increase the number of vehicles, modify how the speed changes, etc. I have tried to keep it lightweight, but if you can improve it and make it more robust, I would love to see your work. :)</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!J2Yq!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F744c5f5a-f4a2-45ea-b8f3-8c8a11645a9a_600x614.gif" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!J2Yq!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F744c5f5a-f4a2-45ea-b8f3-8c8a11645a9a_600x614.gif 424w, https://substackcdn.com/image/fetch/$s_!J2Yq!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F744c5f5a-f4a2-45ea-b8f3-8c8a11645a9a_600x614.gif 848w, https://substackcdn.com/image/fetch/$s_!J2Yq!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F744c5f5a-f4a2-45ea-b8f3-8c8a11645a9a_600x614.gif 1272w, https://substackcdn.com/image/fetch/$s_!J2Yq!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F744c5f5a-f4a2-45ea-b8f3-8c8a11645a9a_600x614.gif 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!J2Yq!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F744c5f5a-f4a2-45ea-b8f3-8c8a11645a9a_600x614.gif" width="600" height="614" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/744c5f5a-f4a2-45ea-b8f3-8c8a11645a9a_600x614.gif&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:614,&quot;width&quot;:600,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:1735867,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/gif&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!J2Yq!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F744c5f5a-f4a2-45ea-b8f3-8c8a11645a9a_600x614.gif 424w, https://substackcdn.com/image/fetch/$s_!J2Yq!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F744c5f5a-f4a2-45ea-b8f3-8c8a11645a9a_600x614.gif 848w, https://substackcdn.com/image/fetch/$s_!J2Yq!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F744c5f5a-f4a2-45ea-b8f3-8c8a11645a9a_600x614.gif 1272w, https://substackcdn.com/image/fetch/$s_!J2Yq!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F744c5f5a-f4a2-45ea-b8f3-8c8a11645a9a_600x614.gif 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>You can also find other great traffic simulators <a href="https://www.traffic-simulation.de/">here</a> or see how traffic flows through different types of junctions <a href="https://www.youtube.com/watch?v=yITr127KZtQ">this video</a>.</p><p>Beyond increasing the time it takes for road users to get to their destinations, phantom traffic is also very inefficient for vehicles because when cars are decelerating or coasting, they burn less fuel and emit much less toxic gases. But when cars drive and stop, and then drive and stop in areas with phantom traffic, each accelerating run burns more gas and emits more pollutants. Research has also shown that phantom traffic causes more accidents as drivers could overreact or underreact to what might happen in front of them (think back on the biking example from STP). Optimistically, autonomous vehicles driving on the roadway dynamically adjust their average speed with knowledge of the traffic ahead, which could help reduce phantom jams. Likewise, such driverless vehicles can be modeled to compute the best following distance and speeds to prevent traffic buildup or react in ways that reduce them.</p><p>In conclusion, traffic that seemingly comes out of nowhere is caused by humans being imperfect, and our actions on the road affect other drivers, which can lead to the buildup of jams. Or, as put more bluntly in <a href="https://freakonomics.com/2008/03/what-causes-traffic-jams-you/">this Freakonomics article</a>: What Causes Traffic Jams? You. With this knowledge, we can be more forgiving and calm when traffic seems to appear out of nowhere, and more conscious of how our driving (say slowing down slightly to go back 30 seconds on a podcast), can affect other drivers and the flow of traffic on the road.</p><p>As a side note, I&#8217;ve also been reading a little about why increasing the size of the road does not solve problems with traffic jams. Here are some great articles to learn more about it: <a href="https://www.wired.com/2014/06/wuwt-traffic-induced-demand/">What&#8217;s Up With That: Building Bigger Roads Actually Makes Traffic Worse</a>, <a href="https://smv.org/learn/blog/how-does-roadway-expansion-cause-more-traffic/">Question Your World: How Does Roadway Expansion Cause More Traffic?</a>, as well as <a href="https://youtu.be/bQld7iJJSyk?si=-gJH9E_NqGTxn_c_">a video</a>.</p><h3>References</h3><p>And resources to learn more from:</p><ul><li><p><a href="https://www.youtube.com/watch?v=TNokBgtSUvQ&amp;t=11s">Why the @#$% is there so much traffic? - Benjamin Seibold</a></p></li><li><p><a href="https://www.newscientist.com/article/dn13402-shockwave-traffic-jam-recreated-for-first-time/">Shockwave traffic jam recreated for first time</a></p></li><li><p><a href="http://trafficwaves.org/">Traffic Waves</a></p></li><li><p><a href="https://www.smartmotorist.com/traffic-jams">Traffic Jams</a></p></li><li><p><a href="https://helper.ipam.ucla.edu/publications/tratut/tratut_12985.pdf">A Mathematical Introduction to Traffic Flow Theory</a></p></li><li><p><a href="https://math.mit.edu/traffic/">Traffic Modeling - Phantom Traffic Jams and Traveling Jamitons</a></p></li></ul>]]></content:encoded></item><item><title><![CDATA[Linux Permissions]]></title><description><![CDATA[Read, Write, Execute &#128421;&#65039;]]></description><link>https://notebook.mubbie.dev/p/linux-permissionshtml</link><guid isPermaLink="false">https://notebook.mubbie.dev/p/linux-permissionshtml</guid><dc:creator><![CDATA[Mubarak Idoko]]></dc:creator><pubDate>Sat, 29 Jun 2024 00:00:00 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/0453165f-e277-49dd-9291-282f9f8d9ca6_740x201.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!aC6r!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F887ab194-f400-46c9-9af5-378b20bff9f8_740x201.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!aC6r!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F887ab194-f400-46c9-9af5-378b20bff9f8_740x201.png 424w, https://substackcdn.com/image/fetch/$s_!aC6r!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F887ab194-f400-46c9-9af5-378b20bff9f8_740x201.png 848w, https://substackcdn.com/image/fetch/$s_!aC6r!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F887ab194-f400-46c9-9af5-378b20bff9f8_740x201.png 1272w, https://substackcdn.com/image/fetch/$s_!aC6r!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F887ab194-f400-46c9-9af5-378b20bff9f8_740x201.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!aC6r!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F887ab194-f400-46c9-9af5-378b20bff9f8_740x201.png" width="740" height="201" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/887ab194-f400-46c9-9af5-378b20bff9f8_740x201.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:201,&quot;width&quot;:740,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Letting Go&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Letting Go" title="Letting Go" srcset="https://substackcdn.com/image/fetch/$s_!aC6r!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F887ab194-f400-46c9-9af5-378b20bff9f8_740x201.png 424w, https://substackcdn.com/image/fetch/$s_!aC6r!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F887ab194-f400-46c9-9af5-378b20bff9f8_740x201.png 848w, https://substackcdn.com/image/fetch/$s_!aC6r!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F887ab194-f400-46c9-9af5-378b20bff9f8_740x201.png 1272w, https://substackcdn.com/image/fetch/$s_!aC6r!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F887ab194-f400-46c9-9af5-378b20bff9f8_740x201.png 1456w" sizes="100vw" fetchpriority="high"></picture><div></div></div></a></figure></div><p><em>Image Source: <a href="https://xkcd.com/215/">XKCD</a></em></p><h3>Introduction</h3><p>In computing, <code>permissions</code> define the level of access, privilege, and control that users have over files, applications, and other system resources. These permissions are divided into three broad categories: <strong>Read (<code>R</code>)</strong>: letting users view the content of files and directories, <strong>Write (<code>W</code>)</strong>: letting users create, modify, and delete files and directories, and <strong>Execute (<code>X</code>)</strong>: letting users run files or programs.</p><p>Unauthorized access to system resources, especially by malicious actors, can lead to dire consequences. Therefore, it is important to set and manage permissions appropriately. In this post, I&#8217;ll share briefly about how to manage permissions in Linux.</p><h3>Users and Groups</h3><p>To begin, we must first understand the concept of <code>users</code> and <code>groups</code> in Linux. A <code>user</code> is an entity that can log in and interact with the system, typically representing a person or a service. Each user has a unique username for friendly identification, a unique numerical identifier (User ID - <code>UID</code>) for the system to identify the user, and a home directory (usually in the form <code>/home/username</code>) to store user-specific files.</p><p>A user can be:</p><ul><li><p>The <code>Root User</code> or <code>Superuser</code>, with unrestricted access to all commands and files on the system, allowing them to perform any actions and system-level tasks.</p></li><li><p>A regular user, with limited permissions and restrictions to their own files and certain system resources.</p></li><li><p>A <code>System User</code>, associated with system services and applications used to run background processes to keep the system functioning.</p></li></ul><p>Each user&#8217;s information, including their username, UID, home directory, and shell, is stored in the <code>\/etc\/passwd</code> file, while passwords are typically stored in a hashed format in the <code>\/etc\/shadow</code> file.</p><p>Groups, on the other hand, represent collections of users that can be managed as a single unit. They are used to manage user permissions and access control for files, directories, and system resources. Each group has a Group ID (<code>GID</code>) and is defined in the <code>\/etc\/group</code> file, which lists group names, GIDs, and the users who are members of the group.</p><p>Each user is assigned to a primary group. The <code>Primary Group</code> is specified in the user&#8217;s account information and determines the group assigned to files created by the user. Each user must belong to one primary group. <code>Secondary Groups</code> specify one or more groups to which a user can belong, granting additional permissions and access to resources shared among users in the group. Typically, a Linux user can belong to up to 15 secondary groups.</p><p>Users and groups together are used by the system to define and enforce access and permissions.</p><h3>Permissions</h3><p>As mentioned earlier, each file and directory in a Linux system has three types of permissions: <code>r</code> (read), <code>w</code> (write), and <code>x</code> (execute). These permissions are defined for three types of entities: the file/directory owner (user), the group, and others (everyone else in the system). Permissions are represented as a 10-character string, such as <code>-rwxr-xr--</code>.</p><p>The first character indicates the file type (<code>-</code> for a regular file, <code>d</code> for a directory, and <code>l</code> for a symbolic link), and the remaining nine characters represent the permissions for the owner, group, and others in sets of three:</p><ul><li><p>The first set of three characters (e.g., <code>rwx</code>) represents the owner&#8217;s (user&#8217;s) permissions.</p></li><li><p>The second set (e.g., <code>r-x</code>) represents the group&#8217;s permissions.</p></li><li><p>The third set (e.g., <code>r--</code>) represents the permissions for others.</p></li></ul><p>A <code>-</code> means there are no permissions for the corresponding operation. For instance, <code>r-x</code> means read and execute permissions are granted, but not write permissions.</p><p>You can view permissions on a Linux machine using the <code>ls -l</code> command:</p><pre><code>$ ls -l
-rw-r--r--  1 user group  4096 Jun 29  01:49 foo.txt
</code></pre><p>In the example output above, <code>-rw-r--r--</code> represents the permissions, <code>user</code> is the username of the owner, and <code>group</code> is the group name for the corresponding group.</p><h3>Modifying Ownership and Permissions</h3><p>You can change the ownership and group of a file using the following commands:</p><ul><li><p><code>chown user file</code>: Changes the owner of a file.</p></li><li><p><code>chgrp group file</code>: Changes the group of a file.</p></li><li><p><code>chown user:group file</code>: Changes the owner and group of the file.</p></li></ul><p>Typically, the <code>chgrp</code> command can be used without <code>sudo</code> if the user is changing to a group they belong to, while <code>chown</code> almost always requires <code>sudo</code> (superuser do) for changing the ownership of a file.</p><p>Permissions can be changed using the <code>chmod</code> command in two main formats:</p><ul><li><p><strong>Symbolic Mode</strong>: Using letters to specify and modify permissions. For instance:</p><ul><li><p><code>chmod u+w file</code>: Adds write permissions for the user (owner) of the file.</p></li><li><p><code>chmod g-x file</code>: Removes execute permissions from the group on the file.</p></li><li><p><code>chmod o=r file</code>: Sets read-only permission for others on the file.</p></li><li><p><code>chmod a+rw file</code>: Adds read and write permissions for all (user, group, others) on the file.</p></li></ul></li><li><p><strong>Numerical (Octal) Mode</strong>: Uses numbers to specify permissions.</p><ul><li><p>Each permission type is represented by a number: read (<code>r</code>) is 4, write (<code>w</code>) is 2, and execute (<code>x</code>) is 1.</p></li><li><p>Permissions are summed up for each entity. For example, <code>rwx</code> (read, write, and execute) is 4+2+1 = 7.</p></li><li><p><code>chmod 755 file</code>: Sets permissions to <code>rwxr-xr-x</code> (7 for user, 5 for group, 5 for others).</p></li></ul></li></ul><h3>Special Permissions</h3><p>There are a few special permissions in Linux:</p><ol><li><p><strong>Setuid (set user ID)</strong>: When set on an executable file, it allows the file to be executed with the permissions of the file&#8217;s owner. It is represented by an <code>s</code> in the owner&#8217;s execute position (e.g., <code>rwsr-xr-x</code>). It can be modified using <code>chmod</code>, as in <code>chmod u+s file</code> or by adding a <code>4</code> at the start of a permission set when using numerical mode with <code>chmod</code>, e.g., <code>chmod 4755 file</code>.</p></li><li><p><strong>Setgid (set group ID)</strong>: Similar to Setuid, it allows a file to be executed with the permissions of the group it belongs to (e.g., <code>-rwxr-sr-x</code>). It can be modified using <code>chmod g+s file</code> or by adding a <code>2</code> to the start of the permission set when using numerical mode, e.g., <code>chmod 2755 file</code>.</p></li><li><p><strong>Sticky Bit</strong>: When set on a directory, it ensures that only the owner of the directory (or root) can delete or modify a file in the directory. It is represented as a <code>t</code> in the <code>execute</code> position of the <code>others'</code> permission set (e.g., <code>drwxrwxrwt</code>). It can be modified using <code>chmod +t directory</code> or by adding a <code>1</code> to the start of the permission set when using numerical mode, e.g., <code>chmod 1755 directory</code>. It only applies to directories.</p></li></ol><h3>Learn More</h3><p>To learn more about Linux and Linux Permissions, you can explore these resources:</p><ul><li><p><a href="https://www.redhat.com/sysadmin/linux-file-permissions-explained">RedHat: Linux Permissions Explained</a></p></li><li><p><a href="https://www.redhat.com/sysadmin/linux-user-group-management">RedHat: Managing User and Groups in Linux</a></p></li><li><p><a href="https://wiki.archlinux.org/title/users_and_groups">ArchLinux: Users and groups</a></p></li></ul><p>And you can always consult the Linux Manual Pages.</p><p>Cheers.</p>]]></content:encoded></item></channel></rss>