<?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: Arun Mahara</title>
    <description>The latest articles on DEV Community by Arun Mahara (@arunmahara).</description>
    <link>https://dev.to/arunmahara</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%2F761054%2Fd9fc8c4e-ee45-488f-94a2-60b21d55e844.jpeg</url>
      <title>DEV Community: Arun Mahara</title>
      <link>https://dev.to/arunmahara</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/arunmahara"/>
    <language>en</language>
    <item>
      <title>Design Patterns</title>
      <dc:creator>Arun Mahara</dc:creator>
      <pubDate>Sat, 27 Nov 2021 20:12:33 +0000</pubDate>
      <link>https://dev.to/arunmahara/design-patterns-310b</link>
      <guid>https://dev.to/arunmahara/design-patterns-310b</guid>
      <description>&lt;p&gt;Design pattern is a broad, reusable solution to common problems in software design. It shows relationships and interactions between classes or objects Design patterns represent the best practices used by experienced object-oriented software developers. Design patterns are solutions to general problems that software developers faced during software development. These solutions were obtained by trial and error by numerous software developers over quite a substantial period of time.&lt;/p&gt;

&lt;p&gt;Design Pattern are classified into three categories:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Creational Patterns:&lt;/strong&gt; These design patterns provide a way to create objects while hiding the creation logic, rather than instantiating objects directly using new operator. This gives program more flexibility in deciding which objects need to be created for a given use case.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Structural Patterns:&lt;/strong&gt; These design patterns concern class and object composition. Concept of inheritance is used to compose interfaces and define ways to compose objects to obtain new functionalities.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Behavioral Patterns:&lt;/strong&gt; These design patterns are specifically concerned with communication between objects.&lt;/p&gt;

&lt;p&gt;Some of the well known design patterns are given below:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Singleton Pattern:&lt;/strong&gt; It is essential in a scenario where only one instance needs to be created, for example, a database connection. It is only possible to create an instance when the connection is closed or you make sure to close the open instance before opening a new one.  This pattern is also referred to as strict pattern, one drawback associated with this pattern is its daunting experience in testing because of its hidden dependencies objects which are not easily singled out for testing.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Prototype Pattern:&lt;/strong&gt; It is based on prototypical inheritance whereby objects created to act as prototypes for other objects. In reality, prototypes act as a blueprint for each object constructor created.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Constructor Design Pattern:&lt;/strong&gt; This is a special method that is used to initialize the newly created objects once a memory is allocated. Since JavaScript is typically object-oriented, it deals with objects most, therefore I intend to delve in to object constructors. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Abstract Factory Pattern:&lt;/strong&gt; It is a creational concerned with the creation of objects without the need for a constructor. It provides a generic interface for creating objects, where we can specify the type of factory objects to be created. Therefore, we only specify the object and the factory instantiates and returns it for us to use. It is wise for us to use factory pattern when the object component set up has a high level of complexity and when we want to create different instances of objects easily depending on the environment we are in. We can also use factory pattern when working with many small objects sharing the same properties and when composing objects that need decoupling.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Module Design Pattern:&lt;/strong&gt; In the module design pattern, there is an improvement from the prototype pattern. The different types of modifiers (both private and public) are set in the module pattern. You can create similar functions or properties without conflicts. There is the flexibility of renaming functions publicly. The daunting part of this is the inability to override the created functions from the outside environment.&lt;/p&gt;

</description>
      <category>design</category>
      <category>oop</category>
      <category>javascript</category>
    </item>
    <item>
      <title>SOLID Principles</title>
      <dc:creator>Arun Mahara</dc:creator>
      <pubDate>Sat, 27 Nov 2021 19:42:04 +0000</pubDate>
      <link>https://dev.to/arunmahara/solid-principles-1gpc</link>
      <guid>https://dev.to/arunmahara/solid-principles-1gpc</guid>
      <description>&lt;p&gt;SOLID is one of the most popular sets of design principles in object-oriented software development. The goal of the SOLID principles is to reduce dependencies so that engineers change one area of software without impacting others. These principles outline best practices for designing software while keeping in mind the project's long-term maintenance and expansion. Adopting these techniques can also help avoid code smells, restructure your code, and design Agile or adaptive software.&lt;/p&gt;

