<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>QWAN - Quality Without a Name</title>
    <description>QWAN - Quality Without a Name: development, coaching, consulting, training. Systemic approach to developing software organizations. Experts in Agile Development, Test Driven Development, Refactoring; long time eXtreme Programmers
</description>
    <link>https://qwan.eu/</link>
    <atom:link href="https://qwan.eu/feed.xml" rel="self" type="application/rss+xml"/>
    <pubDate>Fri, 24 Jul 2026 12:58:36 +0000</pubDate>
    <lastBuildDate>Fri, 24 Jul 2026 12:58:36 +0000</lastBuildDate>
    <generator>Jekyll v3.10.0</generator>
    
      <item>
        <title>Connascence: Heuristics for managing coupling (part 10)</title>
        <description>&lt;p&gt;In the previous posts, we &lt;a href=&quot;/2026/05/08/connascence-intro&quot;&gt;introduced the Connascence model as a model of coupling&lt;/a&gt; and
elaborated the different types of connascence. In this post, we will discuss how to use this model to manage coupling in
software and share a number of heuristics.&lt;/p&gt;

&lt;p&gt;Connascence is a model for reasoning about coupling and defines three dimensions of coupling: strength, degree, and
distance, as the picture below shows.&lt;/p&gt;

&lt;p class=&quot;post-image post-image-50&quot;&gt;&lt;img src=&quot;/attachments/blogposts/2026/connascence/slide-19-degree.png&quot; alt=&quot;connascence in three dimensions, from green to red&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;managing-coupling-and-cohesion-with-connascence&quot;&gt;Managing coupling and cohesion with connascence&lt;/h2&gt;

&lt;p&gt;In his presentation about &lt;a href=&quot;https://www.youtube.com/watch?v=NLT7Qcn_PmI&quot;&gt;“The Grand Unified Theory of Software Design”&lt;/a&gt;,
the late Jim Weirich shared a number of rules of thumb to guide refactoring towards less coupling:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Rule of Strength&lt;/li&gt;
  &lt;li&gt;Rule of Locality&lt;/li&gt;
  &lt;li&gt;Rule of Degree&lt;/li&gt;
  &lt;li&gt;Rule of Stability&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Rule of Strength&lt;/strong&gt;: try to create the weakest possible connascence.&lt;/p&gt;

&lt;p&gt;Convert strong forms of connascence to weak forms wherever possible. Try to refactor towards static rather than dynamic
connascence. Connascence by Identity or Value, for example, can be encapsulated as much as possible in a module, so that the
rest of the code base has Connascence by Type.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Rule of Locality&lt;/strong&gt;: as the distance between software elements increases, use weaker forms of connascence. If things
are close together, stronger connascence is ok.&lt;/p&gt;

&lt;p&gt;So if you cannot reduce strong connascence to a weaker form, try bringing the elements as close together as possible.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Rule of Degree&lt;/strong&gt;: elements that have a high degree of connascence are more difficult to understand and to change.&lt;/p&gt;

&lt;p&gt;Can this be reduced by introducing a level of indirection or an abstraction? What part is essential, what part is
accidental? For example, &lt;a href=&quot;/2026/06/24/connascence-identity&quot;&gt;misuse of the Singleton design pattern&lt;/a&gt; introduces a high
degree of identity-based coupling that is not essential.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Rule of Stability&lt;/strong&gt;: if two elements have a strong form of connascence with low locality and high degree, then they
should not change. In other words, those elements should be &lt;em&gt;stable&lt;/em&gt;. Coupling is about things that need to change
together. &lt;em&gt;If things don’t change, we won’t be affected by it.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;In an &lt;a href=&quot;/2026/05/29/connascence-position&quot;&gt;earlier post&lt;/a&gt;, we mentioned the C &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sprintf&lt;/code&gt; function having Connascence by
Position with its callers. The function is widely used, so the degree of connascence is very high. The function is also
stable, so the actual risk is very low.&lt;/p&gt;

&lt;h2 id=&quot;managing-connascence-with-automated-tests&quot;&gt;Managing connascence with automated tests&lt;/h2&gt;

&lt;p&gt;We can try to reduce stronger forms of connascence as much as possible and remove most of the dynamic connascence, but
sometimes we are left with some connascence across codebases and services that will bite us sooner or later.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Automated testing&lt;/strong&gt; can help. If we have Connascence by Value across the system landscape, we could capture this in an
end-to-end test or in local, fast-running tests that document the value and fail whenever we change the value.&lt;/p&gt;

&lt;p&gt;An automated test introduces a bit of extra connascence, from the test to the coupled elements, to provide early warning
about one element changing without the others being updated. Especially for more dynamic forms of connascence, the test
introduces a piece of explicit knowledge about what elements are coupled and why.&lt;/p&gt;

&lt;p&gt;Static forms of connascence (name, type, meaning, position, algorithm) can often be detected using a &lt;strong&gt;compiler&lt;/strong&gt; or 
&lt;strong&gt;static analysis tooling&lt;/strong&gt;.&lt;/p&gt;

&lt;h2 id=&quot;detecting-connascence&quot;&gt;Detecting connascence&lt;/h2&gt;

&lt;p&gt;Dynamic connascence is harder to detect, but version control systems can provide insights. We can &lt;strong&gt;analyse the git
history&lt;/strong&gt; of the code to see what parts often change together, a strong hint these might be coupled somehow.&lt;/p&gt;

&lt;p&gt;Analysing git history can also provide insights in what parts of our code are changing a lot and what parts are stable,
to know where to focus on.&lt;/p&gt;

&lt;h2 id=&quot;examples&quot;&gt;Examples&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;If we put a queue or message bus between two services, have we decoupled them?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Yes, but only to some extent. We have reduced &lt;strong&gt;Connascence by Timing&lt;/strong&gt;, but we still have &lt;strong&gt;Connascence by Algorithm&lt;/strong&gt;
(producer and consumer need to agree on the format of the data) and &lt;strong&gt;Meaning&lt;/strong&gt; (producer and consumer need to agree
on how to interpret the data).&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Can we avoid coupling by duplicating some code instead of introducing a shared abstraction?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;It depends. If the two pieces of code look similar, but they are actually different things, they do not need to change
together. A shared abstraction will introduce accidental coupling, which can make things worse.&lt;/p&gt;

&lt;p&gt;The basic test that we should apply comes from the definition of connascence: &lt;strong&gt;if one changes, do we need to change the
other as well to guarantee correctness&lt;/strong&gt;? If so, the two pieces of code are connascent. Even if we duplicate, the pieces
of code are still coupled, but in a more implicit way. We still have Connascence by Meaning, but spread across the code
base. Instead of avoiding coupling, we risk introducing even stronger coupling!&lt;/p&gt;

&lt;h2 id=&quot;summary&quot;&gt;Summary&lt;/h2&gt;

&lt;p&gt;We want ‘loose coupling’ in our software systems. But without coupling, there is no working software. Managing coupling
is a key element of our work.&lt;/p&gt;

&lt;p&gt;Connascence offers a language to talk about coupling and cohesion. It is not bound to a specific paradigm, being
applicable to object-oriented programming, functional programming, SQL, stored procedures.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Coupling is not binary!&lt;/strong&gt; The connascence model offers three dimensions to reason about coupling: strength, locality,
and degree.
We want to isolate strong coupling as much as possible in one place and use weaker forms of coupling when the distance
and/or degree are high.&lt;/p&gt;

&lt;p&gt;The connascence model is not perfect. The distinction between the types is not always clear, for example, between
Connascence by Meaning and Connascence by Value. In practice, the ranking of the different strengths is not always that
strict.&lt;/p&gt;

&lt;p&gt;We find this model still quite useful, because:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;it provides rich vocabulary to reason about forms, degrees, and locality of coupling;&lt;/li&gt;
  &lt;li&gt;it recognises that our goal is not getting rid of coupling, but rather keeping coupling explicit, limited, and
manageable.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;further-reading&quot;&gt;Further reading&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.linkedin.com/pulse/i-still-feel-urge-reuse-code-even-though-know-its-wrong-dilger-yphie/&quot;&gt;I Still Feel the Urge to Reuse Code (Even Though I Know It’s Wrong)&lt;/a&gt;
by Martin Dilger&lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Another good read from this year
is &lt;a href=&quot;https://ewolff.com/2026/01/08/cohesion-modules-hierachies.html&quot;&gt;Cohesion, Modules, and Hierarchies&lt;/a&gt; by Eberhard
Wolff&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;Meilir Page-Jones, Fundamentals of OO Design in UML (1999)&lt;/li&gt;
  &lt;li&gt;Meilir
Page-Jones, &lt;a href=&quot;https://dl.acm.org/doi/10.1145/130994.131004&quot;&gt;Comparing Techniques by Means of Encapsulation and Connascence&lt;/a&gt;,
in Communications of the ACM Sept 1992&lt;/li&gt;
  &lt;li&gt;Jim Weirich, &lt;a href=&quot;https://www.youtube.com/watch?v=NLT7Qcn_PmI&quot;&gt;The Grand Unified Theory of Software Design&lt;/a&gt;, at the Acts
as Conference 2009&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://connascence.io&quot;&gt;Connascence.io&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;Vlad Khononov, &lt;a href=&quot;https://vladikk.com/page/books/&quot;&gt;Balancing Coupling in Software Design&lt;/a&gt; (2024)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This post is part of a series on connascence and coupling.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;/2026/05/08/connascence-intro&quot;&gt;Part 1 - Introduction&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/2026/05/13/connascence-name-type&quot;&gt;Part 2 - Connascence by Name and Type&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/2026/05/21/connascence-meaning&quot;&gt;Part 3 - Connascence by Meaning&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/2026/05/29/connascence-position&quot;&gt;Part 4 - Connascence by Position&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/2026/06/03/connascence-algorithm&quot;&gt;Part 5 - Connascence by Algorithm&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/2026/06/08/connascence-execution-order&quot;&gt;Part 6 - Connascence by Execution Order&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/2026/06/12/connascence-timing&quot;&gt;Part 7 - Connascence by Timing&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/2026/06/17/connascence-value&quot;&gt;Part 8 - Connascence by Value&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/2026/06/24/connascence-identity&quot;&gt;Part 9 - Connascence by Identity&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;em&gt;Part 10 - Heuristics for managing coupling&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;Credits: Scales photo
by &lt;a href=&quot;https://unsplash.com/@saltsup?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText&quot;&gt;Piret
Ilver&lt;/a&gt;
on &lt;a href=&quot;https://unsplash.com/photos/white-and-brown-sewing-machine-0k9fu-P-110?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText&quot;&gt;
Unsplash&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;aside&gt;
&lt;h3&gt;Is painful coupling holding you back?&lt;/h3&gt;
&lt;p&gt;We can help your teams find hidden, implicit coupling and refactor towards a design that is easier to change, 
test, and evolve.&lt;/p&gt;
&lt;div&gt;
&lt;a href=&quot;/contact&quot;&gt;Let&apos;s have a chat&lt;/a&gt;
&lt;/div&gt;
&lt;/aside&gt;
</description>
        <pubDate>Mon, 29 Jun 2026 00:00:00 +0000</pubDate>
        <link>https://qwan.eu/2026/06/29/connascence-managing-coupling.html</link>
        <guid isPermaLink="true">https://qwan.eu/2026/06/29/connascence-managing-coupling.html</guid>
        
        <category>architecture</category>
        
        <category>coupling</category>
        
        <category>design</category>
        
        <category>heuristics</category>
        
        
      </item>
    
      <item>
        <title>Connascence: Identity (part 9)</title>
        <description>&lt;p&gt;In the previous posts, we &lt;a href=&quot;/2026/05/08/connascence-intro&quot;&gt;introduced the Connascence model as a model of coupling&lt;/a&gt; and elaborated connascence by name, type, meaning, position, algorithm, execution order, timing, and value. In this post, we will discuss Connascence by Identity.&lt;/p&gt;

