<?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 John Coleman on Medium]]></title>
        <description><![CDATA[Stories by John Coleman on Medium]]></description>
        <link>https://medium.com/@qbyteconsulting?source=rss-e70eb7ae8c2a------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*i49VzBjkJV8y_3QrpIIEkw@2x.jpeg</url>
            <title>Stories by John Coleman on Medium</title>
            <link>https://medium.com/@qbyteconsulting?source=rss-e70eb7ae8c2a------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 13:18:30 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@qbyteconsulting/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[Another Web Interface Framework]]></title>
            <link>https://medium.com/@qbyteconsulting/another-web-interface-framework-4949438ee06e?source=rss-e70eb7ae8c2a------2</link>
            <guid isPermaLink="false">https://medium.com/p/4949438ee06e</guid>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[web-framework]]></category>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[vuejs]]></category>
            <dc:creator><![CDATA[John Coleman]]></dc:creator>
            <pubDate>Sat, 22 Aug 2026 12:40:23 GMT</pubDate>
            <atom:updated>2026-08-26T03:52:17.588Z</atom:updated>
            <content:encoded><![CDATA[<h4>Porting Apache Tapestry To The Browser</h4><p><a href="https://react.dev/">React</a> is the most popular web interface development library, unlike more substantial frameworks like <a href="https://angular.dev/">Angular</a> and <a href="https://vuejs.org/">Vue</a>, React focuses just on providing the components for the presentation layer and with only a few key mechanisms to do the job, hence a seemingly low cognitive load — but things tend to get more complicated in reality and the cognative load mushrooms.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YrSb4CtdcPGa_oArQ6FHFA.jpeg" /><figcaption>Depiction of React as &quot;hooks of horror&quot;</figcaption></figure><p>Write any relatively sophisticated application with React and you will probably end up debugging it to find out why it will not behave as expected. React also muddles the presentation and data hydration code together which is a pattern going back to PHP. With PHP the barrier to entry is low, and for a small page a bit of code sprinkled through the markup is honestly fine. Java Server Pages (JSP), a Java technology I worked with long ago, also followed the PHP pattern, as Microsoft did later with their Active Server Pages (ASP).</p><p>In Java Server Pages the programatic elements are mixed in with the markup, just like PHP, and are encoded as <em>scriptlets — </em>little chunks of Java code. Later JSTL was developed which was much better, however it used custom tag libraries that meant the page was not directly renderable in a browser.</p><h4>Blending Presentation And Hydration Code An Anti-Pattern</h4><p>When the markup and the program are blended, it means there cannot be clean separation between the markup design process and the programming process. This creates hand-off friction when changes are made to the markup and the developer has to integrate them back into the page. Practically what tended to happen is programmers ended up both designing and programming web sites, but with a paucity of design skills the resulting sites had a prosaic developer aesthetic. If the design was done by a dedicated designer, delivering site change suffered from added technical impedance.</p><p>If the markup and program are separated then a designer can work on the markup and the program can be maintained separately — in theory revisions to the presentation layer and the program can be easily split between the design and development teams. Separation of concerns is also one of the most powerful principles in software development. This realisation was one of the motivations behind <a href="https://www.linkedin.com/in/howard-lewis-ship-a86a0a21b/">Howard Lewis Ships</a> creation of <a href="https://tapestry.apache.org/">Tapestry,</a> now an Apache project in its 5 generation. These benefits and more are summarised below:</p><ul><li><strong>Parallel work by different roles</strong> Designers and front-end people can refine the look and structure while developers implement behaviour. This reduces bottlenecks and hand-off friction.</li><li><strong>Templates remain readable by non-programmers</strong> Because the template is mostly HTML, it stays understandable to people who don’t write code. This is rare in frameworks that mix logic and markup heavily (e.g. heavy use of scriptlets, JSX with complex logic, or Angular templates packed with directives).</li><li><strong>Logic becomes easier to test</strong> Page and component classes can be unit-tested without rendering HTML. You test behaviour in isolation.</li><li><strong>Clear ownership and lower cognitive load</strong> When you open a template, you know you’re looking at structure and presentation. When you open the class, you’re looking at state and behaviour. Mental context-switching is reduced.</li><li><strong>Easier evolution</strong> You can redesign the UI without rewriting business logic, and you can change the logic without risking visual breakage.</li></ul><p>Separation of concerns is the highest-leverage principle in software architecture: by giving each part of a system one clear reason to change, it makes software dramatically easier to understand, safer to evolve, cheaper to maintain, and possible for teams to scale without collapsing into complexity. React has not followed this path, and is perhaps another example of the <a href="https://www.youtube.com/watch?v=LEZv-kQUSi4">narcissistic design</a> underlying many a <em>cargo cult</em> found in the world of software. In contrast, both Vue and more so Angular are similar to Tapestry:</p><p><strong>Affinity Ranking: Tapestry → Modern Frameworks</strong></p><p><strong>1. Angular — Highest</strong> Class-based components with decorators and separate HTML templates. The closest structural and philosophical match.</p><p><strong>2. Vue — Medium</strong> HTML-based templates with a relatively clean separation of concerns, though its reactivity model differs significantly.</p><p><strong>3. React — Lowest</strong> JSX mixes markup and logic in the same file. The functional + hooks style sits furthest from Tapestry’s architecture.</p><p>React, like PHP and JSP, has perhaps become popular because it looks like doing software development instead of web design — markup is submerged inside functions. Sometimes network effects and ecosystem development can outweigh pure architectural considerations, but the tradeoffs that result can come back to bite.</p><h4>Project Qloom</h4><p>So with this dissatisfaction with React in mind and my nostalgia for Tapestry, I though why not use AI to port Tapestry to the browser? Translating code from Java to TypeScript is the kind of thing LLMs can do very quickly, the code is open source and the framework is well documented, so everything looks good — the <a href="https://github.com/ccordenier/tapestry5-hotel-booking">Hotel Booking</a> web application can also serve as a reference to prove the solution.</p><p>I call this project <a href="https://github.com/JohnSColeman/qloom">Qloom</a> for want of a better idea — reuse an already well documented web framework, capture the architectural elegance and produce a light weight alternative to React that I can use for personal projects and tools. Programming will be simple decorated TypeScript — no more hooks of horror! The Hello example looks like this:</p><pre>import { Page, Property } from &quot;@qloom/runtime&quot;;<br><br>export class Hello extends Page {<br>  @Property name = &quot;world&quot;;<br>  @Property mood = &quot;sunny&quot;;<br>  @Property title = &quot;Greetings&quot;;<br>  @Property items = [&quot;alpha&quot;, &quot;beta&quot;, &quot;gamma&quot;];<br>  @Property item = &quot;&quot;; // loop variable — bound by &lt;t:loop value=&quot;item&quot;&gt;<br><br>  @Property count = 0;<br><br>  get hasItems(): boolean {<br>    return this.items.length &gt; 0;<br>  }<br><br>  onIncrement(): void {<br>    this.count += 1;<br>  }<br>}</pre><pre>&lt;t:panel heading=&quot;title&quot;&gt;<br>  &lt;h1&gt;Hello, ${name}!&lt;/h1&gt;<br>  &lt;p class=&quot;greeting ${mood}&quot;&gt;You have ${items.length} items.&lt;/p&gt;<br>  &lt;t:if test=&quot;hasItems&quot;&gt;<br>    &lt;t:loop source=&quot;items&quot; value=&quot;item&quot;&gt;<br>      &lt;span class=&quot;item&quot;&gt;${item} &lt;/span&gt;<br>    &lt;/t:loop&gt;<br>  &lt;/t:if&gt;<br><br>  &lt;p&gt;<br>    &lt;a href=&quot;#&quot; t:type=&quot;eventlink&quot; t:event=&quot;increment&quot; t:zone=&quot;counter&quot; id=&quot;bump&quot;&gt;Increment&lt;/a&gt;<br>  &lt;/p&gt;<br>  &lt;t:zone t:id=&quot;counter&quot;&gt;<br>    &lt;p id=&quot;count&quot;&gt;Count: ${count}&lt;/p&gt;<br>  &lt;/t:zone&gt;<br>&lt;/t:panel&gt;</pre><h4>Goodbye State Managers</h4><p>React spawned an entire state-manager industry — Redux, MobX, Zustand, Jotai, Recoil — because component state is ephemeral and local. Anything shared or durable gets lifted into a store, which becomes a second source of truth you have to keep in sync with the URL, the back button, and a page reload. Which is why “why did the back button break?” is its own genre of bug report.</p><p>In React, a function component runs again on every render. Anything you want to “remember” must be stored in a hook (useState, useReducer, etc.) or an external store. This creates a permanent need for state containers.</p><p>In Qloom, a page or component is a normal TypeScript <strong>class instance</strong> that stays alive. State is just fields:</p><pre>@Property username = &quot;&quot;;<br>@Property items: Item[] = [];</pre><p>There is no “how do I keep this value across renders?” problem, so the pressure to reach for Redux/Zustand/Jotai/etc. never appears. Because the framework already answers “where does this state live?”, developers are not forced to invent (or adopt) a general-purpose store.</p><p>Qloom’s core invariant is:</p><blockquote><em>A page must be reconstructable from </em><strong><em>(URL) + (@Persist storage) + (backend API)</em></strong><em>. Never from in-memory state alone.</em></blockquote><p>This rule actively discourages the classic React pattern of putting large amounts of application state in a client-side store that disappears on refresh. If the state matters, it belongs in the URL or in durable storage. If it doesn’t matter, a simple field is enough.</p><p>React’s fine-grained reactivity model (and the libraries that grew around it) exists partly because updating the UI efficiently is hard when everything is a function that re-runs.</p><p>Qloom updates are deliberate and coarse:</p><ul><li>Change some fields</li><li>Call Zones.refreshZone(“someZone”) (or navigate)</li></ul><p>You don’t need a sophisticated reactive graph or selector system to keep performance acceptable. The framework’s Zone reconciler handles the DOM patching.</p><p>Tapestry/Qloom comes from a tradition that prefers <strong>clear conventions</strong> and a relatively opinionated structure. React deliberately left state management as an open problem (“it’s just a UI library”). That vacuum was filled by numerous competing libraries.</p><p>Qloom fills the vacuum itself with a small, coherent set of primitives (@Property, @Parameter, @Persist, URL state, Zones). There is much less room — and less need — for third-party state libraries to grow.</p><h4>Conclusions</h4><p>I’m not going to pretend this is free. React’s gravity is real — the ecosystem, the hiring pool, the answer for every question. Qloom is a faithful port of Tapestry 5’s model, so if you’ve never met Tapestry, the render-phase protocol and container-based event bubbling are a genuinely new mental model, even as they delete the hook rules and the store. And “no server round-trip” means reconstructability is on you: put navigational state in the URL and durable state in @Persist, or you&#39;ve re-created the reload bug. There&#39;s no free lunch — just a smaller set of costs.</p><p>But that’s rather the point. React asks you to internalise JSX, hook rules, dependency arrays, and a state library, then ship a virtual DOM runtime — that’s added complexity. Qloom asks you to write an HTML template and a plain class, keep state where it can be reconstructed, and offload the heavy lifting to the compiler. Less to learn, less to ship, less to get wrong on the back button.</p><p>Older ideas, done faithfully, turning out to weigh less than the framework that replaced them — is kind of the whole pitch, right?</p><p>Getting your first Qloom application going is trivial:</p><pre>npm create qloom my-app<br>cd my-app &amp;&amp; npm install &amp;&amp; npm run dev</pre><p>Qloom includes a comprehensive suite of documentation as SKILL.md files that get set up when you create your project so your agentic coding tool, such as Claude Code, can turn your ideas into working web apps with minimal effort.</p><p>To read more visit <a href="https://github.com/JohnSColeman/qloom">https://github.com/JohnSColeman/qloom</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4949438ee06e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[OOP in Moderation]]></title>
            <link>https://medium.com/@qbyteconsulting/oop-in-moderation-05389cdc95e4?source=rss-e70eb7ae8c2a------2</link>
            <guid isPermaLink="false">https://medium.com/p/05389cdc95e4</guid>
            <dc:creator><![CDATA[John Coleman]]></dc:creator>
            <pubDate>Thu, 25 Jun 2026 13:21:01 GMT</pubDate>
            <atom:updated>2026-11-17T01:13:04.036Z</atom:updated>
            <content:encoded><![CDATA[<h3>OOP In Moderation</h3><h4>Lessons from critics</h4><p><em>Object-oriented programming promised to tame complexity and it can, but too often code morphs into an unmaintainable muddle that even minor changes break. In this article I will explain why and what to do about it drawing on several sources for inspiration.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*muRdTAIJh_rGXWOCwncwBA.jpeg" /><figcaption>Object-oriented programming depicted as an example of <a href="https://en.wikipedia.org/wiki/Law_of_the_instrument">Maslow’s hammer</a></figcaption></figure><p>Most developers have seen this — codebase that started clean and simple has, a few years on, turned into something nobody wants to touch. A “small” change ripples through dozens of files, state gets mutated in so many places that bugs are hard to pin down, and threads race or deadlock. There’s plenty of architecture on show — layers, managers, factories, interfaces everywhere — and yet you still can’t change anything without something else breaking, right? We have names for this: technical debt, spaghetti code, the “big ball of mud”. The odd part is that most of that code was written carefully, by competent people, following the rules they were taught.</p><p>And it isn’t only the messy projects. Even when a team keeps a coherent architecture and avoids the mud, misapplying object orientation can still leave you with an over-complicated solution. A case in point I’ve come across is Magento.</p><p>Magento is one of the most widely deployed e-commerce platforms in the world, and it is object-oriented to its core — every item is backed by a rich, extensible Product object, with new attributes you can bolt on at will. But that flexibility comes at a price. When Magento renders a price on a category page — the single most common thing a storefront does — it does not, at scale, load that Product object at all. A real product&#39;s attributes are scattered across generic key-value tables and have to be reassembled through a stack of joins, and doing that for every item on every page is simply too slow. So Magento largely sidesteps its own rich Product object for the common operations. It serves category pages and search results from precomputed OpenSearch documents and catalog indexes built in the background — one document per product, tuned for how the storefront actually reads the data.</p><p>The elaborate object model is still there, of course; it’s just carried as overhead on the path the storefront mostly avoids. Around that model Magento has built two whole subsystems — one that wraps every public method call so plugins can hook in, another that fires events whenever an object is saved or loaded. Both intercept behaviour; neither changes how the data is organised. So the platform keeps bolting more object-oriented machinery onto a model it then sidesteps for the work that actually carries the load. This isn’t sloppiness — Magento is carefully engineered. It’s a symptom — the encapsulation was drawn around the wrong thing. The leverage was never in the Product object, it was in the data laid out for how it&#39;s really used, the object design got in the way. Once you notice that pattern you start seeing it in a lot of places: across the network, down in the database, all through ordinary business code. That&#39;s what the rest of this article is about.</p><p>Object-oriented programming as it’s commonly practised, needs to be challenged, because the way it is being done is a big part of the problem. This isn’t a rant against OOP in general, it’s a constructive criticism based on several independent voices that expose some of the cracks. There is a reflex where developers model every problem as a hierarchy of mutable objects that each own their data and call one another directly — familiarity with UML will promote this mindset. We’ve treated that like a law of nature and applied it everywhere, for decades, including for jobs it was never suited to. It’s become a bit of a cargo cult, and enterprises can get stuck in it, because the dominance of Java and C# means they mostly hire for that same familiarity?</p><p>So what is good architecture actually supposed to give you? The symptoms above are the opposites of it. Good design lets you change one part of a system without fear of breaking another — that’s decoupling. It lets you reason about a piece of code on its own, understanding it locally without having to hold the whole program in your head. And it keeps concerns apart, so your business rules don’t end up tangled in your database queries and your network code doesn’t creep into your domain logic. Brittleness, spaghetti and runaway bug counts are what you get when those properties go missing — usually in the name of moving fast.</p><p>Of course there are always trade-offs, and to be fair to OOP, it delivers exactly those properties in the domains it was born for. Object orientation grew out of Simula’s simulations and Smalltalk’s graphical interfaces, and it still does well wherever the thing you’re modelling really is a fairly stable, self-contained unit with its own identity and a small surface area. A button or a window in a GUI genuinely <em>is</em> an object — internal state, a handful of operations, a clean boundary. The same goes for low-level systems code that wraps a real resource such as a file handle or a socket, where an object with a narrow interface and protected internals is the natural way to model something that really is encapsulated. In those places objects do good work because these are all simulation adjacent use cases.</p><p>The friction starts when we export that same model into three domains where the assumptions stop holding: across a network (distributed systems), down into the database (the persistence layer), and across ordinary business logic (everyday application programming). This is where the trouble actually shows up, and it’s worth understanding <em>why</em> in each case rather than just asserting that OOP “doesn’t scale”.</p><h3>Why it breaks down</h3><p>The following points are distilled from a rich body of criticism that’s worthy of your full attention — but for brevity I’ll stick to these five areas of friction.</p><h4><strong>Code shape vs. domain shape</strong></h4><p>The deepest confusion of the lot is one Casey Muratori traces back thirty-five years, in his talk <em>The Big OOPs</em>. We look at a problem, spot the nouns — Order, Customer, Guard, Door — and conclude the code must be a matching tree of classes. But the shape of the domain and the shape of the code are two different things, and forcing them to be the same is the original mistake. A class hierarchy is a hard commitment baked into your source: when requirements shift, the hierarchy resists; behaviour that naturally spans several objects has nowhere clean to live; and you lose the ability to process data in bulk. Muratori&#39;s counterexample is the Entity-Component-System pattern from game engines, where an entity is just an id and its data lives in component tables addressed by that id — so the encapsulation boundary is drawn around a <em>system</em> (physics, rendering, combat) rather than around the domain objects. It&#39;s a lesson that generalises: the real architectural decision is <em>where you put the walls</em>, and mirroring the domain is often the wrong place to put them.</p><h4>The Kingdom of Nouns</h4><p>The same thinking in typical OOP code such as Java produces what Steve Yegge calls the <em>Kingdom of Nouns</em>. In a language that won’t let a verb stand on its own, every action has to be wrapped in a noun, so your codebase fills up with OrderManager, PaymentStrategy and RequestExecutor — classes whose entire job is to host a single function that wanted to be a function all along. A one-line idea turns into pages of boilerplate, and that clutter is a genuine source of complexity. Yegge&#39;s cutting point is that all this ceremony <em>looks</em> like solid engineering, so we mistake the bulk for strength when it&#39;s really just rigidity. It&#39;s a category error — treating an action as a thing — and it&#39;s responsible for a fair share of the &quot;where is the actual logic in all of this?&quot; feeling.</p><h4>Mutable, encapsulated state</h4><p>Bigger than either of those, though, is what a colleague once drew my attention to under the fitting title <em>Narcissistic Design</em> — Stuart Halloway’s name for the single biggest multiplier of complexity: mutable, deeply-encapsulated state. A constructor briefly promises you a valid object, and then a setter quietly breaks that promise. Wire a few hundred such objects into a graph of references and you can no longer reason about whether any part of it is sound, because anything might be mutated from somewhere else between two lines of your own code. Mutability is behind a whole category of bugs — aliasing, order-dependence, the “I changed it <em>here</em>, why did it break <em>there</em>?” sort of problem. Halloway’s other point is that wrapping plain information in bespoke objects (CustomerBean, OrderBean) cuts it off from all the generic tools that already know how to handle lists and maps — so you end up writing more code to do less.</p><h4>The database becomes the model</h4><p>Halloway was particularly hard on object-relational mappers, because they concentrate so many of these complaints — hidden mutable state, business logic tangled up with persistence — in a single tool that also forces your classes and your tables into the same shape, so neither can change without disturbing the other. It’s also where the relational model collides with Domain-Driven Design. The problem is that once you let the database take charge, its schema ends up as your de facto domain model — whether you intended that or not. A query JOINs straight into the middle of an order and bypasses the very rules the Order was supposed to guard; logic migrates into triggers and stored procedures until nobody can say where the business rules actually live; and the ORM papers over the gap with lazy loading, N+1 queries and unit-of-work machinery that are workarounds, not domain concepts. The root cause is that objects (identity, references, encapsulation) and relations (rows, sets, whole-table queries) are genuinely different shapes — a normalised database optimised for querying across the whole dataset pulls in the opposite direction from a domain model that wants to protect consistency within small boundaries. The usual end state is the anaemic domain model: classes that are just data bags mirroring tables, with the behaviour exiled to service layers. That&#39;s OOP in name only and procedural in fact, which is really an admission that OOP was the wrong fit here.</p><h4>Objects across the network</h4><p>Send objects across a network and the assumptions break. Anand Kumar Keshavan explains why in <em>Objects Across the Chasm</em> — OOP was tuned for a single process with fast, reliable, shared memory, and a network offers none of that. A remote call is millions of times slower than a local one; nodes fail independently while the rest keep running; and under a network partition you’re forced to choose between consistency and availability (the CAP trade-off). The anti-pattern that looks clever at first is “location transparency” — making a call across the wire look like an ordinary method call (hello RMI) — because it hides the one fact you most need to see. Fine-grained object chatter that was free in-process becomes dozens of round trips, and consistency you can’t hope to maintain, the instant it crosses a machine.</p><p>Dick Dowdell points out a nice historical irony here. Alan Kay, who coined the term, had something quite specific in mind:</p><blockquote><em>“OOP to me means only messaging, local retention and protection and hiding of state-process, and extreme late-binding of all things.” — Alan Kay</em></blockquote><p>Autonomous units that share no state and talk only through messages, with no central clock. And object.method(args), bound at load time, is pretty much the opposite. So OOP kept Kay&#39;s vocabulary and threw away his architecture. Kay’s messaging vision was actually built at global scale just once — the stateless, uniform-interface web that Roy Fielding called REST — and that really works.</p><p>The five frictions are really the same mistake in different forms. It’s a kind of conflation — collapsing decisions that ought to stay independent into a single lump: how you describe the domain for humans, how you shape the code, how you lay out the data, how you store it, and how the parts talk to each other. This is exactly why Ian Joyner is worth reading as the constructive dissent. His argument in <em>The Misunderstanding of OO</em> is that the problem was never object orientation itself but our misunderstanding of it: a well-designed class is a small, self-contained algebra of values, operations and invariants that hides its <em>implementation</em> — not merely its data — and sits in a clean layer you never have to drill through to get work done. Disciplined OO, in other words, looks nothing like the noun-soup being criticised.</p><h3>A way forward</h3><p>The one principle that helps most here, I think, is separation of concerns. The really useful shift is to stop treating the domain model, the code structure and the storage layout as a single thing. They’re three different shapes serving three different audiences — humans, the compiler, and the access pattern — and none of them should get to dictate the others. Get that separation right and most of the other problems become a lot easier to deal with.</p><p>From there it’s a matter of picking the right approach for each kind of requirement, rather than reaching for the same hammer every time.</p><ul><li><strong>For application and business logic</strong>, prefer plain immutable data and free functions. Reserve classes for things that are genuinely <em>things</em>. Pass behaviour around as first-class functions instead of inventing wrapper nouns, and model “this is exactly one of N cases” with a sum type — a tagged union the compiler forces you to handle exhaustively — rather than a sprawling class hierarchy. A functional core wrapped in a thin shell of input and output restores the local reasoning that mutable object graphs destroy.</li><li><strong>For state and consistency</strong>, place your boundaries deliberately — around aggregates, bounded contexts or systems — keep the core immutable, and, in Joyner’s spirit, design your types so an invalid object simply can’t be constructed. Correctness by construction beats scattered checks.</li><li><strong>For persistence</strong>, let the database serve the domain rather than define it. Store a whole aggregate as a single document, or as a stream of events, so its consistency boundary survives on disk, and split the domain-shaped write model from a query-optimised read model (the CQRS pattern) so neither distorts the other. That read side — reporting, search, analytics — is exactly where a relational database earns its keep. So if you need SQL, and you often will, keep it there: a derived store fed from the domain, never the source of truth that dictates its shape.</li><li><strong>For distribution</strong>, stop shipping fine-grained objects across the wire. Communicate with coarse, asynchronous messages and events over explicit contracts, treat the network as a fact rather than a hidden detail, design for partial failure, and prefer compensating actions — undo by doing something — over distributed transactions that try to roll the world back. And if there’s sufficient justification, look to <a href="https://claude.ai/epitaxy/local_17c7314b-ccd3-4843-82d9-415fc01ecdf7#">utilise platforms</a> that ease the pains of handling distributed effects.</li></ul><p>None of this is really a war on objects. OOP still serves quite well in certain domains — GUIs, encapsulated resources, discrete simulations, large-grained module boundaries. What stands out from the points above is less about rejecting OOP and more about recovering some powerful tools that got sidelined as it rose to dominance: sum types, first-class functions, genuine message-passing, event sourcing, immutable data structures.</p><p>The recommendation isn’t to install a new dogma in place of the old one. It’s simply to let encapsulation boundaries form where the problem domain seems to want them, keep data more visible and accessible, and reach for whichever paradigm best matches the situation.</p><p>There’s a final reason this shift is worth making now, and it has nothing to do with preference. The same properties that make these designs robust for humans — explicit data, local reasoning, clean seams, cases handled exhaustively — are precisely the ones that make a codebase legible to an LLM. A pure function over plain data can be read, generated, tested and verified in isolation; a sum type turns “did we handle every case?” into a compile error a model can act on; and decoupled persistence bounds the blast radius of any change a tool might make. Plain data and pure functions are what <em>both</em> humans and machines reason about most safely. So moving beyond domain-hierarchy OOP isn’t only a way to stop multiplying complexity — it’s also a reasonable bet on how software is increasingly going to be built, by people and agents working the same legible material.</p><p>To conclude, object orientation isn’t a bad idea — the problem is the reflex that turned one good idea, suited to a handful of domains, into the default answer for all of them. As Thomas Sowell put it, “there are no solutions, there are only trade-offs”. The way out isn’t to abandon objects, it’s to use them where they genuinely fit and reach for something else where they don’t. That takes a bit of discipline, of course, but it’s the difference between an object model that carries its weight and one you spend years working around.</p><p>Sources</p><ol><li>Casey Muratori — <em>The Big OOPs: Anatomy of a Thirty-five-year Mistake</em> (Better Software Conference, 2025). <a href="https://www.youtube.com/watch?v=wo84LFzx5nI">https://www.youtube.com/watch?v=wo84LFzx5nI</a></li><li>Steve Yegge — <em>Execution in the Kingdom of Nouns</em> (Stevey’s Blog Rants, 2006). <a href="http://steve-yegge.blogspot.com/2006/03/execution-in-kingdom-of-nouns.html">http://steve-yegge.blogspot.com/2006/03/execution-in-kingdom-of-nouns.html</a></li><li>Stuart Halloway — <em>Narcissistic Design</em> (conference talk). <a href="https://www.youtube.com/watch?v=LEZv-kQUSi4">https://www.youtube.com/watch?v=LEZv-kQUSi4</a></li><li><em>How RDBMS Breaks Domain-Driven Design</em> (talk). <a href="https://youtu.be/ZZI7MVE1ZBo?t=2271">https://youtu.be/ZZI7MVE1ZBo?t=2271</a></li><li>Martin Fowler — Anemic Domain Model. <a href="https://martinfowler.com/bliki/AnemicDomainModel.html">https://martinfowler.com/bliki/AnemicDomainModel.html</a></li><li>Anand Kumar Keshavan — <em>Objects Across the Chasm: Navigating the Conflict Between OOP and Distributed Systems</em> (LinkedIn, 2025). <a href="https://www.linkedin.com/pulse/objects-across-chasm-navigating-conflict-between-oop-keshavan--wnuxf/">https://www.linkedin.com/pulse/objects-across-chasm-navigating-conflict-between-oop-keshavan--wnuxf/</a></li><li>Dick Dowdell — <em>Why Modern Software Still Collapses Under Its Own Complexity</em> (Medium, 2026). <a href="https://dick-dowdell.medium.com/software-architecture-still-fails-at-scale-9b607a444fda">https://dick-dowdell.medium.com/software-architecture-still-fails-at-scale-9b607a444fda</a></li><li>Ian Joyner — <em>The Misunderstanding of OO</em> (Medium, 2026). <a href="https://medium.com/@ianjoyner">https://medium.com/@ianjoyner</a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=05389cdc95e4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Remedy 10 common anti-patterns]]></title>
            <link>https://medium.com/@qbyteconsulting/remedy-10-common-anti-patterns-7ce9dbee7637?source=rss-e70eb7ae8c2a------2</link>
            <guid isPermaLink="false">https://medium.com/p/7ce9dbee7637</guid>
            <dc:creator><![CDATA[John Coleman]]></dc:creator>
            <pubDate>Thu, 15 Jan 2026 10:18:26 GMT</pubDate>
            <atom:updated>2026-02-18T01:34:59.676Z</atom:updated>
            <content:encoded><![CDATA[<p>Some time ago a friend shared a <a href="https://youtu.be/LEZv-kQUSi4?si=-dc_4S4kkxhOqRuL">satirical video by Stuart Halloway</a> about 10 anti-patterns that software often incorporates that add technical complexity to projects, and so likely also to sources of bugs. Stuart provided a couple of prime causes of additional complexity; ORM frameworks and build tools.</p><p>The presentation was satirical because these issues create a great opportunity for developers to make more work for themselves, which Stuart says is great, so let’s not change it!</p><blockquote>“… <strong>you can do all this stuff and just make this expanding thing with tendrils of complexity that goes and goes and goes and then it turns to concrete in the system and once that thing turns to concrete you will never be out of a job.” Stuart Halloway</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3c5TsasadcKzES1SK5V0zg.png" /></figure><p>Below I summarise the anti-patterns (with help from Claude) and identify what to do instead, go deeper on some points for clarity, so you save about 30 minutes on watching the Stuarts great presentation!</p><h3>Embrace Setters</h3><p>Setters undermine the constructor’s guarantee of valid state. Once objects are mutable, you can never reason about whether composed object graphs remain in a sound state.</p><p>→ <strong>Takeaway:</strong> Make objects immutable and fully initialised by their constructors. If state must change, return new instances rather than mutating existing ones. Where speed is critical mutation may be a must, otherwise avoid.</p><h3>Prefer APIs Over Data</h3><p>Data formats (like XML/JSON reports) are temporally decoupled, language-neutral, and immutable. Tight APIs force consumers to be online, speak your language, and handle mutation.</p><p>→ <strong>Takeaway:</strong> Prefer exchanging data over requiring API calls. Data can be stored, inspected, replayed, and processed by any language without runtime coupling.</p><p>When you require consumers to call an API, you create three forms of coupling: <strong>Temporal coupling</strong> — The consumer must be running at the same time as you. They can’t do their work offline, can’t process things later, can’t retry easily, <strong>Language coupling</strong> — The consumer must either write in your language or hope someone has written bindings for theirs. This limits your audience and creates maintenance burden, <strong>Mutation coupling</strong> — If the API exposes mutable state, the consumer must handle the fact that things might change between calls, leading to race conditions and defensive programming.</p><p>This abstraction is loose and adaptable:</p><pre>&lt;testsuite name=”MyTests” tests=”3&quot; failures=”1&quot;&gt;<br> &lt;testcase name=”testAddition” time=”0.001&quot;/&gt;<br> &lt;testcase name=”testSubtraction” time=”0.002&quot;&gt;<br> &lt;failure message=”Expected 5 but got 4&quot;/&gt;<br> &lt;/testcase&gt;<br>&lt;/testsuite&gt;</pre><p>This is tight coupling:</p><pre>public interface TestListener {<br> void testStarted(Description description);<br> void testFinished(Description description);<br> void testFailure(Failure failure);<br>}</pre><h3>Start with a DSL, Not an Information Model</h3><p>Good design: information model → API → DSL.</p><p>Complexity-inducing design: DSL only, forcing users to “mash strings together” (like SQL).</p><p>→ <strong>Takeaway:</strong> Design the information model first, then optionally layer an API and DSL on top. Users should always be able to access the underlying data programmatically.</p><p>As examples, both SQL and regular expressions are problematic DSLs to use. SQL is a powerful DSL but it hides away all the interesting details about the information, and can anyone do regular expressions without supporting material and feel confident they are correct?</p><h3>Connect Instead of Enqueue</h3><p>Direct object references create the tightest coupling. Queues enable temporal decoupling and resilience.</p><p>→ <strong>Takeaway:</strong> Ask “what happens if this connection breaks?” Use queues and asynchronous messaging to decouple components temporally and improve system resilience.</p><p>The producer/consumer, actor model, reactive programming and similar approaches are useful here, but don’t over use them.</p><h3>Create Abstractions for Information</h3><p>Instead of exposing data as maps/lists/sets (which everyone already has tools for), wrap everything in custom beans — instantly multiplying code size.</p><p>→ <strong>Takeaway:</strong> Use generic data structures (maps, lists, sets) for information. Everyone already has tools to manipulate these. Custom beans add ceremony without value.</p><h3>Use Static Typing Across Subsystem Boundaries</h3><p>Checked exceptions and specific types force every intermediary to know about your contracts, even if they don’t care about the data.</p><p>→ <strong>Takeaway:</strong> Keep boundaries loosely typed. Intermediaries that just pass data through shouldn’t need to understand or compile against your domain types.</p><p>Use the fewest domain types possible, for example, limit the use of exception types, or any other technical domain types where practical.</p><p>Avoid this:</p><pre>// Deep in payment processing<br>public PaymentResult processPayment(PaymentRequest request) <br>    throws CardDeclinedException, InsufficientFundsException, CardExpiredException,<br>           FraudDetectedException, PaymentGatewayTimeoutException, <br>           PaymentGatewayUnavailableException, InvalidCardNumberException,<br>           CVVMismatchException, AddressVerificationFailedException,<br>           DuplicateTransactionException, AmountExceedsLimitException;<br><br>// Intermediate layer - doesn&#39;t handle these, just passes them through<br>public Order createOrder(Cart cart, PaymentInfo payment) <br>    throws CardDeclinedException, InsufficientFundsException, CardExpiredException,<br>           FraudDetectedException, PaymentGatewayTimeoutException,<br>           PaymentGatewayUnavailableException, InvalidCardNumberException,<br>           CVVMismatchException, AddressVerificationFailedException,<br>           DuplicateTransactionException, AmountExceedsLimitException,<br>           InventoryUnavailableException, ShippingAddressInvalidException;<br><br>// HTTP layer - just wants to return 400 or 500<br>public Response handleCheckout(Request request)<br>    throws CardDeclinedException, InsufficientFundsException, CardExpiredException,<br>           FraudDetectedException, PaymentGatewayTimeoutException,<br>           // ... every layer must declare every exception</pre><p>Clean alternative:</p><pre>// Payment layer translates gateway errors to its own abstraction<br>public PaymentResult processPayment(PaymentRequest request) <br>    throws PaymentException;<br><br>// Order layer has its own single exception type<br>public Order createOrder(Cart cart, PaymentInfo payment) <br>    throws OrderCreationException;<br><br>// HTTP layer has its own single exception type  <br>public Response handleCheckout(Request request)<br>    throws CheckoutException;<br><br>// Detail preserved as DATA, not types<br>public enum PaymentFailureReason {<br>    CARD_DECLINED, INSUFFICIENT_FUNDS, FRAUD_DETECTED, GATEWAY_UNAVAILABLE<br>    // Adding new reasons = adding enum value<br>}</pre><h3>Put Language Semantics on the Wire</h3><p>CORBA, RMI, etc. failed to scale. The dynamically-typed web succeeded.</p><p>→ <strong>Takeaway:</strong> Use language-neutral data formats (JSON, Avro, Protobuf) for serialisation. Don’t let your programming language’s type system dictate wire formats.</p><h3>Write Lots of (Bad) Unit Tests</h3><p>Hand-crafted inputs limit coverage. Polishing English-language DSLs wastes time on a research problem.</p><p>→ <strong>Takeaway:</strong> Use generative/property-based testing (QuickCheck, fast-check) to let the computer generate inputs. Separate input generation, execution, and validation. Don’t let unit tests substitute for code review or documentation.</p><p>Every test case you think of, you write. Every case you don’t think of, you miss. Generating unit test inputs my sometimes be a better job for computers.</p><p>Tests are examples, not explanations — while they offer some explaining power they are not a substitute for documentation or code review. Prefer documentation in the code where it is easiest to maintain and don’t rely on tests instead of code review.</p><p>Developing a natural language DSL for your unit tests can be time consuming and not produce much value causing “<a href="https://en.wikipedia.org/wiki/Law_of_triviality">bike-shedding</a>”. BDD style syntax is powerful for communicating domain knowledge with business stakeholders, but is overkill otherwise.</p><pre># Just write code. It&#39;s already a language.<br>def test_valid_credentials_return_token():<br>    token = authenticate(&quot;alice&quot;, &quot;correct_password&quot;)<br>    assert token is not None</pre><p>Limit tests to those that fit the contract, no need to make tests up for behaviours that the software does not require — think YAGNI for tests. If you can, use generative testing, this will help save time and catch cases manual test generation may miss. <a href="https://blog.stevensanderson.com/2009/11/04/selective-unit-testing-costs-and-benefits/">Steve Sanderson’s blog</a> provides a more objectivity method of where to focus to get value if you are doing TDD.</p><h3>Update Information in Place</h3><p>Mutable state makes sharing, distribution, concurrency, and caching all exponentially harder.</p><p>→ <strong>Takeaway:</strong> Use immutable/persistent data structures. Treat state changes as appending new facts rather than overwriting old ones (like Git does). Mutability should be reserved for modelling the substrate (machine level code), specific algorithms, or explicit time models.</p><h3>Leverage Implicit Context</h3><p>Active Record-style patterns where databases, connections, and tables are contextual create hidden dependencies that break mysteriously during upgrades or scaling. Frameworks that leverage annotations/decorations that add layers of hidden magic are another example.</p><p>→ <strong>Takeaway:</strong> Make dependencies explicit. Pass connections, configurations, and context as arguments rather than relying on ambient state. Explicit beats implicit for maintainability.</p><p>Consider the Active Record design pattern. Code is written in such a way that the framework connects the code to a database and allows it to interact with the table, all by convention, and that abstracts away dependencies which are implicit instead of explicit. The code is not portable, harder to test and can fail in unexpected ways.</p><p>Complexity flows through systems via increased coordination requirements: stateful conversations, single sources of truth, and tight coupling. The antidote is designing for independence: immutable data, explicit context, loose coupling at boundaries, and information models that don’t require your consumers to be online, speaking your language, or synchronised with your mutable state.</p><p>Those are just some code related anti-patterns, also worthy of the anti-pattern brand is the additional complexity that is often introduced by over engineered cloud services, making everything a “microservice” with its own container and deployment — worthy of a separate disection.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7ce9dbee7637" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Get started with durable computing]]></title>
            <link>https://medium.com/@qbyteconsulting/get-started-with-durable-computing-ced456ed2772?source=rss-e70eb7ae8c2a------2</link>
            <guid isPermaLink="false">https://medium.com/p/ced456ed2772</guid>
            <category><![CDATA[temporal]]></category>
            <category><![CDATA[saga-pattern]]></category>
            <category><![CDATA[golem-cloud]]></category>
            <category><![CDATA[durable-computing]]></category>
            <category><![CDATA[typescript]]></category>
            <dc:creator><![CDATA[John Coleman]]></dc:creator>
            <pubDate>Tue, 06 Jan 2026 04:34:40 GMT</pubDate>
            <atom:updated>2026-11-13T03:10:44.120Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gqj21YECJiGulpWzqe7CLg.jpeg" /><figcaption>AI image of a tough guy computer</figcaption></figure><p>In my article <a href="https://medium.com/@qbyteconsulting/fixing-30-years-of-software-development-pains-d39cc761313">Fixing 30 years of software development pains?</a> I spoke about how much easier software development used to be. The hardware was more reliable than todays commodity servers are, uptimes could be measured in years and not weeks because the computers had redundant CPUs onboard, error correcting memory, RAID disks that were directly on the bus and guaranteed data storage, and uninterruptible power supplies — when something failed you called in an engineer and they would replace parts while the computer continued to do its work, occasionally you might have to shut down temporarily to apply a patch. A contest held by Stratus to identify its longest-running server in 2010 found that <a href="https://www.datacenterknowledge.com/servers/this-server-s-uptime-puts-your-sla-to-shame">a system had been running continuously for 24 years in Dearborn, Michigan</a>. This kind of reliability made application programming easier because code did not have to handle failures, it was all business logic — a dream in todays development environment where teams are pushed to deliver business functionality rather than sweat over what needs to happen when things go wrong.</p><p>In contrast, early experiences with PCs could be very frustrating:</p><blockquote><strong>Customer: </strong>Hi. I was working on an Excel file yesterday and forgot to save it before my computer crashed. Can you help me recover it?<br><a href="https://www.justanswer.com/microsoft-office/e6rlj-working-excel-file-yesterday-forgot.html">Microsoft Office Questions, justanswer.com</a></blockquote><p>Work was lost when PCs crashed and the user had not diligently saved their work every so often, or if they accidentally pressed the wrong dialog button when quitting the application. A similar issue afflicts todays business computing.</p><p>When computing is distributed maintaining correct state becomes complicated, failures add complexity often to both the code and the systems architecture. The code may have to implement exception handling for recovery (often badly implemented), and use a consumer-producer design with the associated complications of introducing message-driven architecture. None of this incidental complexity arises from the business logic, it’s additional complication arising from the technical limitations. It would be great if all that added complication could be avoided, so that once again developers can focus on delivery of pure business logic.</p><blockquote>Durable computing is a technique that makes it easier for teams to address resiliency and reliability in distributed systems. It involves handling state in such a way to ensure requests can be run to completion, reducing the risks of failure or downtime.<br><a href="https://www.thoughtworks.com/en-th/insights/blog/cloud/durable-computing-making-easier-resilience-distributed-systems"><em>Durable computing</em></a>, <a href="https://www.thoughtworks.com/en-th/profiles/r/richard-gall"><strong><em>Richard Gall</em></strong></a></blockquote><p>Of course not every application requires this durability, however financial and other mission critical systems still need it, which is why banks are still running on systems with “six nines” uptime, instead of migrating to the cloud.</p><p>I recently showed how the ideas of <em>inverted mocking</em> and <em>functional core imperative shell</em> can be applied to implement <a href="https://github.com/JohnSColeman/inverted-mocking-demo">a simple order processing application in TypeScript</a>. Once business logic is functionally pure it then becomes fairly easy to implement durable computing — in this completely working demo project I used <a href="https://temporal.io/">Temporal</a>. What is Temporal?</p><h3>Temporal</h3><p>Temporal supports todays popular programming languages such as Python, Go, TypeScript, Ruby, C#, Java and PHP and it’s a mature technology used by businesses such as NVIDIA, Salesforce and Twilio.</p><p>Temporal is based on the concept of a workflow and a workflow consists of activities (input/output)— it’s these activities that Temporal can give assurances of completion thereby guaranteeing the workflow is a success (given there is no serious disaster). Not only this, but should the servers running your application with Temporal shut down, they will recover the workflows and restart them off from where they were terminated — “belt and braces”. This idiom lends itself well to implementing the <a href="https://temporal.io/blog/saga-pattern-made-easy">Saga Design Pattern</a> and makes it easy to implement the compensatory effects (assuming idempotency).</p><p>For todays applications that often make use of SAAS to (for example) process payments, complete a KYC verification, send messages and orchestrate numerous activities that can fail, this workflow idiom is designed to fit the need for distributed transactions without using heavyweight solutions like <a href="https://en.wikipedia.org/wiki/X/Open_XA">XA</a>. This is also a useful for running long lived agentic workflows.</p><p>In my <a href="https://github.com/JohnSColeman/inverted-mocking-demo">demo project</a> the <a href="https://github.com/JohnSColeman/inverted-mocking-demo/blob/main/src/temporal/processOrder.workflow.ts">process order workflow module</a> includes; retry configurations, proxies to wrap effects with Temporal assurances, and the implementation of an effects provider that delegates to the Temporal activities. The code snippet below shows how these 3 pieces work together to build a workflow including a call to an API.</p><pre>const apiActivityOptions: ActivityOptions = {<br>  startToCloseTimeout: &#39;150s&#39;,<br>  retry: {<br>    initialInterval: 500,<br>    backoffCoefficient: 2,<br>    maximumAttempts: 10,<br>    maximumInterval: 3000,<br>  },<br>}<br><br>const {<br>  getDiscountRules,<br>} = proxyActivities&lt;Pick&lt;Activities, &#39;getDiscountRules&#39;&gt;&gt;(apiActivityOptions);<br><br>export async function processOrderWorkflow(orderId: string): Promise&lt;Either&lt;NonEmptyList&lt;string&gt;, ProcessedOrder&gt;&gt; {<br>  const temporalEffects: AppEffects = {<br>    ...<br>    pricing: {<br>      getDiscountRules: getDiscountRules,<br>    },<br>    ...</pre><p>When the business logic layer calls <strong>getDiscountRules</strong>, Temporal will take care of the retries as well as restore and continue the workflow should it be suspended. As a bonus it also provides observability of the workflow execution so you can follow everything that happens! You may still want a <a href="https://martinfowler.com/bliki/CircuitBreaker.html">circuit breaker</a> to prevent new workflows starting during failure, but all the workflows that are in flight can be assured of completion. The business logic stays pure and because of the functional purity, can be tested without the complexity of mocking the externalities.</p><p>It is quite easy to get set up and working with Temporal or even to just migrate critical parts of your code onto this platform — the focus of complication is shifted to hosting and deployment.</p><h3>Golem Cloud</h3><p>A relatively new platform that takes a more radical approach to durable computing is <a href="https://www.golem.cloud/">Golem Cloud</a>. Golem currently supports agents written with TypeScript, Rust, MoonBit, Go and Scala and which get compiled to WASM. That limits external calls to using HTTP — although <a href="https://learn.golem.cloud/develop/rdbms">database connection</a> is also supported, more recently interfaces to support agentic platforms were added. Why would you want to deploy your applications as WASM modules like that instead of as more typical docker containers?</p><p>Running WASM offers a number of powerful benefits to Golem:</p><ul><li>Golem can snapshot a program’s memory and execution state with extreme instruction point precision. This means that other than the mechanisms to utilise agents, there is minimal impact of the durability SDK on written code, so the learning curve is minimal.</li><li>If a node goes down, Golem uses an “oplog” (operation log) to restore the worker on another machine at the millisecond it left off — note that this recovery process can introduce latency, as also the case with reloading passivated agents.</li><li>Golem agents run in a restricted sandbox. Because this isolation is so strong and lightweight, Golem can safely run code from many different users on the same physical hardware without them interfering with one another. An agent that runs out of memory will not bring the entire runtime down.</li><li>WASM modules can be compact (100s of kilobytes vs hundreds of megabytes) and therefore load in milliseconds vs full containers.</li><li>Language interoperability guarantees*</li></ul><p>The above benefits essentially provide the resilience of mainframes with the flexibility and scalability of distributed computing, and make development and deployment painless. This means applications can be written without the clutter of coping mechanisms such as retry handling, or other architectural complexity such as replication and message queuing, but you will still have to think about managing memory. The limitations of using WASM do introduce some bumps when dealing with remote systems that are not HTPP based — hopefully this will be addressed in future?</p><p>Golem is currently version 1.6 which includes many new features to suport agentic applications, but is yet to see widespread adoption. That aside, why use Golem instead of Temporal?</p><p>While temporal is opinionated on the workflow idiom, Golem makes no such assumptions and is more adaptable. Golem is agent based, and an agent could be workflow like or domain oriented — a number of patterns are possible. As Vigoo shows in the blog post <a href="https://blog.vigoo.dev/posts/golem-agent-patterns/">Agent patterns in Golem</a>, you can implement an agent as a state machine with workflow semantics to provide observability for multi-step workflows, rather like Temporal. Vigoo goes on to explain that agents can also represent domain entities, which is well suited to the Domain-Driven Design approach and fits the practice of building REST APIs that are entity orientated — as demonstrated, an agent could represent a Customer or an Order entity, for example (agents are also restrictive in terms of functions just working with primitive types).</p><p>Agents provide the capability to build code where the focus will be on implementing the domain in an intuitive code structure, as well as ensuring that the code execution is thoroughly robust. [I’m also thinking that domain modelling technology with code generation like <a href="https://www.jetbrains.com/mps/">Jetbrains MPS</a> could be leveraged to generate agent code directly from the model — something I may explore when Golem is stable and more feature complete.]</p><p>If you are interested in trying Golem you can follow the official <a href="https://learn.golem.cloud/quickstart">quickstart</a> — I have used this quickstart to build a complete working TypeScript project for Node which you can find on my Github <a href="https://github.com/JohnSColeman/golem-agent-example">golem-agent-example</a> repository. The main branch implements the example counter agent and includes all the instructions in one place to get set up and running easily with details for working on macOS, but you can easily adapt to other operating systems. Writing an agent is trivial as shown below, and the agents state is automatically persistent so no database required! Some ceremony is required to deploy the agent and expose the agent as a restful API (not shown), but from version 1.5, this is quite trivial.</p><pre>@agent({<br>  mount: &quot;/counters/{name}&quot;<br>})<br>class CounterAgent extends BaseAgent {<br>    private readonly name: string;<br>    private value: number = 0;<br><br>    constructor(name: string) {<br>        super();<br>        this.name = name;<br>    }<br><br>    @prompt(&quot;Increase the count by one&quot;)<br>    @description(&quot;Increases the count by one and returns the new value&quot;)<br>    @endpoint({ post: &quot;/increment&quot; })<br>    async increment(): Promise&lt;number&gt; {<br>        this.value += 1;<br>        return this.value;<br>    }<br>}</pre><p>You can learn more about the above counter example in this <a href="https://www.youtube.com/live/ovVn_fNIyJU?si=-UsQgwkqNLua6MUx&amp;t=541">YouTube video</a> where John De Goes sets the project up and runs it as well as explaining more about the features of Golem and how they can be used to implement a database.</p><p>If you want to push ahead and run an integration test server on AWS for your team to collaborate for experimentation, the <a href="https://github.com/JohnSColeman/golem-agent-example/tree/infra/infra/docker">infra branch provides the deployment scripts</a> you can run to set everything up using docker with EC2. Maybe you can use AI to convert the scripts to suit other cloud platforms? For production you can use <a href="https://learn.golem.cloud/deploy/golem-cloud">Golem Cloud</a> hosting, although the platform still seems to be developing.</p><p>If you want to self host for production using Golems open source containers, you will probably need to consider Kubernetes but as yet <a href="https://learn.golem.cloud/deploy/kubernetes">there is no documentation</a> — this process will be time consuming but should be doable. For AWS this will likely require RDS and ElastiCache in addition to an EKS cluster. Unfortunately this is beyond the scope of this introduction.</p><h3>The Tradeoffs</h3><p>Of course there are always tradeoffs. Whether you use Temporal or another durable computing platform, you must learn some new technology and rethink how you build and deploy applications — but the approach ought to simplify development considerably. Consider also how you are going to host or utilise what is essentially a SAAS solution with ongoing costs that will probably introduce friction with established in-house CI/CD operations and change control mechanisms that also complicate delivery. However, for PoC, startups or applications where data residence and ownership is not an issue, some platforms have their own SAAS offerings available.</p><p>Final note: Achieving five nines or more availability with cloud service providers can still be a significant challenge and will likely involve a multi-region solution and then specialised hardware if you really need to reach those extra 9s — and even then you will never achieve the performance of working on a single high-availability machine.</p><p>If you want to dig into some of the pitfalls of durable execution Chris Gillums article <a href="https://blog.cgillum.tech/common-pitfalls-with-durable-execution-frameworks-like-durable-functions-or-temporal-eaf635d4a8bb">Common Pitfalls with Durable Execution Frameworks, like Durable Functions or Temporal</a> is a great start.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ced456ed2772" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Launching a Magento store in minutes]]></title>
            <link>https://medium.com/@qbyteconsulting/launching-a-magento-store-in-minutes-a7670b4d5864?source=rss-e70eb7ae8c2a------2</link>
            <guid isPermaLink="false">https://medium.com/p/a7670b4d5864</guid>
            <category><![CDATA[e-commerce-software]]></category>
            <category><![CDATA[magento-2]]></category>
            <dc:creator><![CDATA[John Coleman]]></dc:creator>
            <pubDate>Sun, 03 Mar 2024 07:24:45 GMT</pubDate>
            <atom:updated>2025-05-18T04:54:26.477Z</atom:updated>
            <content:encoded><![CDATA[<p>If you are interested in exploring the world of e-commerce with the Magento® 2 platform, there are more than a few articles on how to set up a store along with the sample data. Most those articles offer only code snippets and will not get you there without a lot of additional work.</p><p>This article will take you through the steps to get set up painlessly, so you will be running a store on your own computer in minutes, ready to explore the platform. When you are done you will be able to see the store with the sample data like this:</p><figure><img alt="Magento store home page with sample data" src="https://cdn-images-1.medium.com/max/1024/1*DSglNEujFx3AvePq_L2nwg.png" /></figure><p>There is a &quot;catch&quot;. The fastest and most reliable way to get any services running is of course to use docker along with docker-compose - so if you do not have those you will need to set them up. The how-to of that is platform dependent, so you will need to find out how to do this for your platform — you will also need to be able to run the shell scripts.</p><p>All the files required are provided on <a href="https://github.com/JohnSColeman/launch-magento-sample-data">github</a> — so if you want to, you can just clone the repo and get started from there.</p><h3>Setting up Magento</h3><p>The initial step is to start all the services Magento will need and then of course start Magento. Bitnami provide both the <a href="https://hub.docker.com/r/bitnami/mariadb">Maria database images</a> and <a href="https://hub.docker.com/r/bitnami/magento/">Magento images</a> , only an Elasticsearch image needs to be added to complete the <a href="https://github.com/JohnSColeman/launch-magento-sample-data/blob/main/docker/docker-compose.yaml"><strong>docker-compose.yaml</strong></a> file:</p><pre>version: &#39;3&#39;<br><br>services:<br>  mariadb:<br>    image: bitnami/mariadb:10.6<br>    container_name: mariadb<br>    environment:<br>      - ALLOW_EMPTY_PASSWORD=yes<br>      - MARIADB_DATABASE=bitnami_magento<br>    ports:<br>      - &quot;3306:3306&quot;<br>    volumes:<br>      - ./db_init:/docker-entrypoint-startdb.d<br>    networks:<br>      - magento-network<br>    healthcheck:<br>      test: [&quot;CMD&quot;, &quot;mysqladmin&quot;, &quot;-u&quot;, &quot;bn_magento&quot;, &quot;-pbitnami&quot;, &quot;ping&quot;, &quot;-h&quot;, &quot;localhost&quot;]<br>      interval: 10s<br>      retries: 5<br><br>  elasticsearch:<br>    image: elasticsearch:7.17.18<br>    container_name: elasticsearch<br>    ports:<br>      - 9200:9200<br>      - 9300:9300<br>    environment:<br>      - discovery.type=single-node<br>      - xpack.security.enabled=false<br>    networks:<br>      - magento-network<br>    healthcheck:<br>      test: [&quot;CMD-SHELL&quot;, &quot;curl --silent --fail http://localhost:9200/_cluster/health || exit 1&quot;]<br>      interval: 30s<br>      retries: 5<br><br>  magento:<br>    image: bitnami/magento:2.4.6 # 2.4.6-p4<br>    container_name: magento<br>    depends_on:<br>      elasticsearch:<br>        condition: service_healthy<br>      mariadb:<br>        condition: service_healthy<br>    ports:<br>      - &#39;80:8080&#39;<br>      - &#39;443:8443&#39;<br>    environment:<br>      - MAGENTO_HOST=localhost<br>      - BITNAMI_DEBUG = &quot;true&quot;<br>      - ALLOW_EMPTY_PASSWORD=yes<br>      - MAGENTO_DATABASE_USER=bn_magento<br>      - MAGENTO_DATABASE_PASSWORD=bitnami<br>      - MAGENTO_DATABASE_NAME=bitnami_magento<br>    networks:<br>      - magento-network<br><br>networks:<br>  magento-network:</pre><p>When you execute <strong>docker-compose up</strong> with this configuration, the services will start in order and after apache is ready, wait for <strong>** Starting Apache **</strong> to display, you can navigate to <strong>http://localhost</strong> to view the default store — but before you do this see the next note.</p><p>Note that the database also needs to be initialised with permissions created with a user for the Magento server to use — so the necessary command is placed in the init.sql file in a directory called db_init. This script will be mounted to the mariadb volume for the database to execute:</p><pre>CREATE USER &#39;bn_magento&#39;@&#39;%&#39; IDENTIFIED BY &#39;bitnami&#39;;<br>GRANT ALL PRIVILEGES ON bitnami_magento.* TO &#39;bn_magento&#39;@&#39;%&#39;;<br>FLUSH PRIVILEGES;</pre><p>Note that these services will run with weak security because the passwords are predictable, so they should never be used like this in production!</p><h3>Setting up sample data</h3><p>The next steps are to install the sample data, update file permissions and create an admin user with credentials we can use to log in to the store administration portal. These steps can be executed using <strong>docker exec</strong> commands.</p><p>First setup the required version of Magento sample data by downloading the sampled data file, running the build script and then perform all the steps to reinitialise the server. The command below will do this:</p><pre>docker exec magento /bin/bash -c &#39;<br>apt update &amp;&amp; apt install wget &amp;&amp; apt install unzip \<br>&amp;&amp; cd /opt/bitnami \<br>&amp;&amp; wget -q https://github.com/magento/magento2-sample-data/archive/refs/tags/2.4.6-p4.zip &amp;&amp; unzip 2.4.6-p4.zip \<br>&amp;&amp; php -f /opt/bitnami/magento2-sample-data-2.4.6-p4/dev/tools/build-sample-data.php -- --ce-source=/opt/bitnami/magento \<br>&amp;&amp; cd /bitnami/magento \<br>&amp;&amp; php ./bin/magento setup:upgrade --keep-generated \<br>&amp;&amp; php ./bin/magento setup:di:compile \<br>&amp;&amp; php ./bin/magento cache:clean \<br>&amp;&amp; php ./bin/magento cache:flush \<br>&amp;&amp; php ./bin/magento indexer:reindex \<br>&amp;&amp; php ./bin/magento setup:static-content:deploy -f \<br>&amp;&amp; php ./bin/magento deploy:mode:set developer<br>&#39;</pre><p>The final step of setting up the developer mode is optional, but useful for displaying any failures.</p><p>The next command grants permissions to some of the directories. Without this the Magento server will report exceptions and media content will not be displayed, or you may see HTTP status code 500 errors.</p><pre>docker exec magento /bin/bash -c &#39;<br>chmod -R 777 /opt/bitnami/magento/generated /opt/bitnami/magento/var /opt/bitnami/magento/pub \<br>&amp;&amp; chmod -R 777 /opt/bitnami/magento2-sample-data-2.4.6-p4/pub<br>&#39;</pre><p>Now you should be able to refresh your browser and see your store complete with the sample data! Note that you may need to restart the docker services to see the full effect.</p><p>Finally before you can access the admin portal you should set up a new admin account using this command:</p><pre>docker exec magento /bin/bash -c &#39;<br>php /bitnami/magento/bin/magento admin:user:create --admin-user=admin --admin-password=admin123 --admin-email=admin@localhost.com --admin-firstname=John --admin-lastname=Doe<br>&#39;</pre><p>You can now navigate to <a href="http://localhost/admin"><strong>http://localhost/admin</strong></a><strong>/</strong> page and sign in using the credentials of the administration account you just created.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a7670b4d5864" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Fast fail exception handling]]></title>
            <link>https://medium.com/@qbyteconsulting/fast-fail-exception-handling-9bba83f7cce7?source=rss-e70eb7ae8c2a------2</link>
            <guid isPermaLink="false">https://medium.com/p/9bba83f7cce7</guid>
            <category><![CDATA[dynamodb-client]]></category>
            <category><![CDATA[exception-handling]]></category>
            <category><![CDATA[c-sharp-programming]]></category>
            <dc:creator><![CDATA[John Coleman]]></dc:creator>
            <pubDate>Thu, 28 Dec 2023 06:17:07 GMT</pubDate>
            <atom:updated>2026-10-15T01:09:38.342Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*b0ANOPdx1XIIZwpkc6HGUA.png" /><figcaption>The Windows blue screen of death</figcaption></figure><p>Exceptions are an unfortunately reality of performing fallible operations, particularly those that involve input/output with hardware such as network and storage. Some exceptions may also be generated internally by application code as a result of invalid operations such as division by zero, or null pointers (ouch). Null references have been called “<a href="https://javapro.io/2025/08/07/fixing-the-billion-dollar-mistake/">The Billion Dollar Mistake</a>”, exceptions probably come a close second in terms of introducing runtime horrors.</p><p>Raising exceptions can be a resource intensive activity, particularly if it involved capturing the call stack (yes Java!), so it is not a good idea to raise exceptions if you can avoid doing so, because it can even cause memory shortages that can crash an application working with limited memory.</p><p>Returning static error codes like the -1 rogue value seems preferable, but documentation is necessary when using rogue values or error codes. Static error types are perhaps the ideal solution because the type name can be self documenting like exception types. Note that “<em>If you’re validating some data, you usually shouldn’t be using exceptions to signal validation failures.” — </em><a href="https://martinfowler.com/articles/replaceThrowWithNotification.html">Martin Fowler</a>.</p><p>So what to do when an exception happens?</p><p>Exception handling by definition <strong>should result in the exception being handled</strong>. Handling an exception implies that the underlying cause of a problem can be transformed from a failure into some other alternative and preferable outcome — ideally by some recovery process that successfully completes the operation. If there is no way to translate the failure to a success then unfortunately there may be little benefit to handling the exception.</p><p>Some typical examples of exception handling include:</p><ol><li>retry—recovering by retrying the operation until it is a success</li><li>fallback mechanism — performing some alternative operation instead</li><li>failover mechanism — using a backup system to complete the operation</li><li>notification &amp; alerting — create a signal to trigger some external recovery process to help complete the operation or resolve the issue</li><li>graceful degradation — disables the feature if it is non-essential</li><li>logging &amp; monitoring — record and monitor failures</li></ol><p>I will not dig into these options, but note that the first 4 examples of exception handling may be able to recover from the failure with success and thus are more worthwhile exception handling because the benefits of recovery/remedy may outweigh the costs of failure. The last examples, 5 and 6, do not result in a successful recovery.</p><h4>Perils of exception swallowing</h4><p>Exception swallowing is the term used to refer to code that hides its failure by capturing a thrown exception and then typically returning null, false or other responses that hide failure. This is bad practice because hiding the failure can result in delaying resolution, wasteful calls, blowing up logs and potentially other unpredictable downstream issues. For example just catching and logging an error, but not re-throwing, or returning a null (or undefined) is a common form of exception swallowing that deprives the caller of dealing with the error.</p><p>The general catch all exception handler is particularly dangerous on some platforms if it swallows the exception, because it could conceal unexpected terminal program states — these should probably lead to swift failure of the application. Any code that catches a top level exception type should throw it, but more likely a generic exception type should not be caught at all.</p><p>It can be tempting to try and deal with failures too low in the stack, for example in repository implementations. A smell here is the use of the generic catching of exceptions, rather than attempting to deal with specific failure types that might need their own specialised handling. If failure types are not explicitly declared and well documented, then it is not possible to handle them in an individually suitable manner. So what to do?</p><pre>try<br>{<br>    return await _context.LoadAsync(id);<br>}<br>catch (Exception ex)<br>{<br>    return null; // exception lost and concealed<br>}</pre><pre>try<br>{<br>    return await _context.ScanAsync(conditions).GetRemainingAsync();<br>}<br>catch (Exception ex)<br>{<br>  return new List(); // exception lost and concealed<br>}</pre><pre>try<br>{<br>    await _context.SaveAsync(data);<br>    return true;<br>}<br>catch (Exception ex)<br>{<br>    return false; // exception lost and concealed<br>}</pre><p>From the above we can reason that generally unless we can recover from an exception, then it’s better not to catch it, and furthermore in such cases it is better to allow fallible code to fail and <strong>let the exception ripple higher up the stack for handlin</strong>g. If the exception is unrecoverable, then the best course of action may be to terminate the service, or mark it unhealthy so that resources are no longer wasted.</p><p>There is also another form of exception handling where the exception is partially swallowed when code looks like this:</p><pre>} catch (ResourceNotFoundException e) {<br>    // exception concealed but not lost<br>    throw new TableDoesNotExistException(&quot;Order table &quot; + tableName + &quot; does not exist&quot;);<br>}</pre><p>With the above approach the original exception and its potentially useful and expensive to create state are wasted and a less useful new state created instead — however at least here this issue is not so bad because there is one simple underlying cause and remedy. Where exceptions have to be of a certain type to satisfy a contract then it ought to be possible to wrap the underlying exception.</p><p>Logging and rethrowing an exception is another potentially wasteful cargo cult practice, not only cluttering code but potentially adding noise to the log. The caller higher up the stack where logic belongs ought to determine how failure is handled — this is where exception logging makes sense. If the exceptions carry the stack dump with them, thats is still available for inspection and/or logging.</p><h4>The fast fail strategy</h4><p>Database and network exceptions are more likely to be unrecoverable and should likely quickly result in service failure after (maybe) a few retry attempts continue to fail — although note that some database clients may raise non-critical exceptions in normal operation. A <em>circuit breaker</em> is a common mechanism for dealing with transient failures — it typically offers a degraded service that resumes after a wait and then a retry was a success. A service may be able to backup a few failing requests, but too much may bring the whole service down, a circuit breaker will prevent this.</p><p>In every case when dealing with fallible code it is important to determine the best process for handling the exception. Is there a recovery process, what is it, and how is it utilised? It is now possible to prompt a coding agent to analyse code and discover all the exceptions that can be thrown from a given point in code. This can then be used to build an exception classifier to deteremine if an exception should terminate a call or trigger a recovery action. But otherwise, if the approach for handling an exception is logging it and then swallowing it, that is very likely a red flag indicating that there is a lack of such knowledge to properly recover. A better approach in this scenario is probably just to <a href="http://principles-wiki.net/principles:fail_fast"><strong>fail fast</strong></a>.</p><blockquote>“Some people recommend making your software robust by working around problems automatically. This results in the software “failing slowly.” The program continues working right after an error but fails in strange ways later on. A system that fails fast does exactly the opposite: when a problem occurs, it fails immediately and visibly. Failing fast is a nonintuitive technique: “failing immediately and visibly” sounds like it would make your software more fragile, but it actually makes it more robust.” — Jim Shore, <a href="https://ieeexplore.ieee.org/stamp/stamp.jsp?arnumber=1331296">Fail Fast</a></blockquote><p>Failing fast is preferable to concealing failure and may also be preferable to delaying failure. Instead, simply pushing the failure back up to the caller should make it easier to deal with the problem and have less unpredictable outcomes. Therefore one needs to consider consequences when weighing up whether to fail fast or perform a recovery.</p><p>Failing fast and using a global exception handler also means that try-catch clutter may be removed from low level code. This makes code cleaner because it will only need to process the “happy path”. This looks like a win-win.</p><h4>Global exception handling</h4><p>What does a global exception handler look like? It ought to be able to translate incoming exceptions to the desired outcomes. Perhaps for some exceptions there will be recovery using a retry, while for others a fail fast approach will be adopted to transform the failure into some kind of general failure response to send back to the caller. The details would depend on the particulars of the underlying exception causes and requirements of the caller.</p><p>Let’s build exception middleware to serve as an exception handler for a simple ASP.NET CRUD controller that depends upon a dynamo database for persisting state. Our underlying repository implementation used by the controller can be implemented without try-catch handlers or logging once the exception middleware is integrated with the application using the below code. This will ensure a consistent response behaviour during failure.</p><pre>app.UseMiddleware&lt;ExceptionMiddleware&gt;()</pre><p>This ExceptionMiddleware class will invoke the underlying controllers implementation method using a RequestDelegate and then handle any exceptions on behalf of the controller:</p><pre>// code not complete<br>public class ExceptionMiddleware<br>{<br>    private readonly RequestDelegate _next;<br>    private readonly ILogger _logger;<br><br>    public ExceptionMiddleware(RequestDelegate next, ILogger&lt;ExceptionMiddleware&gt; logger)<br>    {<br>        _logger = logger;<br>        _next = next;<br>    }<br><br>    public async Task InvokeAsync(HttpContext httpContext)<br>    {<br>        try<br>        {<br>            await _next(httpContext);<br>        }<br>        catch (AmazonDynamoDBException ex)<br>        {<br>            _logger.LogError(ex, &quot;Request failed {request}&quot;, FormattedRequest(httpContext.Request));<br>            await SendResponse(new ExceptionMessage(ex), (int)ex.StatusCode);<br>        }<br>        catch (Exception ex)<br>        {<br>            _logger.LogError(ex, &quot;Unexpected failure&quot;);<br>            await SendResponse(new ExceptionMessage(), (int)HttpStatusCode.InternalServerError);<br>            throw;<br>        }<br><br>        return;<br><br>        async Task SendResponse(ExceptionMessage message, int code)<br>        {<br>            httpContext.Response.ContentType = &quot;application/json&quot;;<br>            httpContext.Response.StatusCode = code;<br>            await httpContext.Response.WriteAsync(message.ToString());<br>        }<br>    }<br>}<br><br>public class ExceptionMessage<br>{<br>    public ExceptionMessage()<br>    {<br>        ErrorMessage= &quot;unexpected failure&quot;;<br>        Retryable = false;<br>    }<br>    <br>    public ExceptionMessage(AmazonDynamoDBException ex)<br>    {<br>        ErrorMessage= &quot;persistence failure&quot;;<br>        Retryable = ex.Retryable != null;<br>    }<br><br>    public string ErrorMessage { get; set; }<br>    public bool Retryable { get; set; }<br>    <br>    public override string ToString()<br>    {<br>        return JsonSerializer.Serialize(this);<br>    }<br>}</pre><p>When the database fails with AmazonDynamoDBException, we may have some useful information in the exception to help the caller handle the failure. In this case we will log the exception and some request details on the error log. Because this exception tells us whether or not we can retry, we should certainly tell the caller about this and the response will also provide a simple generic message describing the cause of failure. We will also return the http status code returned by the database call because there is little point in any other logic for a CRUD api. After that we will consider the exception as handled by the caller, and because we know this exception is from a remote process, there is no need to re-throw — handling is complete. The client will then need to figure out what they do depending on what was reported. If the retry flag is true, then they can implement logic to retry the request again after a delay, otherwise they might display a helpful failure message.</p><p>For a catch of the unexpected generic exception type, we will just log the exception along with a simple message, and then return an http status of 500 along with a minimal error message, and then finally re-throw the exception because it should not be swallowed. On the client side we might indicate that there is a serious service problem and they should try again after waiting a longer break.</p><h4>Summary</h4><p>Let’s summarise the benefits of this fail fast/global exception handler approach:</p><ol><li>we can clean out try-catch from low level code and handle only the happy path allowing failures to ripple up (except for specific failures that can be resolved to success)</li><li>there is a try-catch code block higher in the call stack for the unhappy paths which will simplify handling failure leading to better comprehension of failure handling</li><li>the application does not hide failures and thereby delay resolution causing unexpected downstream consequences</li><li>we provide useful information from specific kinds of errors to help better handle the failure when possible</li><li>the behaviour under failure is consistent across implementations making it easier for the failure to be processed</li></ol><p>If you have a more complex service than a trivial CRUD api, you may of course need to implement more sophisticated exception handlers.</p><h4>See also</h4><ul><li><a href="https://medium.com/@christian.ppl/introduction-to-the-fail-fast-principle-in-software-development-865ccab28979">Introduction to the ‘Fail Fast!’ Principle in Software Development</a></li><li><a href="https://youtu.be/oWvX-hdIAQo?si=pZPAQqbkAk_g4i-g">You’re Doing Exceptions Wrong — Matt Burke</a> (YouTube)</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9bba83f7cce7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Spring Controllers and Vavr validation]]></title>
            <link>https://medium.com/@qbyteconsulting/spring-controllers-and-vavr-validation-b6f617095ce3?source=rss-e70eb7ae8c2a------2</link>
            <guid isPermaLink="false">https://medium.com/p/b6f617095ce3</guid>
            <category><![CDATA[spring-boot]]></category>
            <category><![CDATA[domain-driven-design]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[vavr]]></category>
            <dc:creator><![CDATA[John Coleman]]></dc:creator>
            <pubDate>Mon, 24 Jul 2023 10:03:02 GMT</pubDate>
            <atom:updated>2024-01-03T07:24:29.035Z</atom:updated>
            <content:encoded><![CDATA[<p>A functional approach to error handling with Springs ResponseEntity</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZiqXAO-1K5xbrJKw6XAG0g.png" /></figure><p>The conventional way of handling errors for Spring REST controllers is to use the ControllerAdvice mechanism to handle exceptions. Here is some sample code given by <a href="https://www.baeldung.com/author/eugen">Eugen Paraschiv</a> in a <a href="https://www.baeldung.com/exception-handling-for-rest-with-spring">Baeldung.com article</a>:</p><pre>@ControllerAdvice<br>public class RestResponseEntityExceptionHandler <br>  extends ResponseEntityExceptionHandler {<br><br>    @ExceptionHandler(value <br>      = { IllegalArgumentException.class, IllegalStateException.class })<br>    protected ResponseEntity&lt;Object&gt; handleConflict(<br>      RuntimeException ex, WebRequest request) {<br>        String bodyOfResponse = &quot;This should be application specific&quot;;<br>        return handleExceptionInternal(ex, bodyOfResponse, <br>          new HttpHeaders(), HttpStatus.CONFLICT, request);<br>    }<br>}</pre><p>Using exceptions makes sense when a program crashes unexpectedly and we want to use the stack trace to help with debugging. If we wanted to respond back with HTTP status 500 messages, this approach is sensible. But there are a few disadvantages to using exceptions for ordinary error handling:</p><ul><li>Error conditions such as validation errors or missing records are normal and expected</li><li>Exceptions are like GOTO statements making program flow unpredictable and limiting errors to one at a time</li><li>Too many stack traces can eat up memory making the service fail</li></ul><p>*See also <a href="https://medium.com/@alexeynovikov_89393/stop-using-exceptions-in-java-456f7db46ea4">Stop using Exceptions in Java</a></p><p>It would be more efficient if we could handle errors without throwing exceptions — think of multiple errors in a form submission, or multiple ways an aggregate function can fail.</p><p>The <a href="https://www.vavr.io/">Vavr</a> library offers a special data type <a href="https://docs.vavr.io/#_validation">Validation</a> for containing either an error or a success type. This allows the computations failure to be passed back up the call stack. An added bonus is that this mechanism will aggregate errors so that multiple-errors can be handed back in the response. Another <a href="https://www.baeldung.com/vavr-validation-api">Baeldung.com article</a> provides an example of this combinator to create a user or return creation errors. This technique is ideal for writing factory methods:</p><pre>    public Validation&lt;Seq&lt;String&gt;, User&gt; validateUser(<br>      String name, String email) {<br>        return Validation<br>          .combine(<br>            validateField(name, NAME_PATTERN, NAME_ERROR),<br>            validateField(email, EMAIL_PATTERN, EMAIL_ERROR))<br>          .ap(User::new);<br>    }</pre><p>You could implement this as a static createUser factory method in a class with a private constructor thereby ensuring all object instances are valid.</p><p>Let’s suppose we have a service that needs to return some electricity usage costs or else report errors. We will implement some additional general purpose validation methods and a factory to help build valid usage costs in a domain package:</p><pre><br>@Service<br>public class ServiceFacade implements UsageCostFactory {<br>    private final MeterReadingService meterReadingService;<br>    private final PricePlanService pricePlanService;<br>    private final AccountService accountService;<br><br>    public ServiceFacade(MeterReadingService meterReadingService, PricePlanService pricePlanService, AccountService accountService) {<br>        this.meterReadingService = meterReadingService;<br>        this.pricePlanService = pricePlanService;<br>        this.accountService = accountService;<br>    }<br><br>    public Validation&lt;Seq&lt;String&gt;, UsageCost&gt; calculateUsageCost(String smartMeterId) {<br>        String pricePlanId = accountService.getPricePlanIdForSmartMeterId(smartMeterId);<br>        Optional&lt;PricePlan&gt; plan = pricePlanService.getPricePlan(pricePlanId);<br>        Optional&lt;List&lt;ElectricityReading&gt;&gt; readings = meterReadingService.getReadings(smartMeterId);<br>        return Validation.combine(<br>                        validatePresent(plan, &quot;price plan not found&quot;),<br>                        validatePresent(readings, &quot;electricity readings not found&quot;)<br>                ).ap((validPlan, validReadings) -&gt; pricePlanService.calculateUsageCost(validReadings, validPlan))<br>                .fold(Validation::invalid, this::usageCost);<br>    }<br>}<br><br>// UsageCostFactory.java<br>public interface UsageCostFactory extends Validations {<br>    default Validation&lt;Seq&lt;String&gt;, UsageCost&gt; usageCost(BigDecimal cost) {<br>        return Validation.combine(<br>                validateNotNull(cost, &quot;usage cost cannot be null&quot;),<br>                validateNotZero(cost, &quot;usage cost cannot be 0&quot;)<br>        ).ap((cost1, cost2) -&gt; new UsageCost(cost));<br>    }<br>}<br><br>// Validations.java<br>public interface Validations {<br>    default &lt;T&gt; Validation&lt;String, T&gt; validateNotNull(T value, String error) {<br>        if (value == null) return Validation.invalid(error);<br>        return Validation.valid(value);<br>    }<br><br>    default &lt;T extends Number&gt; Validation&lt;String, T&gt; validateNotZero(T value, String error) {<br>        if (value.doubleValue() == 0) return Validation.invalid(error);<br>        return Validation.valid(value);<br>    }<br><br>    default &lt;T&gt; Validation&lt;String, T&gt; validatePresent(Optional&lt;T&gt; value, String error) {<br>        return value.&lt;Validation&lt;String, T&gt;&gt;map(Validation::valid)<br>                .orElseGet(() -&gt; Validation.invalid(error));<br>    }<br>}</pre><p>The Validation object returned in this case will either contain a valid UsageCost, if the state is valid, or else it can return 1 <strong>or more</strong> errors — in this case represented by simple String values. In production we might use a special abstract Error type and assign some constant values with helpful names — these would substitute for the more usual BusinessException. This could also help with any logic that might need to be applied by the caller — similar to using <em>catch</em>.</p><p>Now we want Springs REST controller code to be able to handle these validation results by either returning the success value or a request failure containing the helpful error messages:</p><pre>@RestController<br>@RequestMapping(&quot;/readings&quot;)<br>public class MeterReadingController implements ResponseEntityFactory {<br><br>    private final ServiceFacade serviceFacade;<br><br>    @GetMapping(&quot;/usage/{smartMeterId}&quot;)<br>    public ResponseEntity&lt;Validation&lt;Seq&lt;String&gt;, UsageCost&gt;&gt; usageCost(@PathVariable String smartMeterId) {<br>        return responseEntity(serviceFacade.calculateUsageCost(smartMeterId));<br>    }</pre><p>However, this code won’t work as-is. We require some additional code to support the serialization process. We will need to configure a serializer for Jackson by providing a bean factory method for Spring — this will trigger our custom rendering for a ResponseEntity of the Validation type:</p><pre>@Configuration<br>public class JacksonConfig {<br><br>    @Bean<br>    public Jackson2ObjectMapperBuilderCustomizer addCustomValidationSerializer() {<br>        return builder -&gt; {<br>            SimpleModule module = new SimpleModule();<br>            module.addSerializer(Validation.class, new ValidationSerializer());<br>            builder.modules(module);<br>        };<br>    }<br>}</pre><p>For the serialization process, the error string sequence will need to be written by the serializer, or the success value is just serialized as an object in the normal fashion:</p><pre>public class ValidationSerializer extends JsonSerializer&lt;Validation&gt; {<br><br>    @Override<br>    public void serialize(Validation value, JsonGenerator gen, SerializerProvider serializers) throws IOException {<br>        if (value.isValid()) {<br>            gen.writeObject(value.get());<br>        } else {<br>            gen.writeStartObject();<br>            writeError(gen, value.getError());<br>            gen.writeEndObject();<br>        }<br>    }<br><br>    private &lt;E&gt; void writeError(JsonGenerator gen, E error) throws IOException {<br>        if (error instanceof Seq) {<br>            gen.writeArrayFieldStart(&quot;errors&quot;);<br>            for (Object element : (Seq&lt;?&gt;) error) {<br>                gen.writeString(element.toString());<br>            }<br>            gen.writeEndArray();<br>        }<br>    }<br>}</pre><p>While this solution does not follow the Spring norms, the resulting code has a more declarative style, is free of exceptions and the associated boilerplate code and is also 100% plain-old-Java. By bringing expected errors back into the normal program flow, we can retain the usual exception handling mechanisms for the purpose to which they are best suited.</p><h3>See also</h3><ul><li><a href="https://medium.com/@qbyteconsulting/fast-fail-exception-handling-9bba83f7cce7?source=your_stories_page-------------------------------------">Fast fail exception handling</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b6f617095ce3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Fixing 30 years of software development pains?]]></title>
            <link>https://medium.com/@qbyteconsulting/fixing-30-years-of-software-development-pains-d39cc761313?source=rss-e70eb7ae8c2a------2</link>
            <guid isPermaLink="false">https://medium.com/p/d39cc761313</guid>
            <category><![CDATA[kotlin]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[scala]]></category>
            <category><![CDATA[go]]></category>
            <dc:creator><![CDATA[John Coleman]]></dc:creator>
            <pubDate>Sat, 08 Jul 2023 09:05:18 GMT</pubDate>
            <atom:updated>2026-06-18T09:10:51.096Z</atom:updated>
            <content:encoded><![CDATA[<p>Reflection upon a personal journey from COBOL to Java thru Go</p><p>What is “legacy code”? More often than not this term is used as a euphemism for rotten code, rather than to refer to some finely aged COBOL. Rotten code arises because of <a href="https://medium.com/better-programming/code-rot-is-a-process-decision-d4b37cf1e26b">code rot</a>, it is code that has become prone to failure, hard to maintain and extend, and likely very impractical to refactor to put right. But how did we get there and how could we avoid this outcome?</p><h3>The Days of Fully Procedural Languages</h3><p>Back in the day, i.e. from the late 1970s to the early 1990s, midrange systems were all the rage as business computing platforms. The earlier machines were usually single core and typically supported only fully procedural languages such as COBOL and on the IBM systems, RPG — oh and they were big, even the smaller machines were huge!</p><figure><img alt="image of an IBM System/36 computer" src="https://cdn-images-1.medium.com/max/1000/1*QlLId99kufhGqSblUbZ2_Q.jpeg" /><figcaption>IBM System/36 — <a href="http://creativecommons.org/licenses/by-sa/3.0/">CC BY-SA 3.0</a></figcaption></figure><p>The life of a “programmer” was simple and innocent — it was an era of comparatively paradisal ease. With no classes, no inheritance, no generics, no access to threads or clustering or capability to scale up and no source control systems, there was virtually nothing to mess up or go wrong the main fear was of a power or hardware failure, and the controls in place usually handled those quite well enough. Nowadays a data centre takes care of things like provisioning, power cuts and hardware failures, often quite transparently — so that bit of the IT solution has become more robust.</p><p>A lot of code was still written for batch processing. Basically what you had were flat record format definitions to describe input and output data structures, plus the mainline code and some subroutines/procedures and limited support for variable types and states. There were still bugs of course and the perennial problems of garbage-in-garbage-out, and managing code changes and reading program listings thousands of lines long was tedious, but with a few easily learnt skills and patience (plus line printer listings and a marker pen) one could do a good job.</p><p>This state of affairs was actually a very good thing. A junior programmer could graduate from some pretty basic training where they learnt the language syntax, which could probably be done in a matter of weeks, and then with some additional project experience coupled with some academic training in structural programming, e.g. <a href="https://en.wikipedia.org/wiki/Jackson_structured_programming">Jackson Structured Programing</a>, they could become a competent programmer with a few months of practical experience. One typically become an “expert” through having extensive experience working with a popular business package such as <a href="https://en.wikipedia.org/wiki/Infor_XA">MAPICS</a> or <a href="https://en.wikipedia.org/wiki/JD_Edwards">J.D. Edwards WorldSoftware</a>, and there were many others as time passed. Most software developers in this era were not developing complex business applications from scratch, instead existing packages were modified and extended.</p><p>These halcyon years would come to a fairly swift end due to the emergence of affordable personal computers.</p><h3>The Dawn of The Personal Computer</h3><p>The personal computer was eventually affordable enough so that individual employees could have their own computer, however making the user experience easy enough for the average person required a new kind of interface, the Graphical User Interface, a.k.a. GUI. The GUI was slick and cool, it had animations and other colourful high resolution capabilities as graphics processing units developed and it could be controlled by pointing with a mouse. These GUIs meant that computing could be brought to the masses, now of course they are used for operating our phones.</p><p>Graphical User Interfaces were complex and demanded a different way to develop them to typical business applications that could be done with fully procedural languages — it would be a nightmare to write a GUI application using COBOL, right? So at this time C++ started to become a more popular Object-Oriented programming language to develop GUI software libraries. The Object-Oriented capabilities meant that abstractions such as Windows, menus and menu items, and other widgets, could be programmatically represented as independent software components for reuse.</p><p>The problem with this C++ was that it was rather complex and easy to write bad programs (hello pointers and memory management) and so eventually Java was developed, a cut down C++ — some called it “C minus minus”. Java removed a whole bunch of sources of failure that were possible with C++. However, Java was in many ways as capable as C++ and is a richly featured Object-Oriented language. This made Java a popular programming language for teaching computing to students, along with C++ and eventually a derivative, C#, which was the Microsoft “C minus minus”. But understand, C was developed for systems programming whereas COBOL was developed for writing business applications. This whole approach of using C-like languages to develop business applications is kind of odd, right?</p><p>The C-like object-oriented languages are excellent for teaching computing, but they are not such good tools to put into the hands of the average, recently graduated junior developer looking to write a business application. That is like giving a newly qualified pilot a fighter plane to practice with.</p><blockquote>“With great power comes great responsibility” — <em>Uncle Ben (Spider-Man)</em></blockquote><p>The thing with fully procedural code is that it is very natural for us write and read software using the English like if-then-do-while syntax — adding mutable state to this is where sources of bugs become a concern but not a big problem. But take that and add clustering, threads, inheritance and other complexities of object-oriented programming with classes and you have a recipe for disaster that all to commonly leads to what has been dubbed the “Big Ball of Mud”.</p><blockquote>“Big Ball of Mud, is a code jungle which is haphazardly structured, sprawling, sloppy and connected by duct-tape. Over the years we have been introduced to various guidelines such as SOLID, GRASP and KISS amongst age old, high cohesion and low coupling to deal with this Mud. However, the situation still remains bleak and Big Ball of Mud still seems to be the most popular way to design and architect software.” — <a href="https://www.infoq.com/profile/Vikas-Hazrati/"><em>Vikas Hazrati</em></a><em>, </em><a href="https://www.infoq.com/news/2010/09/big-ball-of-mud/"><em>Big Ball of Mud, Still the Most Popular Software Design</em></a></blockquote><p>There are all manner of copes to try and prevent the “Big Ball of Mud”, but <strong>the reality is that many development teams will shortcut in order to deliver faster and meet business goals</strong>. This is often incorrectly labelled as “velocity”, forgetting that velocity is movement in a direction — hopefully <strong>the right one</strong>? For many businesses there are often good reasons they need to work this way. Unfortunately once in this situation, “technical debt” accumulates and it can be very hard to break out of — the original developers become irreplaceable and new team members can’t hope to be highly productive without their assistance. Software development less resembles a team effort and instead becomes politicized and competitive. A colleague recently drew my attention to the appropriately labelled title for this phenomena, “<a href="https://www.youtube.com/watch?v=LEZv-kQUSi4">Narcissitic Design</a>” — here is my distillation of that program <a href="https://medium.com/@qbyteconsulting/remedy-10-common-anti-patterns-7ce9dbee7637">Remedy 10 common anti-patterns</a>.</p><blockquote>“There are no solutions, there are only trade-offs.” — <a href="https://www.youtube.com/watch?v=3_EtIWmja-4"><em>Thomas Sowell</em></a></blockquote><h3>The Growth of Software Engineering</h3><p>Back in those early days we were “programmers” because we just developed programs, occasionally you might have to load a magnetic disk pack or tape or print off a listing. Today a software developer has to handle a whole lot more complexity than just writing some fully procedural code or grappling with physical media. This greater complexity demanded a much broader range of skills and disciplines, and so the role of the programmer eclipsed and gave way to the era of software engineering to deal with all the new complexities and their associated risks of failure.</p><p>If you thinking <em>keep-it-simple</em> at this point, you might be wondering why we don’t just go back to COBOL or even back to those simple computing systems — they provided a robust server-side platform after all. All that was needed was to figure out the program that would convert the input data structure into the desired output data structure. And the answer to that is that obviously todays applications are usually required to do more complex things, even if they don’t have the complexity of a GUI. But let’s keep the theme of simplicity in mind as we continue.</p><p>If you have read my article <a href="https://medium.com/@qbyteconsulting/hierarchy-of-controls-in-it-b6ddaa528da3">Hierarchy of Controls in IT</a>, you will know that essentially there are 2 different ways to deal with risks in IT solutions:</p><ul><li>strategic — category A high-level technology centric approaches of 1) elimination, 2) substitution and 3) engineering controls</li><li>tactical — category B low-level people centric administrative controls and individual actions to cope with what issues remain</li></ul><p>Dealing with the ‘Big Ball of Mud’ issue has been ongoing for about 30 years and of course this has occupied the minds of software engineers a great deal, because we love problems and it seems we love them more than solutions — as in politics, secure careers are built upon not really solving problems but being seen to do something.</p><p>Unfortunately the “solutions” have typically been limited to engineering controls, although often not enough, along with the tactical category B copes. These approaches are all about dealing with the issues instead of getting rid of them. These approaches do work when applied, but the solutions involve substantial resource intensive trade-offs. To start to change that meant a shift away from home made architectures and the C-like languages that introduced the programming vulnerabilities in the first place. Let’s look at how a few such examples have developed.</p><p>The functional programming paradigm has been somewhat popularised by the Scala language, but the concept have also penetrated into many other languages. With Functional Programming the concurrency issues associated with parallel execution would be addressed with immutability, and more sophisticated abstraction capabilities meant that more boilerplate code could be eliminated or even replaced by more concise and expressive syntax that can even develop into “domain specific language” — very cool. Scala has a way for dealing with null values (Option — later adapted by Java), superior type safety and other goodies that took away sources of failure. However, the learning curve for Scala is steep and so it was never destined for popularity — businesses don’t usually like to shell out for long periods of training or learning on the job, particlalry if this may not be successful. Scala also inherited the full object-oriented capabilities and vulnerabilities as well as implementing a nasty Future class for dealing with asynchronous computation in the manner that Java also does badly with its Future classes.</p><p>Let’s get back to that <em>keep-it-simple</em> thinking we were considering when we started this section, because that is what started to happen at Google with the development of the Go language. Go would strip away easy to fudge inheritance and provide instead a safer and more functional style of composition, it also does away with null values by enforcing a default value instead, and finally worthy of mention are Go routines, a safer and simpler way of implementing concurrency, pointers make a comeback but are safer. Early versions of Go lacked generics, which meant more boilerplate code, however this capability has now been added. <strong>Through elimination and substitution of vulnerable features, the Go language offers a very capable and safer alternative to the preceding C-like languages.</strong> Although it may be argued to be less of a suitable language for teaching computing, the trade-off is that it is a great language for developing safer server side code. It’s limitations make for an easy learning curve and are also part of its strengths. Another recent language to follow the <em>keep-it-simple</em> ethos is Dart.</p><p>Finally it’s worth mentioning Kotlin again which I <a href="https://medium.com/@qbyteconsulting/why-kotlin-and-not-java-2218c22aa0bb">have previously promoted</a>. Kotlin addresses many of the shortcomings of both Java and Scala. More sophisticated than Go with something of a resemblance to both Java and Scala, it deals well with null pointers and has suspend functions instead of the nasty Future for simplified asynchronous programming rather like Go. Kotlin still comes with the power and vulnerabilities of Object-Oriented programming like Scala and Java do, and adds its own quirks — but as with Scala, Kotlin can be developed in a more functional style and also supports tail recursion. Perhaps the big advantage of Kotlin over Go is its native compatibility with the huge and mature Java ecosystem. Kotlin has gained converts for server-side development at both <a href="https://medium.com/agoda-engineering/7-best-practices-and-tips-for-using-kotlin-a-guide-for-scala-developers-ae9199463509">Agoda</a> and <a href="https://medium.com/grindr-engineering/from-java-to-kotlin-migrating-microservices-at-grindr-7956a89f60b8">Grindr</a>.</p><p>To conclude, it must be pointed out that while the newer programming languages do address some of the vulnerabilities of their predecessors, this does not make them thoroughly immune to the Big Ball of Mud problem, and therefore proven engineering controls still need to be applied.</p><p>Genenerally I believe that more mature development teams in established enterprises using the JVM platform should prefer Kotlin, whereas less mature teams working on new projects will likely do better with Go. Obviously there are many other languages that suit their particular niches and use cases, and it is beyond the scope of this article to cover all those. Here the goal has been to emphasize the value newer programming languages bring by eliminating or substituting problematic features of older programming languages, in order to reduce risk when delivering IT solutions.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d39cc761313" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Hierarchy of Controls in IT]]></title>
            <link>https://medium.com/@qbyteconsulting/hierarchy-of-controls-in-it-b6ddaa528da3?source=rss-e70eb7ae8c2a------2</link>
            <guid isPermaLink="false">https://medium.com/p/b6ddaa528da3</guid>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[risk-management]]></category>
            <category><![CDATA[it-solutions]]></category>
            <dc:creator><![CDATA[John Coleman]]></dc:creator>
            <pubDate>Sun, 14 May 2023 07:42:23 GMT</pubDate>
            <atom:updated>2023-07-13T06:30:00.778Z</atom:updated>
            <content:encoded><![CDATA[<p>Minimizing hazards with IT solutions</p><p>If you’ve seen <a href="https://www.linkedin.com/in/tyson-gabriel-91b481b2/">Tyson Gabriel</a>s’ take down of community masking policy (see his Substack), you will not only understand that these policies were unscientific, you will also be familiar with <a href="https://www.cdc.gov/niosh/topics/hierarchy/default.html">the Hierarchy of Controls</a>, and the associated inverted pyramid depiction. Below is a version of that pyramid somewhat altered to apply to tech. The hierarchy of controls is a systematic set of common sense approaches we should apply to reduce risks.</p><p>Seniors working in IT solution development should be knowledgeable in these controls, so if you are looking to move into a senior role, this will provide you a fairly comprehensive overview of topics to look into.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/537/1*fijAAaS1cXo5ufdDqu6q3w.png" /></figure><p>The use of IT solutions is fraught with hazards, although happily software “bugs” don’t cause deadly contagions. There is the hazard of implementing IT solutions that do not work well or are difficult to implement, manage or maintain. This can be true in both domains of hardware and software — delivery and costs are risks as well of course.</p><p>A fundamental point to grasp about the different levels of control is their varying degree of effectiveness. The top 3 layers of controls are the most effective, while the lower levels are least effective because they are more dependent upon the behaviours of many human actors, and changing business culture and individual behaviours can be very challenging.</p><p>Let’s dig into the pyramid as technology implementers and see how we apply its wisdom to how we approach IT solutions. As business scales up and the impact of failure rises, it becomes more critical to work on all these areas of risk.</p><h3>Elimination</h3><p>There are a number of conservative principles in software development such as YAGNI (you-aren’t-gonna-need-it) and KIS (keep-it-simple) etc. that try to control hazards at source by eliminating them. Thinking more widely, we can even ask things like:</p><ul><li>do we need this digital delivery?</li><li>do you need this application?</li><li>do we need this feature?</li><li>do we really need this/these cloud service(s), server(s), laptop(s) etc.?</li><li>do we need this software?</li><li>do we need a database, cache, message-queue etc.?</li><li>do we need this service?</li><li>do we need this programming language?</li><li>do we need this program?</li><li>do we need this method, routine, line of code?</li></ul><p>If we can say no to any of such perceived needs, then that should seriously be considered as a right course of action.</p><p>Anything we can entirely eliminate, takes away a point of failure thereby getting rid of a hazard. Obviously this control is best implemented at the inception of projects or changes when it is most practical to do so, because then it will have the greatest impact and later it will probably be difficult to undo.</p><h3>Substitution</h3><p>We can’t always choose to eliminate a part of the solution, but there may be an alternative to use instead that will reduce risk. One technology does something more reliably than another, another programming language is less prone to bugs than another and so forth.</p><ul><li>which hardware option has the better MTBF?</li><li>will a cloud service be more dependable than on-prem?</li><li>is there a more reliable networking tech?</li><li>is there a more resilient database?</li><li>is there some more reliable library code to use?</li><li>what programming language option reduces bugs?</li><li>will developer B do a better job than developer A?</li></ul><p>As with elimination, substitution can have a hugely beneficial impact on reducing risk and raising the quality of service. Again, this is something to focus upon during inception phases because it may prove impractical to change to something else better later.</p><h3>Engineering Controls</h3><p>At the middle tier of the hierarchy of controls we start to get more deeply into mitigating the risks inherent to the systems in place, that we couldn’t eliminate or substitute to avoid the risks entirely. Engineering controls are systems put in place with technology that will reduce the risk of, or manage failures.</p><p>Software development benefits from numerous engineering controls, including:</p><ul><li>automated testing</li><li>automated code generation</li><li>static code analysis</li><li>version control</li><li>code quality metrics</li><li>logging</li><li>automated deployment</li><li>load testing</li><li>security testing</li><li>continuous integration and delivery</li><li>metrics monitoring</li></ul><p>Infrastructure can also include engineering controls such as:</p><ul><li>backups and redundancy</li><li>power management solutions</li><li>network monitoring systems</li><li>cloud services</li><li>access control systems</li><li>system configuration management</li><li>systems monitoring</li></ul><p>By putting engineering controls in place we isolate the source of problems from the vulnerable systems, or manage the consequences of failure to reduce the effect upon services.</p><h3>Administrative Controls</h3><p>So far we have looked at implementing technical solutions to reduce the risk of failure. The bottom layers of the hierarchy of controls are measures taken to directly mitigate the risk that peoples behaviours introduce to IT systems. Human behaviours can have the most dramatic effect when it comes to risk. If you have ever had one of those IT security trainings, you will know that something as simple as a successful phishing attack can bring a business down.</p><p>Administrative controls are implemented through working practices, these are attempts to cope with the risks that could not be eliminated by the superior approaches above. They may include all manner of best practices, guidelines, standards and procedures that people using IT systems need to follow. Administrative controls can be experienced as onerous, so there will be a tendency to try and avoid or circumvent them.</p><p>When administrative controls become onerous it may also be an indicator of poor engineering and as human based systems administrative controls are subject to human error. For these reasons it would be preferable to mitigate risks by the superior methods. Administrative controls are an ongoing expense that adds to delivery costs and timelines - engineering solutions can prevent issues arising, and thus be regarded as more of a setup cost that can help to reduce the ongoing costs and speed delivery.</p><p>Software developers should be familiar with the following list of administrative controls:</p><ul><li>coding standards, best practices and guidelines</li><li>code reviews, pair programming</li><li>testing; unit testing, integration testing, system testing, acceptance testing, regression testing, performance testing, security testing, usability testing, exploratory testing, user acceptance testing, A/B testing, localisation testing, compatibility testing</li><li>version control and change management</li><li>secure programming</li><li>documentation; requirements documentation (consider BDD), design documentation, test documentation, installation documentation, configuration documentation, user documentation, support documentation, maintenance documentation, security documentation, disaster recovery documentation</li><li>continuous integration and deployment</li></ul><p>Many software developers are averse to providing comprehensive documentation — we prefer to code, however documentation of some form can play an important role in disaster recovery and support and of course efficient and effective knowledge transfer.</p><p>At the business level there are also many ways of better managing risk by implementing administrative controls including:</p><ul><li>specified ways of working to manage delivery; SCRUM, XP, Waterfall etc.</li><li>risk management</li><li>quality assurance</li><li>effective communication</li><li>interviewing, education and training</li><li>the working environment and culture</li><li>audits</li><li>disaster recovery planning</li><li>access measures/security measures</li></ul><h3>PPE?</h3><p>So finally, what can we do as individual contributors to reduce our own risk of failure? We can’t just don some personal protective equipment (PPE), but what is there to assist us beyond administrative controls? Here are some individual centred actions that help reduce the risk of delivering defectively:</p><ul><li>use of code analysis plugins for IDEs that detect bugs and code smells</li><li>assistive prompting tools for IDEs</li><li>code defensively, assure quality by checking code metrics</li><li>using patterns, consulting experienced experts/expert literature</li><li>self development, discussion and study etc.</li><li>taking good care of ourselves physically and emotionally</li></ul><p>There is of course an immediate cost for doing things well enough to keep the risks manageable, and then there are the risks of taking short-cuts. Business should plan to apply the appropriate level of controls commensurate with the risks and of course within budgets.</p><blockquote>High internal quality reduces the cost of future features, meaning that putting the time into writing good code actually reduces cost. — <a href="https://martinfowler.com/"><em>Martin Fowler</em></a><em>, </em><a href="https://martinfowler.com/articles/is-quality-worth-cost.html"><em>Is High Quality Software Worth the Cost?</em></a></blockquote><p>As individual contributors, we can have the most significant effect on successful delivery. Making sure we deliver quality and encouraging others to do so, will help raise the bar and reduce the <em>total-cost-of-ownership</em>. It is better to spend 2 months delivering a project properly, than it is to spend 1 month delivering a project poorly, and then have to spend more time dealing with the consequences of bugs, defects and code that will be hard to maintain and may roll on for many months.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b6ddaa528da3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[You aren’t going to need it?]]></title>
            <link>https://medium.com/@qbyteconsulting/you-arent-going-to-need-it-9cbf4df81781?source=rss-e70eb7ae8c2a------2</link>
            <guid isPermaLink="false">https://medium.com/p/9cbf4df81781</guid>
            <category><![CDATA[agile-methodology]]></category>
            <category><![CDATA[extreme-programming]]></category>
            <dc:creator><![CDATA[John Coleman]]></dc:creator>
            <pubDate>Mon, 17 Oct 2022 08:41:28 GMT</pubDate>
            <atom:updated>2023-04-09T11:26:42.805Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>“Always implement things when you actually need them, never when you just foresee that you need them.” <a href="https://en.wikipedia.org/wiki/Ron_Jeffries">Ron Jeffries</a></blockquote><p>“You aren’t gonna need it”, a.k.a. YAGNI, is a principle from the eXtreme Programming (XP) paradigm. This principle also aligns with a principle behind the Agile Manifesto:</p><blockquote>Simplicity — the art of maximizing the amount of work not done — is essential. <a href="https://agilemanifesto.org/principles.html"><em>The Agile Manifesto</em></a></blockquote><figure><img alt="Collage images of person fitting seat belt, a fire extinguisher, a condom and a pistol." src="https://cdn-images-1.medium.com/max/1024/1*hwNnC36j11rBaqaSUt1xtQ.jpeg" /><figcaption>Protective devices</figcaption></figure><p>As you may ascertain from the images of protective devices that I’ve included in this article, I think this is not the kind of principle you may want to generalise or apply dogmatically. As with vaccines, sometimes you want to take precautions now, even though the need for them is far from certain, because taking precautions in the time of certain need isn’t always such a great idea. YAGNI is a reasonable objection to giving users more features than requested.</p><p>Naively following YAGNI in software design resulting in skimping, leads to technical debt — the decision to do things the quick way rather than the right way. There’s another principle from the Agile Manifesto as well:</p><blockquote>Continuous attention to technical excellence and good design enhances agility. <a href="https://agilemanifesto.org/principles.html"><em>The Agile Manifesto</em></a></blockquote><p>Software development is quite a different scenario to the protective devices above of course, because there will likely be no catastrophe in doing some software development later (this may not always be true though). By delaying, as with lazy initialization, we are simply substituting delivery now for delivery later, when we can be sure we have the need. But is reality that simple, and how do we balance YAGNI with the principle of good design? It’s time to consider some scenarios.</p><p>A real world example I have come across is internationalisation (i18n). Many applications with a user interface will need to support many languages, however, as is sometimes the case, the first release of an app may only be in 1 language, the primary language. The business may require for the first release to be in Mandarin and then the next to support English as well, for example. So as the application developer, do you 1) create a plain English version of the app with hard-coded strings for the first release, or do you 2) implement i18n from the start?</p><p>If you are a naïve YAGNI dogmatist you would go with initial hard-coding and later i18n delivery, but if you believe in good design over fast delivery, you will build i18n into your solution from the start. Which is the optimal approach? To answer this question wisely we need to understand what the balance of convenience is and take an educated guess as to whether or not the feature is more likely or not, to be required.</p><p>I suggest that if 1) it is more likely than not that we will require the feature, and 2) the balance of convenience favours early implementation, then we should indeed follow option 2 and adopt early, also according to the agile good design principles.</p><p>Consider as well the way that i18n solutions solve the problem — they allow us to implement a solution that makes it easier to deliver the additional feature later without the impact of the full delivery in the present. Of course we are not getting a free ride. Anyway, we implement the Mandarin translations using i18n and leave the English until the business says they want it — thus we can get the best of both options without too much up-front investment. This is a feature of good design solutions — we reduce the opportunity cost of having to go all the way. Instead of an all or nothing, we can have an in-between.</p><p>The next question to consider is whether the approach above of early adoption of good design should be generalised to other concerns we usually have in enterprise scale applications such as telemetry, or security?</p><p>I think you will need to look at your specifics and answer this for yourself, but in the meantime understand the risks of adopting a naïve and dogmatic version of YAGNI as a principle. You may end up accumulating a lot of technical debt that developers will find tedious or even problematic to deliver later, and not all refactoring is possible to deliver piecemeal. When you do apply YAGNI, be aware that you must also adopt the practice of continuously refactoring and clean coding, plus following good design.</p><p>Certainly we should follow YAGNI and not develop features the business doesn’t want yet, but it should not be used as an objection to delivering on technical excellence and good design. Embrace YAGNI but don’t skimp, keep technical debt manageable through continuous refactoring.</p><p>Further reading</p><p>(1) <a href="https://ronjeffries.com/articles/019-01ff/iter-yagni-skimp/">YAGNI, yes. Skimping, no. Technical Debt? Not even.</a> — Jeffies, Ron</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9cbf4df81781" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>