Rename book to Process Control

This commit is contained in:
MatsuneMikuroi committed 2026-09-29 12:34:56 +02:00
1 parent 919e79eb2a
commit afb816f459
53 files changed
+5587 -503

No files matched your search

+67 -23
View File
@@ -7,7 +7,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
<title>2&nbsp; Part I — Start with what you already know – From Calling to Eventing</title>
<title>2&nbsp; Part I — Start with what you already know – Process Control</title>
<style>
/* Default styles provided by pandoc.
** See https://pandoc.org/MANUAL.html#variables-for-html for config info.
@@ -87,9 +87,13 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
<link href="site_libs/quarto-contrib/calc-exo-2.0.0/exo.css" rel="stylesheet">
<script src="site_libs/quarto-contrib/calc-quiz-1.0.0/quiz.js"></script>
<link href="site_libs/quarto-contrib/calc-quiz-1.0.0/quiz.css" rel="stylesheet">
<link href="site_libs/quarto-contrib/calc-further-1.0.0/further.css" rel="stylesheet">
<link href="site_libs/quarto-contrib/calc-latex-tables-1.0.0/latex-tables.css" rel="stylesheet">
<script src="site_libs/quarto-contrib/calc-notes-1.0.0/calc-notes.js"></script>
<link href="site_libs/quarto-contrib/calc-notes-1.0.0/theme.css" rel="stylesheet">
<link href="site_libs/quarto-contrib/calc-notes-1.0.0/high-contrast.css" rel="stylesheet">
<link href="site_libs/quarto-contrib/calc-notes-1.0.0/calc-notes.css" rel="stylesheet">
<link href="site_libs/quarto-contrib/calc-notes-1.0.0/narrow.css" rel="stylesheet">
<script src="site_libs/quarto-contrib/calc-glossary-2.0.0/glossary.js"></script>
<link href="site_libs/quarto-contrib/calc-glossary-2.0.0/glossary.css" rel="stylesheet">
<script id="quarto-search-options" type="application/json">{
@@ -132,7 +136,7 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
nothing is attached to the links themselves: one capture-phase listener on
the document reads the link's final address at click time.
If a language has not been built (./render-all.sh), its pages do not exist:
If a language has not been built, its pages do not exist:
the target is checked first and a short note is shown instead of a
"Not Found" page.
@@ -148,12 +152,9 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
var ROOT_LANG = 'en'; // the language at the top of _book/
var COOKIE = 'notes-lang';
var NOTE = {
de: 'Diese Sprache wurde noch nicht erstellt. Einmal ./render-all.sh ausführen – '
+ 'danach funktioniert der Wechsel auch in der Vorschau.',
fr: 'Cette langue n’a pas encore été générée. Lancez une fois ./render-all.sh : '
+ 'ensuite le changement fonctionne aussi dans l’aperçu.',
en: 'This language hasn’t been built yet. Run ./render-all.sh once, '
+ 'then switching works in the preview too.'
de: 'Diese Sprache ist hier noch nicht verfügbar.',
fr: 'Cette langue n’est pas encore disponible ici.',
en: 'This language is not available here yet.'
};
var here = (document.documentElement.lang || ROOT_LANG).slice(0, 2);
@@ -167,9 +168,20 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
var m = document.cookie.match(/(?:^|;\s*)notes-lang=(de|fr|en)(?:;|$)/);
return m ? m[1] : null;
}
// path '/' on purpose: every book of these notes is served from one host,
// each under its own folder, so a language picked in any of them is the
// language all of them open in. A book hosted on its own would be no worse
// off -- the cookie simply has nothing else to reach.
var COOKIE_PATH = '/';
function remember(code) {
document.cookie = COOKIE + '=' + code + '; path=' + root + '; max-age=31536000; SameSite=Lax'
document.cookie = COOKIE + '=' + code + '; path=' + COOKIE_PATH
+ '; max-age=31536000; SameSite=Lax'
+ (location.protocol === 'https:' ? '; Secure' : '');
// a copy written under the book's own path by an earlier version would be
// the more specific one and would shadow the shared cookie for good
if (root !== COOKIE_PATH) {
document.cookie = COOKIE + '=; path=' + root + '; max-age=0';
}
}
// a returning reader lands in the language picked last time
@@ -191,7 +203,11 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
box.style.cssText = 'position:fixed;left:50%;bottom:1.25rem;transform:translateX(-50%);'
+ 'max-width:min(34rem,calc(100vw - 2rem));padding:.6rem .9rem;border-radius:6px;'
+ 'background:#1f2328;color:#fff;font-size:.85rem;line-height:1.4;z-index:2000;'
+ 'box-shadow:0 4px 16px rgba(0,0,0,.25)';
// a status message, so it keeps its own dark surface in either mode; the
// hairline is the page's rule colour, invisible on a light page and an
// edge against a dark one, where the shadow alone no longer separates it
+ 'border:1px solid var(--calc-line,#444);'
+ 'box-shadow:0 4px 16px var(--calc-shadow,rgba(0,0,0,.25))';
document.body.appendChild(box);
setTimeout(function () { box.remove(); }, 7000);
}
@@ -232,7 +248,35 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
}, true);
})();
</script>
<style>:root { --calc-notecolor: #B45309; }</style>
<style>:root {
--calc-furthercolor-src: #6B3FA0;
--calc-furthercolor: var(--calc-furthercolor-src);
}</style>
<style>:root {
--calc-notecolor-src: #B45309;
--calc-notecolor: var(--calc-notecolor-src);
}</style>
<script>(function (e) {
var KEY = 'notes-contrast', forced = false;
var picked = null;
try { picked = localStorage.getItem(KEY); } catch (err) {}
var q = null;
try { q = window.matchMedia && window.matchMedia('(prefers-contrast: more)'); } catch (err) {}
if (picked === 'more' || (picked !== 'normal' && (forced || (q && q.matches)))) {
e.classList.add('hc');
}
if (q) {
var f = function () {
var p = null;
try { p = localStorage.getItem(KEY); } catch (err) {}
if (p === null) e.classList.toggle('hc', forced || q.matches);
};
if (q.addEventListener) q.addEventListener('change', f);
else if (q.addListener) q.addListener(f);
}
})(document.documentElement);</script>
</head>
@@ -261,7 +305,7 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
<nav id="quarto-sidebar" class="sidebar collapse collapse-horizontal quarto-sidebar-collapse-item sidebar-navigation docked overflow-auto">
<div class="pt-lg-2 mt-2 text-left sidebar-header">
<div class="sidebar-title mb-0 py-0">
<a href="./">From Calling to Eventing</a>
<a href="./">Process Control</a>
<div class="sidebar-tools-main tools-wide">
<div class="dropdown">
<a href="" title="" id="quarto-navigation-tool-dropdown-0" class="quarto-navigation-tool dropdown-toggle px-1" data-bs-toggle="dropdown" aria-expanded="false" role="link" aria-label=""><i class="bi bi-translate"></i></a>
@@ -283,7 +327,7 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
</li>
</ul>
</div>
<a href="./From-Calling-to-Eventing.pdf" title="Download PDF" class="quarto-navigation-tool px-1" aria-label="Download PDF"><i class="bi bi-file-pdf"></i></a>
<a href="./Process-Control.pdf" title="Download PDF" class="quarto-navigation-tool px-1" aria-label="Download PDF"><i class="bi bi-file-pdf"></i></a>
<a href="" class="quarto-reader-toggle quarto-navigation-tool px-1" onclick="window.quartoToggleReader(); return false;" title="Toggle reader mode">
<div class="quarto-reader-toggle-btn">
<i class="bi"></i>
@@ -308,7 +352,7 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="./00-orientation.html" class="sidebar-item-text sidebar-link">
<span class="menu-text"><span class="chapter-number">1</span>&nbsp; <span class="chapter-title">Step 0 — What the tutorial is about</span></span></a>
<span class="menu-text"><span class="chapter-number">1</span>&nbsp; <span class="chapter-title">Step 0 — What this is about</span></span></a>
</div>
</li>
<li class="sidebar-item">
@@ -417,7 +461,7 @@ Figure&nbsp;2.1: The procedural version. The wiring is written into the code: <c
<section id="sec-step-2" class="level2" data-number="2.2">
<h2 data-number="2.2" class="anchored" data-anchor-id="sec-step-2"><span class="header-section-number">2.2</span> Step 2 — Three egoistic capabilities</h2>
<p>An <strong>egoistic</strong> component says: I know what I can do, what data I accept and what data I produce — and I would rather not know the business process around me. Concretely, <code>ConsoleIn</code> must not contain <code>rot13(...)</code>, and <code>ROT13</code> must not contain <code>consoleOut(...)</code>.</p>
<p>Removing those calls immediately creates a problem, which the tutorial states as a question: if nobody knows anybody, <strong>who makes this into a system?</strong> Note what the question does <em>not</em> say: the knowledge is not gone, it has to go somewhere else. Two connections are missing, not one — <code>ConsoleIn ↔︎ ROT13</code> and <code>ROT13 ↔︎ ConsoleOut</code>.</p>
<p>Removing those calls immediately creates a problem, best put as a question: if nobody knows anybody, <strong>who makes this into a system?</strong> Note what the question does <em>not</em> say: the knowledge is not gone, it has to go somewhere else. Two connections are missing, not one — <code>ConsoleIn ↔︎ ROT13</code> and <code>ROT13 ↔︎ ConsoleOut</code>.</p>
</section>
<section id="sec-step-3" class="level2" data-number="2.3">
<h2 data-number="2.3" class="anchored" data-anchor-id="sec-step-3"><span class="header-section-number">2.3</span> Step 3 — Give every capability a mailbox</h2>
@@ -429,7 +473,7 @@ Figure&nbsp;2.1: The procedural version. The wiring is written into the code: <c
<span id="cb2-5"><a href="#cb2-5" aria-hidden="true" tabindex="-1"></a><span class="bu">BlockingQueue</span><span class="op">&lt;</span>Message<span class="op">&gt;</span> <span class="fu">mailbox</span><span class="op">(</span><span class="bu">String</span> name<span class="op">)</span> <span class="op">{</span></span>
<span id="cb2-6"><a href="#cb2-6" aria-hidden="true" tabindex="-1"></a> <span class="cf">return</span> mailboxes<span class="op">.</span><span class="fu">computeIfAbsent</span><span class="op">(</span>name<span class="op">,</span> _ <span class="op">-&gt;</span> <span class="kw">new</span> <span class="bu">LinkedBlockingQueue</span><span class="op">&lt;&gt;());</span></span>
<span id="cb2-7"><a href="#cb2-7" aria-hidden="true" tabindex="-1"></a><span class="op">}</span></span></code></pre></div><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></div>
<p>The tutorial insists on calling these <strong>mailboxes</strong>, not topics, and gives the reason: if two readers call <code>take()</code> on the same mailbox, they compete — each message goes to exactly <em>one</em> of them and is not copied to both. A topic, in Publish/Subscribe, would hand every subscriber its own copy. One reader per message is enough for now, and the limitation is kept on purpose: it is what makes it clear later what Publish/Subscribe actually adds.</p>
<p>These are <strong>mailboxes</strong>, not topics, and the distinction is worth insisting on: if two readers call <code>take()</code> on the same mailbox, they compete — each message goes to exactly <em>one</em> of them and is not copied to both. A topic, in Publish/Subscribe, would hand every subscriber its own copy. One reader per message is enough for now, and the limitation is kept on purpose: it is what makes it clear later what Publish/Subscribe actually adds.</p>
</section>
<section id="sec-steps-4-6" class="level2" data-number="2.4">
<h2 data-number="2.4" class="anchored" data-anchor-id="sec-steps-4-6"><span class="header-section-number">2.4</span> Steps 4–6 — The three capabilities become egoistic</h2>
@@ -460,7 +504,7 @@ Figure&nbsp;2.1: The procedural version. The wiring is written into the code: <c
</tr>
</tbody>
</table>
<p>No capability contains the name of another. The tutorial’s own summary of the result: “three nicely isolated capabilities. And they do absolutely nothing together.” Nothing moves a message from <code>consoleIn.outbox</code> to <code>rot13.inbox</code>, or from <code>rot13.outbox</code> to <code>consoleOut.inbox</code>.</p>
<p>No capability contains the name of another, and that is exactly the result: three nicely isolated capabilities that do absolutely nothing together. Nothing moves a message from <code>consoleIn.outbox</code> to <code>rot13.inbox</code>, or from <code>rot13.outbox</code> to <code>consoleOut.inbox</code>.</p>
</section>
<section id="sec-step-7" class="level2" data-number="2.5">
<h2 data-number="2.5" class="anchored" data-anchor-id="sec-step-7"><span class="header-section-number">2.5</span> Step 7 — Enter the mediator</h2>
@@ -485,7 +529,7 @@ Figure&nbsp;2.2: The mediated version inside one JVM. In the web version, <stron
<section id="sec-step-8" class="level2" data-number="2.6">
<h2 data-number="2.6" class="anchored" data-anchor-id="sec-step-8"><span class="header-section-number">2.6</span> Step 8 — Ask again: who knows whom?</h2>
<p>Does ConsoleIn know ROT13? No.&nbsp;Does ROT13 know ConsoleIn or ConsoleOut? No.&nbsp;Has the topology disappeared? No — it sits in the two <code>mediate(...)</code> calls inside <code>main()</code>.</p>
<p>This is the tutorial’s first major result:</p>
<p>This is the first major result:</p>
<blockquote class="blockquote">
<p><strong>Decoupling often does not make knowledge disappear. It moves knowledge to where it belongs.</strong></p>
</blockquote>
@@ -494,7 +538,7 @@ Figure&nbsp;2.2: The mediated version inside one JVM. In the web version, <stron
<section id="sec-step-9" class="level2" data-number="2.7">
<h2 data-number="2.7" class="anchored" data-anchor-id="sec-step-9"><span class="header-section-number">2.7</span> Step 9 — Why virtual threads?</h2>
<p>Five loops now wait indefinitely: the keyboard, <code>rot13.inbox</code>, <code>consoleOut.inbox</code> and the two mediators’ sources. Virtual threads are simply the cheap Java way to let five waits happen at once inside one JVM.</p>
<p>They are an implementation convenience, not an architecture. The architecture — who knows whom, and where the wiring lives — is in the mailbox names, not in the threads. The tutorial’s own evidence for the separation: the same architecture will run as separate processes in step 11, with no threads shared between the parts.</p>
<p>They are an implementation convenience, not an architecture. The architecture — who knows whom, and where the wiring lives — is in the mailbox names, not in the threads. The evidence for the separation: the same architecture will run as separate processes in step 11, with no threads shared between the parts.</p>
</section>
<section id="sec-step-10" class="level2" data-number="2.8">
<h2 data-number="2.8" class="anchored" data-anchor-id="sec-step-10"><span class="header-section-number">2.8</span> Step 10 — Keep the services egoistic</h2>
@@ -521,7 +565,7 @@ Figure&nbsp;2.2: The mediated version inside one JVM. In the web version, <stron
</tr>
</tbody>
</table>
<p>The tutorial is honest about the price: this design “may look indirect — even a little odd”, and it promises a different way to keep services egoistic <em>without</em> a mediator in every message’s path.</p>
<p>The price is worth stating plainly: this design may look indirect — even a little odd. There is another way to keep services egoistic <em>without</em> a mediator in every message’s path, and it comes later.</p>
</section>
<section id="sec-part-i-result" class="level2" data-number="2.9">
<h2 data-number="2.9" class="anchored" data-anchor-id="sec-part-i-result"><span class="header-section-number">2.9</span> What part I moved</h2>
@@ -551,7 +595,7 @@ Figure&nbsp;2.2: The mediated version inside one JVM. In the web version, <stron
</tr>
</tbody>
</table>
<p>Functionality: unchanged. Lines of code: more. Parts that know each other: none. That is the trade the rest of the tutorial keeps testing.</p>
<p>Functionality: unchanged. Lines of code: more. Parts that know each other: none. That is the trade everything that follows keeps testing.</p>
</section>
@@ -1178,8 +1222,8 @@ Figure&nbsp;2.2: The mediated version inside one JVM. In the web version, <stron
</script>
<nav class="page-navigation">
<div class="nav-page nav-page-previous">
<a href="./00-orientation.html" class="pagination-link" aria-label="[Step 0 — What the tutorial is about]{.en}[Étape 0 — De quoi parle le tutoriel]{.fr}[Schritt 0 — Worum es im Tutorial geht]{.de}">
<i class="bi bi-arrow-left-short"></i> <span class="nav-page-text"><span class="chapter-number">1</span>&nbsp; <span class="chapter-title">Step 0 — What the tutorial is about</span></span>
<a href="./00-orientation.html" class="pagination-link" aria-label="[Step 0 — What this is about]{.en}[Étape 0 — De quoi il s'agit]{.fr}[Schritt 0 — Worum es geht]{.de}">
<i class="bi bi-arrow-left-short"></i> <span class="nav-page-text"><span class="chapter-number">1</span>&nbsp; <span class="chapter-title">Step 0 — What this is about</span></span>
</a>
</div>
<div class="nav-page nav-page-next">