<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Dnyaneshwar Dhakane</title>
    <description>The latest articles on DEV Community by Dnyaneshwar Dhakane (@dnyanesh).</description>
    <link>https://dev.to/dnyanesh</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1948670%2F969b22f6-6153-40fa-a760-41e8c025bd4d.jpg</url>
      <title>DEV Community: Dnyaneshwar Dhakane</title>
      <link>https://dev.to/dnyanesh</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/dnyanesh"/>
    <language>en</language>
    <item>
      <title>Sending Invoices Shouldn’t Be a Headache — So I Built Free Invoice Generator Tool</title>
      <dc:creator>Dnyaneshwar Dhakane</dc:creator>
      <pubDate>Sun, 13 Jul 2025 04:13:20 +0000</pubDate>
      <link>https://dev.to/dnyanesh/sending-invoices-shouldnt-be-a-headache-so-i-built-free-invoice-generator-tool-gf7</link>
      <guid>https://dev.to/dnyanesh/sending-invoices-shouldnt-be-a-headache-so-i-built-free-invoice-generator-tool-gf7</guid>
      <description>&lt;h2&gt;
  
  
  💸 Sending Invoices Shouldn’t Be a Headache — So I Built This Free Invoice Generator Tool
&lt;/h2&gt;

&lt;p&gt;You're done with the project. Client is ready to pay. Now you just need to &lt;strong&gt;generate a professional invoice...&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;But if you’re a &lt;strong&gt;freelancer or shop owner&lt;/strong&gt;, you know the struggle:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Searching for a professional invoice template every time&lt;/li&gt;
&lt;li&gt;Manually editing Word or Excel files&lt;/li&gt;
&lt;li&gt;Forgetting to include tax details or payment terms&lt;/li&gt;
&lt;li&gt;Or worse... sending an outdated, unprofessional invoice 😓&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That’s why I built &lt;a href="//Pro-InvoiceGenerator.com"&gt;Pro-InvoiceGenerator.com&lt;/a&gt; — a clean and powerful &lt;strong&gt;free invoice generator&lt;/strong&gt; to help you create &lt;strong&gt;professional invoices online&lt;/strong&gt; and &lt;strong&gt;download them as PDFs&lt;/strong&gt; in just a few clicks.&lt;/p&gt;

&lt;h4&gt;
  
  
  ✅ What Makes It Useful?
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;🧾 Choose from 3 Professional Templates&lt;/strong&gt; — Freelancer Invoice, Standard tax Invoice, and a Modern Clean Look — all designed for real-world use cases&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;⚡ No Sign-Up, No Delay&lt;/strong&gt; Just fill the form, download your PDF, send to client. That’s it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;📱 Works Great on Mobile&lt;/strong&gt; Need to send an invoice from your shop or on the go? This tool has your back.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🎨 Customizable&lt;/strong&gt; Add your logo, tax info, client details, payment instructions — in seconds.&lt;/p&gt;

&lt;h4&gt;
  
  
  💡 Who Should Use It?
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Freelancers: Designers, developers, writers, marketers, consultants who are tired of ugly Word templates&lt;/li&gt;
&lt;li&gt;Shop Owners &amp;amp; Small Businesses: Service providers, vendors, agencies who don’t want to rely on pen and paper&lt;/li&gt;
&lt;li&gt;Anyone who wants to send a clean, professional invoice PDF in under 2 minutes and get paid faster&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;👉 Try it now:&lt;/strong&gt; &lt;a href="https://pro-invoicegenerator.com" rel="noopener noreferrer"&gt;Pro-InvoiceGenerator.com&lt;/a&gt; It's free, fast, and built to make your work look as professional as it is.&lt;/p&gt;

&lt;p&gt;🙏 I’d love to hear your feedback:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Was it useful?&lt;/li&gt;
&lt;li&gt;Any features you'd want added?&lt;/li&gt;
&lt;li&gt;What could be improved?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Drop your thoughts in the comments or DM me. And if you know someone who needs this — feel free to share.&lt;/p&gt;