&lt;p&gt;SOLID stands for:&lt;br&gt;
• S - Single-Responsibility Principle&lt;br&gt;
• O - Open-Closed Principle&lt;br&gt;
• L - Liskov Substitution Principle&lt;br&gt;
• I - Interface Segregation Principle&lt;br&gt;
• D - Dependency Inversion Principle&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Single-Responsibility Principle:&lt;/strong&gt; A class should have only one cause to change, which means it should only have one task.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--OOuYsNhv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8dp5gil1u2cl8p5yzgz5.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--OOuYsNhv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8dp5gil1u2cl8p5yzgz5.PNG" alt="Image description" width="321" height="652"&gt;&lt;/a&gt;&lt;em&gt;Here I have created different classes(Addition, Subtraction, Multiplication, Division) which have one job to do.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Open-Closed Principle:&lt;/strong&gt; Objects or entities should be open for extension but closed for modification.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Liskov Substitution Principle:&lt;/strong&gt; Let q(x) be a property provable about objects of x of type T. Then q(y) should be provable for objects y of type S where S is a subtype of T. &lt;br&gt;
&lt;em&gt;This means that every subclass or derived class should be substitutable for their base or parent class.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Interface Segregation Principle:&lt;/strong&gt; A client should never be forced to implement an interface that it doesn’t use, or clients shouldn’t be forced to depend on methods they do not use.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Dependency Inversion Principle:&lt;/strong&gt; Entities must depend on abstractions, not on concretions. It states that the high-level module must not depend on the low-level module, but they should depend on abstractions.&lt;/p&gt;

</description>
      <category>design</category>
      <category>oop</category>
      <category>javascript</category>
    </item>
    <item>
      <title>OOP</title>
      <dc:creator>Arun Mahara</dc:creator>
      <pubDate>Sat, 27 Nov 2021 16:07:37 +0000</pubDate>
      <link>https://dev.to/arunmahara/oop-318f</link>
      <guid>https://dev.to/arunmahara/oop-318f</guid>
      <description>&lt;p&gt;Object-oriented programming (OOP) is nothing but that which allows the writing of programs with the help of certain classes and real-time objects. It is a programming paradigm that relies on the concept of classes and objects. It is used to structure a software program into simple, reusable pieces of code blueprints (usually called classes), which are used to create individual instances of objects.&lt;br&gt;
• OOP models complex things as reproducible, simple structures.&lt;br&gt;
• Reusable, OOP objects can be used across programs.&lt;br&gt;
• Allows for class-specific behavior through polymorphism.&lt;br&gt;
• Easier to debug, classes often contain all applicable information to them.&lt;br&gt;
• Secure, protects information through encapsulation.&lt;/p&gt;

&lt;p&gt;There are certain features or mechanisms which makes a JavaScript Object-Oriented like: &lt;br&gt;
&lt;strong&gt;Classes:&lt;/strong&gt; A code template for creating objects.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--2xsi_-ig--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g432oo3honz58jtho9py.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--2xsi_-ig--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g432oo3honz58jtho9py.PNG" alt="Image description" width="416" height="253"&gt;&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;Object:&lt;/strong&gt; Objects are variables which can contain many values.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--fD-7chCL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r1mx5kxgunlgt4vsshb2.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--fD-7chCL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r1mx5kxgunlgt4vsshb2.PNG" alt="Image description" width="374" height="215"&gt;&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;Encapsulation:&lt;/strong&gt; The process of wrapping property and function within a single unit.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--qUH3jbWn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iyqk47a0lqx9kdzd037a.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--qUH3jbWn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iyqk47a0lqx9kdzd037a.PNG" alt="Image description" width="572" height="312"&gt;&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;Inheritance:&lt;/strong&gt; A concept in which some property and methods of an Object is being used by another Object.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--UbRfsYO5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jfg35udg56o9kdzcbez0.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--UbRfsYO5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jfg35udg56o9kdzcbez0.PNG" alt="Image description" width="603" height="329"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>oop</category>
      <category>javascript</category>
    </item>
  </channel>
</rss>
