<story><title>Indirection Is Not Abstraction</title><url>https://www.silasreinagel.com/blog/2018/10/30/indirection-is-not-abstraction/</url></story><parent_chain></parent_chain><comment><author>gregmac</author><text>&amp;gt; The users of this software would be very disappointed if any of these indirections involved adding any number besides 3.&lt;p&gt;What? No, it works great to add numbers beside 3:&lt;p&gt;&lt;pre&gt;&lt;code&gt;    class Sample {
        public Sample(IThreeProvider threeProvider) {
             _threeProvider = threeProvider;
        }

        private readonly IThreeProvider _threeProvider;
  
        public int AddThree(int val)
        {
            return val + _threeProvider.Get().AsInt();
        }
    }

    public class MyCustomThreeProvider() {
       public int Get() { return 4; }
    }
&lt;/code&gt;&lt;/pre&gt;
Now you can just do:&lt;p&gt;&lt;pre&gt;&lt;code&gt;    var sample = new Sample(new MyCustomThreeProvider()); 
    sample.AddThree(2); 
&lt;/code&gt;&lt;/pre&gt;
And get 6, as you&amp;#x27;d expect. ..So long as you read and fully understood the &lt;i&gt;entire&lt;/i&gt; codebase first, anyway.&lt;p&gt;I think this actually highlights one of the bigger problems in adding unnecessary indirections: that it practically begs for strange work-around and hacks and strange layers added on top. It becomes too difficult to change the underlying classes -- eg, changing the AddThree method to handle an arbitrary number means also changing the entire concept of ThreeProviders and everywhere that calls or tests any of the related code -- and as a result it&amp;#x27;s faster to workaround.</text></comment>
<story><title>Indirection Is Not Abstraction</title><url>https://www.silasreinagel.com/blog/2018/10/30/indirection-is-not-abstraction/</url></story><parent_chain></parent_chain><comment><author>bjpbakker</author><text>Of course the original post about Indirection vs Abstract was by Zed A. Shaw [0].&lt;p&gt;I strongly like to urge authors to give credit where credit is due. IMO this post should have at least mentioned the original article.&lt;p&gt;[0] - &lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;zedshaw.com&amp;#x2F;archive&amp;#x2F;indirection-is-not-abstraction&amp;#x2F;&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;zedshaw.com&amp;#x2F;archive&amp;#x2F;indirection-is-not-abstraction&amp;#x2F;&lt;/a&gt;</text></comment>