<?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>Forem: eXpLorE wItH mE</title>
    <description>The latest articles on Forem by eXpLorE wItH mE (@aryaglekshmi).</description>
    <link>https://forem.com/aryaglekshmi</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%2F2405225%2Fb54a571b-9dae-4528-9a11-d19a2a1b4688.png</url>
      <title>Forem: eXpLorE wItH mE</title>
      <link>https://forem.com/aryaglekshmi</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/aryaglekshmi"/>
    <language>en</language>
    <item>
      <title>🧠 Managed vs Unmanaged Code — Explained for Beginners</title>
      <dc:creator>eXpLorE wItH mE</dc:creator>
      <pubDate>Wed, 05 Nov 2025 08:11:24 +0000</pubDate>
      <link>https://forem.com/aryaglekshmi/managed-vs-unmanaged-code-explained-for-beginners-16b5</link>
      <guid>https://forem.com/aryaglekshmi/managed-vs-unmanaged-code-explained-for-beginners-16b5</guid>
      <description>&lt;p&gt;If you're learning C# or exploring .NET, you've probably heard the terms managed code and unmanaged code. This post breaks down what they mean, how they differ, and why it matters — using real-world analogies and examples.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🔧 What Is Managed Code?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Managed code is code that runs under the supervision of a runtime environment — in C#, that’s the .NET Runtime (CLR).&lt;br&gt;
✅ Features of Managed Code:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Automatic memory management (garbage collection)&lt;/li&gt;
&lt;li&gt;Type safety and security&lt;/li&gt;
&lt;li&gt;Exception handling&lt;/li&gt;
&lt;li&gt;Cross-platform support&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;🏢 Real-world analogy: Managed code is like living in a smart apartment — the system handles electricity, plumbing, and security for you.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;🧠 What Is a Runtime Environment?&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%2Fq7tyezmanvzotz4uotot.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%2Fq7tyezmanvzotz4uotot.png" alt=" " width="800" height="396"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A runtime environment is software that manages the execution of programs written in certain languages.You can install them from their official websites.Once installed, they allow you to run and build applications in that language.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🧱 What Is Unmanaged Code?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Unmanaged code runs directly on the operating system without a runtime managing it. You’re responsible for memory, safety, and cleanup.&lt;/p&gt;

&lt;p&gt;❌ Features of Unmanaged Code:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Manual memory management&lt;/li&gt;
&lt;li&gt;No built-in safety or garbage collection&lt;/li&gt;
&lt;li&gt;Platform-specific&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;🏕️ Real-world analogy: Unmanaged code is like building your own cabin in the woods — you control everything, but you also maintain everything yourself.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;📦 What Is an Assembly?&lt;/strong&gt;&lt;br&gt;
When you compile managed C# code, it’s packaged into a binary unit called an assembly (.dll or .exe). Assemblies contain:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Compiled code&lt;/li&gt;
&lt;li&gt;Metadata&lt;/li&gt;
&lt;li&gt;Optional resources&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;📦 Think of an assembly as a software package that the .NET Runtime knows how to run.&lt;/p&gt;
&lt;/blockquote&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%2Fl450bscccwjfug9xxszs.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%2Fl450bscccwjfug9xxszs.png" alt=" " width="800" height="518"&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%2F2jjfn6kdytobfwqsnu8i.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%2F2jjfn6kdytobfwqsnu8i.png" alt=" " width="695" height="349"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>csharp</category>
      <category>basic</category>
      <category>beginners</category>
      <category>java</category>
    </item>
    <item>
      <title>Building Blocks of the .NET Platform — Explained for Beginners</title>
      <dc:creator>eXpLorE wItH mE</dc:creator>
      <pubDate>Wed, 05 Nov 2025 05:18:10 +0000</pubDate>
      <link>https://forem.com/aryaglekshmi/building-blocks-of-the-net-platform-explained-for-beginners-2lae</link>
      <guid>https://forem.com/aryaglekshmi/building-blocks-of-the-net-platform-explained-for-beginners-2lae</guid>
      <description>&lt;p&gt;If you're new to .NET, understanding its core building blocks is essential. This guide breaks down the key components — from the runtime engine to the shared libraries — using simple language and real-world analogies.&lt;br&gt;
Let’s break down the main elements that enable .NET applications: the .NET Runtime, CTS, and CLS.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🔧 .NET Runtime&lt;/strong&gt;&lt;br&gt;
The .NET Runtime is the core engine that runs .NET applicationsIt includes the Common Language Runtime (CLR), which:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Manages memory&lt;/li&gt;
&lt;li&gt;Handles exceptions&lt;/li&gt;
&lt;li&gt;Provides system services
It adapts to different platforms (Windows, Linux, iOS) and architectures (x86, x64, ARM).&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;🧠 Think of the .NET Runtime as the engine that powers your application — it manages memory, handles errors, and ensures smooth execution across different systems.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;📐 Common Type System (CTS)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The Common Type System (CTS) describes all possible data types and programming constructs supported by the runtime.&lt;/p&gt;

&lt;p&gt;It specifies how these entities interact and how they are represented in the .NET metadata format.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;🧠 Think of CTS as a universal building code — it ensures that all .NET languages follow the same rules so they can work together.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;📘 Common Language Specification (CLS)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A given .NET language might not support every feature defined by the CTS.&lt;/p&gt;

&lt;p&gt;The Common Language Specification (CLS) defines a subset of common types and programming constructs that all .NET languages can agree on.&lt;/p&gt;

&lt;p&gt;✅ If you build .NET types using only CLS-compliant features, they can be used by any .NET language.&lt;/p&gt;

