
Escape the 8-Parameter Initialization Hell with the Swift Builder Pattern
When building an app with Swift, your initialization code eventually starts looking like this.
Read articleARCHIVE · 27
Follow the trail from foundational concepts to practical engineering decisions.

When building an app with Swift, your initialization code eventually starts looking like this.
Read article
Abstract Factory groups mutually compatible objects into product families and replaces them at once. Using a Swift theme example, this article explains how to prevent composition errors and choose between it and Factory Method.
Read article
The final part of the series is about money. If you have run an agent through an API, you may have noticed something odd on the bill. Input tokens cost vastly more than output tokens. Given the architecture from Part 1, that is only natural. Every turn resends everything from the system prompt through the full conversation history, so in a 50-turn agent session, the same system prompt is effectively billed 50 times…
Read article
If you have followed the series this far, you will see a common pattern: minimize what stays inside the context window. Part 3’s “write state to a file before /clear,” Part 4’s “only pointers instead of the body,” and Part 5’s “leave the process to subagents, send only conclusions to the main agent” all point in the same direction. But we have not yet properly addressed the destination of these files—that is, information sent outside the context.
Read article
Swift factory functions give creation logic intent-revealing names and make return types and reuse policies flexible. This covers when to choose static func over init and how it differs from the GoF Factory Method.
Read article