&lt;p&gt;Connascence is a model for reasoning about coupling and defines three dimensions of coupling: strength, degree and distance, as the picture below shows.&lt;/p&gt;

&lt;p class=&quot;post-image post-image-50&quot;&gt;&lt;img src=&quot;/attachments/blogposts/2026/connascence/slide-19-degree.png&quot; alt=&quot;connascence in three dimensions, from green to red&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;connascence-by-identity&quot;&gt;Connascence by Identity&lt;/h2&gt;

&lt;p&gt;Connascence by Identity means that two elements need to agree on the identity of something, i.e. they need to make sure they are using the exact same thing or instance.&lt;/p&gt;

&lt;p class=&quot;post-image post-image-50&quot;&gt;&lt;img src=&quot;/attachments/blogposts/2026/connascence/slide-15-identity.png&quot; alt=&quot;connascence by identity&quot; /&gt;&lt;/p&gt;

&lt;p&gt;When we create a new object and subsequently use that object, we have Connascence by Identity between the creation and usage parts of the code. The code shown below knows exactly which instance it is using, namely the one it has created itself.&lt;/p&gt;

&lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;table class=&quot;rouge-table&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;rouge-gutter gl&quot;&gt;&lt;pre class=&quot;lineno&quot;&gt;1
2
3
&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;rouge-code&quot;&gt;&lt;pre&gt;&lt;span class=&quot;kt&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;p&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Person&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;p&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;doSomething&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;p&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Another example: the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;this&lt;/code&gt; or &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;self&lt;/code&gt; reference in instance methods always refers to the object the method was invoked on. This coupling to identity is inevitable in this case, but also quite harmless because it is local - all contained within the same class.&lt;/p&gt;

&lt;p&gt;These examples show that there will always be some Connascence by Identity in our code: the identity of a variable is known within its scope. If we keep the scope small, the impact is low and the connascence is well manageable. The larger the scope, the nastier it gets. This makes global variables for example problematic from a coupling point of view.&lt;/p&gt;

&lt;h2 id=&quot;singletons&quot;&gt;Singletons&lt;/h2&gt;

&lt;p&gt;Over-usage of the &lt;a href=&quot;https://en.wikipedia.org/wiki/Singleton_pattern&quot;&gt;Singleton design pattern&lt;/a&gt; is an example of Connascence by Identity getting tricky. The intent of this pattern is to ensure there is only a single instance of a specific object. The solution is to make it difficult or impossible to create multiple instances.&lt;/p&gt;

&lt;p&gt;Most of the code using the instance does not care about what specific instance it is using. It just wants to do its thing on whatever instance it receives. It should not know about creation of the instances and the singleton requirement. In practice, we see that singletons are accessed all over the place, introducing a lot of unnecessary identity coupling.&lt;/p&gt;

&lt;p&gt;The example below shows code using the singleton construct directly, because it needs a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;TrackingCache&lt;/code&gt; instance. It uses the singleton as a global variable, not having to think about how dependencies are injected.&lt;/p&gt;

&lt;div class=&quot;language-csharp highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;table class=&quot;rouge-table&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;rouge-gutter gl&quot;&gt;&lt;pre class=&quot;lineno&quot;&gt;1
2
3
4
5
6
7
8
9
10
11
12
13
14
&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;rouge-code&quot;&gt;&lt;pre&gt;&lt;span class=&quot;k&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;VehicleMessageDecoder&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;MessageDecoder&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;handleMessage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;byte&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;identification&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;byte&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[]&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;message&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;length&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;switch&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;decodingState&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;k&quot;&gt;case&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;WAITING_FOR_INITIALFRAME&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;message&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Protocol&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;FrameTypeIndex&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Protocol&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;FullFrame&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
          &lt;span class=&quot;n&quot;&gt;currentEntry&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;TrackingCache&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;getInstance&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;().&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;createCacheEntry&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;decoderId&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
          &lt;span class=&quot;c1&quot;&gt;// ... &lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;break&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This introduces unnecessary, tight coupling, specifically increasing the &lt;em&gt;degree&lt;/em&gt; of coupling on the singleton instance. Code that does not care about the specific instance gets burdened with this knowledge, making it hard to test.&lt;/p&gt;

&lt;h2 id=&quot;managing-connascence-by-identity&quot;&gt;Managing Connascence by Identity&lt;/h2&gt;

&lt;p&gt;To reduce Connascence by Identity in a component, we apply &lt;strong&gt;dependency injection&lt;/strong&gt;, by either wiring through the constructor or passing the dependency as a function parameter.&lt;/p&gt;

&lt;p&gt;This works well e.g. with &lt;strong&gt;&lt;a href=&quot;/2020/08/20/hexagonal-architecture&quot;&gt;Hexagonal Architecture&lt;/a&gt;&lt;/strong&gt;. Instantiating services and adapters takes place in one place, in a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;main&lt;/code&gt; function or some Spring configuration code. These are injected into the rest of the code, which takes these as explicit dependencies. This reduces the identity coupling to a single place in the code.&lt;/p&gt;

&lt;p&gt;Whenever Connascence by Identity is unavoidable, we try to &lt;strong&gt;reduce scope&lt;/strong&gt; and &lt;strong&gt;keep it local&lt;/strong&gt;, within a module, class or function.&lt;/p&gt;

&lt;h2 id=&quot;whats-next&quot;&gt;What’s next&lt;/h2&gt;

&lt;p&gt;This post is part of a series on connascence and coupling. In the next post, we will focus on what we can to manage connascence and coupling in our software.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;/2026/05/08/connascence-intro&quot;&gt;Part 1 - Introduction&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/2026/05/13/connascence-name-type&quot;&gt;Part 2 - Connascence by Name and Type&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/2026/05/21/connascence-meaning&quot;&gt;Part 3 - Connascence by Meaning&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/2026/05/29/connascence-position&quot;&gt;Part 4 - Connascence by Position&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/2026/06/03/connascence-algorithm&quot;&gt;Part 5 - Connascence by Algorithm&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/2026/06/08/connascence-execution-order&quot;&gt;Part 6 - Connascence by Execution Order&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/2026/06/12/connascence-timing&quot;&gt;Part 7 - Connascence by Timing&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/2026/06/17/connascence-value&quot;&gt;Part 8 - Connascence by Value&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;em&gt;Part 9 - Connascence by Identity&lt;/em&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/2026/06/29/connascence-managing-coupling&quot;&gt;Part 10 - Heuristics for managing coupling&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;Credits: spiderweb thumbnail Photo by &lt;a href=&quot;https://unsplash.com/@georgerosema?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText&quot;&gt;George Rosema&lt;/a&gt; on &lt;a href=&quot;https://unsplash.com/photos/water-droplets-on-spider-web-in-close-up-photography-yg8pLPTAY8M?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText&quot;&gt;Unsplash&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;aside&gt;
&lt;h3&gt;Decouple more deliberately!&lt;/h3&gt;
&lt;p&gt;We offer hands-on workshops about connascence and refactoring towards loosely coupled, highly cohesive systems.
&lt;/p&gt;
&lt;div&gt;
&lt;a href=&quot;/contact&quot;&gt;Let&apos;s have a chat&lt;/a&gt;
&lt;/div&gt;
&lt;/aside&gt;
</description>
        <pubDate>Wed, 24 Jun 2026 00:00:00 +0000</pubDate>
        <link>https://qwan.eu/2026/06/24/connascence-identity.html</link>
        <guid isPermaLink="true">https://qwan.eu/2026/06/24/connascence-identity.html</guid>
        
        <category>architecture</category>
        
        <category>coupling</category>
        
        <category>design</category>
        
        
      </item>
    
      <item>
        <title>Connascence: Value (part 8)</title>
        <description>&lt;p&gt;In the previous posts, we &lt;a href=&quot;/2026/05/08/connascence-intro&quot;&gt;introduced the Connascence model as a model of coupling&lt;/a&gt; and elaborated connascence by name, type, meaning, position, algorithm, execution order, and timing. In this post, we will discuss Connascence by Value.&lt;/p&gt;

&lt;p&gt;Connascence is a model for reasoning about coupling and defines three dimensions of coupling: strength, degree and distance, as the picture below shows.&lt;/p&gt;

&lt;p class=&quot;post-image post-image-50&quot;&gt;&lt;img src=&quot;/attachments/blogposts/2026/connascence/slide-19-degree.png&quot; alt=&quot;connascence in three dimensions, from green to red&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;connascence-by-value&quot;&gt;Connascence by Value&lt;/h2&gt;

&lt;p&gt;Connascence by Value means two elements are coupled because they need to agree on a specific value. Several values in different parts of the code or in different systems need to change together, otherwise the correctness of the system will break.&lt;/p&gt;

&lt;p class=&quot;post-image post-image-50&quot;&gt;&lt;img src=&quot;/attachments/blogposts/2026/connascence/slide-14-value.png&quot; alt=&quot;connascence by value&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Let’s look at an example, shown in the picture below. The Organization Management service sets the type of an organization to a specific number, let’s say 22. Other services that use organizations like service C will need know and use this specific value as well. The two other services are also coupled through that specific value. The services that pass on the organization data (A and B) might also be accidentally coupled if they know about the organization type values when passing on the data.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/attachments/blogposts/2026/connascence/cov-org-type.jpg&quot; alt=&quot;one service sets the value 22, the data passes through other services, and some other service checks if the value is 22&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Connascence by Value looks somewhat similar to Connascence by Meaning, but the latter concerns coupling based on meaning, conventions, usage, interpretation of values, while the Connascence by Value concerns coupling on a specific value.&lt;/p&gt;

&lt;p&gt;Connascence by Value can be tricky, especially if the values are used in different systems and codebases, e.g. a hard coded ‘22’ in Java code and a value 22 somewhere in a database column. When different systems are deployed at different rates, changing a specific value means we will have to deal with the old and new values co-existing for some time.&lt;/p&gt;

&lt;h2 id=&quot;tackling-connascence-by-value&quot;&gt;Tackling Connascence by Value&lt;/h2&gt;

&lt;p&gt;If the coupled elements are close enough to each other (in the same codebase), there are some options to reduce the pain:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;We can extract the special value into &lt;strong&gt;constant&lt;/strong&gt; and use the constant everywhere. This reduces it to Connascence by Name. If the connascence is between different code bases using the same language, we can investigate moving the value to a shared library.&lt;/li&gt;
  &lt;li&gt;Sometimes we can generalize the code using the value and &lt;strong&gt;inject the value&lt;/strong&gt; instead of hard-coding it. This reduces it to Connascence by Type or Meaning.&lt;/li&gt;
  &lt;li&gt;We can bring all code that knows the special value close together, e.g. by &lt;strong&gt;encapsulating&lt;/strong&gt; it in a single class, reducing it to Connascence by Meaning.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We could resort to end-to-end tests to cover values that are coupled across different systems, but these tests tend to be slow and fragile. Striving to keep the values &lt;strong&gt;stable&lt;/strong&gt; is probably the least risky option. Instead of changing a specific value, we can e.g. add a new one and deprecate the old one.&lt;/p&gt;

&lt;h2 id=&quot;whats-next&quot;&gt;What’s next&lt;/h2&gt;

