Skip to content
ImagineWorld

Build Your Own Trade-Off Analysis

node_idnode-book_software-architecture-the-hard-parts_chapter-15-build-your-own-trade-off-analysis
node_typechapter-node
schema_profileworld.chapter_node.v1
statusactive
entropyhigh
manifoldworld
domainimagineworld.net
authorityinforms
layercorpus
chapter_num15
chapter_titleBuild Your Own Trade-Off Analysis
pillar_membershipJ — architecture_design_craft
governed_byCORPUS
constitutional_citationCONSTITUTION
local graph

Chapter 15 — Build Your Own Trade-Off Analysis

Section titled “Chapter 15 — Build Your Own Trade-Off Analysis”

CHAPTER 15 Build Your Own Trade-Off Analysis

Section titled “CHAPTER 15 Build Your Own Trade-Off Analysis”

The conference room somehow seemed more brightly lit than it did on that fateful day in September when the business sponsors of the Sysops Squad were about to pull the plug on the entire support contract business line. People in the conference room were chatting with each other before the meeting started, creating an energy not seen in the conference room for a long, long time.

“Well,” said Bailey, the main business sponsor and head of the Sysops Squad ticketing application, “I suppose we should get things started. As you know, the purpose of this meeting is to discuss how the IT department was able to turn things around and repair what was nine months ago a train wreck.”

“We call that a retrospective,” said Addison. “And it’s really useful for discovering how to do things better in the future, and to also discuss things that seemed to work well.”

“So then, tell us, what worked really well? How did you turn this business line around from a technical standpoint?” asked Bailey.

“It really wasn’t one single thing,” said Austen, “but rather a combination of a lot of things. First of all, we in IT learned a valuable lesson about looking at the business drivers as a way to address problems and create solutions. Before, we always used to focus only on the technical aspects of a problem, and as a result never saw the big picture.”

“That was one part of it,” said Dana, “but one of the things that turned things around for me and the database team was starting to work together more with the application teams to solve problems. You see, before, those of us on the database side of things did our own thing, and the application development teams did their own thing. We never would have gotten to where we are now without collaborating and working together to migrate the Sysops Squad application.”


“For me it was learning how to properly analyze trade-offs,” said Addison. “If it weren’t for Logan’s guidance, insights, and knowledge, we wouldn’t be in the shape we’re in now. It was because of Logan that we were able to justify our solutions from a business perspective.”

“About that,” said Bailey, “I think I speak for everyone here when I say that your initial business justifications were what prompted us to give you one last shot at repairing the mess we were in. That was something we weren’t accustomed to, and, well, quite frankly it took us by surprise—in a good way.”

“OK,” said Parker, “so now that we all agree things seem to be going well, how do we keep this pace going? How do we encourage other departments and divisions within the company from getting into the same mess we were in before?”

“Discipline,” said Logan. “We continue our new habit of creating trade-off tables for all our decisions, continue documenting and communicating our decisions through architecture decision records, and continue collaborating with other teams on problems and solutions.”

“But isn’t that just adding a lot of extra process and procedures to the mix?” asked Morgan, head of the marketing department.

“No,” said Logan. “That’s architecture. And as you can see, it works.”

Throughout this book, the unifying example illustrates how to generically perform trade-off analysis in distributed architectures. However, generic solutions rarely exist in architecture and, if they do, are generally incomplete for highly specific architectures and the unique problems they bring. Thus, we don’t think that the communication analysis covered in Chapter 2 is exhaustive, but rather a starting point for you to add more columns for the unique elements entangled with your problem space.

To that end, this chapter provides some advice on how to build your own trade-off analysis, using many of the same techniques we used to derive the conclusions presented in this book.

Our three-step process for modern trade-off analysis, which we introduced in Chapter 2 is as follows:

  • Find what parts are entangled together.
  • Analyze how they are coupled to one another.
  • Assess trade-offs by determining the impact of change to interdependent systems.

We discuss some techniques and considerations for each step next. Finding Entangled Dimensions

An architect’s first step in this process is to discover what dimensions are entangled, or braided, together. This is unique within a particular architecture but discoverable by experienced developers, architects, operations folks, and other roles familiar with the existing overall ecosystem and its capabilities and constraints.

Coupling

The first part of the analysis answers this question for an architect: how are parts within an architecture coupled to one another? The software development world has a wide variety of definitions of coupling, but we use the simplest, most intuitive version for this exercise: if someone changes X, will it possibly force Y to change?

In Chapter 2, we described the concept of the static coupling between architecture quanta, which provides a comprehensive structural diagram of technical coupling. No generic tool exists to build this because each architecture is unique. However, within an organization, a development team can build a static coupling diagram, either manually or via automation.

For example, to create a static coupling diagram for a microservice within an architecture, an architect needs to gather the following details:

  • Operating systems/container dependencies
  • Dependencies delivered via transitive dependency management (frameworks, libraries, etc.)
  • Persistence dependencies on databases, search engines, cloud environments, etc.
  • Architecture integration points required for the service to bootstrap itself
  • Messaging infrastructure (such as a message broker) required to enable communication to other quanta

The static coupling diagram does not consider other quanta whose only coupling point is workflow communication with this quantum. For example, if an AssignTicket Service cooperates with the ManageTicket within a workflow but has no other coupling points, they are statically independent (but dynamically coupled during the actual workflow).

Teams that already have most of their environments built via automation can build into that generative mechanism an extra capability to document the coupling points as the system builds.

For this book, our goal was to measure the trade-offs in distributed architecture coupling and communication. To determine what became our three dimensions of dynamical quantum coupling, we looked at hundreds of examples of distributed architectures (both microservices and others) to determine the common coupling points. In other words, all the examples we looked at were sensitive to changes to the dimensions of communication, consistency, and coordination.

This process highlights the importance of iterative design in architecture. No architect is so brilliant that their first draft is always perfect. Building sample topologies for workflows (much as we do in this book) allows an architect or team to build a matrix view of trade-offs, allowing quicker and more thorough analysis than ad hoc approaches.

Once an architect or team has identified the coupling points they want to analyze, the next step is to model the possible combinations in a lightweight way. Some of the combinations may not be feasible, allowing the architect to skip modeling those combinations. The goal of the analysis is to determine what forces the architect needs to study—in other words, which forces require trade-off analysis? For example, for our architecture quantum dynamic coupling analysis, we chose coupling, complexity, responsiveness/availability, and scale/elasticity as our primary trade-off concerns, in addition to analyzing the three forces of communication, consistency, and coordination, as shown in the ratings table for the “Parallel Saga(aco) Pattern” on page 346, appearing again in Table 15-1.

Table 15-1. Ratings for the Parallel Saga pattern

Parallel SagaRatings
CommunicationAsynchronous
ConsistencyEventual
CoordinationCentralized
CouplingLow
ComplexityLow
Responsiveness/availabilityHigh
Scale/elasticityHigh

When building these ratings lists, we considered each design solution (our named patterns) in isolation, combining them only at the end to see the differences, shown in Table 15-2.

Table 15-2. Consolidated comparison of dynamic coupling patterns

PatternCoupling levelComplexityResponsiveness/availabilityScale/elasticity
Epic SagaVery highLowLowVery low
Phone Tag SagaHighHighLowLow
Fairy Tale SagaHighVery lowMediumHigh
Time Travel SagaMediumLowMediumHigh
Fantasy Fiction SagaHighHighLowLow
Horror StoryMediumVery highLowMedium
Parallel SagaLowLowHighHigh
Anthology SagaVery lowHighHighVery high

Once we had analyzed each pattern independently, we created a matrix to compare the characteristics, leading to interesting observations. First, notice the direct inverse correlation between coupling level and scale/elasticity: the more coupling present in the pattern, the worse its scalability. This intuitively makes sense; the more services involved in a workflow, the more difficult for an architect to design for scale.

Second, we made a similar observation around responsiveness/availability and coupling level, which is not quite as direct as the preceding correlation but also significant: higher coupling leads to less responsiveness and availability because the more services involved in a workflow, the more likely the entire workflow will fail based on a service failure.

This analysis technique exemplifies iterative architecture. No architect, regardless of their cleverness, can instantly understand the nuances of a truly unique situation—and these nuances constantly present themselves in complex architectures. Building a matrix of possibilities informs the modeling exercises an architect might want to do in order to study the implications of permutating one or more dimensions to see the resulting effect.

Once you have built a platform that allows iterative “what if” scenarios, focus on the fundamental trade-offs for a given situation. For example, we focused on synchronous versus asynchronous communication, a choice that creates a host of possibilities and restrictions—everything in software architecture is a trade-off. Thus, choosing a fundamental dimension like synchronicity first limits future choices. With that dimension now fixed, perform the same kind of iterative analysis on subsequent decisions encouraged or forced by the first. An architect team can iterate on this process until they have solved the difficult decisions—in other words, decisions with entangled dimensions. What’s left is design.

Over time, the authors have created a number of trade-off analyses and have built up some advice on how to approach them.

