iTranslated by AI

The content below is an AI-generated translation. This is an experimental feature, and may contain errors. View original article
💭

Concept Models and Production Models: Examining Cognitive Structure in Software Development

に公開

1. Introduction

In software development, the term "cognitive load" is frequently used. Team Topologies treats cognitive load as a central constraint in team design, and Domain-Driven Design attempts to reduce the cost of shared cognition through a ubiquitous language. However, I believe there are surprisingly few systematically organized models regarding the structure of a developer's cognition and where that load originates.

In this article, I will attempt to model the cognitive structure of developers in product development and clarify the sources of cognitive load. I will temporarily set aside team design and organizational theory to build an abstract model assuming a single "universal developer." This is intended to serve as a foundation for understanding the basic structure of cognition, not just as a precursor to thinking about team design and organizational theory, but also for design of the development process itself. I believe that iteration design in development processes, the shortening of feedback loops, and approaches to estimation and planning are all closely related to the developer's cognitive structure.

Following this, I will deepen my consideration of various practices based on this model.


2. Defining Concepts

2.1 Two Models in Developer Cognition

It is considered that a developer's cognition consists of two distinct models.

Concept Model

A model of the "ideal state," which is not yet reflected in production and arises from feedback or external factors. It has a hypothetical nature, and verification can only be obtained after it is reflected in production.

Production Model

A model of "current understanding," reflecting the product currently in operation. Relatively immediate feedback is obtained through interaction with the codebase and the operational product.

2.2 Four Domains Interacting with Developer Cognition

A developer's cognition interacts with the following four external domains.

Domain Definition
User Users of the product. The source of expectations, behaviors, and feedback.
Codebase Source code, design, and documentation. It is an externalization of cognition and also an object from which cognition is obtained through reading.
Operational Product The system running in the production environment. Cognition is verified through operation.
Environment Technology trends, laws and regulations, market/competitors, etc. External factors where changes force updates to cognition. It also includes general knowledge (mental models shared as common sense) and specialized knowledge (mental models accepted among experts). These significantly influence the design sense in building the product's mental model and serve as a foundation for designing interactions that feel natural to the user.

2.3 Positioning of Domain Knowledge

Business rules and domain knowledge are not treated as independent domains. I believe it is appropriate to treat them as controllable within the scope of laws and regulations, and as being contained within the developer's mental models (Concept Model/Production Model). Updates to domain knowledge occur through feedback from users or the environment (e.g., legal amendments).


3. Main Discussion

3.1 Overview of Cognitive Structure

The cognitive structure of a developer can be illustrated as follows:

CognitiveModel.png

Looking at this diagram, it should be easy to see how a developer's cognition interacts with external domains.

3.2 Feedback Paths and Time Characteristics

Feedback from each domain to a developer's cognition has different delay characteristics depending on the path. I believe this difference also affects the nature of cognitive load.

Immediate to Short-term Feedback

Feedback from the codebase to the production model is obtained relatively immediately. The important point here is the difference in abstraction and concreteness between the model and the codebase. The model is abstract, while the codebase is its concretization.

The act of writing code is the process of "concretizing an abstract model," and feedback to the model occurs during this concretization process. Designs that were supposed to be valid in the abstract can reveal contradictions or ambiguities when attempting to concretize them. Many developers have likely experienced this empirically. The act of reading code is the process of "reconstructing the abstract from the concrete," restoring the model from the codebase. Build errors and test results are also included in this loop as feedback from the concrete.

Short-term to Mid-term Feedback

Feedback from the operational product to the production model is obtained through monitoring, log analysis, troubleshooting, etc. While there is more delay than feedback from the codebase, cognition is updated in a relatively short cycle.

Mid-term to Long-term Feedback

Feedback from users to the concept model is obtained through requests, analysis of usage patterns, interviews, etc. Feedback from the operational product to the concept model (hypothesis testing, A/B test results, etc.) also belongs to this time axis.

Irregular Feedback

Feedback from the environment to the concept model occurs at unpredictable times, such as legal amendments, deprecation of technologies, or trends among competitors. The trouble with this is that it does not wait for our convenience.