&lt;p&gt;This post is part of a series on connascence and coupling. In the next post, we will focus on Connascence by Identity, where two elements need to agree on the identity of something.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;/2026/05/08/connascence-intro&quot;&gt;Part 1 - Introduction&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/2026/05/13/connascence-name-type&quot;&gt;Part 2 - Connascence by Name and Type&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/2026/05/21/connascence-meaning&quot;&gt;Part 3 - Connascence by Meaning&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/2026/05/29/connascence-position&quot;&gt;Part 4 - Connascence by Position&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/2026/06/03/connascence-algorithm&quot;&gt;Part 5 - Connascence by Algorithm&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/2026/06/08/connascence-execution-order&quot;&gt;Part 6 - Connascence by Execution Order&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/2026/06/12/connascence-timing&quot;&gt;Part 7 - Connascence by Timing&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;em&gt;Part 8 - Connascence by Value&lt;/em&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/2026/06/24/connascence-identity&quot;&gt;Part 9 - Connascence by Identity&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/2026/06/29/connascence-managing-coupling&quot;&gt;Part 10 - Heuristics for managing coupling&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;Credits: chains thumbnail photo by &lt;a href=&quot;https://unsplash.com/@a_uem?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText&quot;&gt;Akinori UEMURA&lt;/a&gt; on &lt;a href=&quot;https://unsplash.com/photos/silver-chain-link-with-black-background--T6vP7ZGz0Q?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText&quot;&gt;Unsplash&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;aside&gt;
&lt;h3&gt;Decouple more deliberately!&lt;/h3&gt;
&lt;p&gt;We offer hands-on workshops about connascence and refactoring towards loosely coupled, highly cohesive systems.
&lt;/p&gt;
&lt;div&gt;
&lt;a href=&quot;/contact&quot;&gt;Let&apos;s have a chat&lt;/a&gt;
&lt;/div&gt;
&lt;/aside&gt;
</description>
        <pubDate>Wed, 17 Jun 2026 00:00:00 +0000</pubDate>
        <link>https://qwan.eu/2026/06/17/connascence-value.html</link>
        <guid isPermaLink="true">https://qwan.eu/2026/06/17/connascence-value.html</guid>
        
        <category>architecture</category>
        
        <category>coupling</category>
        
        <category>design</category>
        
        
      </item>
    
      <item>
        <title>Connascence: Timing (part 7)</title>
        <description>&lt;p&gt;In the previous posts, we &lt;a href=&quot;/2026/05/08/connascence-intro&quot;&gt;introduced the Connascence model as a model of coupling&lt;/a&gt; and elaborated connascence by name, type, meaning, position, algorithm, and execution order. In this post, we will discuss Connascence by Timing.&lt;/p&gt;

&lt;p&gt;Connascence is a model for reasoning about coupling and defines three dimensions of coupling: strength, degree and distance, as the picture below shows.&lt;/p&gt;

&lt;p class=&quot;post-image post-image-50&quot;&gt;&lt;img src=&quot;/attachments/blogposts/2026/connascence/slide-19-degree.png&quot; alt=&quot;connascence in three dimensions, from green to red&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;connascence-by-timing&quot;&gt;Connascence by Timing&lt;/h2&gt;

&lt;p&gt;Connascence by Timing means that two elements are coupled because they need to agree on timing.&lt;/p&gt;

&lt;p class=&quot;post-image post-image-50&quot;&gt;&lt;img src=&quot;/attachments/blogposts/2026/connascence/slide-13-timing.png&quot; alt=&quot;connascence by timing&quot; /&gt;&lt;/p&gt;

&lt;p&gt;An example of Connascence by Timing is a producer and consumer exchanging data, while working concurrently and asynchronously, e.g. in separate threads or services. How do we ensure each produced value is consumed once and only once? If we don’t take any measures, we will end up with the consumer missing values and/or reading double values.&lt;/p&gt;

&lt;p class=&quot;post-image post-image-70&quot;&gt;&lt;img src=&quot;/attachments/blogposts/2026/connascence/producer-value-consumer.jpg&quot; alt=&quot;a producer and consumer that exchange a value asynchronously&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Different patterns and mechanisms are available to handle a timing dependency like this, by adding some form of synchronization. Examples are probes, semaphores, locks, futures, promises, and observables.&lt;/p&gt;

&lt;p&gt;In some cases we can relax the consistency constraints somewhat. If we relax the &lt;em&gt;exact once&lt;/em&gt; constraint to &lt;em&gt;at least once&lt;/em&gt;, we reduce timing coupling. This makes synchronisation less complicated, in particular for failure scenarios. It puts a higher burden on the consumer, which should allow for duplicate values. Message idempotency helps.&lt;/p&gt;

&lt;p&gt;What if there is a single producer and multiple consumer workers, and we need to make sure each value is read exactly once by exactly one consumer?&lt;/p&gt;

&lt;p class=&quot;post-image post-image-70&quot;&gt;&lt;img src=&quot;/attachments/blogposts/2026/connascence/queue-overtaking-2.png&quot; alt=&quot;single producer, multiple consumers&quot; /&gt;&lt;/p&gt;

&lt;p&gt;When a consumer starts reading a value, it can create a lock to ensure it is the only one reading at that moment, and release the lock when done. This trades off throughput for consistency, as the consumers sometimes need to wait while a value is processed.&lt;/p&gt;

&lt;p class=&quot;post-image post-image-70&quot;&gt;&lt;img src=&quot;/attachments/blogposts/2026/connascence/queue-overtaking-3.png&quot; alt=&quot;single producer, only one consumer reads at a time&quot; /&gt;&lt;/p&gt;

&lt;p&gt;If we can &lt;em&gt;partition&lt;/em&gt; the data and have each consumer process its own part of the data, the resulting throughput will be higher. We do need to find a good way to partition the data evenly; otherwise some consumers will be very busy, limiting how much we can scale the consumers for better throughput.&lt;/p&gt;

&lt;p&gt;Automated end-to-end testing is another area where we have to deal with Connascence by Timing, in particular with browser-based tests. It takes time for the system under test to process changes and make these visible. Frontend applications add extra asynchronous behaviour. Probes are helpful and they are used by end-to-end testing frameworks like &lt;a href=&quot;https://playwright.dev/&quot;&gt;Playwright&lt;/a&gt; to handle timing and asynchronous behaviour.&lt;/p&gt;

&lt;p&gt;We often have to deal with asynchronous, concurrent processes and the resulting Connascence by Timing. Sometimes we could remove it by replacing it with a synchronous call, but usually the async coupling is there for a good reason, like better throughput, scalability, independent deployability, or external services that are out of our control.&lt;/p&gt;

&lt;h2 id=&quot;eventual-consistency&quot;&gt;Eventual consistency&lt;/h2&gt;

&lt;p&gt;A trade-off we can make is being less strict in agreeing on timing, and settle for data to be &lt;em&gt;eventually consistent&lt;/em&gt; instead of immediately consistent. Eventual consistency provides more options for the different parts of the system to eventually settle on a change. What ‘eventually’ means depends on the context and the domain, it could be milliseconds, seconds, the next day.&lt;/p&gt;

&lt;p class=&quot;post-image post-image-70&quot;&gt;&lt;img src=&quot;/attachments/blogposts/2026/connascence/eventual-consistency.jpg&quot; alt=&quot;visualization of eventual consistency, a user does an update, which is propagated through an async queue to some view that is eventually consistent&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Again, there are trade-offs here. For example, eventual consistency makes it more complicated to detect that something did &lt;em&gt;not&lt;/em&gt; happen: if the visible state has not been updated for X seconds, is it still waiting for the change to propagate or did it fail? Explicit queries at some time are needed for instance, whereas a timeout, optionally with a back-off algorithm is &lt;em&gt;relatively&lt;/em&gt; simple.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;strong&gt;Eventual consistency is a business decision&lt;/strong&gt;&lt;br /&gt;
Showing an inconsistent state for a short amount of time is often good enough. Users are able to handle this and it is not worth adding the extra complexity of stricter consistency constraints. If I transfer money with my banking app, I often see the old balance for a second in the app until the transfer is processed, which is good enough.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2 id=&quot;whats-next&quot;&gt;What’s next&lt;/h2&gt;

&lt;p&gt;This post is part of a series on connascence and coupling. In the next post, we will focus on Connascence by Value, where two elements need to agree on a specific value.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;/2026/05/08/connascence-intro&quot;&gt;Part 1 - Introduction&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/2026/05/13/connascence-name-type&quot;&gt;Part 2 - Connascence by Name and Type&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/2026/05/21/connascence-meaning&quot;&gt;Part 3 - Connascence by Meaning&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/2026/05/29/connascence-position&quot;&gt;Part 4 - Connascence by Position&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/2026/06/03/connascence-algorithm&quot;&gt;Part 5 - Connascence by Algorithm&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/2026/06/08/connascence-execution-order&quot;&gt;Part 6 - Connascence by Execution Order&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;em&gt;Part 7 - Connascence by Timing&lt;/em&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/2026/06/17/connascence-value&quot;&gt;Part 8 - Connascence by Value&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/2026/06/24/connascence-identity&quot;&gt;Part 9 - Connascence by Identity&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/2026/06/29/connascence-managing-coupling&quot;&gt;Part 10 - Heuristics for managing coupling&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;Credits: watch thumbnail photo by &lt;a href=&quot;https://unsplash.com/@agebarros?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText&quot;&gt;Agê Barros&lt;/a&gt; on &lt;a href=&quot;https://unsplash.com/photos/a-close-up-of-a-silver-watch-face-rBPOfVqROzY?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText&quot;&gt;Unsplash&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;aside&gt;
&lt;h3&gt;Decouple more deliberately!&lt;/h3&gt;
&lt;p&gt;We offer hands-on workshops about connascence and refactoring towards loosely coupled, highly cohesive systems.
&lt;/p&gt;
&lt;div&gt;
&lt;a href=&quot;/contact&quot;&gt;Let&apos;s have a chat&lt;/a&gt;
&lt;/div&gt;
&lt;/aside&gt;
</description>
        <pubDate>Fri, 12 Jun 2026 00:00:00 +0000</pubDate>
        <link>https://qwan.eu/2026/06/12/connascence-timing.html</link>
        <guid isPermaLink="true">https://qwan.eu/2026/06/12/connascence-timing.html</guid>
        
        <category>architecture</category>
        
        <category>coupling</category>
        
        <category>design</category>
        
        
      </item>
    
      <item>
        <title>Connascence: Execution Order (part 6)</title>
        <description>&lt;p&gt;In the previous posts, we &lt;a href=&quot;/2026/05/08/connascence-intro&quot;&gt;introduced the Connascence model as a model of coupling&lt;/a&gt; and elaborated connascence by name, type, meaning, position and algorithm. In this post, we will discuss Connascence by Execution Order.&lt;/p&gt;

&lt;p&gt;Connascence is a model for reasoning about coupling and defines three dimensions of coupling: strength, degree and distance, as the picture below shows.&lt;/p&gt;

&lt;p class=&quot;post-image post-image-50&quot;&gt;&lt;img src=&quot;/attachments/blogposts/2026/connascence/slide-19-degree.png&quot; alt=&quot;connascence in three dimensions, from green to red&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;connascence-by-execution-order&quot;&gt;Connascence by Execution Order&lt;/h2&gt;

&lt;p&gt;Connascence by Execution Order means that two elements are coupled because they need to agree on the order in which steps are executed.&lt;/p&gt;

&lt;p class=&quot;post-image post-image-50&quot;&gt;&lt;img src=&quot;/attachments/blogposts/2026/connascence/slide-12-execution.png&quot; alt=&quot;connascence by execution order&quot; /&gt;&lt;/p&gt;

&lt;p&gt;What we know as imperative programming is all about execution order. We are used to things like the code below, where we first need to create a TCP client, then set up a writer, and only then we can start sending data.&lt;/p&gt;

&lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;table class=&quot;rouge-table&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;rouge-gutter gl&quot;&gt;&lt;pre class=&quot;lineno&quot;&gt;1
2
3
4
5
6
7
&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;rouge-code&quot;&gt;&lt;pre&gt;&lt;span class=&quot;nc&quot;&gt;BinaryWriter&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;output&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;output&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;output&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;nc&quot;&gt;TcpClient&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;client&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;TcpClient&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;host&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;port&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;output&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;BinaryWriter&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;client&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;GetStream&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;());&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;output&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;But this can get complicated, as the next example shows. This is an excerpt from our &lt;a href=&quot;/training/mastering-legacy-code&quot;&gt;Dirty Jobs legacy code exercise&lt;/a&gt;. The &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;HandleMessage&lt;/code&gt; method processes frame data received over the network. It first creates a cache entry and then stores the received data in that cache entry. Finally, it calls &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;commit&lt;/code&gt; to make the changes definitive. There should be no further calls on the cache entry after &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;commit&lt;/code&gt;, but nothing will keep us from doing so. Any data stored after calling &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;commit&lt;/code&gt; will get lost - a mistake waiting to happen.&lt;/p&gt;