You may have noticed that virtually none of our trade-off tables are quantitative—based on numbers—but are rather qualitative—measuring the quality of something rather than the quantity, which is necessary because two architectures will always differ enough to prevent true quantitative comparisons. However, using statistical analysis over a large data set allows reasonable qualitative analysis.

For example, when comparing the scalability of patterns, we looked at multiple different implementations of communication, consistency, and coordination combinations, assessing scalability in each case, and allowing us to build the comparative scale shown in Table 15-2.

Similarly, architects within a particular organization can carry out the same exercise, building a dimensional matrix of coupled concerns, and look at representative examples (either within the existing organization or localized spikes to test theories).

We recommend you hone the skill of performing qualitative analysis, as few opportunities for true quantitative analysis exist in architecture.

It is important for architects to be sure they are comparing the same things rather than wildly different ones. For example, it’s not a valid comparison to compare a simple message queue to an enterprise service bus, which contains a message queue but dozens of other components as well.

A useful concept borrowed from the technology strategy world to help architects get the correct match of things to compare is a MECE list, an acronym for mutually exclusive, collectively exhaustive:

Mutually exclusive

None of the capabilities can overlap between the compared items. As in the preceding example, it is invalid to compare a message queue to an entire ESB because they aren’t really the same category of thing. If you want to compare just the messaging capabilities absent the other parts, that reduces the comparison to two mutually comparable things.

Collectively exhaustive

This suggests that you’ve covered all the possibilities in the decision space, and that you haven’t left out any obvious capabilities. For example, if a team of architects is evaluating high-performance message queues and consider only an ESB and simple message queue but not Kafka, they haven’t considered all the possibilities in the space.

The goal of a MECE list is to cover a category space completely, with no holes or overlaps, as shown pictorially in Figure 15-1.

Figure 15-1. A MECE list is mutually exclusive and collectively exhaustive

The software development ecosystem constantly evolves, uncovering new capabilities along the way. When making a decision with long-term implications, an architect should make sure a new capability hasn’t just arrived that changes the criteria. Ensuring that comparison criteria is collectively exhaustive encourages that exploration.

When assessing trade-offs, architects must make sure to keep the decision in context; otherwise, external factors will unduly affect their analysis. Often, a solution has many beneficial aspects, but lacks critical capabilities that prevent success. Architects need to make sure they balance the correct set of trade-offs, not all available ones.

For example, perhaps an architect is trying to decide whether to use a shared service or shared library for common functionality within a distributed architecture, as illustrated in Figure 15-2. Figure 15-2. Deciding between shared service or library in a distributed architecture

The architect facing this decision will begin to study the two possible solutions, both via general characteristics discovered through research and via experimental data from within their organization. The results of that discovery process lead to a trade-off matrix such as the one shown in Figure 15-3.

Figure 15-3. Trade-off analysis for two solutions

406 | Chapter 15: Build Your Own Trade-Off Analysis The architect seems justified in choosing the shared library approach, as the matrix clearly favors that solution…overall. However, this decision exemplifies the out-of-context problem—when the extra context for the problem becomes clear, the decision criteria changes, as illustrated in Figure 15-4.

Figure 15-4. Shifting decision based on additional context

The architect continued to research not only the generic problem of service versus library, but the actual context that applies in this situation. Remember, generic solutions are rarely useful in real-world architectures without applying additional situation-specific context.

This process emphasizes two important observations. First, finding the best context for a decision allows the architect to consider fewer options, greatly simplifying the decision process. One common piece of advice from software sages is “embrace simple designs,” without ever explaining how to achieve that goal. Finding the correct narrow context for decisions allows architects to think about less, in many cases simplifying design.

Second, it’s critical for architects to understand the importance of iterative design in architecture, diagramming sample architectural solutions to play qualitative “what-if” games to see how architecture dimensions impact one another. Using iterative design, architects can investigate possible solutions and discover the proper context in which a decision belongs.

Architects shouldn’t make decisions in a vacuum, without relevant drivers that add value to the specific solution. Adding those domain drivers back to the decision process can help the architect filter the available options and focus on the really important trade-offs.

For example, consider this decision by an architect as to whether to create a single payment service or a separate service for each payment type, as illustrated in Figure 15-5.

Figure 15-5. Choosing between a single payment service or one per payment type

As we discussed in Chapter 7, architects can choose from a number of integrators and disintegrators to assist this decision. However, those forces are generic—an architect may add more nuance to the decision by modeling some likely scenarios.

For example, consider the first scenario, illustrated in Figure 15-6, to update a credit card processing service.

In this scenario, having separate services provides better maintainability, testability, and deployability, all based on quantum-level isolation of the services. However, the downside of separate services is often duplicated code to prevent static quantum coupling between the services, which damages the benefit of having separate services. Figure 15-6. Scenario 1: update credit card processing service

In the second scenario, the architect models what happens when the system adds a new payment type, as shown in Figure 15-7.

Figure 15-7. Scenario 2: adding a payment type

The architect adds a reward points payment type to see what impact it has on the architecture characteristics of interest, highlighting extensibility as a benefit of separate services. So far, separate services look appealing.

However, as in many cases, more complex workflows highlight the difficult parts of the architecture, as shown in the third scenario in Figure 15-8.

In this scenario, the architect starts gaining insight into the real trade-offs involved in this decision. Utilizing separate services requires coordination for this workflow, best handled by an orchestrater. However, as we discussed in Chapter 11, moving to an orchestrator likely impacts performance negatively and makes data consistency more of a challenge. The architect could avoid the orchestrator, but the workflow logic must reside somewhere—remember, semantic coupling can only be increased via implementation, never decreased. Figure 15-8. Scenario 3: using multiple types for payment

Having modeled these three scenarios, the architect realizes that the real trade-off analysis comes down to which is more important: performance and data consistency (a single payment service) or extensibility and agility (separate services).

Thinking about architecture problems in the generic and abstract gets an architect only so far. As architecture generally evades generic solutions, it is important for architects to build their skills in modeling relevant domain scenarios to home in on better trade-off analysis and decisions.

Prefer Bottom Line over Overwhelming Evidence

Section titled “Prefer Bottom Line over Overwhelming Evidence”

It’s easy for architects to build up an enormous amount of information in pursuit of learning all the facets of a particular trade-off analysis. Additionally, anyone who learns something new generally wants to tell others about it, especially if they think the other party will be interested. However, many of the technical details that architects uncover are arcane to nontechnical stakeholders, and the amount of detail may overwhelm their ability to add meaningful insight into the decision.

Rather than show all the information they have gathered, an architect should reduce the trade-off analysis to a few key points, which are sometimes aggregates of individual trade-offs.

Consider the common problem an architect might face in a microservices architecture about the choice of synchronous or asynchronous communication, illustrated in Figure 15-9. Figure 15-9. Deciding between communication types

The synchronous solution orchestrator makes synchronous REST calls to communicate with workflow collaborators, whereas the asynchronous solution uses message queues to implement asynchronous communication.

After considering the generic factors that point to one versus the other, the architect next thinks about specific domain scenarios of interest to nontechnical stakeholders. To that end, the architect will build a trade-off table that resembles Table 15-3.

Trade-Offs

Table 15-3. Trade-offs between synchronous and asynchronous communication for credit card processing

Synchronous advantageSynchronous disadvantageAsynchronous advantageAsynchronous disadvantage
Customer must wait for credit card approval process to startNo wait for process to start
Credit approval is guaranteed to start before customer request endsNo guarantee that the process has started
Customer application rejected if orchestrator is downApplication submission not dependent on orchestrator

After modeling these scenarios, the architect can create a bottom-line decision for the stakeholders: which is more important, a guarantee that the credit approval process starts immediately or responsiveness and fault-tolerance? Eliminating confusing technical details allows the nontechnical domain stakeholders to focus on outcomes rather than design decisions, which help avoids drowning them in a sea of details.

One unfortunate side effect of enthusiasm for technology is evangelism, which should be a luxury reserved for tech leads and developers but tends to get architects in trouble.

Trouble comes because, when someone evangelizes a tool, technique, approach, or anything else people build enthusiasm for, they start enhancing the good parts and diminishing the bad parts. Unfortunately, in software architecture, the trade-offs always eventually return to complicate things.

An architect should also be wary of any tool or technique that promises any shocking new capabilities, which come and go on a regular basis. Always force evangelists for the tool or technique to provide an honest assessment of the good and bad—nothing in software architecture is all good—which allows a more balanced decision.

For example, consider an architect who has had success in the past with a particular approach and becomes an evangelist for it, as illustrated in Figure 15-10.

Figure 15-10. An architect evangelist who thinks they have found a silver bullet

This architect has likely worked on problems in the past where extensibility was a key driving architecture characteristic and believes that capability will always drive the decision process. However, solutions in architecture rarely scale outside narrow confines of a particular problem space. On the other hand, anecdotal evidence is often compelling. How do you get to the real trade-off hiding behind the knee-jerk evangelism?

