<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Dependency-Injection on Brian Faust</title><link>https://wimdy.works/tags/dependency-injection/</link><description>Recent content in Dependency-Injection 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://wimdy.works/tags/dependency-injection/rss.xml" rel="self" type="application/rss+xml"/><item><title>Dependencies Should Be Visible at Construction</title><link>https://wimdy.works/thoughts/dependencies-should-be-visible-at-construction/</link><pubDate>Mon, 01 Jun 2020 00:00:00 +0000</pubDate><guid>https://wimdy.works/thoughts/dependencies-should-be-visible-at-construction/</guid><description>&lt;p&gt;This line created a database record:&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;span class="sr-only" data-copy-status role="status" aria-live="polite"&gt;&lt;/span&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="nv"&gt;$user&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;UserFactory&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="na"&gt;new&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="na"&gt;create&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="s1"&gt;&amp;#39;external_id&amp;#39;&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;123&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&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 also performed an HTTP request.&lt;/p&gt;
&lt;p&gt;The factory did not mention a client. The model did not accept one. A
synchronous observer noticed the external identifier, prepared a profile
export, and resolved a connector from global framework state. The connector
then looked up a remote account.&lt;/p&gt;
&lt;p&gt;In tests without a fake, that lookup reached DNS or the network and retried
three times with exponential backoff. Tests which had run in under five
seconds took more than thirty. The slow test was annoying, but it was only the
visible symptom. A local-looking construction operation had acquired an
undeclared remote dependency.&lt;/p&gt;</description></item></channel></rss>