</description>
      <category>proinvoicegenerator</category>
      <category>invoicegenerator</category>
      <category>freeinvoice</category>
      <category>freelancelife</category>
    </item>
    <item>
      <title>Abstract Factory vs Factory Pattern in C# .NET: UML &amp; Code Guide</title>
      <dc:creator>Dnyaneshwar Dhakane</dc:creator>
      <pubDate>Sun, 09 Feb 2025 12:39:19 +0000</pubDate>
      <link>https://dev.to/dnyanesh/abstract-factory-vs-factory-pattern-in-c-net-uml-code-guide-428a</link>
      <guid>https://dev.to/dnyanesh/abstract-factory-vs-factory-pattern-in-c-net-uml-code-guide-428a</guid>
      <description>&lt;h3&gt;
  
  
  Factory Design Pattern vs Abstract Factory Design Pattern
&lt;/h3&gt;

&lt;p&gt;Design patterns are powerful tools for building scalable and maintainable software. When it comes to Factory and Abstract Factory patterns, understanding their differences can get tricky if you learn one after the other. This blog offers a comparative approach to clarify their concepts and uses.&lt;/p&gt;

&lt;p&gt;Let's start with the &lt;strong&gt;Factory Design Pattern&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  Factory Design Pattern
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpz5vz7idk3u1xxxbl91j.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpz5vz7idk3u1xxxbl91j.png" alt="Factory Design UML Diagram" width="800" height="472"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The Factory Design Pattern provides an interface for creating objects, allowing subclasses to alter the type of objects that will be created.&lt;/p&gt;

&lt;p&gt;In the UML diagram above, the &lt;code&gt;IDbServerFactory&lt;/code&gt; returns a &lt;code&gt;DbServer&lt;/code&gt; object based on the parameter passed by the user. &lt;/p&gt;

&lt;p&gt;This approach abstracts the creation process, making it simple for clients. For instance, if new providers are integrated, the client code remains unchanged—it simply specifies the provider, and the factory handles the object creation.&lt;/p&gt;

&lt;h3&gt;
  
  
  Example Code:
&lt;/h3&gt;

&lt;p&gt;Imagine a client (&lt;code&gt;FactoryDesignPattern&lt;/code&gt;) that needs an Azure DB server. By calling &lt;code&gt;GetDbServer("azure")&lt;/code&gt;, the desired server is created seamlessly.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="k"&gt;using&lt;/span&gt; &lt;span class="nn"&gt;Contracts&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;namespace&lt;/span&gt; &lt;span class="nn"&gt;FactoryDP.Services&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;FactoryDesignPattern&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;IDesignPattern&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;object&lt;/span&gt; &lt;span class="nf"&gt;ExecuteDesignPattern&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="n"&gt;IDbServerFactory&lt;/span&gt; &lt;span class="n"&gt;dbServerFactory&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nf"&gt;DbServerFactory&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
            &lt;span class="kt"&gt;var&lt;/span&gt; &lt;span class="n"&gt;dbServer&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;dbServerFactory&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;GetDbServer&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"azure"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
            &lt;span class="n"&gt;dbServer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;SetupDatabse&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;dbServer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;GetType&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;ToString&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;+&lt;/span&gt; &lt;span class="s"&gt;" Created"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Key Factory Components:
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Factory Interface (&lt;code&gt;IDbServerFactory&lt;/code&gt;)&lt;/strong&gt;: Defines a method to return a &lt;code&gt;DbServer&lt;/code&gt; instance.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Concrete Factory (&lt;code&gt;DbServerFactory&lt;/code&gt;)&lt;/strong&gt;: Implements logic to decide which specific object to create.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Abstract Product (&lt;code&gt;DbServer&lt;/code&gt;)&lt;/strong&gt;: Declares the interface for concrete products.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Concrete Products (&lt;code&gt;AzureDbServer&lt;/code&gt;, &lt;code&gt;AwsDbServer&lt;/code&gt;)&lt;/strong&gt;: Implement the product interface.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Sample Implementation:
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="k"&gt;namespace&lt;/span&gt; &lt;span class="nn"&gt;FactoryDP.Services&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;interface&lt;/span&gt; &lt;span class="nc"&gt;IDbServerFactory&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;DbServer&lt;/span&gt; &lt;span class="nf"&gt;GetDbServer&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="n"&gt;serverProvider&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;DbServerFactory&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;IDbServerFactory&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="n"&gt;DbServer&lt;/span&gt; &lt;span class="nf"&gt;GetDbServer&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="n"&gt;serverProvider&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;serverProvider&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;ToLower&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="k"&gt;switch&lt;/span&gt;
            &lt;span class="p"&gt;{&lt;/span&gt;
                &lt;span class="s"&gt;"aws"&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nf"&gt;AwsDbServer&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
                &lt;span class="s"&gt;"azure"&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nf"&gt;AzureDbServer&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
                &lt;span class="n"&gt;_&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nf"&gt;AzureDbServer&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
            &lt;span class="p"&gt;};&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;By using this design, clients no longer need to manage the complexity of object creation.&lt;/p&gt;