While experience is useful, scenario analysis is one of an architect’s most powerful tools to allow iterative design without building whole systems. By modeling likely scenarios, an architect can discover if a particular solution will, in fact, work well. In the example shown in Figure 15-10, an existing system uses a single topic to broadcast changes. The architect’s goal is to add bid history to the workflow—should the team keep the existing publish-and-subscribe approach or move to point-to-point messaging for each consumer?

To discover the trade-offs for this specific problem, the architect should model likely domain scenarios using the two topologies. Adding bid history to the existing publish-and-subscribe design appears in Figure 15-11.

Figure 15-11. Scenario 1: Adding bid history to the existing topic

While this solution works, it has issues. First, what if the teams need different contracts for each consumer? Building a single large contract that encompasses everything implements the “Stamp Coupling for Workflow Management” on page 378 anti-pattern; forcing each team to unify on a single contract creates an accidental coupling point in the architecture—if one team changes its required information, all the teams must coordinate on that change. Second, what about data security? Using a single publish-and-subscribe topic, each consumer has access to all the data, which can create both security problems and PII (Personally Identifiable Information, discussed in Chapter 14) issues as well. Third, the architect should consider the operational architecture characteristic differences between the different consumers. For example, if the operations team wanted to monitor queue depth and use auto-scaling for bid capture and bid tracking but not for the other two services, using a single topic prevents that capability—the consumers are now operationally coupled together.

To mitigate these shortcomings, the architect should model the alternative solution to see if it addresses the preceding problems (and doesn’t introduce new intractable ones). The individual queue version appears in Figure 15-12. Figure 15-12. Using individual queues to capture bid information

Each part of this workflow (bid capture, bid tracking, bid analytics, and bid history) utilizes its own message queues and addresses many of the preceding problems. First, each consumer can have their own contract, decoupling the consumers from each other. Second, security access and control of data resides within the contract between the producer and each consumer, allowing differences in both information and rate of change. Third, each queue can now be monitored and scaled independently.

Of course, by this point in the book, you should realize that the point-to-point based system isn’t perfect either but offers a different set of trade-offs.

Once the architect has modeled both approaches, it seems that the differences boil down to the choices shown in Table 15-4.

Table 15-4. Trade-offs between point-to-point versus publish-and-subscribe messaging

Point-to-pointPublish-and-subscribe
Allows heterogeneous contractsExtensibility (easy to add new consumers)
More granular security access and data control
Individual operational profiles per consumer

414 | Chapter 15: Build Your Own Trade-Off Analysis In the end, the architect should consult with interested parties (operations, enterprise architects, business analysts, and so on) to determine which of these sets of trade-offs is more important.

Sometimes an architect doesn’t choose to evangelize something but is rather coerced into playing an opposite foil, particularly for something that has no clear advantage. Technologies develop fans, sometimes fervent ones, who tend to downplay disadvantages and enhance upsides.

For example, recently a tech lead on a project tried to wrangle one of the authors into an argument about monorepo versus trunk-based development. Both have good and bad aspects, a classic software architecture decision. The tech lead was a fervent supporter of the monorepo approach, and tried to force the author to take the opposing position—it’s not an argument if two sides don’t exist.

Instead, the architect pointed out that it was a trade-off, gently explaining that many of the advantages touted by the tech lead required a level of discipline that had never manifested within the team in the past, but will surely improve.

Rather than be forced into taking the opposing position, instead the architect forced a real-world trade-off analysis, not based on generic solutions. The architect agreed to try the Monorepo approach but also gather metrics to make sure that the negative aspects of the solution didn’t manifest. For example, one of the damaging anti-patterns they wanted to avoid was accidental coupling between two projects because of repository proximity, so the architect and team built a series of fitness functions to ensure that, while technically possible to create a coupling point, the fitness function prevented it.

Don’t allow others to force you into evangelizing something—bring it back to trade-offs.

We advise architects to avoid evangelizing and to try to become the objective arbiter of trade-offs. An architect adds real value to an organization not by chasing silver bullet after silver bullet but rather by honing their skills at analyzing the trade-offs as they appear.

Monday, June 20, 16:55

OK, I think I finally get it. We can’t really rely on generic advice for our architecture—it’s too different from all the others. We have to do the hard work of trade-off analysis constantly.”

That’s correct. But it’s not a disadvantage—it’s an advantage. Once we all learn how to isolate dimensions and perform trade-off analysis, we’re learning concrete things about our architecture. Who cares about other, generic ones? If we can boil the number of trade-offs for a problem down to a small enough number to actually model and test them, we gain invaluable knowledge about our ecosystem. You know, structural engineers have built a ton of math and other predictive tools, but building their stuff is difficult and expensive. Software is a lot… well, softer. I’ve always said that testing is the engineering rigor of software development. While we don’t have the kind of math other engineers have, we can incrementally build and test our solutions, allowing much more flexibility and leveraging the advantage of a more flexible medium. Testing with objective outcomes allows our trade-off analyses to go from qualitative to quantitative—from speculation to engineering. The more concrete facts we can learn about our unique ecosystem, the more precise our analysis can become.”

Yeah, that makes sense. Want to go to the after-work gathering to celebrate the big turnaround?” “Sure.”


416 | Chapter 15: Build Your Own Trade-Off Analysis

In this book, we’ve made several references to terms or concepts that are explained in detail in our previous book, Fundamentals of Software Architecture. The following is a forward reference for those terms and concepts:

Cyclomatic complexity: Chapter 6, page 81 Component coupling: Chapter 7, page 92 Component cohesion: Chapter 7, page 93 Technical versus domain partitioning: Chapter 8, page 103 Layered architecture: Chapter 10, page 135 Service-based architecture: Chapter 13, page 163 Microservices architecture: Chapter 12, page 151 This document page contains a list of tables with corresponding captions. The tables are formatted in a clear and organized manner, with each table having its own caption. The text is clear and legible, and the tables are presented in a structured format. APPENDIX B

Each Sysops Squad decision in this book was accompanied by a corresponding Architecture Decision Record. We consolidated all the ADRs here for easy reference:

“ADR: A short noun phrase containing the architecture decision” on page 5

“ADR: Migrate Sysops Squad Application to a Distributed Architecture” on page 61

“ADR: Migration Using the Component-Based Decomposition Approach” on page 79

“ADR: Use of Document Database for Customer Survey” on page 184

“ADR: Consolidated Service for Ticket Assignment and Routing” on page 211

“ADR: Consolidated Service for Customer-Related Functionality” on page 215

“ADR: Using a Sidecar for Operational Coupling” on page 241

“ADR: Use of a Shared Library for Common Ticketing Database Logic” on page 247

“ADR: Single Table Ownership for Bounded Contexts” on page 280

“ADR: Survey Service Owns the Survey Table” on page 281

“ADR: Use of In-Memory Replicated Caching for Expert Profile Data” on page 297

“ADR: Use Orchestration for Primary Ticket Workflow” on page 321

“ADR: Loose Contract for Sysops Squad Expert Mobile Application” on page 380 This document page contains a list of tables with corresponding captions. The tables are formatted in a clear and organized manner, with each table having its own caption. The text is clear and legible, and the tables are presented in a structured format. APPENDIX C

The primary focus of this book is trade-off analysis; to that end, we created a number of trade-off tables and figures in Part II to summarize trade-offs around a particular architecture concern. This appendix summarizes all the trade-off tables and figures for easy reference:

Figure 6-25, “Relational databases rated for various adoption characteristics” on page 163

Figure 6-26, “Key-value databases rated for various adoption characteristics” on page 166

Figure 6-27, “Document databases rated for various adoption characteristics” on page 168

Figure 6-28, “Column family databases rated for various adoption characteristics” on page 170

Figure 6-30, “Graph databases rated for various adoption characteristics” on page 172

Figure 6-31, “New SQL databases rated for various adoption characteristics” on page 174

Figure 6-32, “Cloud native databases rated for various adoption characteristics” on page 175

Figure 6-33, “Time-series databases rated for various adoption characteristics” on page 177

Table 8-1, “Trade-offs for the code replication technique” on page 223

Table 8-2, “Trade-offs for the shared library technique” on page 227