Feedback Path Delay Examples
Codebase Immediate to Short (seconds to hours) Reading, building, implementation, testing
Operational Product Short to Mid (hours to days) Monitoring, incidents, log analysis
User Mid to Long (weeks to months) Requests, usage patterns
Operational Product Long (weeks to months) Hypothesis testing, A/B testing
Environment Irregular Legal amendments, technology shifts

3.3 Sources of Cognitive Load

Based on this model, I believe cognitive load can be classified into four types. The important thing is that these are not fixed to specific locations but are universal load types that can occur at any cognitive boundary.

Type 1: Delta Load

A state where there is a divergence between two cognitive states. This can occur at any boundary, not just between the concept model and the production model, but also between a developer's cognition and the codebase, or between a developer's cognition and user expectations.

Type 2: Holding Load

The cost of maintaining a certain target as cognition. This is caused by the complexity of the object on the other side of the boundary, such as the scale and coupling of the codebase, the complexity of the operational state, or the number of domain rules.

Type 3: Translation Load

Load incurred when converting concepts across boundaries. This occurs in interactions between different domains, such as translating users' words into a developer's understanding, reading code to build a production model, or incorporating environmental changes into cognition.

Type 4: Uncertainty

The processing cost for a state where you do not know what you do not know. This lies latent as a "blind spot" at each boundary. Applying the Johari Window, this corresponds to "a delta that exists in reality but is not recognized by cognition."

3.4 Load Occurrence at Boundaries

The four load types occur at every boundary, as follows:

Within a Developer's Cognition

Between the concept model and the production model. I consider the act of development essentially to be "converging the concept model into the production model," but during that process, the concept model continues to be updated by new feedback. Therefore, the delta cannot theoretically reach zero, resulting in a structure of constant pursuit.

Between the Developer and the 4 Domains

At each boundary with users, the codebase, the operational product, and the environment, four types of load occur.

Boundary Delta Load Holding Load Translation Load Uncertainty
User Divergence between expectations and reality Complexity of user persona Interpretation of requirements True needs
Codebase Divergence between cognition and code Scale and complexity of code Reading/Writing Hidden dependencies
Operational Product Divergence between assumptions and reality Complexity of state Interpretation of observations Unknown failure patterns
Environment Divergence between knowledge and reality Breadth/complexity of knowledge Tracking/Learning Existence/occurrence of unknown rules/knowledge

3.5 Verification via Concrete Examples

Having covered abstract concepts, I would like to verify the model with concrete examples.

Example 1: Responding to Legal Changes

When a legal change such as the invoice system occurs, feedback enters the concept model from the environment. The developer understands the legal requirements (translation load) and recognizes the delta from the current production model (delta load). By reflecting this delta in the codebase and deploying it to the operational product, the production model is updated. New development is based on the post-legal-change state, and legal requirements are no longer included in the delta between the concept model and the production model.

Example 2: Feature Requests from Users

Feedback from users updates the concept model. However, requests are often ambiguous, resulting in high translation load. Also, the true needs behind the requests can belong to blind spots (uncertainty), which only manifest after hypothesis testing in the operational product. I suspect this is something every developer has experienced. By building a concept model and repeating validation, one aims to build a better production model.

Example 3: Refactoring Legacy Code

The complexity of the codebase increases the holding load of the production model. Even after reading the code, the production model cannot be built accurately, making it difficult to predict the impact of changes. This is a combination of translation load and holding load, which may be part of why legacy code feels "scary." If one is forced to build a concept model while the accuracy of the production model is low, the holding load and translation load of the concept model naturally increase as well.


4. Discussion

In this chapter, I will provide observations based on the proposed model from several perspectives.

4.1 Application to Development Processes

To keep the delta load between the concept model and the production model small, improvements in the development process are essential. Shorter iterations, continuous integration, and releasing with small batch sizes can all be understood as strategies to get the production model to follow before the delta becomes too large.

