<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Jordy Baylac on Medium]]></title>
        <description><![CDATA[Stories by Jordy Baylac on Medium]]></description>
        <link>https://medium.com/@jbaylacc?source=rss-9894dffb7be7------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*RYlleqoMzYFLbUfM9Rqiug.jpeg</url>
            <title>Stories by Jordy Baylac on Medium</title>
            <link>https://medium.com/@jbaylacc?source=rss-9894dffb7be7------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 02:08:05 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@jbaylacc/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How two software development principles can save your project]]></title>
            <link>https://medium.com/free-code-camp/how-2-software-development-principles-can-save-your-project-573fc10461cb?source=rss-9894dffb7be7------2</link>
            <guid isPermaLink="false">https://medium.com/p/573fc10461cb</guid>
            <category><![CDATA[tech]]></category>
            <category><![CDATA[design-patterns]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Jordy Baylac]]></dc:creator>
            <pubDate>Fri, 18 Jan 2019 01:38:33 GMT</pubDate>
            <atom:updated>2019-06-24T01:43:08.052Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5IVmxQk8nIcC_qJ4n2fWBw.jpeg" /></figure><h3>Introduction</h3><p>In this post I will focus on explaining how one Design Pattern (<strong>Inversion Of Control</strong>) and one Practice (<strong>YAGNI</strong>) can reduce the possibility of having a failed software project. You can start applying these techniques right away.</p><p>If you are an Engineering Manager, this is a good read if you want to reduce the volatility on the marginal cost of features 💪.</p><h3>Inversion of Control (IoC)</h3><p>Did I mean <em>Dependency Injection</em>? Not really, but we can use Dependency Injection as the tool to achieve Inversion Of Control between dependencies.</p><p><strong>IoC </strong>can help in changing the dependency direction. It can help in situations when component A depends on component B, and now you want A to be unaware of the implementation details of B.</p><p><strong>Current situation</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/511/1*RCx6u3_JOxc8XPZxR134UQ.png" /><figcaption><em>Component A depends on Component B.</em></figcaption></figure><p><strong>Target situation</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/506/1*1ZjKqM1zSvmGvr5ygWptdA.png" /><figcaption><em>Component A does not depends on the implementation details of component B.</em></figcaption></figure><p>With the last approach, component A does not depend on the specifics of component B. In fact, new implementations of <em>IBehaviourB </em>could be added to the project without even touching component A.</p><h4>Code example</h4><p><em>An unknown application having three well-known layers.</em></p><pre>UI -&gt; REST API -&gt; Database</pre><p>Zooming into the REST API we found <em>UsersController </em>class. We noted that it is reading and writing from/to a <em>SQLServer Database</em>. Below is a possible implementation on C#:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/22ddbef635e4b8a151bee357fd37c93f/href">https://medium.com/media/22ddbef635e4b8a151bee357fd37c93f/href</a></iframe><p>If you consider the above solution not to be a good design, you are right 👌.</p><p>In the example, <em>UsersController </em>is <strong>tightly coupled</strong> with the SQLServer implementation. The <em>postUser </em>method makes it difficult to write <strong>Tests </strong>(remember that a unit-test should not hit databases or external services). As the application scales there will be a high dependency on the specific SQLServer library used. If somebody decides to split the application by domain area, it can be late 💥.</p><p>This code example corresponds with the <strong>“current situation” </strong>presented at the beginning of the article. In this case:</p><ul><li><strong>A</strong> = <em>UsersController</em></li><li><strong>B</strong> = <em>System.Data.SqlClient</em> on .NET</li></ul><p>But wait…</p><p><strong>What if we apply Inversion of Control</strong> so that UsersController does not depend on a specific SQLServer implementation? What if we make the REST API unaware of what Persistence layer we are using?</p><p>😬, ok, let’s do it:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*E4rMivDDauz8sM-KiJuCEA.jpeg" /></figure><p><strong>20 days later </strong>😜:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9fd063f8399330554e81e943a8f77bba/href">https://medium.com/media/9fd063f8399330554e81e943a8f77bba/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8c3db4682be104bb71c70aa86e03ba15/href">https://medium.com/media/8c3db4682be104bb71c70aa86e03ba15/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/bcb9e8fba54192223d4cbe1f275247eb/href">https://medium.com/media/bcb9e8fba54192223d4cbe1f275247eb/href</a></iframe><p>For simplicity’s sake, we have denoted three source files, but in practice, they could be split or located on separates assemblies or folders. This solution corresponds with the <strong>“target situation”</strong> presented at the beginning. In this case:</p><ul><li><strong>A</strong> = <em>UsersController</em></li><li><strong>B</strong> = <em>SQLUserService</em></li><li><strong>IBehaviourB </strong>= <em>IUserService</em>.</li></ul><p>We did it!</p><p>Oh, but wait, how is the <em>IUserService </em>dependency injected on the constructor of <em>UsersController</em>? Well, the implementation details of that are out of the scope of this article. However, if you are interested, check out the tutorial I added at the end.</p><h4>Benefits</h4><ul><li>Our architecture is open for extensions. Also, we reduced the necessity of modification in existing classes. <strong>Open/Close</strong> principle 😎</li><li>Tests are easy to write. We can inject a mock <em>UserService </em>when testing UsersController 👌</li><li>Business logic is not coupled and does not depend on any <em>persistence </em>strategy. ⭐️</li></ul><h3>YAGNI</h3><p><em>You aren’t going to need it!</em></p><p>I consider that every developer should adopt YAGNI as one of their core practices. This principle can save you from over engineering and having unused code (<em>untouchable</em>). It can also save your job.</p><p><strong>A funny small story:</strong></p><p>I worked in a project where Software Architects decided to represent almost all <strong>boolean </strong>columns in the database with a <strong>char </strong>datatype. At least they were using English — <strong>true </strong>was stored as “Y”, <strong>false </strong>with “N”. This makes sense right? When I asked how so magical a solution was conceived, they replied:</p><p><em>“In this way, we are open to the possibility that a third state can come in”.</em></p><p>I never understood how a <strong>true/false</strong> thing can have a third state (perhaps they thought about qubits). As you may note, this ended up being a really bad decision and the consequences were present all over the code. I found things like:</p><pre>if (supportOrderType === &quot;Y&quot; || supportOrderType === &quot;y&quot;) { ...</pre><p>Code readability was affected, and SQL queries were also affected.</p><p>But this didn’t stop there. With time, the software added internationalization to its user interfaces. Some configuration and catalogs were provided by the client itself using a GUI application. We get to the point in which some of our <strong>boolean </strong>columns had “S” and “N” (<strong>S</strong>i and <strong>N</strong>o in Spanish).</p><p>The code was really unmaintainable. I don’t want to talk about the solution they proposed 😫.</p><h3>Conclusions</h3><p>According to Uncle Bob, <em>good developers will try to maximize the number of decisions not made</em>. Do not write something that you believe is going to be helpful in six months. Instead, wait the six months, take a look at your architecture, see how much it has evolved, and then, do the work. Apply YAGNI.</p><p>You should manage your dependencies properly. Inversion of Control will guide you on that.</p><p>I hope to get into your conscious and help you be a better developer.</p><blockquote>“Any fool can write code that a computer can understand. Good programmers write code that humans can understand.” ― <strong>Martin Fowler</strong></blockquote><h3>Read more on</h3><ul><li><a href="https://www.codeproject.com/Articles/1234518/Dependency-Injection-using-Unity-Resolve-dependenc">Dependency Injection on C#</a></li><li><a href="https://nehalist.io/dependency-injection-in-typescript/">TypeScript dependency injection.</a></li><li><a href="https://martinfowler.com/bliki/Yagni.html">Martin Fowler on YAGNI</a></li></ul><p><strong>Please share your thoughts and ask any questions. I’ll be glad to answer</strong> them. 😉 <strong>Find me</strong> <strong>on </strong><a href="https://twitter.com/jbaylacc"><strong>twitter</strong></a><strong>.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=573fc10461cb" width="1" height="1" alt=""><hr><p><a href="https://medium.com/free-code-camp/how-2-software-development-principles-can-save-your-project-573fc10461cb">How two software development principles can save your project</a> was originally published in <a href="https://medium.com/free-code-camp">We’ve moved to freeCodeCamp.org/news</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>