<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Domain-Modeling on Brian Faust</title><link>https://vacua.dev/tags/domain-modeling/</link><description>Recent content in Domain-Modeling 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/domain-modeling/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>Time Zones Are Part of the Data Model</title><link>https://vacua.dev/thoughts/time-zones-are-part-of-the-data-model/</link><pubDate>Thu, 01 Jun 2017 00:00:00 +0000</pubDate><guid>https://vacua.dev/thoughts/time-zones-are-part-of-the-data-model/</guid><description>&lt;p&gt;One metering path assigns an event to a billing month after converting its
occurrence time into the account&amp;rsquo;s timezone. The same path derives its daily
usage key directly from the occurrence timestamp without that conversion.&lt;/p&gt;
&lt;p&gt;Near midnight, those two fields can disagree:&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;event instant: May 31, 21:30 UTC
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;local business time: June 1, 00:30
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;billing period: June
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;stored usage date: May 31&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
 &lt;/div&gt;
&lt;/figure&gt;
&lt;p&gt;Each expression looks like a date calculation. They model different things.
The defect appears only when the difference changes a boundary.&lt;/p&gt;</description></item><item><title>Null Is a Domain Decision</title><link>https://vacua.dev/thoughts/null-is-a-domain-decision/</link><pubDate>Sat, 01 Apr 2017 00:00:00 +0000</pubDate><guid>https://vacua.dev/thoughts/null-is-a-domain-decision/</guid><description>&lt;p&gt;We added four nullable fields to preserve a pricing snapshot: net amount, tax
rate, tax amount, and gross amount.&lt;/p&gt;
&lt;p&gt;Each field could now be absent. That did not mean each field was independently
optional.&lt;/p&gt;
&lt;p&gt;For older records, all four nulls meant one thing: this record predates the
snapshot and does not contain captured pricing evidence. For new records, all
four values had to arrive together. A row containing gross and net but no tax
rate was not “partly known.” It was invalid.&lt;/p&gt;</description></item></channel></rss>