Distributed systems

The Hidden Costs of Just-In-Time Architecture

Designing everything up front is slow, and designing nothing up front costs you later.

Matt Kindy · · 8 min read

The software industry has embraced “shift left” thinking in many areas, moving work that used to happen at the end of development closer to the start. Security has moved from penetration testing at the end of a project to security practices built into the whole development lifecycle. Quality assurance went from testing after development to continuous validation, and operations teams went from planning deployments late to writing “infrastructure as code” from day one.

Architectural planning, though, is often still reactive. In 2001, the Agile Manifesto named “responding to change over following a plan” as one of its core values. That principle changed software development enormously, but some teams have taken it as a reason to put off architectural decisions until a problem forces them. Two decades later, I think architecture benefits from shifting left the way security and quality assurance did, by bringing a systematic understanding of the system, and the planning that goes with it, earlier into development.

The architecture spectrum

Software architecture has historically swung between two extremes. On one side are the “ivory tower” architects, who design systems far removed from the realities of day-to-day development. Their elaborate plans often crack under the pressure of implementation, because they don’t account for practical constraints and operational realities.

On the other side is the pure “just-in-time” approach, where teams build with minimal upfront planning and let the architecture emerge through iteration. This approach makes early development fast, but it can lead to significant problems as the system grows more complex.

Understanding system impact

It’s common to see architectural decisions made on the fly, driven by immediate needs more than by long-term vision. These just-in-time architectures often start strong, but they quickly turn into a tangle of dependencies and technical debt that slows development to a crawl. Applying the same shift-left rigor to architecture starts with understanding what a change will affect before building it. The flowchart below shows the two ways of handling a new feature request.

Flowchart of two ways to handle a new feature request, chosen by the architectural approach. Reactive design starts with a quick implementation, discovers dependencies during development, refactors the implementation, and then loops between uncovering new dependencies and refactoring again. Proactive design runs a system impact analysis, maps the affected components, designs an implementation strategy, and ends in guided development with known constraints. New Feature Request Architectural Approach Reactive Design Proactive Design Quick Implementation Start Discover Dependencies During Development Refactor Implementation Uncover New Dependencies System Impact Analysis Map Affected Components Design Implementation Strategy Guided Development with Known Constraints
The reactive and proactive ways to handle a new feature request.

The reactive approach on the left is the just-in-time one, and it might seem faster at first. Developers start implementing the feature right away, and their progress is visible immediately. Because nobody planned for the feature’s dependencies, though, the team discovers them during development, refactors, and then uncovers even more. Each new dependency needs further changes that can affect other parts of the system in ways nobody foresaw, so without upfront planning the complexity keeps cascading.

The proactive approach, on the right, begins with a deliberate effort to understand the impact across the system. Developers analyze the existing architecture, map the components the new feature will affect, and then design an implementation strategy that accounts for those dependencies. That upfront investment means development is guided, because the constraints are known from the start. I think this approach avoids the pitfalls of both ivory-tower planning and just-in-time reacting, because the plan starts from the system as it exists, with its practical constraints, and covers only the change at hand. The table below compares all three for a few common changes, with the proactive approach in the Balanced column.

  Ivory Tower Just-In-Time Balanced
New API Endpoint Architect designs the endpoint, data models, and service interactions in detail before development begins. Developer adds the endpoint to an existing service, modifying data models as needed. Architect and developer collaborate to identify the appropriate service, data model changes, and potential impact on other services, using system understanding tools.
Database Change Architect updates the master database schema, requiring all teams to adapt. Developer adds a new column or table, potentially creating inconsistencies or performance issues. Developer proposes the change, using impact analysis tools to understand potential consequences. Architect reviews and approves, ensuring consistency and addressing potential performance concerns.
New Service Architect designs the service’s interfaces, responsibilities, and interactions with other services based on a pre-defined architectural plan. Developer creates a new service to encapsulate new functionality, often duplicating existing code or creating tight coupling with existing services. Team discusses the need for a new service, using system mapping tools to visualize dependencies and identify the optimal placement within the architecture.
Outcome Mismatches between design and implementation. Slow initial development. Difficult to adapt to changing requirements. Rapid initial progress. Increasing technical debt. Difficulties with scaling, performance, and maintainability as the system grows. Decisions informed by tool-assisted analysis of the existing system. Faster development cycles. Maintainable and adaptable architecture.

Finding a practical balance