From this perspective, we can reinterpret the difference between Waterfall and Agile. In Waterfall, a large concept model is built before reflecting it in the production model (implementation/deployment). Because feedback cannot be obtained during this period, the concept model cannot be validated, and the delta continues to accumulate. Furthermore, since changes from the environment or users do not wait, the concept model itself may be obsolete by the time reflection is complete (the developer ends up having to maintain a different, future-facing concept model than the one currently being developed). From the perspective of cognitive load, Waterfall might be considered a process that maximizes delta load and uncertainty.

On the other hand, Agile reflects the concept model in the production model in small units, obtains feedback, and then constructs the next concept. It is structured to keep the delta small and resolve uncertainty early. It is clearly rational.

4.2 Application to Architectural Design

We can examine which architectural strategies are effective for each source of cognitive load. For instance, modularization and abstraction can be considered for holding load, ubiquitous language and layer organization for translation load, and improving observability for uncertainty.

In particular, application decomposition based on the magnitude of cognitive load is a critical design decision. While Team Topologies uses the "range a team can cognitively handle" as a criterion for decomposition, I believe this is also applicable to architecture. There is a limit to the complexity that a single developer (or a single team) can maintain as a production model. Systems that exceed this limit should be divided into cognitively manageable units.

I believe this structure can have fractal properties, similar to Team Topologies. The entire system is divided into cognitively manageable units, and the interior of each unit is further divided into manageable units. The same structure of "delta between concept and production models," "interaction with 4 domains," and "4 load types" appears at each level. Although higher levels handle models with coarser granularity and lower levels handle detailed models, the structure of cognition itself can be similar.

4.3 Implications for AI Utilization

The model of cognitive structure presented here also offers implications for considering the utilization of AI (especially Large Language Models).

the issue of cognitive load can essentially be translated into an issue of "limiting context." Just as human developers suffer cognitive load due to constraints in working memory, LLMs also have constraints in their context window. One cannot handle the entire system at once and must work within a scope delimited by appropriate boundaries.

From this perspective, boundary design to minimize cognitive load also serves as design for the units in which AI can work effectively. A codebase that is modularized, has clear responsibilities, and is understandable within a limited context is easier to handle for both humans and AI.

Furthermore, the fractal structure concept should be effective in AI utilization. The higher layer handles a conceptual model with abstract, coarse granularity, and as necessary, one descends into the details of the lower layers. Since the same cognitive structure and four load types apply to each layer, the AI can focus on the current context while being able to acquire necessary information at appropriate granularity. In human-AI collaboration, clarifying which layer and which range is being handled may enable effective task division.

4.4 Documentation as a Means of Externalizing Models

While the codebase functions as a means of externalizing cognition, design documents and other documentation can also serve as externalization tools. However, when treating documents as model externalization, caution is needed because they require maintenance separate from the codebase.

Maintaining both the codebase and documents creates a new source of cognitive load: the "delta between the codebase and the documentation." Developers must pay the cost of determining which is correct. From this perspective, I believe that documents should only be positioned as supplements to the codebase, and the Source of Truth should be strictly limited to the codebase.

For documents created during the concept model review stage (design proposals, proposals, ADRs, etc.), it is appropriate to treat them as having fulfilled their role once the production model is merged (implemented/deployed). While they are worth keeping as "records of consideration," clearly stating the assumption that they will not be subject to continuous maintenance can prevent the growth of delta load.

4.5 Cognitive Delta in Team Development

In team development, the subject of model construction becomes the team or organization. The model is extracted as the consensus of the team. Cognitive boundaries will also exist between developers. Even when looking at the same codebase, each developer's production model is different. Even when hearing the same requirements, each developer's concept model is different. This delta becomes a cognitive load within the team.

┌─────────────────┐              ┌─────────────────┐
│ Developer A's    │←─[4 Types of  ─→│ Developer B's    │
│ Cognition        │    Load]      │ Cognition       │
│ Concept/         │               │ Concept/        │
│ Production       │               │ Production      │
└─────────────────┘              └─────────────────┘

The accuracy of model understanding varies by developer. This is thought to be due to the following factors:

  • Technical Skills: Proficiency in programming languages, frameworks, and architecture patterns.
  • Education: The breadth of mental models shared as general knowledge.
  • Expertise: The depth of knowledge regarding the target domain.
  • Understanding of the Codebase: Proficiency in existing implementation and grasp of historical context.