Table 8-3, “Trade-offs for the shared service technique” on page 233 Table 8-4, “Trade-offs for the Sidecar pattern / service mesh technique” on page 239 Table 9-1, “Joint ownership table split technique trade-offs” on page 256 Table 9-2, “Joint ownership data-domain technique trade-offs” on page 258 Table 9-3, “Joint ownership delegate technique trade-offs” on page 261 Table 9-4, “Joint ownership service consolidation technique trade-offs” on page 262 Table 9-5, “Background synchronization pattern trade-offs” on page 272 Table 9-6, “Orchestrated request-based pattern trade-offs” on page 277 Table 9-7, “Event-based pattern trade-offs” on page 279 Table 10-1, “Trade-offs for the Interservice Communication data access pattern” on page 286 Table 10-2, “Trade-offs for the Column Schema Replication data access pattern” on page 288 Table 10-3, “Trade-offs associated with the replicated caching data access pattern” on page 293 Table 10-4, “Trade-offs associated with the data domain data access pattern” on page 295 Table 11-1, “Trade-offs for orchestration” on page 306 Table 11-2, “Trade-offs for the Front Controller pattern” on page 312 Table 11-3, “Stateless choreography trade-offs” on page 313 Table 11-4, “Stamp coupling trade-offs” on page 314 Table 11-5, “Trade-offs for the choreography communication style” on page 315 Table 11-6, “Trade-off between orchestration and choreography for ticket workflow” on page 319 Table 11-7, “Updated trade-offs between orchestration and choreography for ticket workflow” on page 320 Table 11-8, “Final trade-offs between orchestration and choreography for ticket workflow” on page 320 Table 12-11, “Trade-offs associated with state management rather than atomic distributed transactions with compensating updates” on page 356 Table 12-12, “Trade-offs associated with atomic distributed transactions and compensating updates” on page 363 Table 13-1, “Trade-offs for strict contracts” on page 371 Table 13-2, “Trade-offs for loose contracts” on page 372

Table 13-3, “Trade-offs for consumer-driven contracts” on page 375

Table 13-4, “Trade-offs for stamp coupling” on page 379

Table 14-1, “Trade-offs for the Data Warehouse pattern” on page 385

Table 14-2, “Trade-offs for the Data Lake pattern” on page 388

Table 14-3, “Trade-offs for the Data Mesh pattern” on page 394

Table 15-2, “Consolidated comparison of dynamic coupling patterns” on page 403

Table 15-3, “Trade-offs between synchronous and asynchronous communication for credit card processing” on page 411

Table 15-4, “Trade-offs between point-to-point versus publish-and-subscribe messaging” on page 414 This document page contains a list of tables with corresponding captions. The tables are formatted in a clear and organized manner, with each table having its own caption. The text is clear and legible, and the tables are presented in a structured format.

abstractness of codebase, 67 distance from main sequence, 69 ACID (atomicity, consistency, isolation, durability) transactions about, 263-267 distributed transactions versus, 265 example, 264 BASE transactions versus, 267 database types cloud native databases, 176 document databases, 169 graph databases, 173 NewSQL databases, 173 relational databases, 163, 164 time series databases, 178 afferent coupling, 66, 68 aggregate orientation, 165 GraphQL read-only aggregated data, 368 key-value databases, 166 NoSQL databases understanding, 171 agility modularity providing, 49, 49 speed-to-market via, 49 testability for, 54 versioning shared libraries, 225 Amazon DynamoDB key-value database, 165 Ambler, Scott, 154 analytical data about, 4, 381 data meshes, 389-394 analytical reporting coupled, 393 when to use, 393 definition, 5 domain over technical partitioning, 388 previous approaches data lakes, 386-389 data warehouses, 382-385 Sysops Squad saga, 381, 386, 389 data mesh, 394-397 annotations distributed transaction management, 356 metadata for, 222 Anthology Saga pattern, 349-351 Apache Cassandra column family database, 170 Apache Ignite replicated caching, 290 APIs endpoint versioning for shared services, 230 platforms for code reuse, 244 Architectural Decision Records (ADRs), 5 architectural decomposition about, 64 eating the elephant, 63 codebase analysis about, 65 abstractness and instability, 67 afferent and efferent coupling, 66 distance from main sequence, 69 component-based, 71-72 about, 64, 82 about patterns, 71, 82 architecture stories, 84 create component domains, 120-122 create domain services, 126-129 determine component dependencies, 111-118 flatten components, 101-107 gather common domain components, 94-96 identify and size components, 84-93 services built from components, 71 data about, 132 about decomposing monolithic, 151 assign tables to data domains, 156-158 create data domains, 156 drivers of decomposition, 132-149 Refactoring Databases (Ambler and Sadalage), 154 schemas to separate servers, 159 separate connections to data domains, 158 switch over to independent servers, 161 Sysops Squad saga, 150 tactical forking, 72-78 about, 64 trade-offs, 77 volatility-based decomposition, 191 architectural fitness functions (see fitness functions for governance) architecture architecture governance, 6 Big Ball of Mud anti-pattern, 65 Equifax data breach, 12 fitness functions, 7 (see also fitness functions) architecture quantum, 28 (see also architecture quantum) brittleness, 243 data warehouses, 384 strict contracts creating, 367 composition versus inheritance, 228 data importance, 4 (see also data) definitions of terms, 14 architecture definition, 3 design versus, 13-15 security controlled through design, 215 evolution of, 3, 6, 47 (see also modularity) iterative nature of analysis, 403 why more important than how, 13 architecture governance, 6 Big Ball of Mud anti-pattern, 65 Equifax data breach, 12 fitness functions, 7 (see also fitness functions) architecture quantum about, 28, 144 coupling, static versus dynamic, 28 dynamic quantum coupling, 38-41 high static coupling, 30-37 user interface, 36 data disintegration driver, 144 separate databases, 159 Sysops Squad saga, 151 data product quantum, 390-393 high functional cohesion, 30 database, 145 independently deployable, 29 Sysops Squad saga, 42 architecture stories, 84 ArchUnit tool, 129 Aslett, Matthew, 173 asynchronous communication about complexity of, 341, 345 definition, 14 delegate technique of data ownership, 259 distributed data access, 287 fault tolerance, 59 performance issues, 231 messaging mitigating, 231 publish-and-subscribe messaging, 277 dead letter queue, 279 durable subscribers, 278 synchronous versus, 38, 43 atomic fitness functions, 7 atomic workflow consistency, 40 definition, 15 eventual consistency versus, 15, 40 atomicity in ACID transactions, 263 distributed transactions versus, 266 attributes for distributed transaction management, 356 availability basic availability of BASE transactions, 267 coupling relationship, 403 database types about availability, 162 cloud native databases, 176 column family databases, 170 document databases, 168 graph databases, 173 key-value databases, 166 NewSQL databases, 174 relational databases, 164 time series databases, 178 modularity and, 58 AWS Redshift cloud native database, 175 Azure CosmosDB cloud native database, 175

B backpressure information link, 212 backup and restore databases, 160 bandwidth and stamp coupling, 377 BASE (basic availability, soft state, eventual consistency) transactions, 267 Beck, Kent, 6 Berners-Lee, Tim, 4 best practices nonexistent, 1 Big Ball of Mud anti-pattern, 65 tactical forking, 72-78 bounded context in microservices, 4, 26, 135 architecture quanta, 35 architecture quantum versus, 42 breaking database changes controlled, 135-138 database abstraction, 136-138 data domains, 155 combining data domains, 157 data requirement in some architectures, 132 data sovereignty per service, 159 granularity and, 206 high functional cohesion, 30 ownership of data (see ownership of data) breaking changes to data structure, 134 bounded context controlling, 135-138 database abstraction, 136-138 brittleness in architecture, 243 data warehouses, 384 strict contracts creating, 367 broker style event-driven architecture quantum, 33, 42 Brooks, Fred, 2 business case for modularity, 59-62

