<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Factory-Pattern on Alireza Dastyar&#39;s blog</title>
    <link>https://alireza.dastyar.space/tags/factory-pattern/</link>
    <description>Recent content in Factory-Pattern on Alireza Dastyar&#39;s blog</description>
    <generator>Hugo</generator>
    <language>en</language>
    <lastBuildDate>Thu, 02 Dec 2021 00:00:00 +0000</lastBuildDate>
    <atom:link href="https://alireza.dastyar.space/tags/factory-pattern/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>DI: Factory pattern to the rescue</title>
      <link>https://alireza.dastyar.space/blog/technical/dependency-injection-factory-pattern/</link>
      <pubDate>Thu, 02 Dec 2021 00:00:00 +0000</pubDate>
      <guid>https://alireza.dastyar.space/blog/technical/dependency-injection-factory-pattern/</guid>
      <description>&lt;h2 id=&#34;introduction&#34;&gt;Introduction&lt;/h2&gt;&#xA;&lt;p&gt;In this article I&amp;rsquo;ll try to showcase how factory pattern can help us to loosen our code dependency to achieve a better structured/designed software.&#xA;As you probably know dependency injection can help us to develop better software which has more separation of concerns and many more benefits&#xA;that comes with it.&lt;/p&gt;&#xA;&lt;p&gt;All that aside back to the main topic, what has factory pattern got to do with it?&lt;/p&gt;&#xA;&lt;h2 id=&#34;problem&#34;&gt;Problem&lt;/h2&gt;&#xA;&lt;p&gt;Lets assume that we have class A thats depended on class B, we declare our dependency on an abstraction of which class B provides the implementation lets call the abstraction B&amp;rsquo;, so that our code is not depended on a concrete implementation and we inject the B class as the implementation while/after instantiation of an object of type A, in this way&#xA;we have loosen our dependency.&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