Development today needs a middle path between rigid upfront design and pure iteration. Getting there starts with grounded architecture, which means making architectural decisions that are deeply informed by the realities of the existing codebase, the team’s expertise and the operational constraints of the system. It involves continuous code analysis, close collaboration between architects and developers, and a willingness to adapt the architecture as the system evolves. The aim is a living architecture that reflects the current state of the system, which a static blueprint designed in isolation can’t do.

Grounded decisions depend on systematic exploration: tools and processes that help a team understand the impact of a change before making it. A team needs ready ways to explore dependencies, data flow and infrastructure relationships.

They also depend on incremental evolution, meaning planning that accommodates change while keeping the system coherent. That means making decisions that are informed by the current state of the system and can still adapt to future needs.

Tools for system understanding

Tools for understanding a system have improved significantly, and they give developers and architects powerful ways to explore complex systems. They support grounded architecture with a deep understanding of the existing system, make systematic exploration of dependencies and impact possible, and support incremental evolution through continuous monitoring and analysis.

System mapping tools give a view of the architecture that can keep up with the system better than a diagram drawn once and left alone. Simon Brown’s C4 model is a way of drawing architecture as a hierarchy of diagrams, from the whole system down to the code, and Structurizr, its reference tool, lets a team write that model as code and generate every diagram from it. The model can then live in version control and change along with the system. Enterprise products such as ServiceNow’s Service Mapping, which discovers the infrastructure each application runs on, and Ardoq offer more comprehensive system mapping, though they often take a significant investment to set up and maintain.

The repository can also keep the parts of the architecture a map doesn’t show. Architecture decision records (ADRs) record why each decision was made and what it led to, and tools such as adr-tools keep them as Markdown files next to the code. Architecture rules can run as tests, too. ArchUnit, an open-source Java library, checks the dependencies between packages and classes from an ordinary unit test, so a test fails when one layer starts depending on another it shouldn’t.

Dependency analysis has become crucial in today’s architectures, and the tools work at different levels. Inside a JavaScript or TypeScript project, dependency-cruiser maps which modules import which and checks them against rules the team writes, and npm-check reports packages that are outdated or unused. Across a whole codebase, CodeScene finds dependencies that no import shows by looking in the version history for files that often change together, and SonarQube’s architecture feature maps the dependencies in the code on each analysis and flags the ones that break a structure the team has defined. At the microservice level, Zipkin and Jaeger trace the dependencies that occur at runtime. The traces usually come from OpenTelemetry, a framework for instrumenting code that leaves storing and viewing the data to backends such as Jaeger. Tracing tools complement static analysis tools that examine the declared dependencies, and together they help a team understand both the intended and the actual behavior of the system.

Impact analysis tools bring the shift-left idea to architecture. They show the potential effects of a change before anyone makes it, so a team can deal with architectural concerns proactively instead of reacting to them. GitHub’s dependency review covers the package side of a change, showing which dependencies a pull request adds, removes or updates and flagging the ones with known vulnerabilities. For the code itself, CAST Imaging maps an application’s architecture, call graph and data access so a team can see what a change would affect, and IBM’s Application Discovery and Delivery Intelligence maps the dependencies in mainframe applications on z/OS. Sourcetrail, an open-source code explorer that draws each symbol’s references as a graph, shows what detailed code exploration can look like. Its original authors archived it in 2021, and a community fork still publishes releases for C, C++ and Java.

Change simulation tools help teams try an architectural change somewhere safe before it reaches production. LocalStack emulates AWS services on a developer’s machine and minikube runs a local Kubernetes cluster, so infrastructure changes can be tested locally. API simulation tools such as Hoverfly and WireMock stand in for the services an application calls, so a team can model an API change against them.

Individual tools are strongest in one area, but more platforms now combine several. Sourcegraph combines code search across all of a company’s repositories with tracing the dependencies between them and making one change across many repositories at once. Enterprise platforms like ServiceNow’s full suite and Ardoq combine system mapping with impact analysis and change management.

What will matter most for these tools is moving system understanding earlier in development while fitting closely into the workflows teams already have. Tools that combine real-time analysis with historical data let a team keep track of its architecture continuously, instead of reacting after something goes wrong. When choosing tools, I’d look for ones that fit the team’s existing workflow and give it what it needs for informed architectural decisions throughout development.

Shifting architecture left

The future of software architecture lies in finding the right balance between upfront planning and iterative adaptation. That means adopting tools and practices that move our architectural thinking earlier, so that the systems we build are both adaptable and resilient.

Get the next essay

Follow the RSS feed to see each new essay when it goes up.