&lt;div class=&quot;language-csharp highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;table class=&quot;rouge-table&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;rouge-gutter gl&quot;&gt;&lt;pre class=&quot;lineno&quot;&gt;1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;rouge-code&quot;&gt;&lt;pre&gt;&lt;span class=&quot;k&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;VehicleMessageDecoder&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;MessageDecoder&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;HandleMessage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;byte&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;identification&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;byte&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[]&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;message&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;length&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;switch&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;decodingState&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;k&quot;&gt;case&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;WAITING_FOR_INITIALFRAME&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;message&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Protocol&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;FrameTypeIndex&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Protocol&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;FullFrame&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
          &lt;span class=&quot;n&quot;&gt;currentEntry&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;TrackingCache&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;getInstance&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;().&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;createCacheEntry&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;decoderId&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
          &lt;span class=&quot;n&quot;&gt;currentEntry&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;setTimestamp&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
              &lt;span class=&quot;n&quot;&gt;CodecUtils&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;decodeInt32&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;message&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Protocol&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;TimeStampIndex&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt;
          &lt;span class=&quot;c1&quot;&gt;// ... more stuff done to currentEntry&lt;/span&gt;
          &lt;span class=&quot;n&quot;&gt;currentEntry&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;commit&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
          &lt;span class=&quot;c1&quot;&gt;// ... updates done here will get lost&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;break&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Another example of Connascence by Execution Order is the &lt;a href=&quot;https://openid.net/developers/how-connect-works/&quot;&gt;OpenID Connect protocol&lt;/a&gt;. OpenID Connect orchestrates authentication and authorization between multiple servers in a number of steps:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;ol&gt;
    &lt;li&gt;End user navigates to a website or web application via a browser.&lt;/li&gt;
    &lt;li&gt;End user clicks sign-in and types their username and password.&lt;/li&gt;
    &lt;li&gt;The RP (Client) sends a request to the OpenID Provider (OP).&lt;/li&gt;
    &lt;li&gt;The OP authenticates the User and obtains authorization.&lt;/li&gt;
    &lt;li&gt;The OP responds with an Identity Token and usually an Access Token.&lt;/li&gt;
    &lt;li&gt;The RP can send a request with the Access Token to the User device.&lt;/li&gt;
    &lt;li&gt;The UserInfo Endpoint returns Claims about the End-User.&lt;/li&gt;
  &lt;/ol&gt;

  &lt;p&gt;&lt;em&gt;source: &lt;a href=&quot;https://openid.net/developers/how-connect-works/&quot;&gt;OpenID Connect&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;When using OpenID Connect, we have to deal with this specific ordering of execution. OpenID Connect is an open standard and the protocol is pretty stable. This limits the actual impact of the execution order constraints.&lt;/p&gt;

&lt;h2 id=&quot;tackling-connascence-of-execution-order&quot;&gt;Tackling Connascence of Execution Order&lt;/h2&gt;

&lt;p&gt;What can we do about it? Connascence by Execution Order is often inevitable. It is hard to detect from static analysis, because the ordering constraints follow from the semantics of the code.&lt;/p&gt;

&lt;p&gt;In the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;HandleMessage&lt;/code&gt; example shown above, we can extract and move the knowledge about the order of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;set...&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;commit&lt;/code&gt; calls to a more appropriate abstraction.&lt;/p&gt;

&lt;p&gt;We can for instance introduce a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;TrackingRepository&lt;/code&gt;, a small abstraction that manages the ordering constraints on updating and saving, which is shown in the code fragment below. &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;HandleMessage&lt;/code&gt; then does not need to know about committing at the right point in time, it just calls &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;saveFullFrame&lt;/code&gt; method on the repository. This increases the &lt;em&gt;locality&lt;/em&gt; of connascence, by moving code that is coupled by ordering constraints together to a single place.&lt;/p&gt;

&lt;div class=&quot;language-csharp highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;table class=&quot;rouge-table&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;rouge-gutter gl&quot;&gt;&lt;pre class=&quot;lineno&quot;&gt;1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;rouge-code&quot;&gt;&lt;pre&gt;&lt;span class=&quot;k&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;VehicleMessageDecoder&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;MessageDecoder&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;TrackingRepository&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;_trackingRepository&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

  &lt;span class=&quot;k&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;HandleMessage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;byte&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;identification&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;byte&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[]&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;message&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;length&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;switch&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;decodingState&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;k&quot;&gt;case&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;WAITING_FOR_INITIALFRAME&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;message&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Protocol&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;FrameTypeIndex&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Protocol&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;FullFrame&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
          &lt;span class=&quot;n&quot;&gt;_trackingRepository&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;saveFullFrame&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;anEntry&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;withTimestamp&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;CodecUtils&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;decodeInt32&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;message&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Protocol&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;TimeStampIndex&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;withXPos&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;cm&quot;&gt;/*....*/&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;break&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;We also use a &lt;a href=&quot;https://martinfowler.com/bliki/FluentInterface.html&quot;&gt;fluent interface&lt;/a&gt; here, which helps to enforce specific ordering using types. This unburdens developers of knowing what to call in which order and reduces possible mistakes.&lt;/p&gt;

&lt;p&gt;Sometimes a set of statements in a specific order is duplicated in multiple places. The higher the &lt;em&gt;degree&lt;/em&gt; of this connascence, the more painful it gets. We can reduce the degree by extracting the set of statements in a function and calling that function wherever it is needed. Note that we still have Connascence by Execution &lt;em&gt;within&lt;/em&gt; that function.&lt;/p&gt;

&lt;h3 id=&quot;hexagonal-architecture&quot;&gt;Hexagonal Architecture&lt;/h3&gt;

&lt;p&gt;&lt;a href=&quot;/2020/08/20/hexagonal-architecture&quot;&gt;Hexagonal Architecture&lt;/a&gt; (also known as &lt;strong&gt;Ports &amp;amp; Adapters&lt;/strong&gt;) helps to reduce the impact of execution order coupling. Hexagonal Architecture puts domain logic in the center and inverts dependencies, so that storage, web and other services depend on domain logic instead of the other way around.&lt;/p&gt;

&lt;p class=&quot;post-image post-image-70&quot;&gt;&lt;img src=&quot;/attachments/blogposts/2026/connascence/ports-and-adapters.png&quot; alt=&quot;Ports and Adapters overview, with a database connected to the domain via a Repository interface (Port) and an Adapter&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Interacting with databases or other services often involves execution order constraints. We need to start a transaction, do updates, and then commit (or rollback) the transaction. If we let these execution order constraints seep into our domain logic, we add extra complexity to the inherent complexity of our domain. This can for example obfuscate transaction boundaries, with  failing updates as a result.&lt;/p&gt;

&lt;p&gt;In Hexagonal Architecture, a &lt;em&gt;port&lt;/em&gt; provides an abstraction in domain terms of the external systems (e.g. through a Repository interface). &lt;em&gt;Adapters&lt;/em&gt; contain the mapping from domain abstractions to external systems and can encapsulate execution order constraints.&lt;/p&gt;

&lt;h2 id=&quot;whats-next&quot;&gt;What’s next&lt;/h2&gt;

&lt;p&gt;This post is part of a series on connascence and coupling. In the next post, we will focus on Connascence by Timing, where two elements need to agree on timing.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;/2026/05/08/connascence-intro&quot;&gt;Part 1 - Introduction&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/2026/05/13/connascence-name-type&quot;&gt;Part 2 - Connascence by Name and Type&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/2026/05/21/connascence-meaning&quot;&gt;Part 3 - Connascence by Meaning&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/2026/05/29/connascence-position&quot;&gt;Part 4 - Connascence by Position&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/2026/06/03/connascence-algorithm&quot;&gt;Part 5 - Connascence by Algorithm&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;em&gt;Part 6 - Connascence by Execution Order&lt;/em&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/2026/06/12/connascence-timing&quot;&gt;Part 7 - Connascence by Timing&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/2026/06/17/connascence-value&quot;&gt;Part 8 - Connascence by Value&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/2026/06/24/connascence-identity&quot;&gt;Part 9 - Connascence by Identity&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/2026/06/29/connascence-managing-coupling&quot;&gt;Part 10 - Heuristics for managing coupling&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;Credits: Flowchart thumbnail Photo by &lt;a href=&quot;https://unsplash.com/@wocintechchat?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText&quot;&gt;Christina @ wocintechchat.com M&lt;/a&gt; on &lt;a href=&quot;https://unsplash.com/photos/person-writing-on-dry-erase-board-tYVkjjMYFBo?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText&quot;&gt;Unsplash&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Updated 10-6-2026: added a paragraph about ports and adapters&lt;/em&gt;&lt;/p&gt;

&lt;aside&gt;
&lt;h3&gt;Decouple more deliberately!&lt;/h3&gt;
&lt;p&gt;We offer hands-on workshops about connascence and refactoring towards loosely coupled, highly cohesive systems.
&lt;/p&gt;
&lt;div&gt;
&lt;a href=&quot;/contact&quot;&gt;Let&apos;s have a chat&lt;/a&gt;
&lt;/div&gt;
&lt;/aside&gt;
</description>
        <pubDate>Mon, 08 Jun 2026 00:00:00 +0000</pubDate>
        <link>https://qwan.eu/2026/06/08/connascence-execution-order.html</link>
        <guid isPermaLink="true">https://qwan.eu/2026/06/08/connascence-execution-order.html</guid>
        
        <category>architecture</category>
        
        <category>coupling</category>
        
        <category>design</category>
        
        
      </item>
    
      <item>
        <title>Connascence: Algorithm (part 5)</title>
        <description>&lt;p&gt;In the previous posts, we &lt;a href=&quot;/2026/05/08/connascence-intro&quot;&gt;introduced the Connascence model as a model of coupling&lt;/a&gt; and elaborated connascence by name, type, meaning and position. In this post, we will discuss Connascence by Algorithm.&lt;/p&gt;

&lt;p&gt;Connascence is a model for reasoning about coupling and defines three dimensions of coupling: strength, degree, and 
distance, as the picture below shows.&lt;/p&gt;

&lt;p class=&quot;post-image post-image-50&quot;&gt;&lt;img src=&quot;/attachments/blogposts/2026/connascence/slide-19-degree.png&quot; alt=&quot;connascence in three dimensions, from green to red&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;connascence-by-algorithm&quot;&gt;Connascence by Algorithm&lt;/h2&gt;

&lt;p&gt;Connascence by Algorithm means two elements are coupled because they need to agree on a shared algorithm or protocol.&lt;/p&gt;

&lt;p class=&quot;post-image post-image-50&quot;&gt;&lt;img src=&quot;/attachments/blogposts/2026/connascence/slide-10-1-algorithm-example.png&quot; alt=&quot;connascence by algorithm&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Connascence by Algorithm occurs when two services need to exchange data, e.g. over a network. We need to know how an API works if we want to consume that API. We need to know what data in what format is returned. File exports/imports is another example of Connascence by Algorithm.&lt;/p&gt;

&lt;p class=&quot;post-image post-image-50&quot;&gt;&lt;img src=&quot;/attachments/blogposts/2026/connascence/algorithm.png&quot; alt=&quot;picture showing a producer and a consumer that are coupled via a shared protocol&quot; /&gt;&lt;/p&gt;

&lt;p&gt;The &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Producer&lt;/code&gt; code below encodes information in a byte array, which gets sent over the network.&lt;/p&gt;

&lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;table class=&quot;rouge-table&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;rouge-gutter gl&quot;&gt;&lt;pre class=&quot;lineno&quot;&gt;1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;rouge-code&quot;&gt;&lt;pre&gt;&lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Producer&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;byte&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[]&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;createFullFrame&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;byte&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ident&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;tstamp&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;xpos&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ypos&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt;
                                       &lt;span class=&quot;nc&quot;&gt;Direction&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;dir&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Speed&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;spd&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Engine&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;eon&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; 
                                       &lt;span class=&quot;nc&quot;&gt;CloseToOther&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;close&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Collision&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;coll&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kt&quot;&gt;byte&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[]&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;result&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;byte&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Protocol&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;FullFrameLength&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;];&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;result&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0x00&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;result&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Protocol&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;FrameLengthIndex&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Protocol&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;FullFrameLength&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;result&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Protocol&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;IdentificationIndex&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ident&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;encodeInt32&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;tstamp&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;result&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;encodeInt16&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;xpos&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;result&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;encodeInt16&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ypos&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;result&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;...&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Consumer&lt;/code&gt; needs to know the order and meaning of the incoming bytes.&lt;/p&gt;

&lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;table class=&quot;rouge-table&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;rouge-gutter gl&quot;&gt;&lt;pre class=&quot;lineno&quot;&gt;1
2
3
4
5
6
7
8
9
&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;rouge-code&quot;&gt;&lt;pre&gt;&lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Consumer&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;handleMessage&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;byte&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;identification&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;byte&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[]&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;message&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;length&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;switch&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;decoderState&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;k&quot;&gt;case&lt;/span&gt; &lt;span class=&quot;nl&quot;&gt;WAITING_FOR_INITIALFRAME:&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;currentEntry&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;setTimestamp&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;CodecUtils&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;decodeInt32&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;message&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Protocol&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;TimeStampIndex&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;));&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;currentEntry&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;setXPos&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;CodecUtils&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;decodeInt16&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;message&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Protocol&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;XPosIndex&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;));&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;currentEntry&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;setYPos&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;CodecUtils&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;decodeInt16&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;message&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Protocol&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;YPosIndex&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;));&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;...&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Connascence by Algorithm is trickier to manage than the weaker forms of connascence like Name or Type, because it often crosses system boundaries. It concerns coupling between systems that have a different lifecycle and often different owners. It tends to come with a high &lt;em&gt;distance&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;This is made worse by consumers and producers evolving at their own pace. When the algorithm or protocol evolves, producers and consumers needs to be kept in sync. The higher the &lt;em&gt;degree&lt;/em&gt; of connascence, the worse it gets: if a producer has many consumers, it becomes even more difficult for the algorithm to evolve.&lt;/p&gt;

&lt;h2 id=&quot;refactoring-connascence-by-algorithm&quot;&gt;Refactoring Connascence by Algorithm&lt;/h2&gt;

&lt;p&gt;What can we do to keep Connascence by Algorithm manageable? Sometimes, we can merge producer and consumer into a single service, reducing it to Connascence by Name and Type. If multiple instances of that service are running, we still need to keep in mind that multiple versions of our protocol could be running alongside each other, e.g. during a deployment.&lt;/p&gt;

&lt;p&gt;Often it is not possible to merge producer and consumer, so we have to deal with it. We can make our lives a bit easier however:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Create a &lt;strong&gt;shared library&lt;/strong&gt; that encapsulates the protocol and have both consumer and producer use it. This moves the producing and consumer code together, increasing the locality of connascence. This is not always possible and comes at the price of managing an extra dependency across multiple services.&lt;/li&gt;
  &lt;li&gt;Use &lt;strong&gt;open formats&lt;/strong&gt; and &lt;strong&gt;industry standards&lt;/strong&gt;. The more stable a format is, the less consumers &amp;amp; producers need to change, and the less impactful coupling is.&lt;/li&gt;
  &lt;li&gt;Use language independent &lt;strong&gt;schemas&lt;/strong&gt; like JSON schema, &lt;a href=&quot;https://avro.apache.org/&quot;&gt;AVRO&lt;/a&gt;, or &lt;a href=&quot;https://protobuf.dev/&quot;&gt;Protocol Buffers&lt;/a&gt;. This allows for schema versioning and sharing through a schema registry. This does not remove the impact of changes, but it makes it more explicit. It allows us to evolve a protocol in steps with a lower risk of breaking something.&lt;/li&gt;
  &lt;li&gt;Add &lt;strong&gt;&lt;a href=&quot;https://pactflow.io/blog/what-is-contract-testing/&quot;&gt;contract tests&lt;/a&gt;&lt;/strong&gt; that provide early feedback about producer and consumer changes.&lt;/li&gt;
  &lt;li&gt;Keep APIs &lt;strong&gt;backward compatible&lt;/strong&gt;, so that consumers are not affected by producer changes.&lt;/li&gt;
  &lt;li&gt;Perform explicit &lt;strong&gt;lifecycle management&lt;/strong&gt; on APIs, through agreements with consumers, e.g. requiring consumers to upgrade to a new API version within 6 months of a change.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;whats-next&quot;&gt;What’s next&lt;/h2&gt;

&lt;p&gt;This post is part of a series on connascence and coupling. In the next post, we will focus on Connascence by Execution Order, where two elements need to agree on the order in which steps are executed.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;/2026/05/08/connascence-intro&quot;&gt;Part 1 - Introduction&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/2026/05/13/connascence-name-type&quot;&gt;Part 2 - Connascence by Name and Type&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/2026/05/21/connascence-meaning&quot;&gt;Part 3 - Connascence by Meaning&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/2026/05/29/connascence-position&quot;&gt;Part 4 - Connascence by Position&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;em&gt;Part 5 - Connascence by Algorithm&lt;/em&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/2026/06/08/connascence-execution-order&quot;&gt;Part 6 - Connascence by Execution Order&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/2026/06/12/connascence-timing&quot;&gt;Part 7 - Connascence by Timing&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/2026/06/17/connascence-value&quot;&gt;Part 8 - Connascence by Value&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/2026/06/24/connascence-identity&quot;&gt;Part 9 - Connascence by Identity&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/2026/06/29/connascence-managing-coupling&quot;&gt;Part 10 - Heuristics for managing coupling&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;aside&gt;
&lt;h3&gt;Decouple more deliberately!&lt;/h3&gt;
&lt;p&gt;We offer hands-on workshops about connascence and refactoring towards loosely coupled, highly cohesive systems.
&lt;/p&gt;
&lt;div&gt;
&lt;a href=&quot;/contact&quot;&gt;Let&apos;s have a chat&lt;/a&gt;
&lt;/div&gt;
&lt;/aside&gt;
</description>
        <pubDate>Wed, 03 Jun 2026 00:00:00 +0000</pubDate>
        <link>https://qwan.eu/2026/06/03/connascence-algorithm.html</link>
        <guid isPermaLink="true">https://qwan.eu/2026/06/03/connascence-algorithm.html</guid>
        
        <category>architecture</category>
        
        <category>coupling</category>
        
        <category>design</category>
        
        
      </item>
    
      <item>
        <title>Connascence: Position (part 4)</title>
        <description>&lt;p&gt;In the previous posts, we &lt;a href=&quot;/2026/05/08/connascence-intro&quot;&gt;introduced the Connascence model as a model of coupling&lt;/a&gt; and elaborated connascence by name, type and meaning. In this post, we will discuss Connascence by Position.&lt;/p&gt;

&lt;p&gt;Connascence is a model for reasoning about coupling and defines three dimensions of coupling: strength, degree and distance, as the picture below shows.&lt;/p&gt;

&lt;p class=&quot;post-image post-image-50&quot;&gt;&lt;img src=&quot;/attachments/blogposts/2026/connascence/slide-19-degree.png&quot; alt=&quot;connascence in three dimensions, from green to red&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;connascence-by-position&quot;&gt;Connascence by Position&lt;/h2&gt;

&lt;p&gt;Connascence by Position means that two elements need to agree on the order of values.&lt;/p&gt;

&lt;p class=&quot;post-image post-image-50&quot;&gt;&lt;img src=&quot;/attachments/blogposts/2026/connascence/slide-9-position.png&quot; alt=&quot;connascence by position&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Positional parameters are an example of Connascence by Position. In the code below, the line calling the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Person&lt;/code&gt; constructor needs to keep the correct order as defined by the constructor signature. The compiler will not complain in case of a mistake.&lt;/p&gt;

&lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;table class=&quot;rouge-table&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;rouge-gutter gl&quot;&gt;&lt;pre class=&quot;lineno&quot;&gt;1
2
3
4
5
&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;rouge-code&quot;&gt;&lt;pre&gt;&lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Person&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;constructor&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;surname&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;town&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;...&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;Person&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Jan&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;Janssen&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;Utrecht&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The &lt;em&gt;degree of connascence&lt;/em&gt; can make positional coupling quite challenging: we can manage two parameters, but the longer the list of parameters is, the more risky it gets. An example is the &lt;a href=&quot;https://en.cppreference.com/w/c/io/fprintf&quot;&gt;C/C++ sprintf function&lt;/a&gt;, which has a variable parameter list that should match the format string provided. In the code fragment below, we need to make sure we pass the four parameters in the correct order.&lt;/p&gt;

&lt;div class=&quot;language-c highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;table class=&quot;rouge-table&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;rouge-gutter gl&quot;&gt;&lt;pre class=&quot;lineno&quot;&gt;1
2
3
4
5
6
&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;rouge-code&quot;&gt;&lt;pre&gt;    &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;id&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;143&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kt&quot;&gt;double&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;price&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;6&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;50&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kt&quot;&gt;char&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;grade&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;&apos;A&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;char&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;tag&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;hardware&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;n&quot;&gt;sprintf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;buffer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;id: %d, name: %s, price: %.2f, tag: %c&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;price&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;tag&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;refactoring-connascence-by-position&quot;&gt;Refactoring Connascence by Position&lt;/h2&gt;

&lt;p&gt;Some languages allow us to refactor positional coupling to Connascence by Name, by using named parameters:&lt;/p&gt;

&lt;div class=&quot;language-javascript highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;table class=&quot;rouge-table&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;rouge-gutter gl&quot;&gt;&lt;pre class=&quot;lineno&quot;&gt;1
2
3
4
5
&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;rouge-code&quot;&gt;&lt;pre&gt;&lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Person&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;kd&quot;&gt;constructor&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;({&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;surname&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;town&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;})&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;...&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Person&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;Jan&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;surname&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;Janssen&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;town&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;Utrecht&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;})&lt;/span&gt;
&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;It is useful to check if a subset (or all) of the parameters form a &lt;strong&gt;Data Clump&lt;/strong&gt; Then we can extract a new type or class to encapsulate those, as the code fragment below shows.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;A &lt;strong&gt;Data Clump&lt;/strong&gt; is a set of variables that belong together and travel together throughout the code.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;table class=&quot;rouge-table&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;rouge-gutter gl&quot;&gt;&lt;pre class=&quot;lineno&quot;&gt;1
2
3
4
5
6
7
8
9
10
11
12
13
&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;rouge-code&quot;&gt;&lt;pre&gt;&lt;span class=&quot;c1&quot;&gt;// from:&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Person&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;Person&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;surname&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;street&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; 
              &lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;postalCode&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;town&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;...&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;// to:&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;record&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;Name&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;first&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;last&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{}&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;record&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;Address&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;street&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;postalCode&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;town&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{}&lt;/span&gt;

&lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Person&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;Person&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;Name&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Address&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;address&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;...&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This reduces the Connascence by Position to Connascence by Type and encapsulates the details in the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Name&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Address&lt;/code&gt; types. We probably want to refactor this further, as we still have come positional coupling in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Name&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Address&lt;/code&gt;.&lt;/p&gt;

&lt;h2 id=&quot;whats-next&quot;&gt;What’s next&lt;/h2&gt;