&lt;h2&gt;
  
  
  Abstract Factory Design Pattern
&lt;/h2&gt;

&lt;p&gt;If you have grasped the Factory pattern, it’s time to move to Abstract Factory.&lt;/p&gt;

&lt;p&gt;In simple terms, the &lt;strong&gt;Abstract Factory&lt;/strong&gt; is a factory that itself returns other factories. Think of it as a "factory of factories."&lt;/p&gt;

&lt;h3&gt;
  
  
  Real-Life Analogy:
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Factory Pattern&lt;/strong&gt;: You walk into a Honda showroom and buy a car.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Abstract Factory Pattern&lt;/strong&gt;: You walk into a multi-brand showroom that offers Honda, Toyota, and other cars, and you choose a Honda.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  UML Example:
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0ej9gklp1lx9oreapq5h.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0ej9gklp1lx9oreapq5h.png" alt="Abstract Factory Design Pattern" width="800" height="848"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the diagram, the &lt;code&gt;ICloudService&lt;/code&gt; factory acts as a wrapper around &lt;code&gt;DbServer&lt;/code&gt; and &lt;code&gt;AppServer&lt;/code&gt; factories. Clients can create either type by calling &lt;code&gt;CreateDbServer("azure")&lt;/code&gt; or similar methods.&lt;/p&gt;

&lt;h3&gt;
  
  
  Example Code:
&lt;/h3&gt;

