<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Martin Ricken on Medium]]></title>
        <description><![CDATA[Stories by Martin Ricken on Medium]]></description>
        <link>https://medium.com/@lorique?source=rss-233164038af------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*BcFnGh9-BSaIHygOaVMNbw.png</url>
            <title>Stories by Martin Ricken on Medium</title>
            <link>https://medium.com/@lorique?source=rss-233164038af------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 18:44:26 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@lorique/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Your LLM Output Looks Correct. It Isn’t.]]></title>
            <link>https://levelup.gitconnected.com/your-llm-output-looks-correct-it-isnt-86c2cc1d90b3?source=rss-233164038af------2</link>
            <guid isPermaLink="false">https://medium.com/p/86c2cc1d90b3</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[llm]]></category>
            <dc:creator><![CDATA[Martin Ricken]]></dc:creator>
            <pubDate>Thu, 26 Mar 2026 14:34:16 GMT</pubDate>
            <atom:updated>2026-03-26T14:34:16.937Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*lbQ0M1KmGUTsS2P7" /><figcaption>Photo by <a href="https://unsplash.com/@jilburr?utm_source=medium&amp;utm_medium=referral">Jilbert Ebrahimi</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h4>Schema validation tells you the shape is right. It doesn’t tell you the content is.</h4><p>It wasn’t my code, it was the model. That’s what led me here.</p><p>I had schema validation of the output, everything they tell you to do, and yet I was not getting the expected number of items. That was the problem. Schema validation wasn’t content validation. I was putting in 100 items, and only getting ~70 back. Through review of the content the problem became clear. There were duplicates in my input, not my output.</p><p>The use case was simple. Take in N items, use LLM to classify them, use classification further down the pipeline. The duplicates weren’t a failure of normalization, it was a feature of the data, and a result of removing non-pertinent information and PII before submitting it to the LLM. The plan was to re-glue the information back on the output, after the LLM pass, but that’s where the bugs appeared. Not all the data showed up as processed. Silent failure, until I thought to check the database.</p><p>I did some minor initial testing confirming my suspicion that the LLM was performing deduplication, and then realized the implications go beyond classification.</p><h4>Why this matters</h4><p>Any pipeline where the LLM processes structured data and duplicates can occur in the input is at risk.</p><p>- <strong>Data transformation / ETL</strong> — “Convert these CSV rows to normalized JSON.” Duplicate rows (e.g., multiple orders from the same customer) get silently merged.</p><p>- <strong>Enrichment / augmentation</strong> — “Add a sentiment score to each review.” If two reviews have identical text, one gets dropped.</p><p>- <strong>Routing / triage</strong> — “Assign these support tickets to teams.” Identical tickets from different users get merged into one.</p><p>- <strong>Extraction</strong> — “Pull all line items from these invoices.” The same item ordered twice appears once in output.</p><p>- <strong>Translation / reformatting</strong> — “Translate these product descriptions.” Duplicate SKU descriptions across regions get deduplicated.</p><p>- <strong>Validation / reconciliation</strong> — “Compare these two lists and flag discrepancies.” The model “fixes” duplicates before comparing, masking real differences.</p><p>These aren’t test scenarios. They’re real production pipelines. When the count of items is meaningful and duplicates exist in the input, the LLM may silently alter that count. If you can’t guarantee the input is unique by the time it reaches the model, this applies to you. If you take nothing else from reading this, that is what you should remember.</p><h4>The test</h4><p>I designed a test case where the task is simple, but escalating complexity of the data is the difficulty. The task is to group a list of people by their job title. Data Transformation. The task is deliberately simple, because I wanted to exclude the possibility of misinterpretation of the task by the LLM. The prompt:</p><pre>You will receive a JSON array of person objects. <br>Each object has a &#39;name&#39; and a &#39;job&#39; field.<br><br>Group the people by their job title.<br><br>CRITICAL: Return EVERY person from the input exactly as many times as <br> they appear. If a person appears multiple times in the input, they MUST <br> appear that same number of times in the output. Do NOT deduplicate. Do NOT <br> remove repeated entries. Preserve all duplicates.</pre><p>On each test, this is the system prompt. Simple, deliberate, and explicitly setting a guardrail against deduplication. It also calls out two relevant fields in the data, making it clear what’s relevant.</p><p>The fixtures are kept in JSON files. There are five fixtures, control, simple, medium, complex and extreme. The control contains only unique items, in order to create a baseline for how the model behaves when not given duplicates. Simple uses 15 items with 2 fields. Medium scales to 30 items with 4 fields. Complex hits 50 items with 7 fields including nested arrays. Extreme pushes to 150 items with 10 fields and nested objects. All contain the two relevant fields, giving the model everything it needs.</p><p>Fixture data is shuffled using a Fisher-Yates algorithm between each test. This matters because models may be more likely to drop duplicates that appear adjacent or near the beginning/end of the input. Incidentally this also combats any caching mechanisms providers might be using.</p><h4><strong>Findings</strong></h4><p>I tested seven models, across three providers. Local LLM (with ollama), OpenAI and Anthropic. For the local test I went with GPT-OSS:20b which, despite its age, is still a popular local model. For OpenAI i tested GPT-5-mini, GPT-5 and GPT-5.4 — their newest model. For Anthropic i tested Opus 4.6, Sonnet 4.6 and Haiku 4.5. My goal in model selection was to try and provide a fair comparison of frontier models from both OpenAI and Anthropic. GPT-OSS is an OpenAI open model based on GPT-4 architecture, and was selected mostly for its popularity.</p><p>Most models were tested with 10 runs per fixture, but some were extended with additional runs to verify consistency. 10 runs is by no means enough to provide accurate failure rates, but it is enough to show that the problem occurs. A proper investigation with controlled variables, statistical significance testing, and larger sample sizes would be needed to draw firm conclusions. That said, the patterns are consistent enough to be worth noting.</p><p><strong>They all fail</strong></p><p>All models fail, it’s just a matter of when. Failure rate scales with complexity, but the curve shape varies by model. Opus 4.6 and GPT-5 achieve a 100% success rate for simple through complex tests, but they failed when given the extreme test.</p><p>GPT-5-mini had a near perfect success rate, with a single shuffle-dependent failure on simple (19/20 across two batches of 10 runs). GPT-OSS:20b showed a gradual degrading curve, only achieving an 80% success rate on the simple dataset and going downhill from there.</p><p>Haiku succeeded at the simple set, then completely cratered on the medium and complex. Sonnet also succeeded at the simple, but ran into issues with medium and complex, hitting only 80% success rate.</p><p><em>The most surprising finding was GPT-5.4 regressing</em>, performing at almost the same level as GPT-OSS — a 20b seven month old model with dated architecture — on medium and complex datasets. Worse than its predecessor gpt-5, and its cheaper sibling gpt-5-mini which both achieved perfect scores.</p><p>The control fixture has zero duplicates, and passed 100% across every model. This problem is triggered specifically by duplicate input. The extreme fixture confirmed that the ceiling exists for every model tested.</p><p>Frontier models raise the ceiling, they don’t remove it.</p><p><strong>It’s not just missing rows</strong></p><p>Models also add and mutate data. On GPT-OSS, one person lost a duplicate entry while another gained one. As if the model conserved a rough total while scrambling the per-person distribution. Haiku almost exclusively deduplicates, but in one test hallucination and deduplication also co-occurred.</p><p>On the extreme dataset we see the same. GPT-5-mini redistributed aggressively, performing 18 deduplications and 2 hallucinations. Opus 4.6 and GPT-5 only deduplicated. The mini model hallucinated, and the flagship GPT-5 didn’t.</p><p>S<em>urprisingly, again, the outlier here is GPT-5.4</em>. On the 7th run of the complex test, it both deduplicated and hallucinated. They co-occurred like in GPT-OSS, further reinforcing how closely 5.4’s behavior mirrors the 20b local model.</p><p><strong>Failures are silent</strong></p><p>Every failed run produced structurally valid JSON that conformed to the schema. No parse errors, no missing fields, no obvious red flags. The output <strong>looks</strong> correct. Only a count- and field-level comparison against the input reveals the integrity violation. This is what makes the problem dangerous in production.</p><pre>// from gpt-oss:20b medium run #2<br>{<br>  fixture: &#39;medium&#39;,<br>  model: &#39;gpt-oss:20b&#39;,<br>  status: &#39;FAIL&#39;,<br>  durationMs: 16403,<br>  usage: { promptTokens: 953, completionTokens: 658, totalTokens: 1611 },<br>  comparison: [<br>    { name: &#39;Gabriel Martin&#39;, inputCount: 5, outputCount: 3 },  // deduplication<br>    { name: &#39;Corey Hussain&#39;, inputCount: 5, outputCount: 6 },   // hallucination<br>    { name: &#39;Ace Donovan&#39;, inputCount: 5, outputCount: 4 },     // deduplication<br>    { name: &#39;Evie Mills&#39;, inputCount: 3, outputCount: 4 },      // hallucination<br>    { name: &#39;Sophie Gray&#39;, inputCount: 3, outputCount: 3 },<br>    { name: &#39;Martha Lane&#39;, inputCount: 3, outputCount: 3 },<br>    { name: &#39;Liam Chen&#39;, inputCount: 3, outputCount: 3 },<br>    { name: &#39;Nora Blake&#39;, inputCount: 3, outputCount: 3 },<br>  ]<br>}</pre><p>Schema validation confirms shape. It doesn’t confirm content. In a traditional API, validating shape and protecting against injection is enough. With an LLM, <strong>the shape can be perfect and the content silently wrong</strong>. If you’re not verifying output against input at both count and field level, you won’t know your data has been altered until something downstream breaks.</p><h4><strong>Mitigation</strong></h4><p>The simplest mitigation is to ensure input uniqueness. The `control` fixture — identical field complexity to `complex` but with zero duplicates — passes 100% across every model tested. If every item in your input is unique, the deduplication failure mode doesn’t apply.</p><p>For pipelines where duplicates naturally occur, add a synthetic unique field (e.g., `_id: uuid()`) to each item before sending it to the model. This makes every object structurally distinct, even if the business data is identical. Strip the field from the output after. The model never sees duplicate objects, so there’s nothing to deduplicate.</p><p>If you can’t modify the input, verify output integrity after: compare per-identity counts between input and output, and reject or retry runs where counts don’t match. Alternatively, a traditional ML model or plain code can handle this more reliably. Using LLMs for ETL or similar work is often both expensive and wasteful.</p><h4><strong>Conclusion</strong></h4><p>Schema validation tells you the shape is right. It doesn’t tell you the content is. Every model I tested proved it.</p><p>From a 20B local model to the most capable frontier models from OpenAI and Anthropic. Eventually they fail to preserve duplicate entries in structured data. Opus 4.6 passed 50 runs without a single error on fixtures up to 50 items, but then failed on 150 items. GPT-5 achieved the same perfect 100% through complex and then failed on extreme. GPT-5.4, OpenAI’s newest model (released days before testing), regressed to 70% on medium and 50% on complex. It was worse than its predecessor GPT-5 and its cheaper sibling GPT-5-mini, both of which scored 100% on those same fixtures.</p><p>The problem is not solved by better models, and newer models can make it worse.</p><p>If your pipeline processes data where duplicates can occur you cannot rely on LLM output to preserve those counts. You must either ensure input uniqueness before sending data to the model, or verify output integrity after. There is <strong>no model</strong> you can choose that eliminates this risk.</p><p>This experiment has limitations. Fixtures vary across multiple dimensions, making it impossible to know which caused the issue, complexity or input length. We don’t surface the actual output data, nor show where the deduplication occurred. The extreme fixture confirmed a ceiling, but didn’t isolate the cause. Research on context degradation (e.g., <a href="https://research.trychroma.com/context-rot">Chroma’s Context Rot study</a>) suggests input length alone is sufficient to degrade output quality, even on trivial tasks. Isolating variables would require a different experimental design, and I’m not an academic. I’m a practitioner.</p><p>The models may not be doing anything wrong here. They are likely doing what they were trained to do: Simplify, normalize and compress redundant information. In that context, deduplication is not a bug, it’s a deeply learned heuristic. When the model sees duplicates its strongest instinct is to collapse it. The same behavior makes it good at summarization, abstraction, and reasoning. When the prompt tells it, in no uncertain terms, to not remove duplicates, it works. But only to a point. As the complexity of the task rises, the heuristic kicks in.</p><p>This is not a general indictment of LLMs with structured data. The `control` fixture (zero duplicates) passes 100% across every model tested. The risk is specific to <strong>duplicate entries in the input</strong>. If your data is guaranteed unique, this problem doesn’t apply. But if duplicates can occur — and in real-world datasets, they usually can — the failure is a matter of when, not if.</p><p>The full test suite, fixtures, and observations are available on <a href="https://github.com/lorique/your-llm-output-looks-correct-it-isnt">GitHub</a>.</p><p>Go test it yourself.</p><p>Remember to leave a follow here on Medium or check out my <a href="https://www.linkedin.com/in/martinricken/">LinkedIn</a> to see what else I get up to.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=86c2cc1d90b3" width="1" height="1" alt=""><hr><p><a href="https://levelup.gitconnected.com/your-llm-output-looks-correct-it-isnt-86c2cc1d90b3">Your LLM Output Looks Correct. It Isn’t.</a> was originally published in <a href="https://levelup.gitconnected.com/">Level Up Coding</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[RAG Isn’t Dead]]></title>
            <link>https://pub.towardsai.net/rag-isnt-dead-5ad8aa890148?source=rss-233164038af------2</link>
            <guid isPermaLink="false">https://medium.com/p/5ad8aa890148</guid>
            <category><![CDATA[retrieval-augmented-gen]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[claude]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[software-engineering]]></category>
            <dc:creator><![CDATA[Martin Ricken]]></dc:creator>
            <pubDate>Wed, 04 Mar 2026 14:07:07 GMT</pubDate>
            <atom:updated>2026-03-09T05:16:29.319Z</atom:updated>
            <content:encoded><![CDATA[<h4>A naive approach to a complex subject is exactly why you think RAG is dead.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*t9qKt-qYRI9Yb3IpmpHNcg.png" /><figcaption>Photo by <a href="https://unsplash.com/@sseeker?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Stormseeker</a> on <a href="https://unsplash.com/photos/a-person-drowns-underwater-rX12B5uX7QM?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>The idea that RAG is dead has been spreading like wildfire, but over and over again I see people lay out their proof and the mistakes are glaring. More importantly, high profile people in the AI business get their words twisted and drafted into the argument. Case in point, this X post by Boris Cherny</p><figure><img alt="X post by Boris Cherny" src="https://cdn-images-1.medium.com/max/800/1*k9ns2Ybc4B9uw3-AhMeZow.jpeg" /></figure><p>Let’s be clear about what Cherny is saying here. For Claude Code specifically, agentic search “worked better”. There are many reasons why that could be the case, but “RAG is DEAD” isn’t one of them. Yet people are already picking sides, and thinking of this as an either or situation. But it isn’t. Most of the time the question is WHEN to use RAG, and not IF. But grasping that nuance requires more than a surface-level knowledge of what RAG actually is and how it works.</p><p>So let’s see if we can’t fix that.</p><h4>What people think RAG is</h4><p>There are about a thousand tutorials out there giving you the naive version of how RAG works, and if you’re reading this, you probably read at least 3 of them. I know I did when I was starting out. So here’s the abridged version:</p><p>Chunk your text. Embed the chunks. Search by similarity. Take the top 5 results. Stuff them into a prompt. Done.</p><p><strong>Except it isn’t.</strong></p><p>You’ve probably started with a fixed length chunking — 500 characters sounds about right — then tried a recursive chunking strategy with some overlap. You picked an embedding model, wired it into the search, and connected your prompt. It looked fine.</p><p><em>For a while.</em></p><p>Then more and more cases crept in where the answers were wrong, or incomplete, or subtly off in ways that were hard to pin down.</p><p>So you tried smaller chunks. Maybe a sentence-level chunker. The reasoning felt sound: fewer characters per chunk, more precise results. But the results didn’t improve the way you expected, and now you’re stuck. You have a RAG pipeline. It followed the tutorial. So why doesn’t it work?</p><p>The answer is that every step in that pipeline carries assumptions most tutorials never mention.</p><h4>Why naive RAG fails</h4><p>Try taking an article, and cutting it into chunks of an arbitrary size. Try this article if you like. Now try reading a random chunk. Not very helpful, is it?</p><p>This is exactly the problem the LLM runs into when you apply a chunking strategy with no respect for the content you are chunking. What you get is content without coherence. Apply this to 100 articles, search for the mention of specific keywords, and the problem only gets worse. For most reasoning, coherence matters, because to give an exact answer you need to understand the full picture.</p><p><strong>The same applies to LLMs.</strong></p><p>They are better than most people at filling in gaps, but it isn’t going to cut it if you’re trying to answer a specific question. Couple this with the fact that similarity isn’t the same as relevance, and the quality of your results are going to degrade.</p><p>The natural instinct is to reach for more advanced chunking strategies. Paragraph or structure based chunking, or LLM guided chunking, but using an advanced strategy doesn’t equal better results. In the recently published research paper <a href="https://arxiv.org/pdf/2602.16974">Beyond Chunk-Then-Embed: A Comprehensive Taxonomy and Evaluation of Document Chunking Strategies for Information Retrieval</a>, you can read — in the conclusion — that findings show optimal chunking strategies are task-dependent.</p><p>The findings are counterintuitive. For standard retrieval tasks, simple structure-based chunking actually beats the fancy LLM-guided approaches. But flip to in-document retrieval and the pattern reverses.</p><p>Your search shouldn’t be a single shot, one-size fits all. We need to know what documents are relevant, and then search those documents with a different method, one which preserves coherence.</p><h4>RAG done right: lessons from building</h4><p>Before I show you what I built, it’s worth clarifying what RAG actually means, because the definition has gotten muddied.</p><p>RAG is the method through which the LLM gathers enough context to be able to answer a query. Regardless of whether or not you use embedded search, whenever you retrieve something and stuff it into a prompt to improve the output of the LLM, you’re doing RAG. It’s retrieval to augment generation. Embedding and embedded search are separate operations that have become almost synonymous with generative AI, but they’re just one form of RAG.</p><p>I recently sat down to rethink my own RAG pipeline. One of my system’s core capabilities is web retrieval, for injecting context on a subject into the prompt. This has context impact, and while a 1,500 token article might be fine, a 15,000 token research paper is more of a problem. The concern is both the attention problem — also known as <a href="https://research.trychroma.com/context-rot">context rot </a>— and the limited size of local models context windows.</p><p>So the question becomes: how do you give the LLM access to a full research paper without actually putting the full research paper in the prompt?</p><p>The solution is to limit the context injected into the prompt, while adding the capability to use semantic search on it. The result was a web_fetch tool which looks something like this:</p><pre>web_fetch(input: {url: string, refresh: boolean}) {<br>    // Check if the url is in local storage first (because we store it)<br>    // Fetch using playwright browser if we don&#39;t.<br><br>    // Generate list of section in the article.<br>    // Summarize article using LLM, including section by section <br>    //   concise summaries.<br>    <br>    // Attach section list - it&#39;s an index or ToC.<br><br>    // Store and Embed the article using a structured data <br>    //   chunking strategy (paragraph)<br><br>    // Return the full summary + relevant metadata, <br>    //   which includes an articleId from storage.<br>}</pre><p>I now have a summary, and an index card to input into my prompt. With this the LLM will know what sections the article contains, and have an idea what’s in them. The next step is to give it some additional tools, to inspect the article further. I’ll skip the embedded search tool, because you already know what that looks like, and jump directly to the point of having the index in the summary. A section retrieval tool:</p><pre>web_recall_section(input: {articleId: string, header: string}) {<br>    // Load the article from the id<br>    // Generate a list of sections from the content.<br><br>    // Return matched section.<br>}</pre><p>It’s that simple. Now, the LLM can both query using semantic search, and retrieve full sections for a coherent understanding of what the context of those random chunks from before actually means. Where the heavy lifting is done, in both cases, is in the section generation. Articles and research papers are structured content, and usually — not always — contain headers. I convert all the html to markdown before parsing, because I’m storing it in markdown. The process of generating sections looks something like this:</p><pre>parseMarkdownSections(markdown: string) {<br>  // Split into lines<br>  // Find markdown headings (## ### etc.)<br>  // Split into flat segments: { depth, header, contentLines }<br>  // Normalize depths so the shallowest heading becomes depth 1. <br>  //   Depth 0 is the title.<br>  // Build nested tree using a stack. Because headings are sometimes <br>  //   nested (h2, h3, etc)<br>  // Build a path through headings, to show placement depth when <br>  //   presented in flat array. Makes it easier to retrieve later.<br>}<br><br>findSections(header: string,<br>  sections: MarkdownSection[],<br>  ancestors: string[],<br>  results: SectionMatch[],<br>) {<br>    // Loop through sections until we find the header<br>    // Build Section from it and its children, recursively<br>}</pre><p>I’ve <a href="https://gist.github.com/lorique/455e580bc40109e938373599daa20c2f">created a gist</a>, where you can see the full codefile with all the utils i use for generating sections, and retrieving them.</p><p>The result of this approach is that my 15,000 token research paper is now ~1,000 tokens of summary, index, and metadata. With the search and section tools the LLM can now retrieve context relevant to my questions, and doesn’t need to keep the full research paper in its prompt, causing both context-rot and context size issues.</p><p><strong>Key insight:</strong> You don’t need the full content to make a good enough starting summary. The summary is a starting point, not the final product. It’s a tool you can leverage to both cut a 15,000 token context down to 1,000 tokens of relevant information, and give the LLM a way to dive deeper into the meat of the context when it needs to.</p><h4>MCP is just RAG</h4><p>I’ve seen people saying MCPs will replace RAG enough that I need to clarify something.</p><p>Most MCPs are a protocol layer for connecting tools and data sources to LLMs. When an MCP server retrieves context to inject into a prompt, that’s RAG. The protocol changed, the principle didn’t. When you use an MCP, you’re adding another RAG pipeline, not replacing RAG with something else. This is the nuance that’s important to understand, because everything in this article builds on that. All the principles I just laid out, and are laid out in the research still apply.</p><p>The optimal chunking strategy IS task dependent. Single-shot approaches aren’t always enough. We still need to know what documents are relevant, not just the random chunks. Context limits and Context-Rot are still concerns you need to care about.</p><p>The biggest win of MCPs is that they make a lot of the hard decisions for you. The MCP knows its knowledge domain, and knows how best to apply RAG to it. This means we can separate that concern away from our application, and only consider how to wire the MCP into our prompt.</p><p>Be warned though: While some MCPs work to protect your LLM’s context, many don’t. They subscribed to the idea that a bigger context window means they can give you more context, without considering context-rot or how this applies to models with smaller context windows.</p><h4>The real problem isn’t the technology</h4><p>The problem was surface-level understanding of a subject that goes far beyond a few lines of code and an embedding model. Retrieval Augmented Generation requires a nuanced approach, not a single-shot solution, to work reliably. There are a lot of factors to consider. What kind of content are you working with? What are you trying to achieve? Where is the data coming from? and much more.</p><p>What most RAG tutorials do is try to boil RAG down to choosing a chunking strategy and an embedding model. This is simply incomplete, and the lack of nuance sets people up for failure. In my opinion this is why we’re seeing so many people declare “RAG is DEAD!” on social media, and in the same breath say “MCP is the future” or “Boris Cherny says so!”</p><p>What I’ve shown you are examples of where naive pipelines fail, and why. You’ve also seen RAG is more than an embedding pipeline, and what Claude Code is doing — according to Boris Cherny’s own words — is still considered RAG. Working on a RAG pipeline requires an understanding of how the data is structured, and how that affects your approach to RAG. Research exists to guide us, but it takes more than reading a summary.</p><p>RAG isn’t dead, and it won’t die anytime soon either. Without it, Claude Code wouldn’t be able to read or edit files. Without it ChatGPT wouldn’t be able to summarize the RAG tutorial you couldn’t hold your attention on long enough, to realize the author did actually tell you this was the <strong>basic</strong> approach. Not an exhaustive instruction manual.</p><p>RAG isn’t dead. It’s a <strong>fundamental</strong> principle making Agentic AI possible.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5ad8aa890148" width="1" height="1" alt=""><hr><p><a href="https://pub.towardsai.net/rag-isnt-dead-5ad8aa890148">RAG Isn’t Dead</a> was originally published in <a href="https://pub.towardsai.net/">Towards AI</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The AI Act and Executive Orders]]></title>
            <link>https://medium.com/@lorique/the-ai-act-and-executive-orders-bd5016dc2f56?source=rss-233164038af------2</link>
            <guid isPermaLink="false">https://medium.com/p/bd5016dc2f56</guid>
            <category><![CDATA[ethics-in-tech]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[politics]]></category>
            <dc:creator><![CDATA[Martin Ricken]]></dc:creator>
            <pubDate>Tue, 21 Jan 2025 13:39:24 GMT</pubDate>
            <atom:updated>2025-01-21T13:39:24.464Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*2MJGBYAqojZctkXD" /><figcaption>Photo by <a href="https://unsplash.com/@smoove857?utm_source=medium&amp;utm_medium=referral">Will Ma</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h4>On January 20th, 2025, President Trump revoked Executive Order 14110, also known as the Executive Order on Artificial Intelligence. This order was the most comprehensive piece of governance on AI in the USA.</h4><p>The order directed various government agencies and departments to, among other things, implement guidelines for the purchase and use of AI in the American government, uphold labor laws, and create Chief AI Officer positions within those agencies and departments.</p><p>So why am I writing this? Well, firstly, it’s because it’s interesting to see how the EU and the United States diverge on this critical issue. Second, because I work with and on AI as a developer, and constantly navigate complicated ethical questions on exactly what we’re using it for.</p><p>AI has great technological potency and potential. Potential to revolutionize all industries, and change the way we interact with our world in very fundamental ways.</p><p>There is danger as well. The most costly accidents happen when something we take for granted stops working for a minute. It’s the everyday things — like the brakes on your car, the food you put in your mouth, or the airplane you took to a meeting — that lead to life-ending disasters when they stop working for a minute.</p><p>We know this, or at least our legislators do. That’s why we have regulators and laws governing how each of those things should be tested and monitored before we — the public — come into contact with them. The reason we can take these things for granted is because laws and regulators made them safe and continue to do so.</p><p>Executive Order 14110 required developers of AI to share and provide transparency to testing, and testing procedures of it. It specified that the order covered AI which pose risks to U.S. national security, the economy, public health or safety. This puts the requirements for such AI on the same level as products produced for the Department of Defence, which is governed by the Defence Production Act.</p><p>It also required the development of Watermarking for AI generated content, which would make it easier to identify AI generated content. This would specifically mean that if you provide a service for generative video, image, audio or text, you must make it identifiable as generated by AI.</p><p>The applications of this for protecting against AI-generated pornography, false imagery, automated call center bots, chatbots, and much more cannot be underestimated. In a time when we’ve already seen the first convictions for the possession of AI-generated child exploitation material, what can be more important than making it easier to find out how it was made?</p><p>The order was also made to stem the tide of intellectual property theft. It’s no secret that lawsuits involving copyright law and generated images are on the rise, and rightfully so. As generative AI becomes better, hordes of artists, photographers, writers, and content creators are being forced out. But they are being forced out not by fair competition but by AI built on their own creations, with no compensation or ability to say no.</p><p>Revoking executive order 14110 is — in my opinion — a huge mistake, when there is nothing to replace it. The White House calls it a legislative reset. Republicans in congress calls it protecting free speech. I don’t see how it’s protecting anything. If there is nothing to replace it, it’s simply a step backwards.</p><p>When the order was issued by President Biden it was hailed by Democrats in congress as a “comprehensive strategy for responsible innovation”, while acknowledging that the initiative to make lasting legislation was now in their hands. Polling showed that 69% of all voters (both parties) supported the executive order, and yet it has now been revoked.</p><p>In the EU, the majority of the AI Act is coming into effect in 2025. The Act addresses the safety concerns of AI by dividing them up into risk categories and applying different rulesets to them based on these categories. Many AI systems pose little, if any, risk, but all will need to be categorized using this system. The most groundbreaking part of the Act — in my opinion — is the Unacceptable Risk category and how it addresses the issue of AI watching AI.</p><p>In the Unacceptable risk category, we find things like:</p><ul><li>Cognitive behavioral manipulation of people</li><li>Social Scoring</li><li>Biometric identification or categorization of people</li></ul><p>It should be clear to all why these things pose an unacceptable risk to our societies. If it’s not, ask yourself what a free society looks like, and then try fitting these things into that society.</p><p>In the High Risk category we find things like AI used in toys, aviation, cars, medical devices and lifts. These things fall under the EU Product safety legislation, and are already highly regulated for public safety so obviously AI in these areas pose a high risk to our society.</p><p>We also find AI systems that fall into specific categories, such as Law Enforcement, Education, Asylum seeking, and Assistance tools in sensitive areas such as legal or medical understanding.</p><p>Most importantly, all High risk systems must be assessed before being put on the market, and throughout their availability. People will also have the right to file complaints against these systems, with the relevant authorities.</p><p>In — what I would call — a groundbreaking move, the Act actually specifies that people and not automation should monitor all AI. Think about that sentence earlier: “It’s the everyday things …” This addresses that. It specifically reminds us not to take AI for granted.</p><p>The AI Act also contains a lot of the same things Executive Order 14110 does, with the important caveat that this is legislation, and won’t be easily overturned by the next President of the European Commission. This includes things like watermarking, and identification of AI generated content so important to law enforcement and public interest.</p><p>So what happens from here?</p><p>This isn’t the biggest divide in the western world, and I can honestly understand why people are more concerned about U.S. withdrawal from the Paris Agreement on Climate Change, than 14110. It shouldn’t come as a surprise, but I understand the concern. It concerns me too.</p><p>Revoking 14110 shouldn’t come a surprise either, but it should be cause for concern. AI is entering every part of our society, and it will only continue to do so. What was a fun gimmick a few years ago, is now becoming frighteningly realistic, to the point where most people can’t tell if an image or video is AI or not anymore.</p><p>“Believe nothing you hear, and only one half that you see” — Edgar Allan Poe</p><p>The “Age of AI” might as well be called the “Age of Disbelief”. When you can’t trust what you see, what you hear, or what you read, then what is left but disbelief? This is why AI must be regulated, made transparent, and its use made clear to all. Because if not, we might as well be living in the <strong>Age of Disbelief</strong>.</p><p>In 2025 (most of) the AI Act comes into effect. With the current cast of characters in the White House, I expect we will see it come under pressure. My hope is that our leaders and legislators will face that pressure head on, and make sure we — the public — know who is putting it under pressure.</p><p><strong>Note for transparency:</strong> I have used Grammarly to edit this article, for correctness. No AI has been used for the contents of this Post.</p><p>Remember to leave a follow here on Medium or check out my <a href="https://www.linkedin.com/in/martinricken/">LinkedIn</a> to see what else I get up to.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bd5016dc2f56" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Postman — Pre-Request scripting]]></title>
            <link>https://medium.com/@lorique/postman-pre-request-scripting-fc7cdcf9ba9c?source=rss-233164038af------2</link>
            <guid isPermaLink="false">https://medium.com/p/fc7cdcf9ba9c</guid>
            <category><![CDATA[api-development]]></category>
            <category><![CDATA[javascript-tips]]></category>
            <category><![CDATA[postman]]></category>
            <category><![CDATA[developer-tools]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Martin Ricken]]></dc:creator>
            <pubDate>Wed, 16 Aug 2023 08:59:07 GMT</pubDate>
            <atom:updated>2023-08-16T08:59:07.695Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*LjDWEHCN0v17YOHh" /><figcaption>Photo by <a href="https://unsplash.com/@rubaitulazad?utm_source=medium&amp;utm_medium=referral">Rubaitul Azad</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>Postman — Pre-Request scripting</h3><h4>I work with APIs a lot, so I decided to solve an annoying problem: updating request tokens automatically. Here is how I did it.</h4><p>I want to preface this guide by saying this script works for most, but not all, of my APIs. The main difference is the login response, which can vary depending on the month&#39;s flavor.</p><pre>{<br>    &quot;id&quot;: 2,<br>    &quot;access_token&quot;: &quot;eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczovL2ZjbXNhcGkudGVzdC9hcGkvdjEvYXV0aC9sb2dpbiIsImlhdCI6MTY5MjE3MjE1OCwiZXhwIjoxNjkyMTc1NzU4LCJuYmYiOjE2OTIxNzIxNTgsImp0aSI6ImZZdmJ3enBDZzFpVUNKT1AiLCJzdWIiOiIyIiwicHJ2IjoiMjNiZDVjODk0OWY2MDBhZGIzOWU3MDFjNDAwODcyZGI3YTU5NzZmNyJ9.9bTpzDT2FjX_JhYb0mcYpKWWaS5WfeQa7b7h7uL2AUY&quot;,<br>    &quot;token_type&quot;: &quot;bearer&quot;,<br>    &quot;expires_in&quot;: 3600<br>}</pre><p>Common for all login responses is that it needs a token and an expiration timer (in seconds). The user&#39;s ID and a token type are often included as well, but these are optional.</p><p>In the above example, a JWT (JSON Web Token) is the token, and we&#39;re using Bearer for authorization.</p><p>The first thing we need is to define the variables we need. I don&#39;t set any default values as it&#39;s unnecessary. If the script has run before, these variables are in the collection variables section of Postman for the collection the script is in.</p><pre>let tokenDate = new Date(2010,1,1);<br>let tokenTimestamp = pm.collectionVariables.get(&#39;timestamp&#39;);<br>let userId = pm.collectionVariables.get(&#39;userid&#39;)<br>let token = pm.collectionVariables.get(&#39;token&#39;)<br>let expiresInTime = pm.collectionVariables.get(&#39;expires_in&#39;);</pre><p>Next, we need to decide if a new token is required. This can be done in many ways, but I prefer the timestamp check because it allows me to run the check the fastest. Worst case scenario, I will need to manually clear the token and rerun the script if it has expired.</p><p>To check if the token has expired, we need to compare the timestamp of when the token was generated to the current timestamp to find out how much time has elapsed and see if it&#39;s above the expires_in value from the login response.</p><pre>if(tokenTimestamp){<br>    tokenDate = Date.parse(tokenTimestamp);<br>}<br><br>if(!expiresInTime){<br>    expiresInTime = 1500000; // Set default expiration time to 15 minutes<br>}<br><br>now = Date.now();<br><br>let elapsed = (now - tokenDate) / 1000;</pre><p>Note that the javascript date returns a value in microseconds and not Unixtime, so we need to convert it to seconds in order to compare it to the expires_in value — which is in seconds.</p><p>Next, we need to find out if we need to get a new token, which is a reasonably simple check on elapsed time and whether or not we already have a token.</p><pre>if(elapsed &gt;= expiresInTime || token === null || token === undefined)<br>{<br>    let url = pm.environment.get(&#39;host&#39;)<br>    url += &#39;:&#39; + pm.environment.get(&#39;port&#39;)<br>    url += pm.environment.get(&#39;uri&#39;)<br>    pm.sendRequest({<br>        url:  url + &#39;/auth/login&#39;,<br>        method: &#39;POST&#39;,<br>        header: {<br>            &#39;Accept&#39;: &#39;application/json&#39;,<br>            &#39;Content-Type&#39;: &#39;application/json&#39;<br>        },<br>        body: {<br>            mode: &#39;raw&#39;,<br>            raw: {<br>                &#39;email&#39;: pm.environment.get(&#39;username&#39;),<br>                &#39;password&#39;: pm.environment.get(&#39;password&#39;),<br>            }<br>        }<br>    }, function (err, res) {<br>        if (res.code === 200) {<br>            let response = res.json();<br>            pm.collectionVariables.set(&#39;token&#39;, response.access_token);<br>            pm.collectionVariables.set(&#39;timestamp&#39;, new Date());<br>            pm.collectionVariables.set(&#39;userid&#39;, response.id);<br><br>            pm.collectionVariables.set(&#39;expires_in&#39;, response.expires_in);<br><br>            console.log(&#39;Token set: &#39; + response.access_token);<br>        }<br>        else {<br>            console.log(res);<br>            throw new Error(&#39;Login failed with status: &#39; + res.status + &#39; (Code: &#39; + res.code + &#39;)&#39;);<br>        }<br><br>    });<br>}</pre><p>If we don&#39;t have a token or it has expired, start the process of making a login request. We build a URL using environment variables, which is a good time to mention you should always be using environments in Postman. I&#39;ve set up a local, staging, and prod environment and defined host port and uri in all of them for each environment.</p><p>We also need login credentials, which should always be defined as environment variables, as the login details may differ, and because you don&#39;t want credentials in your code.</p><p>We send the request using pm.sendRequest which takes a request object (similar to many other javascript HTTP request frameworks), and as the second parameter, it takes a callback with the response in. We check for code 200; if we get it, we set the variables from the response. If we get an error, we log the response object and throw a javascript error to stop further execution.</p><p>I set this pre-request script on my Auth folder for my Postman APIs to make it easier for me to test and browse authorized endpoints. Sometimes, I need to make small changes to which response fields I read from, but for the most part, the script remains unchanged.</p><p>Pre-request scripts are powerful tools, and although I wish I could have more &quot;files&quot; for all my other scripts (for better organization), this one works well.</p><p>Try it out, and let me know what you think!</p><p>Remember to leave a follow here on Medium or check out my <a href="https://www.linkedin.com/in/martinricken/">LinkedIn</a> to see what else I get up to.</p><p>Get the complete script on my <a href="https://gist.github.com/lorique/6ad269b30005b5efb985141741375cd5">GitHub</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fc7cdcf9ba9c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[HowTo: Multi-Stage docker builds with Hugo.]]></title>
            <link>https://medium.com/@lorique/howto-multi-stage-docker-builds-with-hugo-78a53565d567?source=rss-233164038af------2</link>
            <guid isPermaLink="false">https://medium.com/p/78a53565d567</guid>
            <category><![CDATA[gohugo]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[serverless]]></category>
            <category><![CDATA[containerization]]></category>
            <category><![CDATA[docker]]></category>
            <dc:creator><![CDATA[Martin Ricken]]></dc:creator>
            <pubDate>Mon, 31 Jul 2023 07:21:57 GMT</pubDate>
            <atom:updated>2023-07-31T07:21:57.792Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QSmg-KsNPpof_yQbZxDjpQ.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@afgprogrammer?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Mohammad Rahmani</a> on <a href="https://unsplash.com/photos/1VW6HLOQE5A?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>Running a flat-file Hugo site couldn’t be easier with Docker and NGINX. A simple two-step process of making the HTML and building a container to run it.</p><p>I love flat-file sites for their speed and simplicity. Here, I’ll show you how to build a Docker container containing only the generated HTML and a webserver.</p><p>For this example, I will focus entirely on making the container and let you find out how to deploy it to your hosting provider.</p><p>First, we need a Dockerfile, and it’s surprisingly simple.</p><pre># Stage 1<br>FROM alpine:latest AS build<br><br># Install the Hugo go app.<br>RUN apk add --update hugo<br><br>WORKDIR /opt/HugoApp<br><br># Copy Hugo config into the container Workdir.<br>COPY . .<br><br># Run Hugo in the Workdir to generate HTML.<br>RUN hugo <br><br># Stage 2<br>FROM nginx:1.25-alpine<br><br># Set workdir to the NGINX default dir.<br>WORKDIR /usr/share/nginx/html<br><br># Copy HTML from previous build into the Workdir.<br>COPY --from=build /opt/HugoApp/public .<br><br># Expose port 80<br>EXPOSE 80/tcp</pre><p>We can see it’s a two-stage process, with stage 1 being the building process where we generate the HTML using the newly installed Hugo application. Stage 2 is a simple NGINX server, where we dump the generated HTML from the build step into, ready to be served.</p><p>Put a reverse proxy for SSL in front (CloudFront for AWS hosting comes to mind), and you’ve got a container serving your flat-file site on pretty much any cloud platform.</p><p>The only downside is cost. Running a container could be more expensive than the S3 setup I’m currently running, especially if you have to scale the setup. It’s also worth mentioning that you must maintain the container yourself, which is an added overhead. That being said, the vendor lock is broken with this setup.</p><p>During a recent meeting, I was asked how my website was hosted, and the short answer was:</p><blockquote>“With some difficulty, and acceptance of vendor locking.”</blockquote><p>But it doesn’t have to be that way. Containers are supported by all cloud hosting providers known to me, so this is how I would untangle myself from my current vendor if I were so inclined.</p><p>Generating and deploying HTML is currently a three-step process, which takes around 30 seconds on average, depending on how many changes I’ve made. It’s worth noting that the S3 bucket is cleared before the new content is uploaded, which also takes a little time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Y3Ai23XPWP5gxYTgfbMsoQ.png" /><figcaption>Github action processing time.</figcaption></figure><p>If you want to know more about my experience of running a flat-file website for two years - and why I switched - you can read more about it here:</p><p><a href="https://medium.com/@lorique/hugo-two-years-with-a-flat-file-serverless-website-cbb6c4459f2d">Hugo: Two years with a flat-file serverless website.</a></p><h3>TLDR;</h3><p>Docker multi-stage builds can generate the HTML from Hugo and then provide that HTML for the next stage, where we make an NGINX container to serve the HTML to visitors. The process is painless, though possibly more expensive to run.</p><p>I don’t consider vendor locking all bad, especially for my current setup. I have zero cost, zero container/server maintenance, and I don’t feel the need to break the vendor locking for this particular setup.</p><p>Don’t forget to leave a follow here on Medium or check out my <a href="https://www.linkedin.com/in/martinricken/">LinkedIn</a> to see what else I get up to.</p><p>Github repo: <a href="https://github.com/lorique/hugo-nginx-docker">https://github.com/lorique/hugo-nginx-docker</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=78a53565d567" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Hugo: Two years with a flat-file serverless website.]]></title>
            <link>https://medium.com/@lorique/hugo-two-years-with-a-flat-file-serverless-website-cbb6c4459f2d?source=rss-233164038af------2</link>
            <guid isPermaLink="false">https://medium.com/p/cbb6c4459f2d</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[serverless]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[gohugo]]></category>
            <dc:creator><![CDATA[Martin Ricken]]></dc:creator>
            <pubDate>Tue, 14 Mar 2023 09:51:21 GMT</pubDate>
            <atom:updated>2023-03-14T09:51:21.508Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PdW7jLwQB7UTNbhFnyuPeg.jpeg" /></figure><h4>In May 2021, I was fed up with my website. It was nothing more than a business card with contact information, and it cost me $20 a month to host it.</h4><p>Worse yet, I had to keep the EC2 container up to date, which required an install and upgrade script that almost always failed. The only thing I had gotten working well was the SSL renew script, and this was now failing due to version changes in the software I was using.</p><p>I needed something new — and simpler — so I went with <a href="https://gohugo.io/">Hugo</a>, a flat-file framework for building websites. The technology stack was YAML, Markdown, and a simple template language on top of HTML/CSS/Javascript built into a Go application. Very simple.</p><p>Hosting it could be done with any cloud provider, so I went with AWS because that’s what I knew. GCP and Azure seem to be just as simple. I wrote an <a href="https://www.lorique.net/posts/web/hugo-a-flat-file-cms/">article about it</a> back then if you want to see how it was set up.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y8JlgTps_85xRumPXggM7A.jpeg" /><figcaption>Server Costs change 2021</figcaption></figure><p>The immediate effect of this change was a 99.75% drop in hosting costs. Almost two years later, I can confidently say that it was a 100% drop in cost because I have received no bills from Amazon since the change.</p><p>I’ve been thinking about why for a while. It could be that it would cost them more to bill me than just to let it go. It could also be that I’ve been wrapped up in some cost program I’m unaware of. Sometimes AWS doesn’t charge you if you have very little traffic, and the site only gets about 20,000 hits monthly.</p><p>Regardless of what caused it, the outcome is the same. No hosting cost for almost two years now.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/973/1*qCaAZ1mWWjyGMKO5aKrP_A.png" /><figcaption>Six-month server cost</figcaption></figure><p>The current status is that AWS costs sit around one American cent per month, and they don’t bill me that one cent.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UehMSjqRCFteOw-H2LxQOg.png" /><figcaption>AWS bill summary Feb 2023</figcaption></figure><p>I was very focused on performance, features, and SEO when building the website. I wanted the site to have more of my CV information and include a blog. I moved the blog here this year, but I still crosspost with canonical URLs.</p><p>Working with the templates is easy, especially since Hugo supports overriding templates and files. I still keep the <a href="https://github.com/hugo-toha/toha">Toha</a> theme around, but I made a lot of modifications to make it work for me and include SEO options such as canonical URLs and image captions. This has been done by simply overriding template files from the theme.</p><p>The theme is stored in a themes folder and is a <a href="https://git-scm.com/book/en/v2/Git-Tools-Submodules">git submodule</a> — a little-known and used feature of git. I don’t recommend anyone use it without expert knowledge of how Git works. Using a package management system is much preferable in this day and age, and I will probably convert to this method myself at some point.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/942/1*vGrt7pL5DFs5O26godlfYQ.png" /><figcaption>Pagespeed stat for Desktop</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/942/1*ntMDX2NGUoXplDh7oiDy0w.png" /><figcaption>Pagespeed stat for Mobile</figcaption></figure><p>Performance is always an issue, but from the beginning, my website performed like a champ. 40ms to first data (even when testing over VPN from Asia), and the theme had acceptable metrics on <a href="https://pagespeed.web.dev/">pagespeed</a> and google search console.</p><p>Regardless I spent a few hours fixing SEO, image, and CSS issues and making the theme a little more my own. All told, I probably spent an initial eight hours working on technical issues. The content took longer, but one workday of technical work to get it into a great state and ready to deploy is very short.</p><p>The biggest surprise has been how little time I’ve spent on technical issues once the site was up and running. Less than one hour to date. This includes upgrading the NodeJS version on my redirect function — which runs from AWS Lambda—updating CSS and JS versions and updating Hugo and Toha versions.</p><p>The biggest realization I’ve had from working with Hugo and flat-file frameworks is <strong>there are little to no attack vectors</strong>. All editing work is done locally and can’t be done through the hosted content. In a world where cybersecurity is becoming a priority, thinking about how your website can be attacked should be at the top of your to-do list. With flat-file, it can be very hard to spot any vulnerabilities, but here are a few things to consider:</p><ul><li>Secure your Github and AWS accounts with two-factor authentication.</li><li>Ensure your S3 bucket is secure, and clear out all files before deploying an update to the site.</li><li>Keep javascript libraries up to date. This includes any Lambda functions.</li><li>Update your flat-file application — Hugo, in my case.</li></ul><p>I really can’t think of anything else. DDOS protection is enabled with standard AWS Shield for Cloudfront, and since I have no forms, logins, or otherwise on my website, everything else is irrelevant.</p><p>Flat-file frameworks can replace 90% of all websites I’ve ever worked on. Most of the features these websites need — such as newsletter signup or e-commerce — can be replaced by a third-party integration, which can be done using pure javascript. So if you haven’t tried out flat-file frameworks yet, I encourage you to do so.</p><p>Have you tried a flat-file framework? Let me know what you think in the comments.</p><p>Like this kind of content? Please leave a clap, comment, or let me know how I’m doing on <a href="https://twitter.com/MartinRicken">Twitter</a>.</p><p>Don’t forget to leave a follow here on Medium or check out my <a href="https://www.linkedin.com/in/martinricken/">LinkedIn</a> to see what else I get up to.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cbb6c4459f2d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How/Why: REST API authorization with JWT in NodeJS]]></title>
            <link>https://medium.com/@lorique/how-why-rest-api-authorization-with-jwt-in-nodejs-71d99af923c8?source=rss-233164038af------2</link>
            <guid isPermaLink="false">https://medium.com/p/71d99af923c8</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[expressjs]]></category>
            <category><![CDATA[node]]></category>
            <dc:creator><![CDATA[Martin Ricken]]></dc:creator>
            <pubDate>Tue, 07 Mar 2023 09:51:09 GMT</pubDate>
            <atom:updated>2023-03-07T09:57:27.977Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kLRlD_eipltAkaJ3a218jA.jpeg" /></figure><h4>In this article, we&#39;ll delve into how to implement JWT using NodeJS and why I think it&#39;s the best way forward for REST architecture.</h4><p>JWT stands for JSON Web Token and is a standard defined in <a href="https://www.rfc-editor.org/rfc/rfc7519">RFC 7519</a> for &quot;representing claims to be transferred between two parties.&quot; The token content is written in JSON and added as a payload which is digitally signed for later verification. The reason we sign it is to ensure the integrity token and protect against the manipulation of the custom token claims and payload.</p><p>Node has a number of packages for making JWTs, and the one I&#39;ll use here is <a href="https://www.npmjs.com/package/jsonwebtoken">jsonwebtoken</a>. It&#39;s installed with npm just like any other Node package, but we need to do one more thing before proceeding; generate a public/private RSA (min 2048 bits) key pair to be used when signing our key.</p><p>A token needs a payload, and for this example, we&#39;ll use a payload that mimics a MongoDB document.</p><pre>// index.js<br>const jwtHelper = require(&#39;./jwtHelper&#39;);<br><br>const user = {<br>  &#39;_id&#39;: 1,<br>  &#39;name&#39;: &#39;Martin Ricken&#39;,<br>  &#39;roles&#39;: [&#39;editor&#39;, &#39;developer&#39;, &#39;architect&#39;]<br>}<br><br>const token = jwtHelper.newToken(user);</pre><p>To sign a token, we include the jsonwebtoken library and call the sign method. Here we pass in our payload, the private key, and any options.</p><pre>// jwtHelper.js<br>const fs = require(&#39;fs&#39;);<br>const jwt = require(&#39;jsonwebtoken&#39;);<br><br>const jwtExpiresIn = 300;<br>const jwtPrivate = fs.readFileSync(&#39;./jwt&#39;, &#39;utf8&#39;).toString();<br>const jwtPublic = fs.readFileSync(&#39;./jwt.pem&#39;, &#39;utf8&#39;).toString();<br><br>const tokenPayload = (user) =&gt; {<br>  return {<br>    id: user._id,<br>    username: user.name,<br>    role: user.roles<br>  };<br>}<br><br>const newToken = (user) =&gt; {<br>  const payload = tokenPayload(user)<br>  const options = {<br>    expiresIn: jwtExpiresIn,<br>    algorithm: &#39;RS256&#39;,<br>    audience: &#39;json-web-token-example&#39;<br>  };<br><br>  return jwt.sign(payload, jwtPrivate, options);<br>}</pre><p>We sign the token synchronously because it&#39;s a quick operation, but if we wanted to, we could make it asynchronous using Promisify. We&#39;ll do that when we verify the token to show how.</p><p>Now that we have the token let&#39;s briefly cover how it should be exchanged with your API. The standard is to forward it with the headers, and for this reason, the JWT is base64url encoded, a form of encoding similar to base64 but specifically url safe.</p><p>The token should be included in the Authorization header — also known as a Bearer Token. The headers sent to your API should look something like this:</p><pre>&gt; GET /api/v1/users/1 HTTP/1.1<br>Host: localhost:3000<br>User-Agent: insomnia/2022.7.3<br>Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjYzZmI1NGZlZjllYzQwNDBlZDAzMzEwMiIsInJvbGUiOiJ1c2VyIiwiaWF0IjoxNjc3NDE4MzUxLCJleHAiOjE2ODUxOTQzNTF9.cUVU6YIzlUCij0QUnZnwNCFGsFTH4005lBIOFfnR8os<br>Accept: */*</pre><p>As you can see from my User-Agent, I use the <a href="https://insomnia.rest/">Insomnia REST</a> application, an alternative to Postman. At a later date, I might go deeper into why, but for now, I&#39;ll leave it up to you how you send requests to your API; just remember to add the Authorization header.</p><p>Once we receive the header with the token, we need to verify its validity. A token can be invalid for many reasons, and you should implement checks that correspond with your application. A few examples of things you should look at when deciding if a token is valid are:</p><ul><li>Is the token expired? Tokens have a lifetime, so we pass in the option <strong>expiresIn</strong>, telling the library how long the token should be valid.</li><li>Is the token using a valid signature? If the token has been manipulated, the token signature will not match, and the token should be considered invalid.</li><li>Did the user change credentials recently? If so, this might indicate a security problem, and all tokens older than when the credentials were changed should be expired.</li><li>Does the user still exist, and is it active in your system? Many developers forget to check if a user is active, causing tokens to be valid even after being disabled.</li><li>Has that been a forced expiration event? Sometimes you&#39;ll want your applications to have the ability to expire all tokens. Things like payload or token lifetime changes and security issues could result in you needing to expire all tokens. So having that ability is worthwhile.</li></ul><p>In this example, we&#39;ll only cover token expiry and validity. The rest is too application dependent and would require a much longer example.</p><pre>// jwtHelper.js<br>const { promisify } = require(&#39;util&#39;);<br><br>const verifyToken = async (token) =&gt; {<br>  const decoded = await promisify(jwt.verify)(<br>    token,<br>    jwtPublic<br>  );<br><br>  return decoded;<br>}</pre><p>To verify a token, we call the verify method, which takes a token and the public key matching the private key used for signing the token. In the verifyToken method above, I&#39;ve used the promisify utility to make the verification step asynchronous and made the method itself asynchronous.</p><p>This is all to show how, but it&#39;s worth noting that you should always consider running all Node asynchronously, as Node is single-threaded, and you don&#39;t want to block the main thread.</p><p>Once verified, the decoded token will contain all my registered and payload claims. So I will have access to the id, username, and roles from my payload in the decoded object.</p><p>So now you know how to generate a JWT. So what payload do you put into it? The RFC specifies a few <a href="https://www.rfc-editor.org/rfc/rfc7519#section-4.1">registered claims</a> which can be used for various things, such as:</p><ul><li>(iss) Multiple issuer environments can be used for logging where faulty keys were issued, so you can track down issues.</li><li>(sub) Subject can be used to identify key types, such as the difference between an authorization key and a data key used for transporting data between services.</li><li>(aud) Audience can be used to identify which services should accept the key. This can be very useful in a microservice setup if you want to limit access to certain services.</li></ul><p>Personally, I&#39;m a fan of using the payload itself to transport permissions and/or roles which the user has. In a microservice architecture, we could need to be able to verify if a user has permission to do certain actions, and by putting this information into the payload, we can verify without having to look up user permissions.</p><p>In the example, my payload includes a list of roles. I&#39;ll use these roles in a permission check at my service endpoint security middleware to either deny or allow access.</p><p>The payload username and ID are useful for audit and error-logging purposes. You can put what you want in the payload, but keep in mind that if the token is compromised, you&#39;re leaking information about the system. So be careful what you put in there, and weigh the usefulness vs. the risk of putting the information in the token.</p><p>JWTs are very useful, especially for decoupled software infrastructure architecture such as Microservices, Security First, or Serverless. As technology progresses and more APIs are built to scale, it becomes critical to think about how we deal with authorization, not just authentication.</p><p>Adding user roles to your JWT payload is one way of dealing with authorization that doesn&#39;t break the decoupling principles. More importantly, it also allows us to inject user permissions into our API. This means that if certain parts of our REST API depend on permissions, we can inject these into it. That makes it a solution that allows us to adhere to the <a href="https://en.wikipedia.org/wiki/SOLID">SOLID</a> principles of software development at an infrastructure level.</p><p>Like this kind of content? Please leave a clap, comment or let me know how I&#39;m doing on <a href="https://twitter.com/MartinRicken">Twitter</a>.</p><p>Don&#39;t forget to leave a follow here on Medium or check out my <a href="https://www.linkedin.com/in/martinricken/">LinkedIn</a> to see what else I get up to.</p><ul><li><a href="https://github.com/LoriqueNET/node-code-examples/tree/master/examples/json-web-token">Full code example</a></li><li><a href="https://github.com/LoriqueNET/node-code-examples">All NodeJS code examples</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=71d99af923c8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why you should be using Go-Task]]></title>
            <link>https://medium.com/@lorique/why-you-should-be-using-go-task-3cd30897f8d8?source=rss-233164038af------2</link>
            <guid isPermaLink="false">https://medium.com/p/3cd30897f8d8</guid>
            <category><![CDATA[developer-tools]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[taskfile]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[docker]]></category>
            <dc:creator><![CDATA[Martin Ricken]]></dc:creator>
            <pubDate>Fri, 03 Mar 2023 08:33:13 GMT</pubDate>
            <atom:updated>2023-03-03T08:33:13.030Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lbpydEgrO3lnT9xjlZJZxg.png" /><figcaption>Logo from <a href="https://taskfile.dev/">Taskfile.dev</a></figcaption></figure><h4>In today’s tooltip I’ll be showcasing go-task. It’s a tool designed to make executing terminal commands or even lists of commands needed for specific operations easier.</h4><p>The example used is GNU make, but there are plenty of other great use cases. In this article, I’ll cover why you should be using it and how to use it.</p><p>If you’ve ever gotten annoyed at long readme installation or execution instructions, you know the pain of having to execute a long list of commands to get a dev environment up an running. It can be a massive pain, especially if there are a number of complicated instructions.</p><p>Go-task solves this problem by combining terminal commands with a light sprinkling of application features that allow you to create scripts and small applications that don’t require much command-line knowledge to execute.</p><p>Installing go-task is very simple. I used to <strong>brew install go-task</strong> to install it on my local machine, but there are many ways to install it. Check the <a href="https://taskfile.dev/installation/">installation instructions</a> for more info.</p><p>The basic task file consists of a task name and command to be executed, written in YAML format.</p><pre># Taskfile.yml<br>version: &#39;3&#39;<br><br>tasks:<br>  greet:<br>    cmds:<br>      - echo &quot;Hello World&quot;</pre><p>To execute the command, you simply run task greet from the same directory as the Taskfile.yml file.</p><p>A good real-world example is running tests. I sometimes like running my NodeJS tests with a local mongo database available because it lets me test for errors coming from mongo schema. This isn’t going to be an article about best practices for testing, but for obvious reasons, testing using 3rd party applications is not ideal.</p><p>Mocking responses from the database will generally be more reliable, but writing these tests is also more time-consuming. Time is the one resource I rarely have in abundance when working for clients, so I sometimes choose the path of least resistance.</p><p>I run my tests with a local MongoDB docker instance, but I want to ensure my environment is clean before running my tests. This command looks something like this:</p><pre>version: &#39;3&#39;<br><br>env:<br>  DB_SERVICE_NAME: mongo<br><br>tasks:<br>  test:<br>    cmds: <br>      - &quot;<br>      read -p &#39;This will reset your local environment. Are you sure? (Y/n) &#39; -r;<br>      if [[ ! $REPLY =~ ^[Yy]$ ]]<br>      then<br>          exit 1;<br>      fi<br>      &quot;<br>      - docker-compose stop -t 0 $DB_SERVICE_NAME<br>      - docker-compose rm -f $DB_SERVICE_NAME<br>      - rm -rf node_modules<br>      - rm -rf docker/db<br>      - docker-compose up -d $DB_SERVICE_NAME<br>      - npm install<br>      - npm run test</pre><p>As you can see, I’m asking the user to confirm before moving ahead, and then I run a series of commands:</p><ul><li>Stop the mongo container if it’s running.</li><li>Remove the mongo container entirely.</li><li>Remove all install node modules.</li><li>Remove the local folder I store my database data in.</li><li>Bring up a new mongo database.</li><li>Install all node modules from the package-lock.json file.</li><li>Run my test command as defined in my package.json</li></ul><p>This is done by simply calling <strong>task test</strong> on any local environment.</p><p>Global environment variables can and should be used in Taskfile.yml, but it’s important to note that they can be used for both specific commands and globally for the script.</p><pre>version: &#39;3&#39;<br><br>env:<br>  DB_SERVICE_NAME: mongo<br><br>dotenv: [&#39;.env&#39;, &#39;config.env&#39;, ...]<br><br>tasks:<br>  env:<br>    LOCAL_ENV: &quot;example-env&quot;<br>  dotenv: [&#39;example.env&#39;]<br>  cmds:<br>    - echo &quot;Local env: $LOCAL_ENV&quot;</pre><p>The dotenv format can also be used, and multiple files can be imported if needed. Remember that these environment variables are also available for any scripts or code you run from your task. So in the test example, the variables I defined are available during the test runs. I can use this to control the application&#39;s aspects during the tests if my application supports it.</p><p>The use cases of go-task is endless. You can run tests to compile CSS or javascript, download test data, or even build entire development setups with a single command.</p><p>The best part is that I no longer have to keep a bin or script directory in all my projects. My readme documentation now includes a few short commands and descriptions of what they do, rather than line upon line of commands someone needs to enter manually.</p><p>Is it better than having specific scripts? From a technical standpoint, it’s the same because I’ve simply moved my scripts into a yaml format. But for handing projects over to new developers or running commands during releases, go-task makes my life a lot easier.</p><p>Have you used go-task? What are some use cases you’d like to try? Let me know in the comments.</p><p>Get go-task at <a href="https://taskfile.dev/">https://taskfile.dev/</a>, and don’t forget to follow me on Medium or <a href="https://www.linkedin.com/in/martinricken/">LinkedIn</a> to see what else I get up to.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3cd30897f8d8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to use prototyping to make smarter code with NodeJS]]></title>
            <link>https://medium.com/@lorique/how-to-use-prototyping-to-make-smarter-code-with-nodejs-604afa2c0cfb?source=rss-233164038af------2</link>
            <guid isPermaLink="false">https://medium.com/p/604afa2c0cfb</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[node]]></category>
            <category><![CDATA[expressjs]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[nodejs]]></category>
            <dc:creator><![CDATA[Martin Ricken]]></dc:creator>
            <pubDate>Mon, 27 Feb 2023 21:59:46 GMT</pubDate>
            <atom:updated>2023-02-27T21:59:46.572Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kLRlD_eipltAkaJ3a218jA.jpeg" /></figure><h4>In this example, I’ll show you how to add helper methods to your classes with little effort using prototyping. As a bonus approach leaves you with no messes to clean up later.</h4><p>I recently dived back into Node and started writing a portfolio project. I ended up wanting to use file caching for the project but needed to be able to expire the caches, which the <a href="https://www.npmjs.com/package/file-system-cache">file-system-cache</a> project does not support.</p><p>I wrote some helper functions for it, which — granted — I could call from inside my code. But instead, I decided to use prototyping to add the methods to the classes themselves and call them from the inside.</p><pre>function prototypeProperties(destClass, propObj) {<br>  Object.keys(propObj).forEach(function (name) {<br>    destClass.prototype[name] = propObj[name];<br>  });<br>}<br><br>export default prototypeProperties</pre><p>I was looking for a way to mimic what PHP does with traits, and with the method above, I’ve achieved that. It takes an uninitialized class (destClass) and an object of properties to add to that class (propObj) as input.</p><p>My main goal with the implementation was to mimic what PHP does with traits. From the point of view of OOP, javascript still has some way to go. Dependency Injection aside, effortlessly adding helper functions to your classes without dealing with inheritance issues is very useful.</p><pre>// helpers.js<br>const getCache = async (cacheKey) =&gt; {<br>  let cached = await cache.get(cacheKey)<br>  if (cached) {<br>    const now = new Date();<br>    if (cached.expiresAt &lt;= now.getTime()) {<br>      return false;<br>    }<br><br>    return JSON.parse(cached.content);<br>  }<br><br>  return false;<br>}<br><br>const setCache = async (cacheKey, content, expiresIn = undefined) =&gt; {<br>  const now = new Date()<br>  const cacheExpiresIn = expiresIn || 60<br>  const status = await cache.set(cacheKey, {<br>    &#39;expiresAt&#39;: now.setSeconds(now.getSeconds() + cacheExpiresIn),<br>    &#39;content&#39;: JSON.stringify(content)<br>  })<br>  return status;<br>}<br><br>const helpers = { getCache, setCache }</pre><p>These are some cache methods I needed to add TTL to my file cache implementation, and as you can see, the methods are fairly self-explanatory. A getter checks if the cache exists or has expired, and a setter stores the cache plus the expiration time as an object.</p><p>Both methods are stored in a helper object and obviously exported in the complete code snippet. With this object, we can continue using our previous prototyping method.</p><pre>// DogApi.js<br>prototypeProperties(DogApi, helpers)</pre><p>The method is called before exporting the class, and the methods are now available on the DogApi class.</p><p>So when should we actually use prototyping? Use cases include adding functionality to classes you either can’t or won&#39;t extend. It’s a clean way of adding new global functionality, such as global helper functions, to existing code without causing too much mess to clean up later.</p><p>I don’t like dealing with deep inheritance hierarchies in my code, though obviously, class inheritance has its place.</p><p>PHP has the ability to see traits, so if you have a trait called <em>Cachable, </em>you can check if classes have this trait. But obviously, we don’t have that option in Node, but we can check for undefined to see if a method is present, so we could use this to check if an object has a method or property.</p><p>What are your thoughts on using prototyping in this way? Do you prefer other approaches to solve the same issues? Let me know in the comments.</p><p>Please leave a follow, and feel free to check out the full code example on my GitHub below.</p><ul><li><a href="https://github.com/LoriqueNET/node-code-examples/tree/master/examples/prototyping">Full code example</a></li><li><a href="https://github.com/LoriqueNET/node-code-examples">All NodeJS code examples</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=604afa2c0cfb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[3 Reasons Scrum is failing you]]></title>
            <link>https://medium.com/@lorique/3-reasons-scrum-is-failing-you-34600f65a309?source=rss-233164038af------2</link>
            <guid isPermaLink="false">https://medium.com/p/34600f65a309</guid>
            <category><![CDATA[scrum]]></category>
            <category><![CDATA[agile]]></category>
            <category><![CDATA[project-management]]></category>
            <category><![CDATA[leadership]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Martin Ricken]]></dc:creator>
            <pubDate>Mon, 13 Feb 2023 07:50:47 GMT</pubDate>
            <atom:updated>2023-02-13T07:50:47.861Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PvPikIlcKD54ElmduoqVng.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@anniespratt?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Annie Spratt</a> on <a href="https://unsplash.com/photos/QckxruozjRg?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><h4>Scrum fails in a lot of businesses. Most don’t realize it, and the rest accept it as an industry standard they can’t avoid. Here are three reasons why Scrum fails and how to fix it.</h4><p>Scrum became an industry standard so long ago that I don’t even remember when it started. Still, I do remember thinking it was a response to a world of increasingly complicated IT projects.</p><p>Agile should be part of every education out there. It’s useful for more than just software development because it provides a framework for handling loosely defined projects, without having the overhead of having to map out everything you need to do immediately.</p><p>While I will advocate for being agile every chance I get, it&#39;s essential to understand that agile is not for everyone. If it&#39;s failing you, it might be a sign agile isn’t the right approach for your project or business.</p><h3>An agile world</h3><p>To ensure we’re on the same page, I want to go over the basic principles of what Agile is and when it&#39;s a good idea to use it.</p><p>Agile started with the Agile Manifesto, which contains the twelve tenants of the <a href="https://agilemanifesto.org/principles.html"><strong>Agile Doctrine</strong></a>. The purpose of the doctrine is to shift the way we think about software development away from fixed features, processes, and contracts, and to the idea of flexibility, interaction, and collaboration.</p><p>IT projects have become ever more complicated, and while we like to invent ways to make them simpler to code, the reality is that very few — if any — people on a project understand the project end to end. In an ever more specialized world of frontend, backend, cloud, architecture, and project management, it’s understandably hard to keep up with everything, so we hire specialists for each task.</p><p>With that comes an increased need for flexibility, interaction, and collaboration. Three words, if anything, have defined successful IT projects for the past two decades — if not more.</p><h3>Scrum is a doctrine</h3><blockquote>“Scrum is an Agile <strong>doctrine</strong> for working with a loosely defined project without having to plan every step of that project out.”</blockquote><p>Please re-read that quote one more time, and fix it in your mind.</p><p>Scrum consists of a number of ceremonies, which all have their place and purpose in the doctrine. Taking away any of them means the interaction between ceremonies becomes less stable and eventually breaks down entirely.</p><p>There is a simple way to know if this has happened. When taking on new projects, I always ask, “What agile method are you using?” And if the response goes something like “We use Scrum, but…” followed by an explanation of all the ceremonies or actions not taken. This is a red flag and clearly indicates that Scrum is failing a project or business.</p><p>Every ceremony has value, and taking one or more of them out will make Scrum fail. Take out the retrospective, and you won’t learn from your mistakes but be doomed to repeat them. Take out planning or backlog estimation sessions, and you will suffer from poorly defined tasks which lead to more tasks not finishing within a sprint or the backlog becoming full of entirely customer-facing tasks.</p><p>The fix to this problem is easy. Implement all ceremonies, and follow them like doctrine. Remember to include stakeholders — if possible — in as many of them as possible. This is an Agile process, and stakeholder feedback is paramount to success. After all, one of the central tenants of the agile manifesto is:</p><blockquote>“Business people and developers must <strong>work together</strong> daily throughout the project.”</blockquote><h3>Fixed projects</h3><p>The biggest reason Scrum is failing your business is this; Your projects are tightly defined, with a fixed delivery time and scope. The only reason you’re calling it agile is you don’t have to plan it all out in detail but can do it on the fly.</p><p>Anything fixed — such as scope, deadline, price, and team size — is deadly to any agile project. You lose the ability to adapt to changing requirements or needs of your stakeholders, and this is counter to another of the Agile manifesto tenants:</p><blockquote><strong>Welcome changing requirements</strong>, even late in development. Agile processes harness change for the customer’s competitive advantage.</blockquote><p>We can estimate only that one more sprint is needed or more than one sprint is needed. We cannot tell you that the project — or even a task — will be completed by a specific date. To do so would lock us into place and make us unable to respond to change.</p><p>Fixing this problem can be difficult. It requires a business to accept agile not only in the IT department but in the whole organization. Some businesses are unprepared for this and often try to do things in increments. But the reality is that if stakeholders are not agile, their projects won’t be either.</p><p>Being agile is not for everyone, and it’s OK. If parts of your business are not agile, sit down with them and discuss what being agile means. Start with the agile manifesto, and talk about the tenants individually. When everyone understands what agile means, you can start talking about what it means in a business context.</p><p>To me, the rewards outweigh agile&#39;s uncertainty, but uncertainty can be deadly to many projects. If it is to your project, it can’t be agile, and you should choose a different approach that eliminates or minimizes uncertainty rather than creates it.</p><h3>Unclear goal and purpose</h3><p>This may seem counterintuitive to everything I’ve just told you, but having a clear goal or purpose with a project is very important. This doesn’t mean it can’t change or we need a fixed scope. These things are counter to being Agile.</p><p>A clear goal for a project could be to build a new BI tool for sales or perhaps a new CRM for marketing use. These may seem like project scopes, but you’ll notice that we have not defined a fixed scope but rather a flexible one that can be adapted to fit the needs and purposes of the business as the project goes on.</p><p>Bad examples of Scrum projects are ongoing maintenance projects or research and prototype projects. To avoid these projects running wild and emptying your budgets, they should be scoped for time. Maintenance projects specifically fit better into the <a href="https://www.atlassian.com/agile/kanban/kanban-vs-scrum">Kanban method</a>, another agile software development approach.</p><p>Research and prototyping can happen within a Scrum project. These are called spike tasks and are scoped for a specific amount of time to gather more information and create properly defined tasks for the backlog. Larger projects entirely focused on creating better-defined tasks — such as a series of workshops with stakeholders — can similarly be scoped for time and revisited at the end of the project. But these should not be treated like scrum projects.</p><p>Fixing a project with an unclear goal or scope can be done in two ways. Either you find a goal and purpose for the project and let that shape the sprints, or you don’t and convert the project into a Kanban or spike project. Changing your approach to an agile project midway can save the project, and not being afraid to adapt is part of being agile.</p><h3>Cultists and Cults</h3><p>I like to reread the short Wiki on Cargo Cults whenever I run into Scrum teams that either partly or entirely ignore vital elements of Scrum. I often refer to these Pacific cults of World War II, using them to illustrate the dangers of ignoring parts of Scrum.</p><blockquote>“A cargo cult is a millenarian belief system in which adherents perform rituals which they believe will cause a more technologically advanced society to deliver goods.” — <a href="https://en.wikipedia.org/wiki/Cargo_cult">Cargo Cult</a></blockquote><p>During WWII, the Japanese and Americans used Pacific islands as supply depots. On some islands, indigenous people had lived for centuries, largely without contact with the rest of the world. Upon seeing the large amounts of food, goods, and <strong>cargo</strong> dropping from the sky, the indigenous people believed these “new” people’s gods must be mighty to provide such a plentiful bounty.</p><p>In the aftermath of WWII, cults started appearing on the islands, worshipping entities with names like “John Frum” or “Tom Navy.” The cults believed these spiritual entities would also provide cargo to them if they followed the same “rituals” as the newcomers had.</p><p>They would light signal fires and build replica airplanes and airstrips, hoping that by pleasing their new gods, cargo would drop from the sky. The cults persist even into our times, with the <a href="https://en.wikipedia.org/wiki/Prince_Philip_movement">Prince Phillip Movement</a> being the most widely known.</p><p>When I tell the Cargo Cult Story, I usually get a few laughs before someone tries to explain why their process isn’t the same. Arguments like: “We don’t need a daily stand-up; our devs just talk to each other whenever.” Or: “We don’t do planning poker with the whole team because our lead estimates everything.”</p><p>When asked what effect they think it has on their process, many struggle to find words or can only come up with positive effects. When challenged on it, answers like: “This is how it was where I worked before, and it got results!” or: “It has always been this way, and it works!” often surface.</p><p>These arguments are the result of a failure of logic. Correlation is, after all, not causation.</p><h3>Be truly agile</h3><p>The Agile manifesto is still a valuable source of inspiration to those who aspire to its tenets and ideas. I am one of those people. To me, agile — and Scrum in particular — is about people and creating an environment where we can freely discuss, iterate, and produce solid software. To be agile is to understand how processes interact and how those interactions change when the process, the people, or the product changes.</p><p>Scrum is, at face value, a set of rituals and ceremonies. It’s a framework for improving your team and your product. How you use the framework is up to you, but understanding, what the rituals and ceremonies are there to do, is vital.</p><p>Otherwise, you’re like the native, lighting a signal fire on the beach, expecting the cargo to drop from the sky any moment now.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=34600f65a309" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>