C caching for distributed data access, 288-293 Chain of Responsibility design pattern, 338 The Checklist Manifesto (Gawande), 13 choreographed coordination, 306-311 about coordination, 40, 300 about orchestrated versus, 300, 331 trade-offs, 315 definition, 15 service granularity and, 200-203 stamp coupling for management, 378 workflow state management, 311-315 Front Controller pattern, 311 stamp coupling, 313 stateless choreography, 313 client/server applications, 382 cloud native databases, 175 Cockburn, Alistair, 235 CockroachDB NewSQL database, 174 code replication as reuse pattern, 221-223 code reuse patterns about, 220 code replication, 221-223 granularity and shared code, 203-205, 224 orthogonal reuse pattern, 238 shared libraries about, 223 granularity and, 224 versioning strategies, 225-227 shared services, 228-234 change risk, 229 fault tolerance, 232 performance, 231 scalability, 232 versioning via API endpoints, 230 sidecars and service mesh, 234-239 Sysops Squad saga, 239 strict contracts and, 367 Sysops Squad saga, 219 shared domain functionality, 244 sidecars and service mesh, 239 value added, 242 reuse via platforms, 244 code volatility as granularity driver, 191 cohesion high functional cohesion, 30 database architecture quantum, 145 maintainability and, 51 metrics information link, 191 service granularity, 189, 194 column family databases, 169 communication about synchronous versus asynchronous, 38, 43 analytical data mesh, 393 coordination required, 40 database connection pool, 138 Sysops Squad saga, 150 distributed data access, 287 dynamic coupling as, 23, 29 communication dependencies, 29 saga pattern matrix, 41, 324, 402 east-west communication, 200-203 interservice communication, 200-203 API endpoint versioning for shared services, 230 bounded context data, 206 data ownership, 252, 259 distributed data access, 285 performance issues, 231 latency with distributed data, 285 publish-and-subscribe messaging, 277 dead letter queue, 279 durable subscribers, 278 service scalability and elasticity, 57 compensating updates in distributed transactions, 275, 327 state management instead, 352, 355 Sysops Squad saga, 358-364 competitive advantage as modularity driver, 49 compile-based versus runtime changes, 229 component-based decomposition, 71-72 about, 64, 82 about components, 71 patterns about, 71, 82 architecture stories, 84 create component domains, 120-122 create domain services, 126-129 determine component dependencies, 111-118 flatten components, 101-107 gather common domain components, 94-96 identify and size components, 84-93 components Create Component Domains pattern, 120-122 fitness functions, 122 definition, 14, 51, 71, 103 dependencies determination, 112 Identify and Size Components pattern, 84-93 fitness functions, 87-89 maintainability and, 51 names, 85 namespaces, 85 size determination, 84 size and granularity, 189 composite architecture characteristics, 7 composition versus inheritance in design, 228 connection management connection quotas, 139 data disintegration driver, 138-141 scalability includes connections, 141 database per service, 143 Sysops Squad saga, 150 consistency about, 40, 162 ACID transactions, 264 distributed transactions versus, 266 database types cloud native ACID, 176 column family tunable, 171 document ACID, 169 graph ACID, 173 key-value tunable, 167 NewSQL ACID, 175 relational ACID, 164 time series ACID or tunable, 178 dynamic coupling relationship matrix, 40, 324, 402 eventual consistency about patterns, 267 atomic workflow versus, 15, 40 background synchronization pattern, 269-272 BASE transactions, 267 event-based pattern, 277-279 finite state machines for, 351 orchestrated request-based pattern, 272-277 majority quorum, 167, 169 tunable consistency, 167, 171 Constantine, Larry, 66, 217 consumer-driven contracts, 373 context for trade-off analysis, 405-407 contracts about, 365 bounded context data ownership, 136-138 contract fidelity and microservices, 373 consumer-driven contracts, 373 definition, 15 distributed data access Data Domain not requiring, 294 Interservice Communication requiring, 286, 294 Replicated Cache requiring, 294 high static coupling, 30 loose contracts, 368 decoupling via, 369, 371 fitness functions required, 371 trade-offs, 371 microservice contracts, 372 stamp coupling about, 376 bandwidth, 377 over-coupling via, 376 workflow management, 378 strict contracts, 367 JSON example, 367 trade-offs, 370 Sysops Squad saga, 365, 379 cooperative quantum, 393 coordination of workflow about, 40, 300 about trade-offs, 315 choreographed coordination, 306-311 about orchestration versus, 300, 331 definition, 15 stamp coupling for management, 378 workflow state management, 311 dynamic coupling relationship matrix, 40, 324, 402 orchestrated coordination, 301-306 about choreographed versus, 300, 331 definition, 14 workflow state management, 311 stamp coupling for management, 378 Sysops Squad saga, 299, 317-321 coupling about static versus dynamic, 29 dynamic coupling, 23, 29 static coupling, 23, 28 Sysops Squad saga, 42 architectural decomposition afferent coupling, 66, 68 common domain functionality consolidated, 99 determining component dependencies, 112 efferent coupling, 66, 68 architecture quantum, 28, 34 dynamic quantum coupling, 38-41 high static coupling, 30-37 independently deployable, 29 Sysops Squad saga, 42 user interface, 36 availability relationship, 403 data relationships, 147 definition, 14, 27 interservice communication pattern, 286 loose contracts for decoupling, 369, 371 consumer-driven contracts, 373 microservices, 372 microservices and contract fidelity, 373 strict contract tight coupling, 370 maintainability and, 51 operational coupling, 234-239 Sysops Squad saga, 239 orchestration, 306 choreography versus, 332 orthogonal coupling, 238 scaling relationship, 332, 403 semantic coupling, 309 implementation coupling, 309 stamp coupling, 378 stamp coupling bandwidth, 377 choreography state management, 313 over-coupling via, 376 workflow management, 378 trade-off analysis, 26-28, 401-403 coupling points, 402 static coupling diagram, 401 Create Component Domains pattern, 120-122 fitness functions, 122 Sysops Squad saga, 123-126, 129 Create Domain Services pattern, 126-129 fitness functions, 129 Sysops Squad saga, 129 credit card data (see PCI (Payment Card Industry) data) custom attributes for distributed transaction management, 356 cyclomatic complexity and maintainability, 51

D data about importance of, 4 about operational versus analytical, 4 analytical data about, 4, 381 data lakes, 386-389 data meshes, 389-394 data meshes coupled to reporting, 393 data warehouses, 382-385 definition, 5 domain over technical partitioning, 388 Sysops Squad saga, 381, 386, 389, 394-397 breaking changes, 134 bounded contexts controlling, 135-138 coupling microservices, 35 multiple quanta event-driven architecture, 34 relationships among data, 147 data domains (see data domains) database-per-service, 143 breaking apart database to achieve, 147 decomposition of operational data about, 132 about decomposing monolithic, 151 assign tables to data domains, 156-158 create data domains, 156 data access in other domains, 158 database-per-service requiring, 147 dependencies, 153-155 drivers of, 132-149 Refactoring Databases (Ambler and Sadalage), 154 schemas to separate servers, 159 separate connections to data domains, 158 switch over to independent servers, 161 Sysops Squad saga, 131, 150 disintegration drivers about, 133 architecture quantum, 144 connection management, 138-141 database change control, 134-138 database type optimization, 146 fault tolerance, 143 scalability, 141 distributed data access (see distributed data access) granularity and data relationships, 205-207 integration drivers about, 146 database transactions, 148 relationships, 147 latency with distributed data, 285 ownership about, 249 assigning, 250 common ownership, 252 data mesh domain ownership, 389 data sovereignty per service, 159 distributed data access, 287, 289 joint ownership, 253-260 service consolidation technique, 261 single ownership, 251 summary, 262 Sysops Squad saga, 249, 279-282 security credit card data, 195 granularity driver, 195 services sharing, 132 changes to database, 134 connection management, 138-141 single point of failure, 143 single point of failure vulnerability, 143 Sysops Squad saga, 151 Sysops Squad data model, 19 data domains, 152 data domain technique of joint ownership, 256-258 data domains about, 152 about decomposing monolithic data, 151 assign tables to data domains, 156-158 bounded context rules, 155 create data domains, 156 schemas to separate servers, 159 separate connections to data domains, 158 switch over to independent servers, 161 combining service consolidation, 261 tables tightly coupled, 157 data access in other domains, 158 data schemas versus, 157 synonyms for tables, 157 distributed data access, 293-295 joint ownership of data, 256-258 soccer ball visualization, 153 Sysops Squad data model, 152 data lakes, 386-389 Data Mesh (Dehghani), 390 data meshes about, 389 Data Mesh (Dehghani), 390 data product quantum, 390-393 Sysops Squad saga, 394-397 when to use, 393 data product quantum (DPQ), 390-393 aggregate DPQ, 391 cooperative quantum, 393 fit-for-purpose DPQ, 392 source-aligned (native) DPQ, 391 data warehouses, 382-385 Star Schema, 383, 384 technical partitioning, 384 database abstraction via bounded context, 136-138 Database as a Service (DBaaS), 164 NewSQL databases, 174 database refactoring book, 154 database structure Sysops Squad saga, 180-184 database transactions and granularity, 198 database types, 178 about characteristics rated, 161 aggregate orientation, 165 cloud native databases, 175 column family databases, 169 database type optimization, 146 document databases, 167 graph databases, 171-173 key-value databases, 165-167 NewSQL databases, 173 NoSQL databases, 165 relational databases, 163-164 schema-less databases, 169 Sysops Squad saga, 179 time series databases, 177-178 database-per-service, 143 breaking apart database to achieve, 147 databases separated physically, 159 Datomic cloud native database, 175 DDD (see Domain-Driven Design) De La Torre, Fausto, 73 dead letter queue (DLQ), 279 decision making, 26-28 (see also trade-off analysis) decomposition (see architectural decomposition) Decorator Design Pattern, 239 Dehghani, Zhamak, 389, 390 delegate technique of joint data ownership, 258-261 dependencies Determine Component Dependencies pattern, 111-118 dynamic coupling as communication dependencies, 29 monolithic data domains, 153-155 Refactoring Databases (Ambler and Sadalage), 154 synonyms for tables, 157 shared libraries, 224, 227 static coupling as operational dependencies, 23, 28 tools JDepend, 9, 66 NetArchTest, 11 visualization importance, 116 visualization tools resource, 113 deployment architectural modularity described, 54 deployability in modularity, 55 fault tolerance, 58 cloud native Production Topology, 176 independent deployability, 29 deprecation strategies for shared libraries, 226 design architecture versus, 13-15 security controlled through design, 215 Chain of Responsibility, 338 composition versus inheritance, 228 Decorator Design Pattern, 239 Pipes and Filters, 338, 351 Determine Component Dependencies pattern, 111-118 fitness functions, 117 Sysops Squad saga, 118-120 dimensional models of Star Schema, 384 distance from main sequence, 69 zones of uselessness and pain, 69 distributed architectures bounded context in microservices, 26 (see also bounded context) code reuse patterns, 220 (see also code reuse patterns) data importance, 4 (see also data) data sovereignty per service, 159 database connection pool, 138 connection management, 139 Sysops Squad saga, 150 dynamic coupling matrix, 41, 324, 402 eventual consistency, 267 (see also eventual consistency) evolution of architecture, 3 sagas as transactional behavior, 15 (see also sagas) sharing data, 257 side effects, 361 state machines, 352-355 static coupling, 32 multiple quanta, 34 single quantum, 33 transactionality challenges, 40

