Skip to main content

Posts

Showing posts with the label Architecture

Step Functions or Plain Code? A Decision Framework for Small Workflows

Here is a question worth asking before adding a state machine to any small product: if the process running step three of five dies right now, what knows that steps one and two already happened? If the honest answer is "a row I wrote myself" or "nothing", there is a durability problem. If the answer is "nothing, and that is fine because every step is cheap to repeat", an orchestrator is probably unnecessary. This guide is a decision analysis rather than a migration report. It lays out the criteria for choosing between orchestration in code and AWS Step Functions, checked against AWS documentation. The test is what survives a crash, not how many steps you have Step count is a poor signal. A five-step flow where every step is idempotent and finishes in seconds is easy to write as plain code. The signals that matter are about time and memory: Does the flow outlive one invocation? A Lambda invocation is capped at 15 minutes, while a Standard workflow ca...

Why Dependency Injection in .NET Modernization Is an Architecture Decision, Not a Testing Tool

Dependency injection (DI) is usually sold as a way to make unit tests easier. In a legacy .NET modernization that is the smallest part of its value. The larger value is that DI forces a team to name the contracts between components that were tangled together for years, and once those contracts exist you can replace what sits behind them one piece at a time. This article is organized as the questions that come up when you start, in the order they usually appear. What problem does DI actually surface? Older .NET code often mixes construction, configuration and execution in one method. A routine that sends an email might create an SMTP client, read a connection string from a config file, build the message, log the attempt, retry on failure and update a database row, all inline. You cannot test it without live dependencies, and you cannot change any one of those concerns without touching the others. DI does not fix that code by itself. What it does is ask an uncomfortable question: wh...

Strangler-Fig Migrations: Replacing a Legacy .NET Monolith One Seam at a Time

A legacy system that runs a real business presents a familiar choice: rewrite it in one risky cutover, or replace it piece by piece while features keep shipping. The strangler-fig pattern, described by Martin Fowler and named after vines that gradually grow around a host tree, takes the second route. You put a routing layer in front of the old system, build new behavior behind it, and move traffic across one slice at a time until the old code has nothing left to do. On a diagram this looks easy. The hard parts are choosing which slice to split first, proving the replacement behaves the same, and living with two systems in production for a long time. This article is a decision guide for those parts. The cycle in five steps Isolate a seam with a clear input and output contract. Shadow it: the new implementation processes the same inputs but does not affect production. Compare the outputs and fix differences. Switch traffic gradually, with an easy way back. Delete the old co...

Designing Tenant Isolation Before the Data Model Becomes Expensive to Change

You are building a product or internal platform that serves several customers or teams. Today there is one database, one shared schema and a WHERE tenant_id = ... clause. It works. The question is whether it will keep working when a large customer needs dedicated infrastructure, when a contract or regulation requires stronger separation, or when one tenant's workload starts slowing everyone else down. Tenant isolation is not only a security topic. It shapes your data model, query patterns, deployment topology and operations. Choosing early and deliberately keeps your options open at a much lower cost than changing models under pressure. The three common models AWS's SaaS guidance calls these pool , bridge and silo , but in database terms they are usually described as follows. Model Isolation Main costs Shared schema (tenant column) Logical, enforced by filters or row-level security A missed filter leaks data; noisy neighbors; hard to move one tenant out Schema per ...

When to Split a Microservice and When to Keep It Together

Suppose a monolithic .NET service handles customer orders, inventory checks and email notifications. One colleague proposes splitting it into three microservices. Another warns the split will triple operational overhead with no business benefit. Both can be right, and neither argument tells you what to do on Monday morning. The decision is less about embracing distributed systems and more about matching boundaries to consequences your team can operate. A wrong split brings alert fatigue, lock-step deployments and debugging sessions that span several repositories. A good boundary reduces coupling, enables independent deployment and makes incidents easier to isolate. Start with deployment, not the domain diagram The first question is not whether orders and email belong to different bounded contexts. It is whether you need to deploy them independently. If email logic changes twice a year and order processing changes weekly, a boundary pays off. If both change in the same sprint becaus...

AWS Lambda Versus Containers: Choose From Execution Shape, Not Cloud Fashion

Should the next service run as an AWS Lambda function or in containers on ECS, EKS or Fargate? The question often arrives wrapped in worry about making the "modern" choice, as if one option were inherently more sophisticated. The useful way to decide ignores fashion and looks at the execution shape of the workload: how it is triggered, how long it runs, whether it holds state or connections, and how its traffic behaves over time. The guide below is a sequence of questions. Answer them in order; the first clear "this needs a container" is usually decisive. Question 1: Can a single run finish within 15 minutes? A Lambda invocation has a maximum duration of 15 minutes. If a unit of work regularly approaches that, you will spend your time on workarounds (chunking, checkpointing, orchestration with Step Functions) instead of on the workload. A long-running batch job that fits naturally in a container task is simpler as a container. If the work can be split into smal...

Building a SaaS on AWS: The Technical Decisions That Actually Matter

"Should we build our SaaS on AWS, or is that overkill for a small team?" The honest answer depends less on AWS itself than on a handful of decisions made on top of it: compute shape, data model and tenant isolation, cost controls, and where to deliberately avoid over-engineering. This article separates what is expensive to change later from what you can safely postpone. Decide now, decide later Decide early (costly to reverse) Postpone (cheap to change) Tenant identity in every data key and every log line Provisioned versus on-demand database capacity Data store family (key-value versus relational) per workload Which API front door (HTTP API, function URL, load balancer) Account and environment structure, tagging scheme Memory sizes and instance types Least-privilege IAM boundaries per function or service Advanced cost plans (savings plans, reserved capacity) A documented failure path for every async trigger Multi-region, until a requirement demands it Compute...