Due to these differences, even when reading the same codebase, the accuracy of the production model constructed differs, and the resolution of the concept model constructed when hearing the same requirements differs. This manifests when externalization occurs.

The strategy for this issue is to deepen shared understanding. Practices such as ubiquitous language, pair programming, mob programming, code reviews, and design discussions reduce the delta in production models between developers. And when the degree of sharing of production models increases, the cognitive delta when extracting new concept models also decreases. If there is a common foundation, discussions about "the ideal state" will become more precise, potentially reducing translation load and uncertainty.

4.6 Feedback Latency and Goal Setting

I will consider the impact of setting feedback from high-latency domains (users and the environment) as developer goals.

Feedback latency also implies large uncertainty. Validating whether the concept model was correct takes time, during which a delta is likely to accumulate. If goals that rely on delayed feedback, such as "maximizing user value," are adopted as short-term performance indicators, developers may have an incentive to expand the concept model without waiting for validation. Consequently, delta load increases, potentially having the opposite effect from the perspective of cognitive load.

What is implied here is the separation of long-term goals and short-term goals. While setting goals that rely on delayed feedback, such as user value or market success, as long-term directions, short-term goals should be set in areas with small feedback latency (codebase quality, deployment frequency, mean time to recovery, etc.). Through this, one can decompose uncertain concepts into verifiable units and head toward long-term goals while controlling delta load. This is double-loop learning itself.

4.7 Maximizing Product Value and User Cognition

While this paper has focused on the developer's cognitive structure, user cognition is also an important subject for consideration when thinking about maximizing product value.

Users use the product as a "tool." At this time, the user recognizes the model behind the product (business rules, conceptual structure) through the product. I believe an excellent product is one where the user can naturally understand the model and perform intended operations without hesitation.

What is important here is the product's "transparency with respect to the model." Whether the product can transmit the model faithfully without unnecessary noise. The concept of modeless design can be understood in this context. If modes exist, the user must recognize the extra state of "which mode am I in now," which depletes cognitive resources for the original task. Modeless interfaces increase product transparency, creating a state where users can focus on the model itself.

Maximizing user value and market impact depend heavily on the quality of this user cognition. An excellent model is transparent, and it can also be cognitively low-load when viewed from the developer's side.


5. Conclusion

In this paper, I have modeled the cognitive structure of developers in software development as follows:

  • Developer cognition has a two-layer structure: "concept model (ideal state)" and "production model (understanding of current state)."
  • Cognition interacts with four external domains (users, codebase, operational product, environment).
  • Feedback from each domain has time characteristics; cognition is updated immediately from the codebase, and with delays from users and the environment.
  • Cognitive load can be classified into four types (delta load, holding load, translation load, uncertainty), and these occur at every cognitive boundary.
  • In team development, boundaries also exist between developers, and similar loads occur.

5.1 Reflections

Through the modeling in this paper, I feel that the essence of the act of "development" has become slightly clearer. Development is "converging the concept model into the production model," but that convergence is theoretically never complete. This is because new feedback is constantly entering from the outside, and the concept model continues to advance.

Assuming this "structure of eternal pursuit," the strategy to minimize cognitive load might not be "making the delta zero," but rather "keeping the delta easy to handle." This is related to the discussion of technical debt, but here I have limited it to the cognitive perspective. Valuation as debt will be a topic for the next layer built upon this model.

By modeling the structure of cognition, one more thing has become visible. It is that various engineering practices in software development can be systematically understood as things to minimize cognitive load and deal with uncertainty. Agile development is a strategy to keep delta load small, continuous integration is a mechanism to shorten feedback loops, pair programming and mob programming are practices to reduce cognitive delta between developers, ubiquitous language is an attempt to reduce translation load, and observability is a means to make uncertainty manifest.

These are often discussed as individual best practices, but when viewed through a model of cognitive structure, they can be understood uniformly as different approaches toward the same goal. I hope the model presented in this paper will be a help to such systematic understanding.

GitHubで編集を提案

Discussion