&lt;p&gt;This post is part of a series on connascence and coupling. In the next post, we will focus on Connascence by Algorithm, where two elements need to agree on the order of values.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;/2026/05/08/connascence-intro&quot;&gt;Part 1 - Introduction&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/2026/05/13/connascence-name-type&quot;&gt;Part 2 - Connascence by Name and Type&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/2026/05/21/connascence-meaning&quot;&gt;Part 3 - Connascence by Meaning&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;em&gt;Part 4 - Connascence by Position&lt;/em&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/2026/06/03/connascence-algorithm&quot;&gt;Part 5 - Connascence by Algorithm&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/2026/06/08/connascence-execution-order&quot;&gt;Part 6 - Connascence by Execution Order&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/2026/06/12/connascence-timing&quot;&gt;Part 7 - Connascence by Timing&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/2026/06/17/connascence-value&quot;&gt;Part 8 - Connascence by Value&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/2026/06/24/connascence-identity&quot;&gt;Part 9 - Connascence by Identity&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/2026/06/29/connascence-managing-coupling&quot;&gt;Part 10 - Heuristics for managing coupling&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;aside&gt;
&lt;h3&gt;Decouple more deliberately!&lt;/h3&gt;
&lt;p&gt;We offer hands-on workshops about connascence and refactoring towards loosely coupled, highly cohesive systems.
&lt;/p&gt;
&lt;div&gt;
&lt;a href=&quot;/contact&quot;&gt;Let&apos;s have a chat&lt;/a&gt;
&lt;/div&gt;
&lt;/aside&gt;
</description>
        <pubDate>Fri, 29 May 2026 00:00:00 +0000</pubDate>
        <link>https://qwan.eu/2026/05/29/connascence-position.html</link>
        <guid isPermaLink="true">https://qwan.eu/2026/05/29/connascence-position.html</guid>
        
        <category>architecture</category>
        
        <category>coupling</category>
        
        <category>design</category>
        
        
      </item>
    
      <item>
        <title>Connascence: Meaning (part 3)</title>
        <description>&lt;p&gt;In the previous posts, we &lt;a href=&quot;/2026/05/08/connascence-intro&quot;&gt;introduced the Connascence model as a model of coupling&lt;/a&gt; and elaborated on the two most explicit forms of connascence: &lt;a href=&quot;/2026/05/13/connascence-name-type&quot;&gt;name and type&lt;/a&gt;. In this post, we will discuss Connascence by Meaning, which is as much about cohesion as it is about coupling.&lt;/p&gt;

&lt;p&gt;Connascence defines three dimensions of coupling: strength, degree and distance, as the picture below shows.&lt;/p&gt;

&lt;p class=&quot;post-image post-image-50&quot;&gt;&lt;img src=&quot;/attachments/blogposts/2026/connascence/slide-19-degree.png&quot; alt=&quot;connascence in three dimensions, from green to red&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;connascence-by-meaning&quot;&gt;Connascence by Meaning&lt;/h2&gt;

&lt;p&gt;Connascence by Meaning means that multiple elements must agree on the meaning of particular values. This is also known as Connascence by Convention.&lt;/p&gt;

&lt;p class=&quot;post-image post-image-50&quot;&gt;&lt;img src=&quot;/attachments/blogposts/2026/connascence/slide-8-meaning.png&quot; alt=&quot;connascence by meaning&quot; /&gt;&lt;/p&gt;

&lt;p&gt;An example of Connascence by Meaning is the use of integers to represent monetary amounts. Code that uses those integers must know how to interpret the values. Is it Euro cents or whole Euros? Euros or Dollars? Is the value allowed to be negative? What operations are valid on these numbers? We can add monetary amounts, we can multiply a monetary amount by a scalar value, but it does not make sense to multiply two monetary amounts.&lt;/p&gt;

&lt;p&gt;The code below shows another example. Apparently the return value &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;null&lt;/code&gt; of function &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;validateAndConvert&lt;/code&gt; means invalid data. The calling code depends on the meaning that &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;validateAndConvert&lt;/code&gt; assigns to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;null&lt;/code&gt;.&lt;/p&gt;

&lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;table class=&quot;rouge-table&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;rouge-gutter gl&quot;&gt;&lt;pre class=&quot;lineno&quot;&gt;1
2
&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;rouge-code&quot;&gt;&lt;pre&gt;&lt;span class=&quot;n&quot;&gt;person&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;validateAndConvert&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;person&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;throw&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;InvalidDataException&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt;
&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Other examples:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;using integers to represent port numbers; port numbers should be in the range from 0 to 65535 with 0-1023 being system ports;&lt;/li&gt;
  &lt;li&gt;using strings to represent email addresses; valid values are defined by RFCs &lt;a href=&quot;https://www.rfc-editor.org/rfc/rfc5322&quot;&gt;5322&lt;/a&gt; and &lt;a href=&quot;https://www.rfc-editor.org/rfc/rfc6854&quot;&gt;6854&lt;/a&gt;;&lt;/li&gt;
  &lt;li&gt;using strings to represent international phone numbers;&lt;/li&gt;
  &lt;li&gt;returning &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;null&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;None&lt;/code&gt; or &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Optional.empty&lt;/code&gt; to signal no results found, or some exceptional situation - what does the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;null&lt;/code&gt; or &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;None&lt;/code&gt; value actually mean?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Different elements need to know what these numbers and text values mean, how to use them, and what valid and invalid values are.&lt;/p&gt;

&lt;p&gt;We will always have Connascence by Meaning somewhere in our code. We use primitives to build higher order concepts and encode assumptions about how these concepts are represented using strings or integers. So Connascence by Meaning is not bad.&lt;/p&gt;

&lt;p&gt;We do like to have all assumptions about meaning explicit and close to each other. We can refactor so that all assumptions are encapsulated in an abstraction, hidden behind a type or interface. The implementation details of the abstraction will be tightly coupled - it is highly &lt;strong&gt;cohesive&lt;/strong&gt;, like the picture below shows. Other code will be coupled to the abstraction (Connascence by Name and Type) and not to specific primitives or assumptions about meaning.&lt;/p&gt;

&lt;p class=&quot;post-image post-image-30&quot;&gt;&lt;img src=&quot;/attachments/blogposts/2026/connascence/connascence-cohesion.jpg&quot; alt=&quot;big circle representing a cohesive element containing highly coupled sub-elements, other elements are connected to it, but not to its internals&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;refactoring-connascence-by-meaning&quot;&gt;Refactoring Connascence by Meaning&lt;/h2&gt;

&lt;p&gt;Managing Connascence by Meaning is what we do on a daily basis. We introduce highly cohesive abstractions and reduce coupling in the rest of the code. Some code smells that are indicators of Connascence by Meaning are &lt;strong&gt;Primitive Obsession&lt;/strong&gt;, &lt;strong&gt;Magic Numbers&lt;/strong&gt;, and &lt;strong&gt;Feature Envy&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Primitive obsession&lt;/strong&gt; is code that uses primitive types all over the place. Usually this means hidden concepts, which can be extracted by encapsulating the primitives and moving the behaviour to the new abstraction.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Magic Numbers&lt;/strong&gt; means using special literal values that have an implicit meaning. This includes the use of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;null&lt;/code&gt; values. We can refactor this to Connascence by Name or Type, by extracting a constant or introducing an exception as the code fragment below shows.&lt;/p&gt;

&lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;table class=&quot;rouge-table&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;rouge-gutter gl&quot;&gt;&lt;pre class=&quot;lineno&quot;&gt;1
2
3
4
5
6
7
8
9
10
11
12
&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;rouge-code&quot;&gt;&lt;pre&gt;&lt;span class=&quot;nc&quot;&gt;Person&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;validateAndConvert&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;throws&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;InvalidDataException&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;isInvalid&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;then&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;throw&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;InvalidDataException&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;...&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;person&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;...&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;try&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;person&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;validateAndConvert&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;catch&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;InvalidDataException&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;invalid&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;...&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The next code fragment shows another example of code with Magic Numbers. It is not clear what 0, 1, 2, and 0x00 mean. Do the different zeroes actually mean the same thing?&lt;/p&gt;

&lt;div class=&quot;language-csharp highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;table class=&quot;rouge-table&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;rouge-gutter gl&quot;&gt;&lt;pre class=&quot;lineno&quot;&gt;1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;rouge-code&quot;&gt;&lt;pre&gt;&lt;span class=&quot;k&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;VehicleMessageDecoder&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;MessageDecoder&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;handleMessage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;byte&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;identification&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;byte&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[]&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;message&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;length&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;switch&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;decodingState&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;k&quot;&gt;case&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;decodingState&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;goto&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;case&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
      &lt;span class=&quot;k&quot;&gt;case&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;message&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0x00&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
          &lt;span class=&quot;n&quot;&gt;currentEntry&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;setTimestamp&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;CodecUtils&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;decodeInt32&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;message&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt;
          &lt;span class=&quot;c1&quot;&gt;// ...&lt;/span&gt;
          &lt;span class=&quot;n&quot;&gt;decodingState&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
          &lt;span class=&quot;n&quot;&gt;numberOfDeltas&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;break&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
      &lt;span class=&quot;c1&quot;&gt;//...&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;If we refactor to Connascence by Name, it becomes clearer what parts need to change together. The different meanings of the zeroes also become clear.&lt;/p&gt;

&lt;div class=&quot;language-csharp highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;table class=&quot;rouge-table&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;rouge-gutter gl&quot;&gt;&lt;pre class=&quot;lineno&quot;&gt;1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;rouge-code&quot;&gt;&lt;pre&gt;&lt;span class=&quot;k&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;VehicleMessageDecoder&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;MessageDecoder&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;handleMessage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;byte&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;identification&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;byte&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[]&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;message&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;length&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;switch&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;decodingState&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;k&quot;&gt;case&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;STARTING&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;decodingState&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;WAITING_FOR_INITIALFRAME&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;goto&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;case&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;WAITING_FOR_INITIALFRAME&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
      &lt;span class=&quot;k&quot;&gt;case&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;WAITING_FOR_INITIALFRAME&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;message&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Protocol&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;FrameTypeIndex&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Protocol&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;FullFrame&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
          &lt;span class=&quot;n&quot;&gt;currentEntry&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;setTimestamp&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;CodecUtils&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;decodeInt32&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;message&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt;
          &lt;span class=&quot;c1&quot;&gt;// ...&lt;/span&gt;
          &lt;span class=&quot;n&quot;&gt;decodingState&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;WAITING_FOR_DELTAS&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
          &lt;span class=&quot;n&quot;&gt;numberOfDeltas&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;break&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
      &lt;span class=&quot;c1&quot;&gt;//...&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Let’s look at another example. The code below shows a piece of shopping cart logic. It computes the total including taxes using &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Money&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Item&lt;/code&gt; data classes. The shopping cart code has intimate knowledge about how money works: it knows how to add amounts and how to apply tax rates.&lt;/p&gt;

&lt;div class=&quot;language-kotlin highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;table class=&quot;rouge-table&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;rouge-gutter gl&quot;&gt;&lt;pre class=&quot;lineno&quot;&gt;1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;rouge-code&quot;&gt;&lt;pre&gt;&lt;span class=&quot;kd&quot;&gt;data class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Money&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;val&lt;/span&gt; &lt;span class=&quot;py&quot;&gt;amount&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;BigDecimal&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;kd&quot;&gt;data class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Item&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;val&lt;/span&gt; &lt;span class=&quot;py&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;val&lt;/span&gt; &lt;span class=&quot;py&quot;&gt;price&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Money&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;ShoppingCart&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;..&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;fun&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;calculateTotalWithTax&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;taxRate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;BigDecimal&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Money&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;py&quot;&gt;totalAmount&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;BigDecimal&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;ZERO&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;item&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;items&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;totalAmount&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;totalAmount&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;add&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;item&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;price&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;amount&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;kd&quot;&gt;val&lt;/span&gt; &lt;span class=&quot;py&quot;&gt;taxMultiplier&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;BigDecimal&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;ONE&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;add&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;taxRate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;kd&quot;&gt;val&lt;/span&gt; &lt;span class=&quot;py&quot;&gt;finalAmount&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;totalAmount&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;multiply&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;taxMultiplier&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Money&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;finalAmount&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;We can refactor this by extracting &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;add&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;withTax&lt;/code&gt; functions and moving these to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Money&lt;/code&gt;, so that &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Money&lt;/code&gt; encapsulates the meaning of the BigDecimal values.&lt;/p&gt;

