Debian Codegraph @

www/src/content/essays/architectural-sympathy.md

raw symbols SCIP
1 ---
2 title: "Architectural Sympathy"
3 description: "In this essay, Carson Gross explores architectural sympathy as a software 01-frontend principle where new software adopts and conforms to the architectural patterns of existing systems. Carson examines the application of architectural sympathy in web development through htmx, its advantages and tradeoffs, and drawing parallels with medieval cathedral construction to illustrate the balance between innovation and coherent 01-frontend."
4 created: 2023-04-06
5 modified: 2023-04-06
6 authors: [ "Carson Gross" ]
7 tags: ["foundations"]
8 ---
9
10 > You don’t have to be an engineer to be a racing driver, but you do have to have Mechanical Sympathy.
11
12 _-Jackie Stewart, racing driver_
13
14 The term "mechanical sympathy" was originally coined by Jackie Stewart to capture a characteristic
15 of race car drivers, who needed a deep and intuitive understanding of how a race car worked in order
16 to get the best possible performance out of the vehicle.
17
18 This term was applied to software development by Martin Thompson when discussing
19 his [LMAX](https://martinfowler.com/articles/lmax.html)
20 architecture, which utilized a low level and intuitive understanding of how his cloud system functioned
21 in order to maximize the performance of it. Thompson maintained [a blog](https://mechanical-sympathy.blogspot.com/)
22 on the topic for many years, and it is well worth going back and reading the posts there.
23
24 ## Architectural Sympathy
25
26 In this brief essay I want to propose another concept and design principle, that of _Architectural Sympathy_:
27
28 > Architectural Sympathy is the characteristic of one piece of software adopting and conforming to the architectural
29 > design of another piece of software
30
31 This is a design principle that I have kept in mind when designing [htmx](https://htmx.org) and
32 [hyperscript](https://hyperscript.org) and I wanted to write it down for reference and so others can think about,
33 criticize and improve it.
34
35 ### htmx's Architectural Sympathy for The Web
36
37 htmx is architecturally sympathetic to The Web because it adopts the underlying [REST-ful](/essays/hateoas) architecture
38 of The Web: exchanging _hypermedia_ in a REST-ful manner with a hypermedia server. As much as is practical, htmx takes
39 design cues from the existing Web infrastructure:
40
41 * It mimics the core hypermedia-exchange mechanic of links and forms
42 * It uses CSS selectors for targeting
43 * It uses standard URL paths for designating end points
44 * It uses the standard API language for specifying swap types
45 * Etc.
46
47 htmx attempts to _fold in_ to the existing conceptual architecture of The Web, rather than replace it.
48
49 This is in contrast with the [SPA](https://developer.mozilla.org/en-US/docs/Glossary/SPA) approach to building web
50 applications. Most SPA frameworks have little architectural sympathy with the original web model. Rather, they largely
51 _replace_ the original, REST-ful, hypermedia-oriented architecture of the web in favor of a more thick-client like
52 architecture, exchanging information over an
53 [RPC-like fixed-data format](/essays/how-did-rest-come-to-mean-the-opposite-of-rest) network architecture.
54
55 ### Advantages Of The Architecturally Sympathetic Approach
56
57 If a new piece of software maintains architectural sympathy with an original piece of software, the following advantages
58 are obtained:
59
60 * A developer who is familiar with the original piece of software does not need to learn a whole new conceptual approach
61 when using the new piece of software.
62 * The design constraints of the original piece of software offer a framework within which to evaluate features for the
63 new piece of software. This makes it easier to [say "no"](https://grugbrain.dev/#grug-on-saying-no) as you develop the
64 new software. ("The enemy of art is the absence of
65 limitations." --[Orson Welles](https://quoteinvestigator.com/2014/05/24/art-limit/))
66 * Experience gained from working with the original piece of software can directly inform the design and implementation
67 of
68 the new software
69 * There will likely be a subjective feeling of "fit" between the new and original software for users of the new software
70
71 ### Disadvantages Of The Architecturally Sympathetic Approach
72
73 Of course, as with any design principle, there are trade-offs when using Architectural Sympathy:
74
75 * The shortcomings of the original piece of software are likely to be found in some way in the new software
76 * The design constraints impressed on the new software by the older software may be so oppressive as to limit progress
77 and functionality in the new software
78 * It may be difficult for developers to "see the point" of the new software, if it feels too close to the original
79 software
80 * By maintaining architectural sympathy with the older, original software, the new software risks appearing old itself,
81 a danger in the software business that has often favored new and exciting approaches to problems.
82 * You may not be able to layer as many new concepts as some users might like on top of the original software
83
84 ## Craftsmanship & Architectural Sympathy
85
86 A non-software example of architectural sympathy that I like to point to are medieval cathedrals: these cathedrals were
87 often built, rebuilt and improved over centuries by many different builders and architects (such as they were). And yet
88 they were able, over those centuries, to maintain a high level of architectural sympathy with the earlier workers.
89
90 Rather than focusing on radically new approaches to building, workers focused on maintaining a coherent whole and,
91 within
92 that framework, on the craftsmanship of their individual contributions. Yes, there were flourishes and changes along the
93 way, but these typically did not sacrifice the conceptual coherence of the whole for the sake of innovation.
94
95 Adopting an architecturally sympathetic mindset in software development often means sacrificing how you would like to
96 do things in favor of how an original piece of software did things. While this constraint can chafe at times, it can
97 also produce well crafted software that is harmonious and that dovetails well with existing software.