<?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: shivasubramaniamR</title>
    <description>The latest articles on DEV Community by shivasubramaniamR (@shivasubramaniamr).</description>
    <link>https://dev.to/shivasubramaniamr</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%2F805550%2F0b7206ee-581b-43cc-8482-9df6b9180c1c.png</url>
      <title>DEV Community: shivasubramaniamR</title>
      <link>https://dev.to/shivasubramaniamr</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/shivasubramaniamr"/>
    <language>en</language>
    <item>
      <title>Design Pattern Series - Single Responsibility Principle</title>
      <dc:creator>shivasubramaniamR</dc:creator>
      <pubDate>Thu, 15 Jun 2023 11:05:31 +0000</pubDate>
      <link>https://dev.to/shivasubramaniamr/design-pattern-series-single-responsibility-principle-1gpl</link>
      <guid>https://dev.to/shivasubramaniamr/design-pattern-series-single-responsibility-principle-1gpl</guid>
      <description>&lt;p&gt;Before we Move on to Design Patterns, It is vital to see the SOLID Principles, the First Acronym S - &amp;gt; Single Responsibility principle. Let's dive into the What, Why and How &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is SRP?&lt;/strong&gt;&lt;br&gt;
The Single Responsibility Principle (SRP) is a fundamental principle in software development and object-oriented design. It states that a class or module should have only one reason to change, meaning it should have a single responsibility.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why SRP is needed?&lt;/strong&gt;&lt;br&gt;
SRP is needed for the below reasons&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Code maintainability&lt;/li&gt;
&lt;li&gt;Code reusability&lt;/li&gt;
&lt;li&gt;Easy Testability&lt;/li&gt;
&lt;li&gt;Flexibility and extensibility&lt;/li&gt;
&lt;li&gt;Reduced coupling&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;How SRP is implemented?&lt;/strong&gt;&lt;br&gt;
For this implementation, we will use Java as the programming Language&lt;/p&gt;

&lt;p&gt;we will have three classes&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;one without SRP&lt;/li&gt;
&lt;li&gt;SRP implemented&lt;/li&gt;
&lt;li&gt;how functionality separated
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public class WithoutSingleResponsibility {

    private String book;
    private String author;

    public String getAuthor() {
        return author;
    }
    public void setAuthor(String author) {
        this.author = author;
    }
    public String getBook() {
        return book;
    }
    public void setBook(String book) {
        this.book = book;
    }
    public void searchBook() {

    }
}

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

&lt;/div&gt;


&lt;p&gt;&lt;strong&gt;Explanation:&lt;/strong&gt;&lt;br&gt;
In the Above class, we have the getters and setters for the author and Book, and the intention of the class is to deal with the book and author. But the problem arises with the search book method. It leads to problems when the author name and book are set. So search method is not part of this class, and it needs to be separated from this class.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public class WithSingleResponsibility {

    private String book;
    private String author;

    public String getAuthor() {
        return author;
    }
    public void setAuthor(String author) {
        this.author = author;
    }
    public String getBook() {
        return book;
    }
    public void setBook(String book) {
        this.book = book;
    }

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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Explanation:&lt;/strong&gt;&lt;br&gt;
Now that we have removed the search book from this class, this is a classical example of SRP.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public class WithSingleResponsibilitySearchSeperated {

    WithSingleResponsibility withSingleResponsibility;

public WithSingleResponsibilitySearchSeperated(WithSingleResponsibility withSingleResponsibility) {
this.withSingleResponsibility = withSingleResponsibility;

}

public void searchBook() {
    withSingleResponsibility.getBook();
    withSingleResponsibility.getAuthor();
}

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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Explanation&lt;/strong&gt;&lt;br&gt;
This is the Separated class, where we create an object of the SRP class and will use it according to the functionality &lt;/p&gt;

</description>
      <category>srp</category>
      <category>designpatterns</category>
      <category>java</category>
      <category>automationtesting</category>
    </item>
    <item>
      <title>Design Pattern Series - SOLID</title>
      <dc:creator>shivasubramaniamR</dc:creator>
      <pubDate>Wed, 14 Jun 2023 12:10:22 +0000</pubDate>
      <link>https://dev.to/shivasubramaniamr/design-pattern-series-solid-4neb</link>
      <guid>https://dev.to/shivasubramaniamr/design-pattern-series-solid-4neb</guid>
      <description>&lt;p&gt;First things first, why do we need Design Pattern ?&lt;/p&gt;

&lt;p&gt;we can get many answers for the above question, but the crux of Design pattern is as below&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Design Patterns provide easy to recognize and use OOP solutions to common problems that arise in software development and provide proven solutions.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Before we dive into the Design Patterns, it is important to learn about the SOLID Principles. &lt;/p&gt;

&lt;p&gt;SOLID is an acronym that represents a set of five design principles in object-oriented programming (OOP) that aim to make software designs more maintainable, flexible, and robust. The SOLID principles were introduced by Robert C. Martin (also known as Uncle Bob) and have become widely adopted in the software development industry&lt;/p&gt;

&lt;p&gt;S -&amp;gt; Single Responsibility Principle (SRP)&lt;br&gt;
O -&amp;gt; Open/Closed Principle (OCP)&lt;br&gt;
L -&amp;gt; Liskov Substitution Principle (LSP)&lt;br&gt;
I -&amp;gt; Interface Segregation Principle (ISP)&lt;br&gt;
D -&amp;gt; Dependency Inversion Principle (DIP)&lt;/p&gt;

&lt;p&gt;These SOLID principles work together to create a codebase that is more maintainable, extensible, and easier to understand.&lt;/p&gt;

&lt;p&gt;Now the Million Dollar Question - Who should use this? is it Only a developer? Automation Testers(QA) don't need it ?&lt;/p&gt;

&lt;p&gt;Ofcourse it is needed by QA(Automation testers). When the Code base grows bigger, without these SOLID Principles and Design Pattern, It is very tedious to maintain that code base.&lt;/p&gt;

</description>
      <category>java</category>
      <category>designpatterns</category>
      <category>solid</category>
      <category>solutions</category>
    </item>
  </channel>
</rss>