&lt;div class=&quot;language-kotlin highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;table class=&quot;rouge-table&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;rouge-gutter gl&quot;&gt;&lt;pre class=&quot;lineno&quot;&gt;1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;rouge-code&quot;&gt;&lt;pre&gt;&lt;span class=&quot;kd&quot;&gt;data class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Money&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;val&lt;/span&gt; &lt;span class=&quot;py&quot;&gt;amount&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;BigDecimal&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;BigDecimal&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;ZERO&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;fun&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;add&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;other&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Money&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Money&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Money&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;amount&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;add&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;other&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;amount&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;fun&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;withTax&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;taxRate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;BigDecimal&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Money&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;kd&quot;&gt;val&lt;/span&gt; &lt;span class=&quot;py&quot;&gt;taxMultiplier&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;BigDecimal&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;ONE&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;add&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;taxRate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Money&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;amount&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;multiply&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;taxMultiplier&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;kd&quot;&gt;data class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Item&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;val&lt;/span&gt; &lt;span class=&quot;py&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;val&lt;/span&gt; &lt;span class=&quot;py&quot;&gt;price&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Money&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;ShoppingCart&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;..&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;fun&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;calculateTotalWithTax&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;taxRate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;BigDecimal&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Money&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;py&quot;&gt;totalAmount&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Money&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;item&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;items&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;totalAmount&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;totalAmount&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;add&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;item&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;price&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;totalAmount&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;withTax&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;taxRate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; 
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;whats-next&quot;&gt;What’s next&lt;/h2&gt;

&lt;p&gt;This post is part of a series on connascence and coupling. In the next post, we will focus on Connascence by Position, where two elements need to agree on the order of values.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;/2026/05/08/connascence-intro&quot;&gt;Part 1 - Introduction&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/2026/05/13/connascence-name-type&quot;&gt;Part 2 - Connascence by Name and Type&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;em&gt;Part 3 - Connascence by Meaning&lt;/em&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/2026/05/29/connascence-position&quot;&gt;Part 4 - Connascence by Position&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/2026/06/03/connascence-algorithm&quot;&gt;Part 5 - Connascence by Algorithm&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/2026/06/08/connascence-execution-order&quot;&gt;Part 6 - Connascence by Execution Order&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/2026/06/12/connascence-timing&quot;&gt;Part 7 - Connascence by Timing&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/2026/06/17/connascence-value&quot;&gt;Part 8 - Connascence by Value&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/2026/06/24/connascence-identity&quot;&gt;Part 9 - Connascence by Identity&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/2026/06/29/connascence-managing-coupling&quot;&gt;Part 10 - Heuristics for managing coupling&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;aside&gt;
&lt;h3&gt;Decouple more deliberately!&lt;/h3&gt;
&lt;p&gt;We offer hands-on workshops about connascence and refactoring towards loosely coupled, highly cohesive systems.
&lt;/p&gt;
&lt;div&gt;
&lt;a href=&quot;/contact&quot;&gt;Let&apos;s have a chat&lt;/a&gt;
&lt;/div&gt;
&lt;/aside&gt;
</description>
        <pubDate>Thu, 21 May 2026 00:00:00 +0000</pubDate>
        <link>https://qwan.eu/2026/05/21/connascence-meaning.html</link>
        <guid isPermaLink="true">https://qwan.eu/2026/05/21/connascence-meaning.html</guid>
        
        <category>architecture</category>
        
        <category>coupling</category>
        
        <category>design</category>
        
        
      </item>
    
      <item>
        <title>Connascence: Name and Type (part 2)</title>
        <description>&lt;p&gt;In the &lt;a href=&quot;/2026/05/08/connascence-intro&quot;&gt;previous post&lt;/a&gt;, we introduced the Connascence model for coupling and cohesion. In this post, we will discuss the two weakest, most explicit forms of connascence: &lt;strong&gt;Name&lt;/strong&gt; and &lt;strong&gt;Type&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Two software elements are connascent if&lt;br /&gt;
&lt;strong&gt;a change in one would require the other to be modified to maintain the overall correctness of the system&lt;/strong&gt;&lt;br /&gt;
or&lt;br /&gt;
&lt;strong&gt;for some change, both would be required to change to maintain the overall correctness of the system.&lt;/strong&gt;
Connascence defines three dimensions of coupling: strength, degree and distance, as the picture below shows.&lt;/p&gt;

&lt;p class=&quot;post-image post-image-50&quot;&gt;&lt;img src=&quot;/attachments/blogposts/2026/connascence/slide-19-degree.png&quot; alt=&quot;connascence in three dimensions, from green to red&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;connascence-by-name-and-by-type&quot;&gt;Connascence by Name and by Type&lt;/h2&gt;

&lt;p&gt;Two elements are connascent by Name or Type if they must agree on the same name or type. If a function is called &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;foo&lt;/code&gt;, the calling code must use that name. Renaming the function means also changing the calling code. The same holds for types. Code using a type or class must change if the type changes, as show in the picture and code fragment below.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/attachments/blogposts/2026/connascence/slide-6-type-example.png&quot; alt=&quot;connascence by name and type&quot; /&gt;&lt;/p&gt;

&lt;div class=&quot;language-java highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;table class=&quot;rouge-table&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;rouge-gutter gl&quot;&gt;&lt;pre class=&quot;lineno&quot;&gt;1
2
3
4
5
6
&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;rouge-code&quot;&gt;&lt;pre&gt;&lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Bar&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;foo&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;...&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;kt&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;bar&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Bar&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;bar&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;foo&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;();&lt;/span&gt;
&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Connascence by Name and Type are explicit. The compiler or interpreter will provide feedback if we forget a change somewhere. Automated refactoring tooling makes this kind of coupling often easy to manage.&lt;/p&gt;

&lt;p&gt;The &lt;em&gt;locality&lt;/em&gt; of the coupling between the elements impacts the risk and the effort involved in keeping everything working correctly. If the elements are all in the same code base, our tooling will do most of the work, and the risk will be minimal. Good refactoring tools reduce the effort.&lt;/p&gt;

&lt;p&gt;If the distance between two coupled parts is higher, the risk and effort is higher. An example is a class &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Customer&lt;/code&gt; with attributes &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;name&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;address&lt;/code&gt; that should match a database table &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;CUSTOMER&lt;/code&gt; with columns &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;NAME&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ADDRESS&lt;/code&gt;. These elements live in different systems (code base and database).&lt;/p&gt;

&lt;p class=&quot;post-image post-image-70&quot;&gt;&lt;img src=&quot;/attachments/blogposts/2026/connascence/name-table.png&quot; alt=&quot;a representation of a database table CUSTOMERS with columns NAME and ADDRESS with should correspond to a class Customer with properties Name and Address&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;refactoring-connascence-by-name-and-type&quot;&gt;Refactoring Connascence by Name and Type&lt;/h2&gt;

&lt;p&gt;If the distance between the coupled elements is low, the compiler or interpreter will help us catch mistakes, e.g. when running unit tests. In that case, we can keep it like it is. Connascence by Name or Type is often the endpoint of refactoring and not something to refactor away from. Trying to refactor away from name and type coupling will make the coupling more implicit and more painful.&lt;/p&gt;

&lt;p&gt;For elements further apart, we can try to move them closer together. For name coupling between code and database, automated checks by our Object-Relational Mapping library or &lt;a href=&quot;/2020/09/17/test-architecture.html#adapter-integration-tests&quot;&gt;automated adapter integration tests&lt;/a&gt; can help.&lt;/p&gt;

&lt;h2 id=&quot;whats-next&quot;&gt;What’s next&lt;/h2&gt;

&lt;p&gt;This post is part of a series on connascence and coupling. In the next post, we will focus on Connascence by Meaning, where two or more elements need to agree on the meaning of particular values.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;/2026/05/08/connascence-intro&quot;&gt;Part 1 - Introduction&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;Part 2 - &lt;em&gt;Connascence by Name and Type&lt;/em&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/2026/05/21/connascence-meaning&quot;&gt;Part 3 - Connascence by Meaning&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/2026/05/29/connascence-position&quot;&gt;Part 4 - Connascence by Position&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/2026/06/03/connascence-algorithm&quot;&gt;Part 5 - Connascence by Algorithm&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/2026/06/08/connascence-execution-order&quot;&gt;Part 6 - Connascence by Execution Order&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/2026/06/12/connascence-timing&quot;&gt;Part 7 - Connascence by Timing&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/2026/06/17/connascence-value&quot;&gt;Part 8 - Connascence by Value&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/2026/06/24/connascence-identity&quot;&gt;Part 9 - Connascence by Identity&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/2026/06/29/connascence-managing-coupling&quot;&gt;Part 10 - Heuristics for managing coupling&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;aside&gt;
&lt;h3&gt;Decouple more deliberately!&lt;/h3&gt;
&lt;p&gt;We offer hands-on workshops about connascence and refactoring towards loosely coupled, highly cohesive systems.
&lt;/p&gt;
&lt;div&gt;
&lt;a href=&quot;/contact&quot;&gt;Let&apos;s have a chat&lt;/a&gt;
&lt;/div&gt;
&lt;/aside&gt;
</description>
        <pubDate>Wed, 13 May 2026 00:00:00 +0000</pubDate>
        <link>https://qwan.eu/2026/05/13/connascence-name-type.html</link>
        <guid isPermaLink="true">https://qwan.eu/2026/05/13/connascence-name-type.html</guid>
        
        <category>architecture</category>
        
        <category>coupling</category>
        
        <category>design</category>
        
        
      </item>
    
      <item>
        <title>Connascence: (de)coupling more effectively (part 1)</title>
        <description>&lt;p&gt;In this post, we will introduce Connascence, a model that describes coupling and cohesion in multiple dimensions. This model gives you an energy label to determine how energy efficient your coupling is.&lt;/p&gt;

&lt;p&gt;Coupling is unavoidable. But you have to choose what kind of coupling is a good fit where. Connascence provides a fine-grained model to reason about different forms and degrees of coupling. It provides options to reduce coupling and improve cohesion. We find it provides a useful perspective on coupling, in addition to other ones.&lt;/p&gt;

&lt;p&gt;It does not make sense to just remove all coupling. As we stated in the &lt;a href=&quot;/2026/01/23/on-coupling&quot;&gt;previous post about coupling&lt;/a&gt;:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Without coupling, there is no working software.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;We accept coupling and deliberately decide the trade-offs. We make it explicit and manageable. We keep parts that are tightly coupled by nature closely together, increasing cohesion. For parts that are coupled but less tightly, we make sure coupling is as explicit as possible, aided by tooling and automated tests.&lt;/p&gt;

&lt;p&gt;This post is the first of a series of posts on Connascence. So what lies ahead? We will first introduce the connascence model and give an overview of its three dimensions. In the next posts, we will elaborate the different types of connascence. Finally, we will discuss how this can help in managing coupling and how it helps in knowing where to refactor to.&lt;/p&gt;

&lt;h2 id=&quot;connascence-defined&quot;&gt;Connascence defined&lt;/h2&gt;