&lt;p&gt;Imagine &lt;code&gt;AbstractFactoryDesignPattern&lt;/code&gt; as a client needing cloud servers.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="k"&gt;using&lt;/span&gt; &lt;span class="nn"&gt;Contracts&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;namespace&lt;/span&gt; &lt;span class="nn"&gt;AbstractFactoryDP.Services&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;AbstractFactoryDesignPattern&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;IDesignPattern&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;object&lt;/span&gt; &lt;span class="nf"&gt;ExecuteDesignPattern&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="n"&gt;ICloudServers&lt;/span&gt; &lt;span class="n"&gt;cloudServers&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nf"&gt;CloudServers&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
            &lt;span class="kt"&gt;var&lt;/span&gt; &lt;span class="n"&gt;dbServer&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;cloudServers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;CreateDbServer&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"azure"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
            &lt;span class="n"&gt;dbServer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;SetupDatabase&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;dbServer&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Key Components:
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Abstract Factory (&lt;code&gt;ICloudServers&lt;/code&gt;)&lt;/strong&gt;: Defines methods for creating related objects (e.g., &lt;code&gt;DbServer&lt;/code&gt;, &lt;code&gt;AppServer&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Concrete Factory (&lt;code&gt;CloudServers&lt;/code&gt;)&lt;/strong&gt;: Implements the creation logic.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Abstract Products (&lt;code&gt;DbServer&lt;/code&gt;, &lt;code&gt;AppServer&lt;/code&gt;)&lt;/strong&gt;: Define interfaces for the concrete products.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Concrete Products (&lt;code&gt;AzureDbServer&lt;/code&gt;, &lt;code&gt;AwsDbServer&lt;/code&gt;, etc.)&lt;/strong&gt;: Implement these interfaces.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Complete Code Sample:
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="k"&gt;namespace&lt;/span&gt; &lt;span class="nn"&gt;AbstractFactoryDP.Services&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;interface&lt;/span&gt; &lt;span class="nc"&gt;ICloudServers&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="n"&gt;DbServer&lt;/span&gt; &lt;span class="nf"&gt;CreateDbServer&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="n"&gt;provider&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="n"&gt;AppServer&lt;/span&gt; &lt;span class="nf"&gt;CreateAppServer&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="n"&gt;provider&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;CloudServers&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;ICloudServers&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="n"&gt;DbServer&lt;/span&gt; &lt;span class="nf"&gt;CreateDbServer&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="n"&gt;provider&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;provider&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;ToLower&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="k"&gt;switch&lt;/span&gt;
            &lt;span class="p"&gt;{&lt;/span&gt;
                &lt;span class="s"&gt;"azure"&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nf"&gt;AzureDbServer&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
                &lt;span class="s"&gt;"aws"&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nf"&gt;AwsDbServer&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
                &lt;span class="n"&gt;_&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nf"&gt;AzureDbServer&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
            &lt;span class="p"&gt;};&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;

        &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="n"&gt;AppServer&lt;/span&gt; &lt;span class="nf"&gt;CreateAppServer&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="n"&gt;provider&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;provider&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;ToLower&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="k"&gt;switch&lt;/span&gt;
            &lt;span class="p"&gt;{&lt;/span&gt;
                &lt;span class="s"&gt;"azure"&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nf"&gt;AzureAppServer&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
                &lt;span class="s"&gt;"aws"&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nf"&gt;AwsAppServer&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
                &lt;span class="n"&gt;_&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nf"&gt;AzureAppServer&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
            &lt;span class="p"&gt;};&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;By leveraging Abstract Factory, you achieve a more scalable design for creating related products.&lt;/p&gt;




&lt;h3&gt;
  
  
  Final Thoughts
&lt;/h3&gt;

&lt;p&gt;Both Factory and Abstract Factory patterns help decouple object creation logic, but their use cases differ:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use &lt;strong&gt;Factory Pattern&lt;/strong&gt; when you need to create a single type of product.&lt;/li&gt;
&lt;li&gt;Use &lt;strong&gt;Abstract Factory Pattern&lt;/strong&gt; when you need to create multiple related products.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you have any questions or need further clarification, or if I miss something feel free to drop a comment. If this post helped you, don’t forget to share it with others!&lt;/p&gt;

&lt;p&gt;Happy Coding! ✨&lt;/p&gt;

</description>
      <category>factorydesignpattern</category>
      <category>abstractfactorypattern</category>
      <category>factoryvsabstractfactory</category>
      <category>softwaredesignpatterns</category>
    </item>
    <item>
      <title>Why I Revisited MS SQL Server Basics: A Deep Dive into String Data Types</title>
      <dc:creator>Dnyaneshwar Dhakane</dc:creator>
      <pubDate>Thu, 29 Aug 2024 04:22:20 +0000</pubDate>
      <link>https://dev.to/dnyanesh/why-i-revisited-ms-sql-server-basics-a-deep-dive-into-string-data-types-4jjd</link>
      <guid>https://dev.to/dnyanesh/why-i-revisited-ms-sql-server-basics-a-deep-dive-into-string-data-types-4jjd</guid>
      <description>&lt;p&gt;Today, when I raised PR with my manager (It was regarding store procedure), my manager asked me a couple of questions about that.&lt;/p&gt;

&lt;p&gt;Like, Why do you declare the data type of string as varchar(n) instead of nvarchar(n) and other scenario-based questions?&lt;/p&gt;

&lt;p&gt;You might also have faced a similar situation with seniors or with teachers in college.&lt;/p&gt;

&lt;p&gt;Although I gave answers to him, that debate raised questions for me on my basics. &lt;/p&gt;

&lt;p&gt;And I decided to revise from the start.&lt;/p&gt;

&lt;p&gt;While revising I noticed a few points, which I thought to share with you all, so I am writing this article.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkr50l8fx7dsjnyeiz2tp.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkr50l8fx7dsjnyeiz2tp.jpg" alt="A Deep Dive into String Data Types" width="800" height="600"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Let's start from the start.
&lt;/h2&gt;

&lt;p&gt;When we create a database 2 files get generated behind the scene.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Data file:&lt;/strong&gt; This has a (.mdf) extension and is known as a primary data file.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Log file:&lt;/strong&gt; This has a (.ldf) extension and is known as a transactional log file.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Although, we can configure how many files should be generated. And if we configure more than 2 files there is 3rd category which is :&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;User-defined files&lt;/strong&gt;: and those known as secondary data files having the extension (.ndf)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Whenever we perform any DB transaction it first gets stored in the log file and once the transaction is completed it gets updated into the Primary data file.&lt;/p&gt;

&lt;p&gt;The default and the lowest size of each file is 8 MB and maximum there is no limit. And for the database, according to Microsoft, one database can be up to 524 PB.&lt;/p&gt;

&lt;h2&gt;
  
  
  Select vs Print query
&lt;/h2&gt;

&lt;p&gt;If you have used the "select" query then, you might have heard about the "Print" query also.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Let's understand when to use which.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Basically "select" query returns the table data in grid format whereas the "Print" query returns data as text.&lt;/p&gt;

&lt;p&gt;So whenever we need to perform an operation on table data we use the "select" query and mostly to print logs or errors we use the "print" query.&lt;/p&gt;

&lt;p&gt;Now, Let's discuss the most favorite interview question. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4hoxpaoxtgh946pno85w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4hoxpaoxtgh946pno85w.png" alt="data types in ms SQL server" width="800" height="264"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Char vs Varchar vs Nvarchar?
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Char:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Char store max &lt;strong&gt;8000&lt;/strong&gt; characters, and hold 1 byte per character space. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;If we don't specify size, by default SQL assigns 1 byte to it and holds only one character.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If we give more input than the defined size, it auto-truncates the data.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Char follows the &lt;strong&gt;static memory allocation&lt;/strong&gt;, so if we allocate a 20-byte size and store 10 characters, SQL still allocates all 20-byte storage and the remaining 10 bytes will be considered a waste of space.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Varchar:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Varchar can store &lt;strong&gt;max 2GB&lt;/strong&gt; of data, and hold 1 byte per character space. Although it stores up to &lt;strong&gt;8000 bytes&lt;/strong&gt; of data in the table anything beyond that is stored in the text file.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;So you might have noticed its limit as 8000 bytes in multiple articles.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;To declare a column to store 2GB data, we can use varchar(max).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Varchar follows the &lt;strong&gt;dynamic memory allocation&lt;/strong&gt;. So if we allocate a 20-byte size and store 10 characters, SQL will allocate only 10-byte storage and the remaining 10 bytes will get saved.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Nvarchar:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Nvarchar follows the same properties as varchar, the only difference is that it uses 2 bytes to store one character.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;because it follows Unicode standard data, to support multiple languages.&lt;br&gt;
And char, varchar follows ASCCI standard data.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;There is one more datatype called &lt;strong&gt;Text&lt;/strong&gt;, but it has been deprecated, so you can ignore it.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;There is one article that I found very useful during my research. It has detailed information about all data types.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.guru99.com/sql-server-datatype.html" rel="noopener noreferrer"&gt;You can go through it for more information.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;If you think I have missed something or need to update feel free to comment. It will help me as well as our community.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>mysql</category>
      <category>sqlserver</category>
      <category>datatypes</category>
      <category>database</category>
    </item>
    <item>
      <title>Let's Understand Recursion in JS: Types, Time-complexity</title>
      <dc:creator>Dnyaneshwar Dhakane</dc:creator>
      <pubDate>Mon, 19 Aug 2024 14:00:44 +0000</pubDate>
      <link>https://dev.to/dnyanesh/lets-understand-recursion-in-js-types-time-complexity-2hp3</link>
      <guid>https://dev.to/dnyanesh/lets-understand-recursion-in-js-types-time-complexity-2hp3</guid>
      <description>&lt;h2&gt;
  
  
  Table Of Contents
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;What is recursion?&lt;/li&gt;
&lt;li&gt;Head recursion&lt;/li&gt;
&lt;li&gt;Tail recursion&lt;/li&gt;
&lt;li&gt;Tree recursion&lt;/li&gt;
&lt;li&gt;Indirect recursion&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What is recursion? &lt;a&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;The process in which the function calls itself is called recursion and the responsible function is called the recursion function.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Types of recursion:&lt;/strong&gt;&lt;br&gt;
On a high level, there are four types&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Head recursion&lt;/strong&gt; &lt;a&gt;&lt;/a&gt;: 
Here, the recursion function calls itself immediately after checking the base condition and before executing any logic.
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function getSquares(n){

    if(n&amp;gt;0){
       getSquares(n-1);
       console.log(n*n);
       return;
    }    
}

getSquares(3)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;code&gt;Output for n = 3 is: 1 4 9&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;If you notice, we are printing the square of a number and then calling the function by reducing the number by 1.&lt;/p&gt;

&lt;p&gt;so you are getting all the squares in ascending order.&lt;/p&gt;

&lt;p&gt;But if you write the same logic for the &lt;strong&gt;tail recursion&lt;/strong&gt; you will get the output in descending order. The time complexity of the above code will be &lt;strong&gt;O(n+1)&lt;/strong&gt; i.e. &lt;strong&gt;O(n)&lt;/strong&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Tail recursion&lt;/strong&gt; &lt;a&gt;&lt;/a&gt;: The recursion function calls itself and the end i.e. after executing all the logic.
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function getSquares(n) {

    if (n == 0)
        return;
    print(n * n);
    getSquares(n - 1);
}

getSquares(3)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;code&gt;Output for n=3 is: 9 4 1&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The time complexity for this is &lt;strong&gt;O(n+1)&lt;/strong&gt; i.e. &lt;strong&gt;O(n)&lt;/strong&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Tree recursion&lt;/strong&gt;&lt;a&gt;&lt;/a&gt;: The recursion function calls itself more than one time within the same condition.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmmxhe5pc38l3rbgjscmt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmmxhe5pc38l3rbgjscmt.png" alt="Tree Recursion" width="360" height="294"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function doSomething(n) {
    if (n &amp;lt;= 2)
        return n;
    return doSomething(n - 1) + doSomething(n - 2);
}