distributed data access Column Schema Replication pattern, 287 Data Domain pattern, 293-295 Interservice Communication pattern, 285 Replicated Caching pattern, 288-293 Sysops Squad saga, 283, 295-298

distributed transactions about, 265, 327 ACID transactions, 263-267 example, 264 BASE transactions, 267 compensating updates, 275, 327 Sysops Squad saga, 358-364 eventual consistency, 267 (see also eventual consistency) managing sagas, 356 (see also transactional saga patterns) Sysops Squad sagas, 279-282, 358-364

distributed workflows about, 299 about coordination, 40, 300 about trade-offs, 315 choreography, 306-311 about orchestration versus, 300 definition, 15 workflow state management, 311-315 orchestration, 301-306 about choreographed versus, 300 definition, 14 workflow state management, 311 semantic coupling, 309 implementation coupling, 309 service granularity and workflow, 200-203 stamp coupling for management, 378

Sysops Squad saga, 299, 317-321 transactional saga patterns, 323 (see also transactional saga patterns) document databases, 167 documentation for managing distributed transactions, 222, 356 domain partitioned architecture, 50 data domains, 152 data lakes losing relationships, 387 data mesh domain ownership, 389 granularity and shared domain functionality, 204 maintainability and, 51 technical partitioning data warehouses as, 384 domain preferred, 388 domain workflows, 311

domain services about, 126 component domains into, 121 Create Domain Services pattern, 126-129 fitness function for namespace, 129 domain cohesion and granularity, 194 Front Controller in choreography, 311 service-based architecture definition, 72, 126 domain versus infrastructure shared functionality, 94

Domain-Driven Design (DDD) bounded context, 4 architecture quantum, 42 high functional cohesion and, 30 information link, 121 namespaces from applications prior to, 121 durability in ACID transactions, 264 distributed transactions versus, 266 durable subscribers in pub/sub messaging, 278 dynamic coupling, 23, 29 about dimensions of, 300, 401 analytical data communication pattern, 393 communication, 38, 43 consistency, 40 coordination, 40 relationships among factors, 40, 324 (see also sagas) static versus, 29 Sysops Squad saga, 42 E east-west communication, 200-203 efferent coupling, 66, 68 elasticity coupling, 43 definition, 56 mean time to startup and, 56 scalability versus, 43, 56 Enterprise Integration Patterns (Hohpe and Woolf), 156 enterprise service bus (ESB) global orchestrator, 301 Epic Saga pattern, 325-330 Equifax data breach, 12 Evans, Erik, 165 event-based eventual consistency, 277-279 publish-and-subscribe messaging, 277 dead letter queue, 279 durable subscribers, 278 event-driven architecture (EDA) multiple architecture quanta, 34 single architecture quantum broker style as, 33, 42 mediator style as, 33 eventual consistency about consistency, 40 about patterns, 267 atomic workflow versus, 15, 40 background synchronization pattern, 269-272 BASE transactions, 267 event-based pattern, 277-279 publish-and-subscribe messaging, 277 finite state machines for, 351 orchestrated request-based pattern, 272-277 extensibility as granularity driver, 196 eXtreme Programming (XP), 6

F Fairy Tale Saga pattern, 333-336 Fantasy Fiction Saga pattern, 340-342 fault tolerance choreography, 314 data disintegration driver, 143 definition, 58, 143, 193 granularity disintegration driver, 193 granularity integration driver, 200-203 modularity driver, 49, 58 orchestration, 305

shared libraries, 232 shared services, 232 single point of failure, 143 Sysops Squad saga, 151 fitness functions for governance about, 7-13 atomic, 7 composite architecture characteristics, 7 holistic, 8 manual versus automated, 11 outcomes, 11 overuse avoided, 13 dynamic coupling monitored, 29 examples component cycles avoided, 8 layer relationship verification, 10 loose coupling requiring, 371 patterns for component-based decomposition create component domains, 122 create domain services, 129 determine component dependencies, 117 flatten components, 107 gather common domain components, 95 identify and size components, 87-89 zero-day exploits, 12 Flatten Components pattern, 101-107 fitness functions, 107 metrics for shared components, 106 Sysops Squad saga, 107-110 Foote, Brian, 65 Ford, Neal, xi, 417 Fowler, Martin, 165, 228 Front Controller in choreography, 311 Fundamentals of Software Architecture (Richards and Ford), xi, 417-423

G Gather Common Domain Components pattern, 94-96 fitness functions, 95 Sysops Squad saga, 97-99 Gawande, Atul, 13 Gee, Trisha, 222 granularity balancing trade-offs, 208 definition, 57 disintegrators of granularity about, 187, 188 code volatility, 191 extensibility, 196 fault tolerance, 193 scalability and throughput, 192 security, 195 service scope and function, 189 elasticity as function of, 57 integrators of granularity about, 187, 197 data relationships, 205-207 database transactions, 198 shared code, 203-205 workflow and choreography, 200-203 metrics, 187 microservice single responsibility, 186, 190 modularity versus, 186 shared data and, 257 shared libraries, 224 Sysops Squad saga, 185, 209-216 graph databases, 171-173 GraphQL loose contracts, 368 Gremlin database language, 173 gRPC protocol information link, 230 performance mitigation by, 231 strict contracts by default, 367

H hard parts of architecture, 2 hash table data structure, 165 Hello2morrow, 50 Henney, Kevlin, 222 Hexagonal Architecture, 235 high functional cohesion, 30 database architecture quantum, 145 Hohpe, Gregor, 156, 364 Horror Story pattern, 343-345

I Identify and Size Components pattern, 84-93 fitness functions, 87-89 Sysops Squad saga, 81 implementation coupling, 309 independent deployability, 29 InfluxDB time series database, 177 infrastructure versus domain shared functionality, 94 inheritance versus composition in design, 228

instability of codebase, 68 distance from main sequence, 69 interservice communication, 200-203 API endpoint versioning for shared services, 230 bounded context data, 206 data ownership common ownership, 252 delegate technique of joint ownership, 259 distributed data access, 285 isolation in ACID transactions, 264 distributed transactions versus, 266 importance of, 361 isomorphic diagrams, 325

J Java Message Service (Richards), 231 JDepend tool, 9 Eclipse plug-in, 66 joint ownership of data about, 253 data domain technique, 256-258 delegate technique, 258-261 service consolidation technique, 261 table split technique, 254-256

K key-value databases, 165-167 Kx time series database, 177

L latency in communication, 285 LATEST caution for versioning, 227 layered architecture architecture governance, 10 modular architecture maintainability, 51 scalability and elasticity, 57 testability, 54 loose contracts decoupling via, 369 fitness functions required, 371 REST and GraphQL, 368 trade-offs, 371

M maintainability of modular architecture, 50-54 metric for tracking, 50 majority quorum, 167, 169 Martin, Robert C., 67, 190 mean time to startup and elasticity, 56 MECE (Mutually Exclusive, Collectively Exhaustive) lists, 404 mediator in orchestration, 301 mediator style event-driven architecture quantum, 33 MemcacheDB key-value database, 165 messaging asynchronicity, 231 Java Message Service (Richards), 231 metadata annotations, 222 microkernel architecture, 50 microservices architecture quantum, 28, 29 decoupled services, 35 high functional cohesion, 30 user interface coupling, 36 bounded context, 4, 26 architecture quanta, 35 architecture quantum versus, 42 breaking database changes controlled, 135-138 data domains, 155 data domains combined, 157 data requirement, 132 database abstraction, 136-138 granularity and, 206 high functional cohesion, 30 ownership of data (see ownership of data) contracts about, 372 consumer-driven contracts, 373 contract fidelity, 373 coupling levels, 372 coordination, 40 (see also coordination) definition, 191 domain partitioning of, 388 modularity, 52 deployability, 56 scalability and elasticity, 57 operational coupling, 234-239 orchestrator per workflow, 301 saga pattern, 323 service-based architecture as stepping-stone, 72, 121, 127 shared database changed, 134 single responsibility principle and granularity, 186, 190 Microservices Patterns (Richardson), 323 Microsoft SQL Server relational database, 164 modularity about, 48, 50 about change, 47 architectural governance, 8 drivers of about, 49 agility, 49, 49 deployability, 55 fault tolerance, 58 maintainability, 50-54 scalability, 48, 56-57 testability, 54 granularity versus, 186 monolithic architectures about modularity, 50 about need for modularity, 47 deployability, 55 fault tolerance, 58 maintainability, 51 modular monoliths, 50 scalability and elasticity, 57 Sysops Squad saga, 45, 59-62 testability, 54 water glass analogy, 47 monolithic architectures architectural decomposition (see architectural decomposition) Big Ball of Mud anti-pattern, 65 tactical forking, 72-78 data decomposition about, 151 assign tables to data domains, 156-158 create data domains, 156 Refactoring Databases (Ambler and Sadalage), 154 schemas to separate servers, 159 separate connections to data domains, 158 switch over to independent servers, 161 data importance, 4 database connection pool, 138 database type optimization, 146 Epic Saga mimicking, 325-330 modular architecture