&lt;p&gt;❌ If you use features outside CLS (like uint in C#), other languages may not understand your code.&lt;/p&gt;

&lt;p&gt;You can tell your C# compiler to check for CLS compliance using:&lt;/p&gt;

&lt;p&gt;csharp&lt;br&gt;
[assembly: CLSCompliant(true)]&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;🧠 Think of CLS as a basic blueprint — every builder (language) understands it, even if some advanced tools are left out.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;📚 The Role of the Base Class Library (BCL)&lt;br&gt;
The .NET platform provides a set of Base Class Libraries (BCLs) available to all .NET languages.&lt;/p&gt;

&lt;p&gt;These libraries include support for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Threads&lt;/li&gt;
&lt;li&gt;File I/O&lt;/li&gt;
&lt;li&gt;Graphics&lt;/li&gt;
&lt;li&gt;External hardware interaction&lt;/li&gt;
&lt;li&gt;Networking&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;🧰 Think of the BCL as a toolbox — it gives you everything you need to build real-world applications.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;.NET Standard&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;.NET Standard is a specification that defines a uniform set of APIs every .NET implementation must support.&lt;/p&gt;

&lt;p&gt;It solves compatibility issues between .NET Framework and .NET Core/.NET 5+.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;🧰 Think of it as a universal checklist that every .NET platform must follow so developers can write code that works everywhere.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;It enables:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Portable libraries across platforms&lt;/li&gt;
&lt;li&gt;Consistent API availability&lt;/li&gt;
&lt;li&gt;Less conditional compilation&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;🔄 Think of it as a universal adapter that connects different .NET versions.&lt;/p&gt;

&lt;p&gt;.NET Standard enables:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A uniform set of APIs across platforms&lt;/li&gt;
&lt;li&gt;Portable libraries&lt;/li&gt;
&lt;li&gt;Less conditional compilation&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;🚫 No New Versions of .NET Standard&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Microsoft has stopped releasing new versions of .NET Standard.&lt;/li&gt;
&lt;li&gt;Instead, they’ve built .NET 5+ as a single platform that includes everything developers need.&lt;/li&gt;
&lt;li&gt;But .NET 5+ still supports .NET Standard 2.1 and earlier, so older libraries still work.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;By understanding these foundational pieces, you’ll be better equipped to build cross-platform .NET applications and write code that’s compatible across the ecosystem.&lt;/p&gt;

</description>
      <category>csharp</category>
      <category>dotnet</category>
      <category>beginners</category>
      <category>microsoft</category>
    </item>
    <item>
      <title>Beginner’s Guide to .NET Development</title>
      <dc:creator>eXpLorE wItH mE</dc:creator>
      <pubDate>Tue, 04 Nov 2025 11:13:27 +0000</pubDate>
      <link>https://forem.com/aryaglekshmi/beginners-guide-to-net-development-8pp</link>
      <guid>https://forem.com/aryaglekshmi/beginners-guide-to-net-development-8pp</guid>
      <description>&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Modern object-oriented programming language developed by Microsoft.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It is simple, powerful &amp;amp; versatile making it great for building a wide range of applications, from desktop software to web service &amp;amp; games.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;ASP.NET is a web framework also developed by Microsoft. It supports several programming languages C#,VB.NET &amp;amp; F#. It is for creating server side code.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&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%2F4xfbsy77a5idl0slj9o3.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%2F4xfbsy77a5idl0slj9o3.png" alt=" " width="604" height="336"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;.NET Runtime - Core component. It includes CLR(Common Language Runtime), which manages memory, handles exceptions and provides other system services. &lt;/li&gt;
&lt;/ol&gt;

&lt;blockquote&gt;
&lt;p&gt;The CLR is like the engine of a car. Just as an engine runs the car, the CLR runs .NET applications.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ol&gt;
&lt;li&gt;.NET Libraries - A vast collection of pre-built code that developers can use to perform common tasks, such as file handling, data access, and network communication.&lt;/li&gt;
&lt;/ol&gt;

&lt;blockquote&gt;
&lt;p&gt;The Class Library is like a toolbox filled with tools.&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;using System;
class Program 
{
static void Main()
  {
        // Using the Class Library to print a message to the console
        Console.WriteLine("Hello, World!");
        // Using the Class Library to get the current date and time
        DateTime now = DateTime.Now;
        Console.WriteLine("Current Date and Time: " + now);
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;C# is a programming language that is both object-oriented and component oriented.&lt;/li&gt;
&lt;/ul&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%2Fbi3v509wusgbu7zv83xy.jpg" 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%2Fbi3v509wusgbu7zv83xy.jpg" alt=" " width="624" height="438"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It is based on C++ and Java, but it has many additional extensions used to perform component oriented programming approach.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;&lt;u&gt;Hello C# World&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;using System;&lt;br&gt;
namespace HelloWorldApplication {&lt;br&gt;
   class HelloWorld {&lt;br&gt;
      static void Main(string[] args) {&lt;br&gt;
         /* my first program in C# */ - comments&lt;br&gt;
         Console.WriteLine("Hello World");&lt;br&gt;
         Console.ReadKey();&lt;br&gt;
      }&lt;br&gt;
   }&lt;br&gt;
}&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;em&gt;using System&lt;/em&gt; : the using keyword is used to include the System namespace in the program. A program generally has multiple using statements. It is like import statement.&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;using System; is like saying, "I want to use the tools from the 'System' section of the library."&lt;br&gt;
Imagine you're in a large library with thousands of books. Each section of the library is like a namespace, and each book is like a class or a function within that namespace. Now, if you want to read a book from the "Science" section, you don't want to walk to the "Science" section every time you need a book. Instead, you can bring the books you need to your table.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;em&gt;namespace&lt;/em&gt; :  A namespace is groups of related classes together.&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;Think of a namespace as a specific section in a library. This section contains a collection of books on a particular topic. "Science Fiction" section in a library is like a namespace. &lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;em&gt;Class&lt;/em&gt; : A class is a blueprint or template in programming that defines the structure and behavior (data and methods) of objects. &lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;Think of a class as a book in a library. This book contains chapters, which are like methods. Each chapter provides specific information or instructions (behavior). While most books have multiple chapters, our HelloWorld class is a simple book with just one chapter called Main, which contains all the information and instructions for one task.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;em&gt;Main&lt;/em&gt; : The Main method is like the front door of a house. When you open it, you enter and see everything inside. Similarly, when a C# program runs, it starts with the Main method, which tells the program what to do first.&lt;/li&gt;
&lt;/ul&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%2Fro9n7y780yqgwb1n7rb8.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%2Fro9n7y780yqgwb1n7rb8.png" alt=" " width="800" height="499"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Class: A blueprint that defines the structure and behavior of objects.&lt;/li&gt;
&lt;li&gt;Namespace: A grouping of related classes.&lt;/li&gt;
&lt;li&gt;Assembly: A compiled code package that contains multiple namespaces all bundled together into a single file (like a DLL or EXE).&lt;/li&gt;
&lt;li&gt;Application: A complete program made up of multiple assemblies.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;&lt;u&gt;Key Benefits&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Supports for numerous programming languages - C#,F# (primary languages for ASP.NET core)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A common runtime engine shared by all .NET languages &lt;/p&gt;&lt;/li&gt;
&lt;/ul&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%2Fp5d1n4qpsld47b4q3ilq.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%2Fp5d1n4qpsld47b4q3ilq.png" alt=" " width="720" height="336"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;A comprehensive base class library - .NET gives you a huge collection of ready-made tools (called classes and types) that help you build all kinds of apps.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Simplified Deployment Model - .NET apps are easy to install and run — no need to mess with system settings or the Windows registry.&lt;br&gt;
.NET apps don’t rely on the registry. Instead, they: Run from their own folder. Can be copied and moved easily, Don’t interfere with other apps or system settings, Allow multiple versions of .NET and apps to coexist peacefully.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;🔄 You can have: One app using .NET 6. Another using .NET 8 → Both work fine on the same machine without registry conflicts.&lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>csharp</category>
      <category>dotnet</category>
      <category>aspnet</category>
      <category>programming</category>
    </item>
    <item>
      <title>Factory Design Pattern - Creational Design Pattern</title>
      <dc:creator>eXpLorE wItH mE</dc:creator>
      <pubDate>Wed, 20 Nov 2024 03:20:09 +0000</pubDate>
      <link>https://forem.com/aryaglekshmi/creational-design-patterns-4c3k</link>
      <guid>https://forem.com/aryaglekshmi/creational-design-patterns-4c3k</guid>
      <description>&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Creational design pattern - ways to create objects.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;These design patterns are used when a decision must be made at the time of instantiation of a class (i.e. creating an object of a class).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It provides a great deal of flexibility in &lt;u&gt;what&lt;/u&gt; is created , &lt;u&gt;who&lt;/u&gt; creates it, and &lt;u&gt;how&lt;/u&gt; it is created&lt;/p&gt;&lt;/li&gt;
&lt;/ul&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%2F42ip14xxcwu1t5sb71u8.jpg" 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%2F42ip14xxcwu1t5sb71u8.jpg" alt=" " width="800" height="600"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;u&gt;Factory Method Design Pattern&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Factory design pattern defines an interface for creation objects, but allow sub classes to alter the type of objects that will be created.&lt;/li&gt;
&lt;li&gt;The Factory Design Pattern allows you to delegate the responsibility of object creation to a factory class, instead of directly instantiating the class yourself in the client code. &lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;Real-World Example:&lt;br&gt;
Imagine you have are running a factory that produces different vehicles: cars, bikes &amp;amp; trucks. The process of manufacturing each type of vehicle is different. But the person ordering vehicle doesn't know the details how each vehicle is produced-they just need their vehicle.&lt;br&gt;
Instead of exposing the complex logic of vehicle creation to the client, we use a factory method to handle the creation process for us. The client only interacts with a single interface, and the factory decides which specific type of vehicle to create.&lt;br&gt;
Instead of directly creating concrete classes (like Car(),Bike()..) the factory method pattern provides an interface or abstract class with factory method that is implemented by concrete classes.&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Abstract Product (Vehicle)
class Vehicle {
  manufacture() {
    throw new Error("This method should be overridden by concrete products");
  }
}

// Concrete Products
class Car extends Vehicle {
  manufacture() {
    return "Manufacturing a Car.";
  }
}

class Bike extends Vehicle {
  manufacture() {
    return "Manufacturing a Bike.";
  }
}

class Truck extends Vehicle {
  manufacture() {
    return "Manufacturing a Truck.";
  }
}

// Abstract Factory
class VehicleFactory {
  createVehicle() {
    throw new Error("This method should be implemented by concrete factories");
  }
}

// Concrete Factories
class CarFactory extends VehicleFactory {
  createVehicle() {
    return new Car();  // Create a Car
  }
}

class BikeFactory extends VehicleFactory {
  createVehicle() {
    return new Bike();  // Create a Bike
  }
}

class TruckFactory extends VehicleFactory {
  createVehicle() {
    return new Truck();  // Create a Truck
  }
}

// Client code
function getVehicle(factory) {
  const vehicle = factory.createVehicle();  // Uses the factory method
  console.log(vehicle.manufacture());
}

// Using the factory to get different vehicles
const carFactory = new CarFactory();
const bikeFactory = new BikeFactory();
const truckFactory = new TruckFactory();

getVehicle(carFactory);   // Output: Manufacturing a Car.
getVehicle(bikeFactory);  // Output: Manufacturing a Bike.
getVehicle(truckFactory); // Output: Manufacturing a Truck.

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

&lt;/div&gt;



&lt;p&gt;If you want to add new vehicle type eg: "Bus" you can add without changing the client code, making system more flexible and maintainable.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Factory&lt;/em&gt; : An abstract class or interface creates objects without specifying the exact class. Subclasses decide which class to instantiate, making the code flexible and easier to maintain.&lt;br&gt;
&lt;em&gt;Abstract Class&lt;/em&gt;: Cannot be instantiated directly. It provides a template with both abstract (no implementation) and concrete (with implementation) methods.&lt;br&gt;
&lt;em&gt;Concrete class&lt;/em&gt; : It is a class in object-oriented programming that can be instantiated, meaning you can create objects from it. Unlike abstract classes, which may have unimplemented methods, a concrete class provides full implementations for all its methods. This makes it a complete blueprint that can be used to create instances.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;u&gt;Use Case&lt;/u&gt;&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Step 1: Define the DatabaseConnection interface
public interface DatabaseConnection {
    void connect();
}

// Step 2: Implement concrete classes for different databases
public class MySQLConnection implements DatabaseConnection {
    @Override
    public void connect() {
        System.out.println("Connecting to MySQL database...");
    }
}

public class PostgreSQLConnection implements DatabaseConnection {
    @Override
    public void connect() {
        System.out.println("Connecting to PostgreSQL database...");
    }
}

public class SQLiteConnection implements DatabaseConnection {
    @Override
    public void connect() {
        System.out.println("Connecting to SQLite database...");
    }
}

// Step 3: Create an abstract factory class
public abstract class DatabaseConnectionFactory {
    public abstract DatabaseConnection createConnection();
}

// Step 4: Implement factory classes for each database type
public class MySQLConnectionFactory extends DatabaseConnectionFactory {
    @Override
    public DatabaseConnection createConnection() {
        return new MySQLConnection();
    }
}

public class PostgreSQLConnectionFactory extends DatabaseConnectionFactory {
    @Override
    public DatabaseConnection createConnection() {
        return new PostgreSQLConnection();
    }
}

public class SQLiteConnectionFactory extends DatabaseConnectionFactory {
    @Override
    public DatabaseConnection createConnection() {
        return new SQLiteConnection();
    }
}

// Step 5: Use the factory to create database connections
public class Main {
    public static void main(String[] args) {
        DatabaseConnectionFactory factory;

        // Example: Creating a MySQL connection
        factory = new MySQLConnectionFactory();
        DatabaseConnection mySQLConnection = factory.createConnection();
        mySQLConnection.connect();

        // Example: Creating a PostgreSQL connection
        factory = new PostgreSQLConnectionFactory();
        DatabaseConnection postgreSQLConnection = factory.createConnection();
        postgreSQLConnection.connect();

        // Example: Creating a SQLite connection
        factory = new SQLiteConnectionFactory();
        DatabaseConnection sqliteConnection = factory.createConnection();
        sqliteConnection.connect();
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example:&lt;br&gt;
&lt;em&gt;DatabaseConnection&lt;/em&gt; is the interface for different types of database connections.&lt;br&gt;
&lt;em&gt;MySQLConnection, PostgreSQLConnection, and SQLiteConnection&lt;/em&gt; are concrete implementations of the DatabaseConnection interface.&lt;br&gt;
&lt;em&gt;DatabaseConnectionFactory&lt;/em&gt; is an abstract factory class with a method createConnection().&lt;br&gt;
&lt;em&gt;MySQLConnectionFactory, PostgreSQLConnectionFactory, and SQLiteConnectionFactory&lt;/em&gt; are concrete factory classes that create specific database connections.&lt;/p&gt;

&lt;p&gt;This pattern allows you to create database connections without specifying the exact class, making the code more flexible and easier to maintain.&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%2Febq01lpx1vzf3uont6ak.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%2Febq01lpx1vzf3uont6ak.png" alt=" " width="800" height="267"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>design</category>
      <category>designpatterns</category>
      <category>backend</category>
      <category>sql</category>
    </item>
    <item>
      <title>Entity Relationship Diagram[ERD]</title>
      <dc:creator>eXpLorE wItH mE</dc:creator>
      <pubDate>Tue, 19 Nov 2024 09:48:02 +0000</pubDate>
      <link>https://forem.com/aryaglekshmi/entity-relationship-diagramerd-2k9g</link>
      <guid>https://forem.com/aryaglekshmi/entity-relationship-diagramerd-2k9g</guid>
      <description>&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Entity Relationship Diagram / Entity Relationship Models&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Entity&lt;/strong&gt; is a distinct object or thing in the real world that can be identified and stored in a database. It is the fundamental to database and represents main object.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Customer:&lt;/em&gt; In an online store, a customer is an entity. Attributes might include CustomerID, Name, Email, and Address.&lt;br&gt;
&lt;em&gt;Book:&lt;/em&gt; In a library system, a book is an entity. Attributes might include BookID, Title, Author, and ISBN.&lt;br&gt;
&lt;em&gt;Order:&lt;/em&gt; In an e-commerce platform, an order is an entity. Attributes might include OrderID, OrderDate, and TotalAmount.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;ERD is a visual representation of the entities within the system and the relationships between those entities. Helps to organize and structure data effectively.&lt;/li&gt;
&lt;/ul&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%2Fp6a6uf2gwoh7iididv2n.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%2Fp6a6uf2gwoh7iididv2n.png" alt=" " width="800" height="253"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;u&gt;Why&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;They help in organizing data, identifying relationships between entities, and ensuring a clear, efficient database design. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;This makes it easier to understand, communicate, and implement the database.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;&lt;u&gt;Symbols Used in ER Diagrams&lt;/u&gt;&lt;/strong&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%2Fbhtb63ojsfq6drpdrtdf.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%2Fbhtb63ojsfq6drpdrtdf.png" alt=" " width="800" height="551"&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%2Fitmx4h0671ijfz1pjj0o.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%2Fitmx4h0671ijfz1pjj0o.png" alt=" " width="492" height="304"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;u&gt;Cardinality&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;It specifies the number of instances of one entity that can or must be associated with each instance of another entity. It helps define the nature of the relationships between entities in a database. &lt;/p&gt;&lt;/li&gt;
&lt;li&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%2Fgqcvbp0fv6pzukfk3vxe.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%2Fgqcvbp0fv6pzukfk3vxe.png" alt=" " width="800" height="372"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;&lt;u&gt;Keys&lt;/u&gt;&lt;/strong&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%2Fqyqge0mghwbgk8jimkza.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%2Fqyqge0mghwbgk8jimkza.png" alt=" " width="800" height="328"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Specialization and generalization are two opposite processes in database design and entity-relationship modeling.&lt;/li&gt;
&lt;/ul&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%2Fs0bx61jpohwix36u4761.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%2Fs0bx61jpohwix36u4761.png" alt=" " width="705" height="124"&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%2Fziv4e7d3r481wzjtgf9m.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%2Fziv4e7d3r481wzjtgf9m.png" alt=" " width="600" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;u&gt;Limitations of ER diagrams and models&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Limited Detail: Can't show complex relationships well.&lt;/li&gt;
&lt;li&gt;Static: Doesn't capture changes over time.&lt;/li&gt;
&lt;li&gt;Varied Notations: Different symbols can cause confusion.&lt;/li&gt;
&lt;li&gt;No Logic: Doesn't show how data is used or manipulated.&lt;/li&gt;
&lt;li&gt;Cluttered: Gets messy with large databases.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>entity</category>
      <category>backend</category>
      <category>sql</category>
      <category>programming</category>
    </item>
    <item>
      <title>Database Normalization</title>
      <dc:creator>eXpLorE wItH mE</dc:creator>
      <pubDate>Tue, 19 Nov 2024 07:18:23 +0000</pubDate>
      <link>https://forem.com/aryaglekshmi/database-normalization-2k3a</link>
      <guid>https://forem.com/aryaglekshmi/database-normalization-2k3a</guid>
      <description>&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Database normalization&lt;/strong&gt; organizes data in a structured and consistent way, eliminating redundancy and ensuring data integrity within relational databases. It makes databases easier to manage, query, and maintain, reducing errors. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;By following normalization rules, you can design databases that are easier to maintain and less prone to errors.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Before dive into the normalization we wanted to know the basics of the relational database. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A &lt;strong&gt;relational database&lt;/strong&gt; is a type of database that stores data in tables, which are structured into rows and columns.
&lt;u&gt;&lt;em&gt;Table&lt;/em&gt;&lt;/u&gt; - Collections of related data entries
&lt;u&gt;&lt;em&gt;Rows&lt;/em&gt;&lt;/u&gt; - Records, each row represents a single data
Columns - Fields, each column represents a specific attribute of the data.&lt;/li&gt;
&lt;/ul&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%2Fqsfi2h5hecqtem6qb367.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%2Fqsfi2h5hecqtem6qb367.png" alt=" " width="500" height="300"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;u&gt;&lt;em&gt;Primary Key&lt;/em&gt;&lt;/u&gt; - A unique identifier for each row in a table. Ensures each record can be uniquely identified.&lt;br&gt;
&lt;u&gt;&lt;em&gt;Foreign Key&lt;/em&gt;&lt;/u&gt; - A field in one table that links to the primary key of another table, creating a relationship between the two tables&lt;br&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%2F4wq1wuwk0x8oyln6phn4.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%2F4wq1wuwk0x8oyln6phn4.png" alt=" " width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We have mentioned that normalization is for eliminating redundancy and inconsistent dependency. What’s that?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Redundant data&lt;/strong&gt; means storing the same data in multiple places, which wastes disk space and creates maintenance problems. If any changes occur in the data, we have to update it in all places.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Inconsistent dependency&lt;/strong&gt; happens when data in a database relies on other data in a way that is unpredictable or incorrect. This can cause errors and make the database unreliable.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Normal form - Each rule in database normalization. If a database follows the first rule of normalization, it’s in “First Normal Form” (1NF). If it follows the first three rules, it’s in “Third Normal Form” (3NF).&lt;/li&gt;
&lt;/ul&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%2Fjeqkk4i4b9a49ibivkkt.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%2Fjeqkk4i4b9a49ibivkkt.png" alt=" " width="800" height="597"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Think of normal forms as checkpoints/rule in a process, similar to how a driving test has stages like learners, parking, and road test.&lt;/p&gt;
&lt;/blockquote&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%2Fja20yw3dgi6kx5wu66ry.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%2Fja20yw3dgi6kx5wu66ry.png" alt=" " width="800" height="244"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;&lt;u&gt;First Normal Form (1NF)&lt;/u&gt;&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;em&gt;Eliminate repeating groups in individual tables.&lt;/em&gt;&lt;/li&gt;
&lt;/ul&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%2Fywq2133pxtzk8tww6ixq.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%2Fywq2133pxtzk8tww6ixq.png" alt=" " width="800" height="506"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;em&gt;Create a separate table for each set of related data.&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To normalize this data, we create separate tables for students and their courses:&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%2F8mus2oxq6cgaxfwl5s9g.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%2F8mus2oxq6cgaxfwl5s9g.png" alt=" " width="800" height="319"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;em&gt;Identify each set of related data with a primary key.&lt;/em&gt;&lt;/li&gt;
&lt;/ul&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%2Fx3fr6b6hoasj2381grqc.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%2Fx3fr6b6hoasj2381grqc.png" alt=" " width="500" height="241"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;&lt;u&gt;Second Normal Form (2NF)&lt;/u&gt;&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;em&gt;Remove partial dependency — Every non-key column must depend on the whole primary key, not just part of it.&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The 1NF only eliminates repeating groups, not redundancy. That’s why there is 2NF. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;A table is said to be in 2NF if it meets the following criteria:&lt;br&gt;
it’s already in 1NF&lt;br&gt;
No partial dependency. That is, all non-key attributes are fully dependent on a primary key.&lt;/p&gt;
&lt;/blockquote&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%2Fix5z7y2jndoheossw1ho.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%2Fix5z7y2jndoheossw1ho.png" alt=" " width="800" height="345"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;&lt;u&gt;Third Normal Form (3NF)&lt;/u&gt;&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;em&gt;Removes transitive dependencies by ensuring that non-key attributes depend only on the primary key.&lt;/em&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Now we need to understand &lt;strong&gt;transitive dependency&lt;/strong&gt;, which is key to understanding 3NF.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Transitive dependency happens when an attribute(column) depends on another non-key attribute rather than directly depending on the primary key.&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%2Fvhp7z587tau02dn8scf2.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%2Fvhp7z587tau02dn8scf2.png" alt=" " width="620" height="280"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;3NF requires&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The table is already is 2 NF&lt;/li&gt;
&lt;li&gt;There are no transitive dependencies. This means that non-key 
 attributes should not depend on other non-key attributes.&lt;/li&gt;
&lt;/ol&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%2F8cfefl717w43qohi3dws.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%2F8cfefl717w43qohi3dws.png" alt=" " width="800" height="345"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;This is the final structure in 3NF:&lt;br&gt;
No partial dependency (because all attributes are fully dependent on the whole primary key in their respective tables).&lt;br&gt;
No transitive dependency (because no non-key attributes depend on other non-key attributes).&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;&lt;u&gt;Elementary key Normal Form (EKNF)&lt;/u&gt;&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;EKNF is a stricter form of 3NF that ensures all functional dependencies are elementary, meaning they are straightforward and clear, without any complex dependencies.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;3NF: Ensures no transitive dependencies.&lt;br&gt;
EKNF: Further refines 3NF by ensuring all functional dependencies are elementary, addressing more complex dependencies that 3NF might not handle.&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%2Fr9y8e4l9u5wqam8kpfm4.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%2Fr9y8e4l9u5wqam8kpfm4.png" alt=" " width="800" height="225"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;&lt;u&gt;Boyce–Codd Normal Form(BCNF)&lt;/u&gt;&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;A table is in BCNF if:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;It is in 3NF.&lt;/li&gt;
&lt;li&gt;For every functional dependency ( A —&amp;gt; B ),A must be a candidate key (superkey).&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Superkey: A set of one or more columns that can uniquely identify a row in a table.&lt;br&gt;
Functional Dependency: A relationship where one attribute uniquely determines another attribute.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;&lt;u&gt;Fourth Normal Form (4NF)&lt;/u&gt;&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Next level of normal form after BCNF.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Other Normal forms are concerned with functional dependencies,  4NF is concerned with a more general type of dependency known as a multivalued dependency.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Multivalued dependency&lt;/strong&gt; - Occurs when one attribute determines multiple values of another attribute independently of other attributes.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&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%2Fdni4v9yuqvrlszsftv27.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%2Fdni4v9yuqvrlszsftv27.png" alt=" " width="800" height="401"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;&lt;u&gt;Fifth Normal Form (5NF)&lt;/u&gt;&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;It is also known as Project-Join Normal Form (PJNF), is the highest level of normalization. A table is in 5NF if it is already in 4NF and cannot be decomposed into smaller tables without losing data integrity. This means that every non-trivial join dependency in the table is implied by the candidate keys.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If we decompose this table into smaller tables to eliminate redundancy, we must ensure that we can still reconstruct the original table without losing any information. In 5NF, this decomposition is done in such a way that no information is lost, and all join dependencies are preserved. explain wit examples&lt;/p&gt;&lt;/li&gt;
&lt;/ul&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%2Fhdaj47pahqh1a91c24bj.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%2Fhdaj47pahqh1a91c24bj.png" alt=" " width="800" height="607"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;&lt;u&gt;Denormalization&lt;/u&gt;&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Tables may be denormalized to improve performance.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Normalization increases the number of tables &amp;amp; relationships.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Accessing multiple tables across relationships requires  more processing than accessing a single table.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>database</category>
      <category>sql</category>
      <category>postgres</category>
      <category>mysql</category>
    </item>
    <item>
      <title>Design Pattern</title>
      <dc:creator>eXpLorE wItH mE</dc:creator>
      <pubDate>Mon, 18 Nov 2024 07:51:02 +0000</pubDate>
      <link>https://forem.com/aryaglekshmi/design-pattern-1nb7</link>
      <guid>https://forem.com/aryaglekshmi/design-pattern-1nb7</guid>
      <description>&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Design Pattern&lt;/strong&gt; is a general reusable solution to a common problem in software design.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Blue print that you can follow to solve a particular design issue in the code.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It is not specific to any programming language and can be applied in various contexts.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The pattern is not a specific piece of code, but a general concept for solving a particular problem. You can follow the pattern details and implement a solution that suits the realities of your own program.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In 1994, four authors published Design Patterns: Elements of Reusable Object-Oriented Software. It introduced design patterns for solving programming problems and became very popular. People often call it “the GoF book” (short for “Gang of Four”).&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;Patterns are often confused with algorithms. &lt;br&gt;
Algorithm: A step-by-step procedure to solve a specific problem. It’s like a recipe with exact steps.&lt;br&gt;
Design Pattern: A general solution to a common problem in software design. It’s more like a blueprint that can be adapted to different situations.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;&lt;u&gt;Why?&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;em&gt;Reusability&lt;/em&gt;: Design patterns provide solutions that can be reused in 
           different parts of your application or in different 
           projects.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Efficiency&lt;/em&gt;: They help you solve problems more quickly by providing a tried-and-tested approach.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Maintainability&lt;/em&gt;: Code that follows design patterns is often easier to understand, maintain, and extend.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Communication&lt;/em&gt;: They provide a common vocabulary for developers, making it easier to discuss and share design ideas.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;u&gt;&lt;strong&gt;How?&lt;/strong&gt;&lt;/u&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Identify the problem&lt;/li&gt;
&lt;li&gt;Choose the right pattern&lt;/li&gt;
&lt;li&gt;Implement the pattern&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;&lt;u&gt;Types&lt;/u&gt;&lt;/strong&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%2Fbzmsbjrn142wf8d67nrz.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%2Fbzmsbjrn142wf8d67nrz.png" alt=" " width="800" height="1009"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Creational Design Patterns&lt;/strong&gt; -&amp;gt; Focus on the process of object creation or problems related to object creation. It help in creating objects in a flexible and efficient way. They control how objects are created to reduce complexity and increase flexibility.&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%2Fzk929t4gq1fbiqig1ss3.jpg" 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%2Fzk929t4gq1fbiqig1ss3.jpg" alt=" " width="800" height="620"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Structural Design Pattern&lt;/strong&gt; -&amp;gt; Focus on how classes and objects are composed to form larger structures. They help ensure that when changes are made in one part of a system, other parts remain unaffected, making the system more flexible and easier to maintain.&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%2Fd3v4m1l610k6tkyk9jaa.jpg" 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%2Fd3v4m1l610k6tkyk9jaa.jpg" alt=" " width="580" height="479"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Behavioral design patterns&lt;/strong&gt; -&amp;gt; Focus on how objects interact and communicate with each other. They help manage complex control flows and ensure that objects work together efficiently. It concerned with algorithms and the assignment of responsibilities between objects. &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%2Frw9heb0oq5qutaz6oh3z.jpg" 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%2Frw9heb0oq5qutaz6oh3z.jpg" alt=" " width="610" height="434"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;u&gt;Drawbacks&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;1. Complexity:&lt;/em&gt; Implementing design patterns can sometimes add unnecessary complexity to the code.&lt;br&gt;
&lt;em&gt;2. Learning Curve:&lt;/em&gt; They can be difficult for beginners to understand and apply correctly.&lt;br&gt;
&lt;em&gt;3. Overhead:&lt;/em&gt; Some patterns may introduce performance overhead.&lt;br&gt;
&lt;em&gt;4. Rigidity:&lt;/em&gt; Overuse of patterns can make the code rigid and harder to modify.&lt;br&gt;
&lt;em&gt;5. Inappropriate Use:&lt;/em&gt; Using the wrong pattern for a problem can lead to inefficient solutions.&lt;/p&gt;

</description>
      <category>designpatterns</category>
      <category>design</category>
      <category>javascript</category>
      <category>programming</category>
    </item>
    <item>
      <title>.git</title>
      <dc:creator>eXpLorE wItH mE</dc:creator>
      <pubDate>Thu, 14 Nov 2024 08:20:58 +0000</pubDate>
      <link>https://forem.com/aryaglekshmi/git-1foj</link>
      <guid>https://forem.com/aryaglekshmi/git-1foj</guid>
      <description>&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Git is a &lt;strong&gt;Version Control System&lt;/strong&gt; that keep track of changes to your files &amp;amp; collaborate with others on project.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Git is a &lt;strong&gt;Content Addressable Filesystem&lt;/strong&gt; - Git is a simple key-value data store. Git is like a special storage system where you can save any content (like files or data). When you save something in Git, it gives you a unique key (a SHA-1 hash - 40-character strings) for that content. You can use this key to retrieve the exact content you saved whenever you need it.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;Imagine you have a library where every book is given a unique code. When you want to find a book, you just use its code to locate it. Similarly, in Git, you save a file, get a unique key, and use that key to get the file back whenever you need it.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;git init&lt;/strong&gt; is a command that initializes a new Git repository. When you run this command in a directory, it sets up the necessary files and structure for Git to start tracking changes in that directory.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;&lt;u&gt;Steps and Effects of Running git init&lt;/u&gt;&lt;/strong&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%2Fh25i57r3o4fkdmvaqzy3.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%2Fh25i57r3o4fkdmvaqzy3.png" alt=" " width="326" height="155"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Creation of the .git Directory - Git creates a hidden .git directory in the root of your project. This directory contains all the metadata and object database for your repository.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Initialization of Default Files - Inside the .git directory, Git sets up various files and subdirectories needed to manage the repository. This includes configuration files, an object database, and references.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Setting Up the Initial Branch - Git sets up the initial branch, usually named main. This branch will be the default branch where your commits will be made initially.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;After initializing a repository, you can use other Git commands like git add, git commit, git push, etc. Without initializing, these commands won’t work because Git doesn’t know where to store the version history.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;By initializing a repository, you can later connect it to a remote repository (e.g., on GitHub) to collaborate with others. This allows multiple people to work on the same project simultaneously.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;Imagine you’re starting a new group project for a school assignment. You create a folder on your computer for the project files. By running git init in that folder, you set up a system to keep track of every change you and your teammates make. This way, if someone accidentally deletes an important file or makes a mistake, you can easily revert to a previous version. It also helps you see who made which changes and when, making collaboration smoother and more organized.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;&lt;u&gt;What's inside .git &lt;/u&gt;&lt;/strong&gt; &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The core components of the .git directory are the &lt;strong&gt;objects&lt;/strong&gt;, which are fundamental to how Git tracks changes.&lt;/li&gt;
&lt;/ul&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%2Fbmk91kw62p0xov96gxr7.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%2Fbmk91kw62p0xov96gxr7.png" alt=" " width="622" height="238"&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;$ tree .git

.git
├── config
├── HEAD
├── hooks
│   └── prepare-commit-msg.msample
├── objects
│   ├── info
│   └── pack
└── refs
    ├── heads
    └── tags

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;We’ll also look at the .git directory structure after the commit. Let’s add a text file named gitText.txt and commit it. This process will return a unique ID for the commit.&lt;/li&gt;
&lt;/ul&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%2Ffwbse0ywpa5of6gxs3mb.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%2Ffwbse0ywpa5of6gxs3mb.png" alt=" " width="669" height="165"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Add the File to the Staging Area &amp;amp;&amp;amp; Commit the File: The commit returns a unique ID (ad35fe3 in this case) that you can use to reference this specific commit.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;C:\git-project&amp;gt;git add .
C:\git-project&amp;gt;git commit -m "added text file"
[master (root-commit) ad35fe3] added text file
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 gitText.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;&lt;u&gt;.git file structure after the commit&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;After the commit, the file structure changed. Some more files were added and data was updated. We will check them one by one.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;&lt;u&gt;index&lt;/u&gt;&lt;/strong&gt; - Staging area, The index file contains metadata information for staging. Once staged, it gathers all the data related to the added files. Think of it as a draft space where you can review and organize your changes.&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%2Ffm6s5pbp8c2qjlo5ek2p.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%2Ffm6s5pbp8c2qjlo5ek2p.png" alt=" " width="800" height="443"&gt;&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;&lt;u&gt;HEAD&lt;/u&gt;&lt;/strong&gt; -  Tracks the current branch or commit. It updates automatically when you switch branches or checkout a commit.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Think of the HEAD file as a bookmark in a book. The bookmark tells you which page (branch or commit) you are currently on.&lt;/p&gt;
&lt;/blockquote&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%2Fgyancl9dxzjpvbq1u6t5.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%2Fgyancl9dxzjpvbq1u6t5.png" alt=" " width="800" height="225"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;u&gt;description&lt;/u&gt;&lt;/strong&gt; - Gives a short description of the repository. A Git repository is like a digital storage space where all the files and their history for a project are kept. It helps developers track changes, collaborate with others, and revert to previous versions if needed.&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%2Fself4spksxleww8aqovr.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%2Fself4spksxleww8aqovr.png" alt=" " width="800" height="169"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;u&gt;config&lt;/u&gt;&lt;/strong&gt; - Text file that contains your git configuration for the current repo. If you look into it, you would see some basic settings for you repo like the author, filemode etc.&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%2Fo7stkn8hn6tanh77pgy2.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%2Fo7stkn8hn6tanh77pgy2.png" alt=" " width="800" height="271"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;u&gt;COMMIT_EDITMSG&lt;/u&gt;&lt;/strong&gt; - It contains the (last) commit message.&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%2Fq3bu4ia8vj7eklt1evbp.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%2Fq3bu4ia8vj7eklt1evbp.png" alt=" " width="800" height="212"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;u&gt;refs&lt;/u&gt;&lt;/strong&gt; - In Git, refs (references) are pointers to commits, making it easier to manage your repository. They are stored in the .git/refs directory and help keep track of branches, tags, and remote branches. Each ref file contains the commit hash it points to, helping you navigate and manage your project’s history.&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%2Fzq01ohid3bhh5641gscc.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%2Fzq01ohid3bhh5641gscc.png" alt=" " width="800" height="309"&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%2F7w7u41fkp4s356tjm9dv.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%2F7w7u41fkp4s356tjm9dv.png" alt=" " width="800" height="437"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;u&gt;objects&lt;/u&gt;&lt;/strong&gt; - The objects directory in Git stores data about your files and commits. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Git objects are the core components that Git uses to store and manage your project’s data. These objects are stored in a compressed format to save space and improve performance&lt;/li&gt;
&lt;/ul&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%2F9mxb16ytvwciwnchwduy.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%2F9mxb16ytvwciwnchwduy.png" alt=" " width="800" height="406"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;1. Blob(Binary Large Object):&lt;/em&gt; Think of a blob as a snapshot of a file. Every time you save a file in Git, it creates a blob to store that version of the file. It saves only the file content.&lt;br&gt;
     &lt;em&gt;2. Tree:&lt;/em&gt; A tree is like a folder. It keeps track of blobs (files) and other trees (subfolders). It helps Git understand the structure of your project.&lt;br&gt;
     &lt;em&gt;3. Commit:&lt;/em&gt; It captures the state of your project at a specific moment. It includes information about what changes were made, who made them, and when.&lt;br&gt;
     &lt;em&gt;4. Tag:&lt;/em&gt; A tag is a label you can put on a specific commit. It’s like bookmarking a particular version of your project, often used for marking releases.&lt;br&gt;
Here’s how it works: Use the git log command to see all your commits.&lt;/p&gt;
&lt;/blockquote&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%2Feanuvo15z0yzl9stjma6.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%2Feanuvo15z0yzl9stjma6.png" alt=" " width="800" height="254"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Each commit has a unique ID called a SHA-1 hash, which is a 40-character string. For example, let’s take a commit with the ID 8d168052de87b8bd8b71211383cd17457f0e2267. Git takes the first two characters (8d) and creates a folder named 8d inside the objects directory. Inside this 8d folder, Git creates a file named 168052de87b8bd8b71211383cd17457f0e2267.&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%2Fvekcsisloafklz3xo4it.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%2Fvekcsisloafklz3xo4it.png" alt=" " width="800" height="145"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This file contains all the information about that specific commit. This structure helps Git organize and find commit data efficiently.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;objects/
├── 8d/
│   └── 168052de87b8bd8b71211383cd17457f0e2267

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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;&lt;u&gt;logs&lt;/u&gt;&lt;/strong&gt; - Git logs track the changes made to your refs over time. They help you understand the sequence of commits and actions taken in your repository.&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%2Fo7wlkanmp4luei9oykv3.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%2Fo7wlkanmp4luei9oykv3.png" alt=" " width="800" height="310"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;u&gt;info&lt;/u&gt;&lt;/strong&gt; - Additional configuration for your Git repository. The most important file here is &lt;em&gt;exclude&lt;/em&gt;, which works like a .gitignore file but is specific to your local repository. You can use it to specify files and directories that Git should ignore, without sharing these rules with others. For example, if you want Git to ignore all .log files, you can add *.log to the info/exclude file. This helps keep your repository clean by excluding unnecessary files from being tracked.&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%2Fnjk4vimm8pvdbtg02eqz.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%2Fnjk4vimm8pvdbtg02eqz.png" alt=" " width="800" height="163"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;u&gt;hooks&lt;/u&gt;&lt;/strong&gt; - It contain any scripts that can be run before/after git does anything. It is like a little helper to automate the tasks. &lt;br&gt;
Client-side hooks - which run on your local machine and are triggered by actions like committing or merging &lt;br&gt;
Server-side hooks - which run on the server where your repository is hosted and are triggered by actions like pushing commits (e.g., pre-receive to enforce rules before accepting commits). &lt;br&gt;
To use a hook, you typically rename a sample script in the .git/hooks directory by removing the .sample extension and making it executable. This allows you to customize and automate your Git workflow effectively.&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%2Fst7py1eg50deqdv25dgm.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%2Fst7py1eg50deqdv25dgm.png" alt=" " width="796" height="513"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>git</category>
      <category>github</category>
      <category>gitlab</category>
      <category>versioncontrol</category>
    </item>
    <item>
      <title>NGINX</title>
      <dc:creator>eXpLorE wItH mE</dc:creator>
      <pubDate>Tue, 12 Nov 2024 11:52:25 +0000</pubDate>
      <link>https://forem.com/aryaglekshmi/nginx-engine-x-1n19</link>
      <guid>https://forem.com/aryaglekshmi/nginx-engine-x-1n19</guid>
      <description>&lt;ul&gt;
&lt;li&gt;Nginx is a web server that can also be used as a &lt;strong&gt;reverse proxy, load balancer, mail proxy and HTTP cache&lt;/strong&gt;. Oops, it is a lot of information. Don't worry we will check one by one in the below section.&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;u&gt;Reverse Proxy&lt;/u&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Forward Proxy&lt;/strong&gt; - A forward proxy server acts as an intermediary between a client and the internet. It sends requests on behalf of the client, hiding the client’s identity and sometimes controlling access to certain websites.&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;Imagine you want to buy a book without revealing your identity. You ask a friend to buy it for you. Your friend goes to the bookstore, buys the book, and brings it back to you. Here, your friend is like a forward proxy, hiding your identity from the bookstore.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Reverse Proxy&lt;/strong&gt; - A reverse proxy server sits in front of web servers and forwards client requests to the appropriate server. It helps manage traffic, improve security, and balance the load on the servers.&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;Think of a popular restaurant with a host at the entrance. Guests tell the host their orders, and the host communicates with the kitchen. The host then brings the food back to the guests. In this case, the host acts as a reverse proxy, managing and directing requests to the kitchen and back to the guests.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Reverse Proxy: Hides the information of the server. It sits in front of the server and handles incoming client requests, forwarding them to the appropriate server while masking the server's identity.&lt;/li&gt;
&lt;li&gt;Forward Proxy: Hides the information of the client. It sits in front of the client and forwards their requests to the web servers, masking the client's identity.&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&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%2Fnhplqbwqrcpd0tjiwwfl.jpg" 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%2Fnhplqbwqrcpd0tjiwwfl.jpg" alt=" " width="686" height="386"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;&lt;u&gt;Load Balance&lt;/u&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Method in which it spreads incoming traffic across multiple servers to prevent any single server from getting overwhelmed, ensuring better performance and reliability.&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;Imagine an online store during a big sale. Instead of all customers being served by one cashier, multiple cashiers are available to help, reducing wait times and keeping things running smoothly.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;p&gt;&lt;u&gt;Mail proxy&lt;/u&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Server that sits between email clients (like your email app) and email servers. It helps manage and route email traffic, ensuring emails are delivered efficiently and securely. &lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;Think of it like a post office that sorts and directs mail to the correct addresses, making sure everything gets to where it needs to go without delays. When you send an email, the mail proxy checks it and then forwards it to the recipient’s email server, ensuring it reaches the right destination quickly and safely.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;p&gt;&lt;u&gt;HTTP Cache&lt;/u&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;System that stores copies of web content (like images, HTML pages, and files) to serve them quickly to users. This reduces the need to fetch the same data repeatedly from the server, speeding up load times and reducing server load. &lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;Think of it like a library that keeps popular books on hand so you don’t have to wait for them to be ordered every time someone wants to read them. When you visit a website, the images and files are stored in the cache. The next time you visit, the site loads faster because it uses the stored copies instead of downloading everything again.&lt;/p&gt;
&lt;/blockquote&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%2Fs7hxr5a41cma39ktpbhy.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%2Fs7hxr5a41cma39ktpbhy.png" alt=" " width="800" height="465"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Nginx is a versatile tool that serves web pages, acts as a reverse proxy, balances traffic across servers, manages email routing, and caches content for faster delivery. It is fast, efficient and easy to set up making it great choice for managing web traffic.&lt;/li&gt;
&lt;/ul&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%2F4wsojbnb29u4kigv7nlq.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%2F4wsojbnb29u4kigv7nlq.png" alt=" " width="796" height="366"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>nginx</category>
      <category>beginners</category>
      <category>database</category>
    </item>
    <item>
      <title>Understanding SSL/TLS: The Role of Encryption and Security Protocols in Internet Communication</title>
      <dc:creator>eXpLorE wItH mE</dc:creator>
      <pubDate>Tue, 12 Nov 2024 10:49:31 +0000</pubDate>
      <link>https://forem.com/aryaglekshmi/ssl-25j5</link>
      <guid>https://forem.com/aryaglekshmi/ssl-25j5</guid>
      <description>&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%2Fqjc9usf7jvjs440ar0zh.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%2Fqjc9usf7jvjs440ar0zh.png" alt=" " width="722" height="407"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;SSL is &lt;strong&gt;Encryption based internet security protocol&lt;/strong&gt;.
 Encryption - Process of converting information or data into a code to prevent unauthorized access.
 Protocol - A set of rules or procedures for transmitting data between electronic devices.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So first we need to know what is Encryption.&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%2Fqbeouv6uj8n6wv6q58xh.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%2Fqbeouv6uj8n6wv6q58xh.png" alt=" " width="800" height="333"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;We need to ensure that data is transferred securely and only authorized people can access it.&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;Example: Imagine sending a letter to a friend. You lock it in a box with a special key (encryption), making it unreadable to others. You send the box, and even if someone intercepts it, they can’t open it without the key. When your friend gets the box, they use their matching key (decryption) to unlock it and read the letter.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;Data encryption is the process of converting data from a readable format to scrambled piece of information that only be read or processed after its been decrypted.&lt;/li&gt;
&lt;/ul&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%2F4imr2o19zckllg7qkba1.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%2F4imr2o19zckllg7qkba1.png" alt=" " width="800" height="315"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Cryptography&lt;/strong&gt; is the science of encrypting and decrypting data to prevent unauthorized access.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Symmetric Encryption Method
&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%2F323burht0o1jlh5sawb5.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%2F323burht0o1jlh5sawb5.png" alt=" " width="800" height="284"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Also called &lt;strong&gt;Private-key cryptography/secret key algorithm&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Process of using a single key(Private key) to both encrypt and decrypt data. Both the sender and receiver of the message need to have a &lt;strong&gt;pre-shared secret key&lt;/strong&gt; that they will use to convert the plaintext into ciphertext and vice versa. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The key must be kept private and be known only to the sender and the receiver.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;Imagine you have a lockbox where you keep your important documents. You and your friend both have a key to this lockbox. This key is the same for both of you, and it’s the only way to open the lockbox.&lt;/p&gt;

&lt;p&gt;In symmetric encryption:&lt;/p&gt;

&lt;p&gt;The lockbox represents the data you want to protect.&lt;/p&gt;

&lt;p&gt;The key represents the secret code used to encrypt and decrypt the data.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Here’s how it works:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Encrypting&lt;/strong&gt;: When you want to send a secret message to your friend, you put the message in the lockbox and lock it with the key. This is like converting your readable message into a coded format that only someone with the key can understand.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Decrypting&lt;/strong&gt;: Your friend receives the lockbox and uses their copy of the key to unlock it and read the message. This is like converting the coded message back into its original, readable format.&lt;/p&gt;

&lt;p&gt;The key point is that both you and your friend use the &lt;strong&gt;same key for both locking (encrypting) and unlocking (decrypting) the message&lt;/strong&gt;. This is why it’s called &lt;strong&gt;“symmetric” encryption&lt;/strong&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%2Fbav8syv0s5kt3cm4au1m.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%2Fbav8syv0s5kt3cm4au1m.png" alt=" " width="800" height="619"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Asymmetric Encryption Method
&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%2Fbiip53aot09tkraxtrjq.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%2Fbiip53aot09tkraxtrjq.png" alt=" " width="800" height="349"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Public-key cryptography&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Uses two keys for the encryption process, a &lt;strong&gt;public and a private key&lt;/strong&gt;, which are mathematically linked. The user employs one key for encryption and the other for decryption, though it doesn’t matter which you choose first.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;As the name implies, the &lt;strong&gt;public key is freely available to anyone&lt;/strong&gt;, whereas the &lt;strong&gt;private key remains with the intended recipients only&lt;/strong&gt;, who need it to decipher the messages. Both keys are simply large numbers that aren’t identical but are paired with each other, which is where the “asymmetric” part comes in.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;Imagine you have a mailbox with a special lock. This lock has two keys:&lt;/p&gt;

&lt;p&gt;A public key that anyone can use to lock (encrypt) the mailbox.&lt;/p&gt;

&lt;p&gt;A private key that only you have, which can unlock (decrypt) the mailbox.&lt;/p&gt;

&lt;p&gt;Here’s how it works:&lt;/p&gt;

&lt;p&gt;Public Key (Locking): You give your public key to anyone who wants to send you a message. They use this key to lock (encrypt) the message and put it in your mailbox. Since the public key is only for locking, it doesn’t matter if others see it.&lt;/p&gt;

&lt;p&gt;Private Key (Unlocking): When you receive the locked message, you use your private key to unlock (decrypt) it and read the message. Only you have the private key, so only you can unlock the mailbox and read the messages.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;`&lt;br&gt;
&lt;strong&gt;Public Key&lt;/strong&gt;: Think of it as your &lt;strong&gt;email address&lt;/strong&gt;. You can share it with anyone, and they can send you emails.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Private Key&lt;/strong&gt;: This is like your &lt;strong&gt;email password&lt;/strong&gt;. Only you know it, and it allows you to access your emails.`&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;When someone wants to send data, they will retrieve the recipient’s public key from a public directory and use it for encryption before sending. The recipient can then decrypt the message using their corresponding private (secret) key.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Many protocols rely on asymmetric cryptography, including &lt;strong&gt;Transport Layer Security (TLS) and Secure Sockets Layer (SSL)&lt;/strong&gt;, which make HTTPS possible.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Asymmetric cryptography is typically used to authenticate data using &lt;strong&gt;digital signatures&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Digital Signatures
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;A digital signature is like a virtual fingerprint, stamped seal or a handwritten signature, but for digital documents. It ensures that the document is authentic and hasn’t been altered.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Here’s how it works:&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Creating a Signature: When you sign a document digitally, a unique code (called a hash) is created from the document’s contents.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Encrypting the Hash: This hash is then encrypted using your private key (more on keys below). This encrypted hash is your digital signature.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Verifying the Signature: When someone receives the document, they can use your public key to decrypt the hash. They then create a new hash from the document and compare it to the decrypted hash. If they match, the document is verified as authentic and unaltered.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;Imagine you want to send a secure email to a friend:

&lt;ol&gt;
&lt;li&gt;You write the email and create a hash of its contents.&lt;/li&gt;
&lt;li&gt;You encrypt the hash with your private key to create a digital 
signature.&lt;/li&gt;
&lt;li&gt;You send the email along with your digital signature.&lt;/li&gt;
&lt;li&gt;Your friend receives the email and uses your public key to decrypt 
the signature.&lt;/li&gt;
&lt;li&gt;They create a new hash from the email and compare it to the 
decrypted hash. If they match, your friend knows the email is from 
you and hasn’t been changed.&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&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%2Foll9hnajer9b9zsqc33i.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%2Foll9hnajer9b9zsqc33i.png" alt=" " width="800" height="481"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Hashing
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Hashing is like creating a unique fingerprint for a piece of data or a message(a fixed-length string of characters).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Even a tiny change in the original data will result in a completely different hash, making it easy to spot alterations.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Once data is hashed, you can’t reverse it back to the original form. This makes hashing great for verifying data integrity.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Not Encryption: Hashing isn’t really encryption because you can’t decrypt it. It’s just a way to check that the data is the same as it was originally.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;Hashing is used to verify the integrity of data, ensuring it hasn’t been altered. While it’s not exactly the same as authentication (which confirms the identity of a user), hashing helps confirm that the data is exactly what it should be.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Encryption for Internet browser secure
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;HTTP is application layer protocol like a conversation between browser &amp;amp; web server. Browser asks for a webpage (request), and the server sends it back (response). This simple process allows you to browse the internet.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;HTTPS (Hypertext Transfer Protocol Secure) is the secure version of HTTP.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;HTTPS uses a protocol called TLS-Transport Layer Security (formerly SSL-Secure Sockets Layer) to encrypt communications. This protocol secures data by using an asymmetric system with two keys: a public key and a private key.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;HTTPS uses port 443 and for HTTP it is 80.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A Certificate Authority (CA) is a trusted organization that issues digital certificates. These certificates are used to verify the identity of websites and other entities on the internet. Essentially, CAs act as a trusted third party that both the website owner and the user can rely on.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&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%2Fg50zhunsg496a3ql53n1.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%2Fg50zhunsg496a3ql53n1.png" alt=" " width="800" height="399"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;When you visit a website, your browser checks the certificate to ensure it’s valid and issued by a trusted CA. If everything checks out, the browser establishes a secure connection.&lt;/li&gt;
&lt;/ul&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%2F2ubx2qdzdubm3zzd87m9.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%2F2ubx2qdzdubm3zzd87m9.png" alt=" " width="800" height="394"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The SSL/TLS handshake is a process that establishes a secure connection between a client (like a web browser) and a server (like a website). During this handshake, the client and server exchange cryptographic keys and agree on encryption methods to ensure data privacy and integrity. The process involves several steps: the client sends a “ClientHello” message to the server, the server responds with a “ServerHello” message, and both parties exchange certificates to authenticate each other. They then generate session keys used to encrypt the data transmitted during the session. This handshake ensures that any data exchanged is secure and protected from eavesdropping or tampering.&lt;/li&gt;
&lt;/ul&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%2Fyb3yq8embnnhhc4jf2ea.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%2Fyb3yq8embnnhhc4jf2ea.png" alt=" " width="800" height="424"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>encryption</category>
      <category>security</category>
      <category>ssl</category>
      <category>secureweb</category>
    </item>
    <item>
      <title>Redis: Understanding the Basics</title>
      <dc:creator>eXpLorE wItH mE</dc:creator>
      <pubDate>Mon, 11 Nov 2024 09:26:46 +0000</pubDate>
      <link>https://forem.com/aryaglekshmi/redis-lets-chat-about-redis-37ip</link>
      <guid>https://forem.com/aryaglekshmi/redis-lets-chat-about-redis-37ip</guid>
      <description>&lt;p&gt;&lt;strong&gt;REDIS&lt;/strong&gt;  - &lt;strong&gt;&lt;u&gt;Re&lt;/u&gt;&lt;/strong&gt;mote &lt;strong&gt;&lt;u&gt;Di&lt;/u&gt;&lt;/strong&gt;ctionary &lt;strong&gt;&lt;u&gt;S&lt;/u&gt;&lt;/strong&gt;erver&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Open Source, advanced key-value store.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It supports various data structures such as strings, hashes, lists, sets, and sorted sets. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Redis is known for its high performance, flexibility, and ease of use, making it a popular choice for developers.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Why
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;The real question is, why do we need Redis? For example, in apps like LinkedIn, Facebook, or Instagram, loading large amounts of data (such as profile pictures, names, followers, and posts) from the database can be slow, especially if the user refreshes the page frequently. Redis helps by caching the data after the first load, so subsequent requests fetch the stored data quickly, improving the user experience.&lt;/li&gt;
&lt;/ul&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%2F6ikcshulqc8shqnuz2ho.jpg" 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%2F6ikcshulqc8shqnuz2ho.jpg" alt=" " width="462" height="462"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Redis
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;In-memory data structure store used as a database, cache, and message broker. Good for building high performance, scalable web applications.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;When we say “everything is in-memory” with Redis, it means that all the data is stored in the computer’s RAM (Random Access Memory) instead of on a hard drive. This makes data access extremely fast because RAM is much quicker to read from and write to compared to a hard drive.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It is often referred to as a data structure server, since the keys can contain strings, hashes, lists, sets and sorted sets. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Redis is written in C.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&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%2Flw2veictzkf50pl21u7b.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%2Flw2veictzkf50pl21u7b.png" alt=" " width="800" height="433"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Data Types
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Strings&lt;/strong&gt;: The simplest type, storing text or binary data. Think of it like a single piece of information, such as a name or a number.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Lists&lt;/strong&gt;: Ordered collections of strings. Imagine a to-do list where you can add, remove, and access items by their position.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Sets&lt;/strong&gt;: Unordered collections of unique strings. Useful for storing items where duplicates aren’t allowed, like a list of unique tags.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Sorted Sets&lt;/strong&gt;: Similar to sets but with a score assigned to each item, allowing them to be sorted. Great for leaderboards where you need to rank items.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Hashes&lt;/strong&gt;: Maps of fields and values, like a dictionary. Perfect for storing objects with multiple attributes, such as user profiles.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Bitmaps&lt;/strong&gt;: Strings that can be treated as arrays of bits, useful for tracking binary states, like user activity.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;HyperLogLogs&lt;/strong&gt;: Probabilistic data structures for counting unique items with minimal memory usage. Handy for large-scale analytics.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Streams&lt;/strong&gt;: Log-like data structures for storing sequences of messages, useful for real-time data processing.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Redis Replication&lt;/strong&gt; - Redis can create copies of its data on multiple other Redis servers, called “slaves.” This process is known as replication. The main server, called the “master,” sends updates to all its slaves. This way, if the master server goes down, one of the slaves can take over, ensuring that your data is always available and safe.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pub/Sub&lt;/strong&gt; - It is like a messaging system, where the &lt;em&gt;senders(publishers)&lt;/em&gt; sends the messaged while the &lt;em&gt;receivers(subscribers)&lt;/em&gt; receive them through &lt;em&gt;channel&lt;/em&gt;. A client can subscribe any number of channels.&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%2Fobcqn0ftc8h5vi87lqqf.jpg" 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%2Fobcqn0ftc8h5vi87lqqf.jpg" alt=" " width="800" height="336"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Redis can be secured so that any client making a connection needs to authenticate before executing commands. To secure Redis, you need to set a password in the configuration file. After setting the password, if a client tries to run a command without authentication, they will receive an (error) NOAUTH Authentication required error. Therefore, the client must use the AUTH command to authenticate.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Redis Persistence
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Persistence refers to the ability to save data to disk so that it can be recovered after a restart or crash. This ensures that your data is not lost and can be restored to its previous state. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;2 main methods for persistence: RDB and AOF.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;1. RDB (Redis Database Backup)&lt;/strong&gt; - Creates a snapshot of the entire dataset at configured intervals. Saves the snapshot to disk as a binary file. Efficient and quick to load. Minimal impact on performance during snapshot creation.&lt;br&gt;
Example - An e-commerce website uses RDB to take snapshots of user sessions and shopping carts every 15 minutes for quick recovery.&lt;br&gt;
Drawbacks - Risk of data loss between snapshots. Not suitable for applications requiring high durability.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. AOF (Append Only File)&lt;/strong&gt; - Logs every write operation received by the server. Periodically rewrites the AOF file to keep it compact. Higher durability with less risk of data loss.&lt;br&gt;
Example - A financial transaction system uses AOF to log every transaction immediately, ensuring high durability and minimal data loss.&lt;br&gt;
Drawbacks - Larger file size compared to RDB. Slower performance due to logging every operation.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Redis allows you to use both RDB and AOF together to combine the benefits of both methods, providing a balance between performance and data safety.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Redis Sharding
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Redis Sharding is a way to split your data across multiple Redis servers to handle more data and traffic efficiently. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Imagine you have a library with thousands of books. If all the books are stored in one room, it can get crowded and slow to find a book. To solve this, you can split the books into different rooms based on their genres. Now, each room has fewer books, making it faster to find what you need.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In Redis, sharding works similarly. Instead of storing all data on one server, you split it across multiple servers (shards). Each shard handles a portion of the data, making the system faster and more scalable.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Disadvantages
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Memory Usage: Redis stores all data in RAM, which can be costly for large datasets.&lt;/li&gt;
&lt;li&gt;Single-Threaded: Redis runs on a single thread, which can limit performance for CPU-intensive tasks.&lt;/li&gt;
&lt;li&gt;Basic Security: Redis has limited built-in security features, which might not be enough for sensitive data.&lt;/li&gt;
&lt;li&gt;No Complex Queries: Redis doesn’t support complex queries like SQL databases do.&lt;/li&gt;
&lt;li&gt;Risk of Data Loss: Since Redis is primarily in-memory, there’s a risk of data loss if the server crashes before data is saved to disk.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>redis</category>
      <category>database</category>
      <category>caching</category>
      <category>backend</category>
    </item>
  </channel>
</rss>