&lt;p&gt;The concept of Connascence was introduced by Meilir Page-Jones in &lt;a href=&quot;https://dl.acm.org/doi/10.1145/130994.131004&quot;&gt;his work on object-oriented design&lt;/a&gt; in the 1990s. He observed that coupling and cohesion are closely related and tried to catch them both using a new term:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;I chose the word “connascence” from the Latin roots meaning “born together.” It is etymologically close to the French “connaissance” meaning knowledge, awareness or consciousness.&lt;/p&gt;

  &lt;p&gt;An undertone of this meaning is “having intertwined destinies in life.”&lt;/p&gt;

  &lt;p&gt;– Meilir Page-Jones&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;Two software elements are connascent if:&lt;/p&gt;

  &lt;p&gt;&lt;strong&gt;a change in one would require the other to be modified to maintain the overall correctness of the system&lt;/strong&gt;&lt;/p&gt;

  &lt;p&gt;or&lt;/p&gt;

  &lt;p&gt;&lt;strong&gt;for some change, both would be required to change to maintain the overall correctness of the system.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;A software element can be a function, a class, database table or schema, a package, a component, an application, a (micro)service, a subsystem. The picture below illustrates this definition of connascence. It shows two elements, both of them consisting of smaller parts, e.g. classes and functions:&lt;/p&gt;

&lt;p class=&quot;post-image post-image-70&quot;&gt;&lt;img src=&quot;/attachments/blogposts/2026/connascence/connascence-visualised-1.jpg&quot; alt=&quot;Schematic visualization of two software elements and their parts (modules, classes, functions, types)&quot; /&gt;&lt;/p&gt;

&lt;p&gt;We can visualize elements that need to change together by connecting them with red lines:&lt;/p&gt;

&lt;p class=&quot;post-image post-image-70&quot;&gt;&lt;img src=&quot;/attachments/blogposts/2026/connascence/connascence-visualised-2.jpg&quot; alt=&quot;Schematic visualization of coupling between different parts of two software elements using red lines to connect parts that are coupled&quot; /&gt;&lt;/p&gt;

&lt;p&gt;This definition of connascence (and coupling) is already useful on its own. It shifts our focus from dependencies to elements that need to be kept consistent with each other.&lt;/p&gt;

&lt;p&gt;It makes conversations about duplication more pragmatic: removing duplication is not about extracting identical pieces of code, but rather about putting things together that need to change together. Code similarity is an indicator for possible coupling, not something that must be refactored.&lt;/p&gt;

&lt;h2 id=&quot;dimensions-of-connascence&quot;&gt;Dimensions of Connascence&lt;/h2&gt;

&lt;p&gt;Connascence introduces three dimensions to reason about coupling and cohesion:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;&lt;strong&gt;Strength&lt;/strong&gt; - how easy or difficult it is to detect coupling and manage changes in coupled elements;&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Locality&lt;/strong&gt; - the distance between two coupled elements;&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Degree&lt;/strong&gt; - the number of elements that are coupled.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3 id=&quot;strength&quot;&gt;Strength&lt;/h3&gt;

&lt;p&gt;The 9 types of connascence are, in order of increasing &lt;em&gt;strength&lt;/em&gt;:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;&lt;strong&gt;Name&lt;/strong&gt; - two elements need to agree on the same name;&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Type&lt;/strong&gt; - two elements need to agree on the same type;&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Meaning&lt;/strong&gt;  - two elements need to agree on the meaning of particular values;&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Position&lt;/strong&gt; - two elements need to agree on the order of values;&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Algorithm&lt;/strong&gt; - two elements need to agree on a shared algorithm or protocol;&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Execution Order&lt;/strong&gt; - two elements need to agree on the order in which steps are executed;&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Timing&lt;/strong&gt; - two elements need to agree on timing;&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Value&lt;/strong&gt; - two elements need to agree on a specific value;&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Identity&lt;/strong&gt; - two elements need to agree on the identity of something - they need to make sure they use the same thing.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;We can visualize this from green to red, as a kind of energy label for coupling:&lt;/p&gt;

&lt;p class=&quot;post-image post-image-70&quot;&gt;&lt;img src=&quot;/attachments/blogposts/2026/connascence/slide-15-identity.png&quot; alt=&quot;9 types connascence from weak to strong, from green to red&quot; /&gt;&lt;/p&gt;

&lt;p&gt;The first five are called &lt;em&gt;static&lt;/em&gt; connascence, because these can usually be detected from the code, using a compiler or static code checks. The other types are called &lt;em&gt;dynamic&lt;/em&gt; — they are related to the dynamic behaviour of the code.&lt;/p&gt;

&lt;p class=&quot;post-image post-image-70&quot;&gt;&lt;img src=&quot;/attachments/blogposts/2026/connascence/slide-16-dynamics.png&quot; alt=&quot;9 types of connascence with 5 static and 4 dynamic types&quot; /&gt;&lt;/p&gt;

&lt;p&gt;The static types of connascence, in particular Name, Type and Meaning, are the most explicit forms of coupling. The stronger types of connascence are more implicit.&lt;/p&gt;

&lt;h3 id=&quot;locality&quot;&gt;Locality&lt;/h3&gt;

&lt;p&gt;The &lt;em&gt;Locality&lt;/em&gt; dimension of connascence refers to the distance between two coupled elements. The higher the distance, the more difficult it is to detect the coupling. Especially when the elements are in different applications, code bases or systems, the coupling becomes quite implicit and hard to manage.&lt;/p&gt;

&lt;p&gt;Vlad Khononov’s Balanced Coupling model mentions “socio-technical distance”, which is a useful addition. If two elements are not only far apart but also owned by different teams, the impact of coupling will be higher. If the teams are part of different organisations, it will be even worse.&lt;/p&gt;

&lt;h3 id=&quot;degree&quot;&gt;Degree&lt;/h3&gt;

&lt;p&gt;The &lt;em&gt;Degree&lt;/em&gt; dimension of Connascence refers to the number of elements that are coupled, i.e. the number of elements that are affected by a specific change. More elements means more work, and a higher chance of missing one element when updating.&lt;/p&gt;

&lt;p&gt;Adding a layer of indirection by introducing a stable abstraction helps to reduce the impact of changes, by isolating the part that changes and making the rest more stable, at the cost of some extra complexity.&lt;/p&gt;

&lt;p class=&quot;post-image post-image-70&quot;&gt;&lt;img src=&quot;/attachments/blogposts/2026/connascence/managing-degree-with-abstraction.jpg&quot; alt=&quot;left part showing 5 elements having &apos;bad&apos; coupling with red lines, right part having a new element in between, decoupling the stable part from the volatile part&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;putting-it-all-together&quot;&gt;Putting it all together&lt;/h2&gt;

&lt;p&gt;The picture below puts everything together. The Connascence model allows to reason about coupling with the three dimensions of strength, locality and degree.&lt;/p&gt;

&lt;p class=&quot;post-image post-image-70&quot;&gt;&lt;img src=&quot;/attachments/blogposts/2026/connascence/slide-19-degree.png&quot; alt=&quot;connascence in three dimensions, from green to red&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;related-work&quot;&gt;Related work&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Coupling_(computer_programming)&quot;&gt;Coupling&lt;/a&gt; and &lt;a href=&quot;https://en.wikipedia.org/wiki/Coupling_(computer_programming)&quot;&gt;cohesion&lt;/a&gt; are very old concepts in software development since the beginning. The concepts were introduced by Larry Constantine in the 1960s, and several people have tried to refine them and make them measurable.&lt;/p&gt;

&lt;p&gt;The Connascence model dates back to the 1990s when Meilir Page-Jones wrote his books about object oriented modelling. He identified coupling and cohesion as being the same thing.&lt;/p&gt;

&lt;p&gt;A recent addition is Vlad Khononov’s Balanced Coupling model, described in his &lt;a href=&quot;https://coupling.dev/posts/learning-resources/&quot;&gt;book&lt;/a&gt; and on the &lt;a href=&quot;https://coupling.dev/&quot;&gt;Balanced Coupling website&lt;/a&gt;. Khononov’s model has some overlap with connascence. He defines three slightly different dimensions of coupling:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;&lt;strong&gt;Integration Strength&lt;/strong&gt; - comparable but with a slightly different angle than connascence strength;&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Distance&lt;/strong&gt; - what is coupled: methods, objects, packages, services, systems;&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Volatility&lt;/strong&gt; - how stable or volatile are the different coupled elements.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The volatility (or stability) of elements is referenced in the Connascence model but it does not define it as a dimension. It is a useful addition to consider explicitly, because coupling is about changing elements together. When things don’t have to change, coupling is not an issue.&lt;/p&gt;

&lt;h2 id=&quot;further-reading&quot;&gt;Further reading&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.linkedin.com/pulse/i-still-feel-urge-reuse-code-even-though-know-its-wrong-dilger-yphie/&quot;&gt;I Still Feel the Urge to Reuse Code (Even Though I Know It’s Wrong)&lt;/a&gt; by Martin Dilger&lt;/li&gt;
  &lt;li&gt;Another good read from this year is &lt;a href=&quot;https://ewolff.com/2026/01/08/cohesion-modules-hierachies.html&quot;&gt;Cohesion, Modules, and Hierarchies&lt;/a&gt; by Eberhard Wolff&lt;/li&gt;
  &lt;li&gt;Meilir Page-Jones, Fundamentals of OO Design in UML (1999)&lt;/li&gt;
  &lt;li&gt;Meilir Page-Jones, &lt;a href=&quot;https://dl.acm.org/doi/10.1145/130994.131004&quot;&gt;Comparing Techniques by Means of Encapsulation and Connascence&lt;/a&gt;, in Communications of the ACM Sept 1992&lt;/li&gt;
  &lt;li&gt;Jim Weirich, &lt;a href=&quot;https://www.youtube.com/watch?v=NLT7Qcn_PmI&quot;&gt;The Grand Unified Theory of Software Design&lt;/a&gt;, at the Acts as Conference 2009&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://connascence.io&quot;&gt;Connascence.io&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;Vlad Khononov, &lt;a href=&quot;https://vladikk.com/page/books/&quot;&gt;Balancing Coupling in Software Design&lt;/a&gt; (2024)&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;whats-next&quot;&gt;What’s next&lt;/h2&gt;

&lt;p&gt;This post is a first of a series about connascence and coupling. The next post will focus on Connascence by Name and by Type, the two weakest, most explicit forms of connascence.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;em&gt;Part 1 - Introduction&lt;/em&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/2026/05/13/connascence-name-type&quot;&gt;Part 2 - Connascence by Name and Type&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/2026/05/21/connascence-meaning&quot;&gt;Part 3 - Connascence by Meaning&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/2026/05/29/connascence-position&quot;&gt;Part 4 - Connascence by Position&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/2026/06/03/connascence-algorithm&quot;&gt;Part 5 - Connascence by Algorithm&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/2026/06/08/connascence-execution-order&quot;&gt;Part 6 - Connascence by Execution Order&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/2026/06/17/connascence-value&quot;&gt;Part 8 - Connascence by Value&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/2026/06/17/connascence-value&quot;&gt;Part 8 - Connascence by Value&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/2026/06/24/connascence-identity&quot;&gt;Part 9 - Connascence by Identity&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/2026/06/29/connascence-managing-coupling&quot;&gt;Part 10 - Heuristics for managing coupling&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;aside&gt;
&lt;h3&gt;Decouple more deliberately!&lt;/h3&gt;
&lt;p&gt;We offer hands-on workshops about connascence and refactoring towards loosely coupled, highly cohesive systems.
&lt;/p&gt;
&lt;div&gt;
&lt;a href=&quot;/contact&quot;&gt;Let&apos;s have a chat&lt;/a&gt;
&lt;/div&gt;
&lt;/aside&gt;
</description>
        <pubDate>Fri, 08 May 2026 00:00:00 +0000</pubDate>
        <link>https://qwan.eu/2026/05/08/connascence-intro.html</link>
        <guid isPermaLink="true">https://qwan.eu/2026/05/08/connascence-intro.html</guid>
        
        <category>architecture</category>
        
        <category>coupling</category>
        
        <category>design</category>
        
        
      </item>
    
  </channel>
</rss>