Index | 435 about need for, 47 deployability, 55 fault tolerance, 58 maintainability, 51 modular monoliths, 50 scalability and elasticity, 57 Sysops Squad saga, 45, 59-62 testability, 54 water glass analogy, 47 namespaces prior to Domain-Driven Design, 121 patterns for migration to service-based about, 71, 82 architecture stories, 84 create component domains, 120-122 create domain services, 126-129 determine component dependencies, 111-118 flatten components, 101-107 gather common domain components, 94-96 identify and size components, 84-93 single architecture quantum, 29 functional cohesion, 30 static coupling, 31 Monorepo, 415 MySQL relational database, 164

N namespaces component domains, 121 applications prior to Domain-Driven Design, 121 fitness functions for governance, 122 components, 85 extend then prior a subdomain, 102 fitness function, 129 root namespace definition, 103 Neo4j graph database, 173 NetArchTest tool, 11 network latency, 285 NewSQL databases, 173 97 Things Every Java Programmer Should Know (Henney and Gee), 222 NoSQL databases aggregate orientation understood, 171 column family databases, 169 document databases, 167 key-value databases, 165

NoSQL Distilled (Sadalage and Fowler), 165 schema-less databases, 169 Nygard, Michael, 5

O online resources (see resources online) Online Transactional Processing (OLTP), 4 operational coupling, 234-239 Sysops Squad saga, 239 operational data definition, 4 Oracle Coherence replicated caching, 290 Oracle relational database, 164 orchestrated coordination, 301-306 about choreographed versus, 300, 331 trade-offs, 315 about coordination, 40, 300 definition, 14 orchestrator, 301 workflow state management, 311 orchestrated request-based eventual consistency, 272-277 Orchestrated Saga pattern, 325-330 orphaned classes definition, 103 orthogonal code reuse pattern, 238 orthogonal coupling, 238 out-of-context trap, 405-407 ownership of data about, 249 assigning, 250 common ownership, 252 data mesh domain ownership, 389 data sovereignty per service, 159 distributed data access, 287, 289 joint ownership about, 253 data domain technique, 256-258 delegate technique, 258-261 table split technique, 254-256 service consolidation technique, 261 single ownership, 251 summary, 262 Sysops Squad saga, 249, 279-282

P Page-Jones, Meilir, 23 Parallel Saga pattern, 346-348 PCI (Payment Card Industry) data security and granularity, 195 Sysops Squad saga, 212-216 Personally Identifiable Information (PII), 387 Phone Tag Saga pattern, 330-333 PII (Personally Identifiable Information), 387 Pipes and Filters design pattern, 338, 351 platforms for code reuse, 244 Ports and Adaptors Pattern, 235 PostgreSQL relational database, 164 publish-and-subscribe messaging, 277 dead letter queue, 279 durable subscribers, 278 pull model consumer-driven contracts, 373 push model definition, 373

Q quanta, 28 (see also architecture quantum) quorum mechanism, 167, 169

R Redis key-value database, 165 Refactoring Databases (Ambler and Sadalage), 154 relational databases (RDBMS), 163-164 links to most popular, 164 transactions and service granularity, 198 replicate databases, 160 replicated in-memory caching, 288-293 resources online ArchUnit tool, 129 book website, xii cohesion metrics information, 191 database links cloud native databases, 175 NoSQL databases, 165 relational databases, 164 dependency tools JDepend, 9, 66 NetArchTest, 11 visualization, 113 Refactoring Databases (Ambler and Sadalage), 154 Saga Pattern (Richardson), 323 stamp coupling information, 376 static code analysis tools, 85 REST (representational state transfer) loose contracts, 368 reuse patterns (see code reuse patterns) Riak KV key-value database, 165 Richards, Mark, xi, 231, 417

Richardson, Chris, 323 root namespace definition, 103 runtime versus compile-based changes, 229

S Sadalage, Pramod, 154, 165 sagas about, 323 definition, 15 dynamic coupling matrix, 41, 324, 402 microservice saga pattern, 323 state machines, 352-355 Sysops Squad saga background, 15 (see also Sysops Squad sagas) techniques for managing, 356 transactional saga patterns about, 41, 324 about state management, 351 Anthology Saga, 349-351 Epic Saga, 325-330 Fairy Tale Saga, 333-336 Fantasy Fiction Saga, 340-342 Horror Story, 343-345 Parallel Saga, 346-348 Phone Tag Saga, 330-333 Sysops Squad saga, 323, 358-364 Time Travel Saga, 336-339

scalability choreography, 314, 331 connection management, 141 database-per-service, 143 Sysops Squad saga, 150 coupling relationship, 332, 403 data disintegration driver, 141 database types cloud native scalable, 176 column family scalable, 170 document scalable, 168 graph read versus write, 172 key-value scalable, 166 NewSQL scalable, 174 relational complexity, 164 time series scalable, 178 definition, 56 elasticity versus, 43, 56 granularity disintegration driver, 192 modularity providing, 47, 57 modularity driver, 49, 56-57 orchestration, 305


Index | 437 choreography versus, 331 service consolidation for data ownership, 262 shared services, 232 schemas for database tables, 156 cross-schema access resolved, 158 data domain versus data schema, 157 databases separated physically, 159 schema-less databases, 169 synonyms for tables, 157 Scylla column family database, 171 security granularity disintegration driver, 195 PCI data Sysops Squad saga, 212-216 security latency, 285 semantic coupling, 309 implementation coupling, 309 stamp coupling to manage workflow, 378 service consolidation technique of joint ownership, 261 service granularity (see granularity) service mesh, 237-239 Sysops Squad saga, 239 service-based architecture about, 32, 72, 126 data access in other domains, 158 data shared by services, 132 changes to database, 134 connection management, 138-141 single point of failure, 143 domain services from component domains, 121 Create Domain Services pattern, 126-129 evolution of architecture, 3 modular architecture scalability and elasticity, 57 monolithic migration to about, 71, 82 architecture stories, 84 create component domains, 120-122 create domain services, 126-129 determine component dependencies, 111-118 flatten components pattern, 101-107 gather common domain components, 94-96 identify and size components, 84-93 static coupling, 32 stepping-stone to microservices, 72, 121, 127 services bounded contexts (see bounded context) choreographed coordination definition, 15 component-based decomposition, 71 Create Component Domains pattern, 120 coupling definition, 14 (see also coupling) data access in other domains, 158 data shared by services, 132 changes to database, 134 connection management, 138-141 single point of failure, 143 database connection pool, 138 Sysops Squad saga, 150 database-per-service, 143 definition, 14 distributed data access Column Schema Replication pattern, 287 Data Domain pattern, 293-295 Interservice Communication Pattern, 285 Replicated Caching pattern, 288-293 Sysops Squad saga, 283, 295-298 extensibility, 196 granularity (see granularity) identifying in sagas, 357 modularity deployability, 56 scalability and elasticity, 57 testability, 54 orchestrated coordination definition, 14 ownership of data assigning, 250 common ownership, 252 data sovereignty per service, 159 distributed data access, 287, 289 joint ownership, 253-260 service consolidation technique, 261 single ownership, 251 summary, 262 Sysops Squad saga, 249, 279-282 service mesh, 237-239 shared services for code reuse, 228-234 Sidecar pattern, 234-239 sharding in databases, 167 document databases, 168 NewSQL databases, 174 shared code and granularity, 203-205 (see also code reuse patterns) shared libraries, 224 shared domain functionality granularity and, 204 shared infrastructure functionality versus, 94 Sysops Squad saga, 244 shared libraries about, 223 fault tolerance, 232 granularity and, 224 versioning strategies, 225-227 shared services for code reuse, 228-234 change risk, 229 fault tolerance, 232 performance, 231 scalability, 232 Sysops Squad saga, 244 versioning via API endpoints, 230 side effects in distributed architectures, 361 Sidecar pattern, 234-239 Sysops Squad saga, 239 silver-bullet solutions, 2 single point of failure (SPOF), 143 Sysops Squad saga, 151 single responsibility principle, 190 granularity and, 186, 190 SMS information link, 189 Snowflake cloud native database, 175 soft state of BASE transactions, 267 software architecture (see architecture) SOLID principles (Martin), 190 SonarQube code hygiene tool, 10 speed-to-market as modularity driver, 49 stamp coupling about, 376 bandwidth, 377 choreography state management, 313, 332 over-coupling via, 376 workflow management, 378 standard deviation calculation, 88 Star Schema of data warehouses, 383, 384 Starbucks Does Not Use Two-Phase Commit (Hohpe), 364 state machines, 352-355 state management compensating updates versus, 355 finite state machines for, 351 about state machines, 352-355 orchestration, 305 stamp coupling for workflow management, 378 workflow state management, 311-315 stateless choreography, 313 statements counted, 84, 187 static code analysis tools resource, 85 static coupling, 23, 28 architecture quantum, 34 high static coupling, 30-37 independently deployable, 29 Sysops Squad saga, 42 dynamic versus, 29 Sysops Squad saga, 42 operational dependencies as, 23, 28 trade-off analysis, 401 coupling points, 402 static coupling diagram, 401 Stine, Matt, 56 strict contracts, 367 JSON example, 367 trade-offs, 370 Structured Design (Yourdon and Constantine), 66 survey database structure, 180-184 synchronous communication asynchronous versus, 38, 43 definition, 14 delegate technique of data ownership, 259 fault tolerance, 59 granularity and, 200-203 scalability and elasticity versus, 57 synonyms for tables, 157 Sysops Squad sagas about, 15 nonticketing workflow, 16 problem, 17 ticketing workflow, 17 analytical data, 381, 386, 389 data mesh, 394-397 architectural components, 18 architecture quantum, 42 contracts, 365, 379 data model, 19 ACID transaction example, 264 data domains, 152 distributed data access, 283, 295-298 Column Schema Replication pattern, 287 Data Domain pattern, 293-295 Interservice Communication Pattern, 285 Replicated Caching pattern, 288-293 distributed transactions, 279-282 distributed workflows, 299, 317-321 epilogue, 416 eventual consistency about, 267 background synchronization, 269-272 event-based pattern, 277-279 orchestrated request-based pattern, 272-277 monolithic application broken apart, 45 6. create domain services, 127 business case for, 59-62 code reuse patterns, 219, 239, 244 create component domains, 123-126 create domain services, 129 data pulled apart, 131, 150 database structure, 180-184 database types, 179 decomposition method, 63, 78 decomposition pattern, 81 determine component dependencies, 118-120 flatten components, 107-110 gather common domain components, 97-99 granularity, 185, 209-216 identify and size components, 90-93 ownership of data, 249, 279-282 state machines, 352-355 trade-off analysis, 399, 416 transactional sagas, 323, 358-364