console.log(doSomething(5))
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;Output for n=5 is: 8&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;If you have noticed in the diagram, we are calling the self function in a tree-like format, that is why we call this type a &lt;strong&gt;tree recursion&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The time complexity for this is &lt;strong&gt;O(2^(n+1)+1)&lt;/strong&gt; i.e. &lt;strong&gt;O(2^n)&lt;/strong&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Indirect recursion&lt;/strong&gt; &lt;a&gt;&lt;/a&gt;: The recursion function A calls the recursion function B and function B calls the recursion function A. So, you can get the point why we call it indirect recursion.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function doSomethingA(n) {
    if (n &amp;lt;= 2)
        return n;
    return doSomethingB(n - 1)
}

function doSomethingB(n) {
    if (n &amp;lt;= 2)
        return n;
    return doSomethingA(n - 1)
}

console.log(doSomethingA(5))
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;Output for n=5 is: 2&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;To be honest there is not much logic in this example, I have taken this example just to explain you the concept.&lt;/p&gt;

&lt;p&gt;if you notice we are calling &lt;strong&gt;doSomethingA()&lt;/strong&gt; and doSomethingA is calling &lt;strong&gt;doSomethingB()&lt;/strong&gt; function and further doSomethingB is calling &lt;strong&gt;doSomethingA()&lt;/strong&gt; function.&lt;/p&gt;

&lt;p&gt;This type of recursion calling is called the indirect recursion.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Question for you:&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;Try to calculate time complexity for indirect recursion. if you have any doubt about it or don't understand any point, you can ask by writing a comment, and I'll try to resolve it with an explanation.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>dsa</category>
      <category>recursion</category>
      <category>programming</category>
      <category>javascript</category>
    </item>
  </channel>
</rss>
