<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>State-Machines on Brian Faust</title><link>https://vacua.dev/tags/state-machines/</link><description>Recent content in State-Machines on Brian Faust</description><generator>Hugo</generator><language>en-US</language><lastBuildDate>Mon, 01 Jan 0001 00:00:00 +0000</lastBuildDate><atom:link href="https://vacua.dev/tags/state-machines/rss.xml" rel="self" type="application/rss+xml"/><item><title>A Method Should Tell You What Changed</title><link>https://vacua.dev/thoughts/a-method-should-tell-you-what-changed/</link><pubDate>Thu, 01 Oct 2020 00:00:00 +0000</pubDate><guid>https://vacua.dev/thoughts/a-method-should-tell-you-what-changed/</guid><description>&lt;p&gt;A balance reservation could be pending, captured, released, or expired. Only a
pending reservation could move to one of the other three states.&lt;/p&gt;
&lt;p&gt;That gave the system three commands:&lt;/p&gt;
&lt;figure class="code-figure"&gt;
 &lt;div class="code-block" data-copy-code&gt;
 &lt;button class="copy-code" type="button" aria-label="Copy code"&gt;copy&lt;/button&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;capture reservation
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;release reservation
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;expire reservation&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
 &lt;/div&gt;
&lt;/figure&gt;
&lt;p&gt;It did not get one method called &lt;code&gt;updateReservation()&lt;/code&gt; with a status argument.
The names said which transition the caller intended. The responses included the
resulting status, so a caller did not have to guess what a successful request
had produced.&lt;/p&gt;</description></item></channel></rss>