T table split technique of joint ownership, 254-256 tactical forking, 72-78 about, 64 trade-offs, 77 technical partitioning data warehouses as, 384 domain partitioning preferred, 388 domain workflows, 311 maintainability and, 51 testability as modularity driver, 54 Thoughtworks Architectural Decision Records, 5 composition versus inheritance, 228 time series databases, 177-178 Time Travel Saga pattern, 336-339 TimeScale time series database, 177 tools ArchUnit, 129 dependencies JDepend, 9, 66 NetArchTest, 11 visualization, 66, 113, 116 SonarQube code hygiene tool, 10 static code analysis, 85 visualization about importance of, 116 afferent and efferent coupling, 66 data domains via soccer ball, 153 dependencies, 66, 113, 116 distance from main sequence, 69 domain diagramming exercise, 123 graph databases, 171-173 isomorphic diagrams, 325 static coupling diagram, 401 trade-off analysis, 26-28 assessing trade-offs, 403 least worst combination, 2 building your own, 400-403 consistency and availability, 178 coordination, 315 coupling, 26-28, 401-403 coupling points, 402 dynamic quantum coupling factors, 41 static coupling diagram, 401 documenting versus governing, 5 granularity, 208 iterative nature of, 403 loose contracts, 371 strict contracts, 370 Sysops Squad saga, 399, 416 tactical forking, 77 techniques of bottom line decision, 410 MECE lists, 404 modeling relevant domain cases, 408-410 out-of-context trap, 405-407 qualitative versus quantitative analysis, 404 snake oil and evangelism, 412 transactional saga patterns about, 324 pattern matrix, 41, 324, 402 about sagas, 323 management techniques, 356 about state management, 351 about state machines, 352-355 compensating updates versus, 355 Anthology Saga, 349-351 Epic Saga, 325-330 Fairy Tale Saga, 333-336 Fantasy Fiction Saga, 340-342 Horror Story, 343-345 Parallel Saga, 346-348 Phone Tag Saga, 330-333 Sysops Squad saga, 323, 358-364 Time Travel Saga, 336-339 transactionality distributed architecture challenge, 40 security versus, 212-216 transactions data integration driver, 148 database transactions and granularity, 198 distributed transactions about, 265, 327 ACID transactions, 263-267 BASE transactions, 267 compensating updates, 275, 327 eventual consistency, 267 (see also eventual consistency) Sysops Squad saga, 279-282, 358-364 Trunk-based Development, 415 tunable consistency, 167, 171

user interface quantum, 36

V version control systems code change frequency metric, 191 LATEST caution, 227 shared code libraries, 225-227 granularity and, 204, 205 shared service API endpoint versioning, 230 strict contracts requiring, 370 visualization tools afferent and efferent coupling, 66 data domains via soccer ball, 153 dependencies, 113 importance of visualization, 116 JDepend Eclipse plug-in, 66 distance from main sequence, 69 domain diagramming exercise, 123 graph databases, 171-173 isomorphic diagrams, 325 static coupling diagram, 401 volatility-based decomposition, 191

W What Every Programmer Should Know About Object-Oriented Design (Page-Jones), 23 why more important than how, 13 wide column databases, 169 Woolf, Bobby, 156 workflow and service granularity, 200-203 (see also distributed workflows)

Y Yourdon, Edward, 66

Z zero-day exploits, 12 Zitzewitz, Alexander von, 50 zones of uselessness and pain, 69

Index | 441

Neal Ford is a director, software architect, and meme wrangler at Thoughtworks, a software company and a community of passionate, purpose-led individuals who think disruptively to deliver technology that addresses the toughest challenges, all while seeking to revolutionize the IT industry and create positive social change. He’s an internationally recognized expert on software development and delivery, especially in the intersection of Agile engineering techniques and software architecture. Neal has authored seven books (and counting), a number of magazine articles, and dozens of video presentations and spoken at hundreds of developers conferences worldwide. His topics include software architecture, continuous delivery, functional programming, cutting-edge software innovations, and a business-focused book and video on improving technical presentations. Check out his website, Nealford.com.

Mark Richards is an experienced, hands-on software architect involved in the architecture, design, and implementation of microservices architectures, service-oriented architectures, and distributed systems in a variety of technologies. He has been in the software industry since 1983 and has significant experience and expertise in application, integration, and enterprise architecture. Mark is the author of numerous technical books and videos, including the Fundamentals of Software Architecture, the “Software Architecture Fundamentals” video series, and several books and videos on microservices as well as enterprise messaging. Mark is also a conference speaker and trainer and has spoken at hundreds of conferences and user groups around the world on a variety of enterprise-related technical topics.

Pramod Sadalage is director of data and DevOps at Thoughtworks. His expertise includes application development, Agile database development, evolutionary database design, algorithm design, and database administration.

Zhamak Dehghani is director of emerging technologies at Thoughtworks. Previously, she worked at Silverbrook Research as a principal software engineer, and Fox Technology as a senior software engineer.

The animal on the cover of Software Architecture: The Hard Parts is a black-rumped golden flameback woodpecker (Dinopium benghalense), a striking species of woodpecker found throughout the plains, foothills, forests, and urban areas of the Indian subcontinent.

This bird’s golden back is set atop a black shoulder and tail, the reason for its pyroinspired name. Adults have red crowns with black-and-white spotted heads and breasts, with a black stripe running from their eyes to the back of their heads. Like other common, small-billed woodpeckers, the black-rumped golden flameback has a straight pointed bill, a stiff tail to provide support against tree trunks, and four-toed feet—two toes pointing forward and two backward. As if its markings weren’t distinctive enough, the black-rumped golden flameback woodpecker is often detected by its call of “ki-ki-ki-ki-ki,” which steadily increases in pace.

This woodpecker feeds on insects, such as red ant and beetle larvae, underneath tree bark using its pointed bill and long tongue. They have been observed visiting termite mounds and even feeding on the nectar of flowers. The golden flameback also adapts well to urban habitats, subsisting on readily available fallen fruit and food scraps.

Considered relatively common in India, this bird’s current conservation status is listed as being of “least concern.” Many of the animals on O’Reilly covers are endangered; all of them are important to the world.

The cover image is a color illustration by Karen Montgomery, based on a black and white engraving from Shaw’s Zoology. The cover fonts are URW Typewriter and Guardian Sans. The text fonts are Adobe Minion Pro and Myriad Pro; the heading font is Adobe Myriad Condensed; and the code font is Dalton Maag’s Ubuntu Mono.

Experience books, videos, live online training courses, and more from O’Reilly and our 200+ partners—all in one place.

Learn more at orellly.com/online-learning


← node-book_software-architecture-the-hard-parts_chapter-14-managing-analytical-data | node-book_software-architecture-the-hard-parts