<?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: Mohini Yadav</title>
    <description>The latest articles on DEV Community by Mohini Yadav (@mohiniyadav301).</description>
    <link>https://dev.to/mohiniyadav301</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%2F590386%2F5dc659b9-c36f-4039-85c2-fac2c15012b0.png</url>
      <title>DEV Community: Mohini Yadav</title>
      <link>https://dev.to/mohiniyadav301</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mohiniyadav301"/>
    <language>en</language>
    <item>
      <title>Adapter Design Pattern</title>
      <dc:creator>Mohini Yadav</dc:creator>
      <pubDate>Sun, 26 Oct 2025 10:06:22 +0000</pubDate>
      <link>https://dev.to/mohiniyadav301/adapter-design-pattern-373m</link>
      <guid>https://dev.to/mohiniyadav301/adapter-design-pattern-373m</guid>
      <description>&lt;p&gt;Adapter design pattern is a structural design pattern.&lt;/p&gt;

&lt;h1&gt;
  
  
  Definition:
&lt;/h1&gt;

&lt;p&gt;Adapter design pattern converts the interface of a class to another interface that client expects, adapter let's classes work together that couldn't otherwise because of incompatible interfaces &lt;br&gt;
Reference from Head First Design Patterns&lt;/p&gt;

&lt;p&gt;There are two variant of Adapter design pattern:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Object Adapter&lt;/li&gt;
&lt;li&gt;Class Adapter&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Object adapter pattern uses composition, class adapter pattern uses inheritance. (It's not possible to implement class adapter pattern in java as multiple inheritance is not supported)&lt;/p&gt;
&lt;h1&gt;
  
  
  UML diagram of an adapter design pattern:
&lt;/h1&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%2F74tsy2ob7aw9xrjgcbz9.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%2F74tsy2ob7aw9xrjgcbz9.png" alt=" " width="800" height="406"&gt;&lt;/a&gt;&lt;/p&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%2Fgm371du713bfwksxvcrf.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%2Fgm371du713bfwksxvcrf.png" alt=" " width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;


&lt;h1&gt;
  
  
  Use Cases:
&lt;/h1&gt;

&lt;p&gt;Adapter pattern is used as a bridge/wrapper to work with legacy code.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public interface Target {
public void request();
}

public interface Adaptee {
public void processRequest();
}


public class Adapter implements Target {
private Adaptee adaptee;

public Adapter(Adaptee adaptee) {
this.adaptee = adaptee;
}

public void request() {
adaptee.processRequest();
}
}


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>programming</category>
      <category>webdev</category>
      <category>java</category>
    </item>
    <item>
      <title>CAP Theorem</title>
      <dc:creator>Mohini Yadav</dc:creator>
      <pubDate>Fri, 02 May 2025 01:33:12 +0000</pubDate>
      <link>https://dev.to/mohiniyadav301/cap-theorem-17f9</link>
      <guid>https://dev.to/mohiniyadav301/cap-theorem-17f9</guid>
      <description>&lt;p&gt;CAP - Consistency, Availability and Partition tolerance&lt;/p&gt;

&lt;p&gt;According to CAP theorem, we can achieve any two out of three guarantees in a distributed system.&lt;/p&gt;

&lt;p&gt;Consistency - Application will return the most recent write to client.&lt;/p&gt;

&lt;p&gt;Availability - Application will return reasonable response in reasonable amount of time.&lt;/p&gt;

&lt;p&gt;Partition Tolerance - Application will continue to work even in the case of network partitions&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Network Partition - It is a scenario in distributed system, when one node is not able to communicate with other node because of network disruption/failure, it divides the network into groups.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;There are two options CP and AP.&lt;/p&gt;

&lt;p&gt;CP - Consistency/Partition Tolerance&lt;br&gt;
Wait for the response from a partitioned node which could also result into an error response. &lt;/p&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%2F8xhpfb4mv2uopv23ciqs.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%2F8xhpfb4mv2uopv23ciqs.png" alt="Image description" width="800" height="482"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;AP - Availability/Partition Tolerance &lt;br&gt;
Application will continue to function with the data it have, it could be a stale.&lt;/p&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%2Fdqhrm7ijkn4jw501x7id.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%2Fdqhrm7ijkn4jw501x7id.png" alt="Image description" width="800" height="449"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
