<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Validation on Brian Faust</title><link>https://vacua.dev/tags/validation/</link><description>Recent content in Validation 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/validation/rss.xml" rel="self" type="application/rss+xml"/><item><title>A Primitive Can Hide a Domain Decision</title><link>https://vacua.dev/thoughts/a-primitive-can-hide-a-domain-decision/</link><pubDate>Wed, 01 Apr 2020 00:00:00 +0000</pubDate><guid>https://vacua.dev/thoughts/a-primitive-can-hide-a-domain-decision/</guid><description>&lt;p&gt;Uppercasing a country code looks like normalization:&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-php" data-lang="php"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;mb_strtoupper&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$input&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;&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 makes &lt;code&gt;fi&lt;/code&gt; and &lt;code&gt;FI&lt;/code&gt; equal. It also turns &lt;code&gt;finland&lt;/code&gt; into &lt;code&gt;FINLAND&lt;/code&gt; and leaves
&lt;code&gt;FIN&lt;/code&gt; looking plausible.&lt;/p&gt;
&lt;p&gt;The function has changed the string&amp;rsquo;s shape. It has not answered the domain
question: is this a supported country identity in the representation this
boundary promises?&lt;/p&gt;
&lt;p&gt;A primitive becomes expensive when every caller must remember that answer.
The reason to introduce a domain type is not that strings are unfashionable.
It is that the scalar no longer carries enough of the contract.&lt;/p&gt;</description></item><item><title>Invalid State Should Be Difficult to Construct</title><link>https://vacua.dev/thoughts/invalid-state-should-be-difficult-to-construct/</link><pubDate>Sat, 01 Feb 2020 00:00:00 +0000</pubDate><guid>https://vacua.dev/thoughts/invalid-state-should-be-difficult-to-construct/</guid><description>&lt;p&gt;A wallet reservation held one amount while a booking was in progress. When the
booking later reached the billing system, an imported record could contain no
price. The reservation knew how much money had been held, but not how that
amount divided into net price and VAT.&lt;/p&gt;
&lt;p&gt;There was no authoritative way to create the final sale from the hold alone.
Inferring a tax rate would turn a guess into accounting data.&lt;/p&gt;</description></item><item><title>Validate at the Boundary You Control</title><link>https://vacua.dev/thoughts/validate-at-the-boundary-you-control/</link><pubDate>Thu, 01 Mar 2018 00:00:00 +0000</pubDate><guid>https://vacua.dev/thoughts/validate-at-the-boundary-you-control/</guid><description>&lt;p&gt;A booking request contains a recipient email and a phone number made entirely
of spaces.&lt;/p&gt;
&lt;p&gt;For one delivery service, email is enough. For the same service with a
particular handoff option, a phone number is mandatory. For another service,
phone is always mandatory.&lt;/p&gt;
&lt;p&gt;There is no honest global rule such as “phone is nullable” or “phone is
required.” The invariant depends on the operation the request asks the system
to perform.&lt;/p&gt;</description></item></channel></rss>