<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Sanduni Muthugala on Medium]]></title>
        <description><![CDATA[Stories by Sanduni Muthugala on Medium]]></description>
        <link>https://medium.com/@sandzlvu?source=rss-a6a77d69a9d9------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*eYg-nEEeHcrSTX7-</url>
            <title>Stories by Sanduni Muthugala on Medium</title>
            <link>https://medium.com/@sandzlvu?source=rss-a6a77d69a9d9------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 10:14:03 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sandzlvu/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[A Comprehensive Guide to Types of Virtualization]]></title>
            <link>https://medium.com/@sandzlvu/a-comprehensive-guide-to-types-of-virtualization-d34af8c04cf1?source=rss-a6a77d69a9d9------2</link>
            <guid isPermaLink="false">https://medium.com/p/d34af8c04cf1</guid>
            <dc:creator><![CDATA[Sanduni Muthugala]]></dc:creator>
            <pubDate>Thu, 19 Oct 2023 13:33:45 GMT</pubDate>
            <atom:updated>2023-10-19T13:33:45.126Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kNF8BWW1U1tU_GhZPSD1uA.jpeg" /></figure><h3>Overview</h3><p>As new technologies emerge, an increasing number of digital use cases emerge. As a result of digital transformation, infrastructure and software, from hardware to operating systems to applications, now require more data, processing power, and memory. <strong>Virtualization </strong>makes serving such requirements possible by enabling a single machine/environment to act like multiple.</p><h3>What is Virtualization?</h3><p>Virtualization creates a simulated, or virtual, computing environment as opposed to a physical environment. Virtualization often includes computer-generated versions of hardware, operating systems, storage devices, and more. This allows organizations to partition a single physical computer or server into several <em>virtual machines </em>(virtualized instance of a computer that can perform almost all of the same functions as a computer). Each virtual machine can then interact independently and run different operating systems or applications while sharing the resources of a single host machine.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*aVnfFB7TF-i7o8TSI2c-sA.png" /></figure><h3>Types of Virtualization</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*Dno-k7Jr9lS6FwbLXqyNKw.jpeg" /></figure><p>There are several types of virtualization, each serving a specific purpose in IT environments. Here are the most common types:</p><ol><li><strong>Server Virtualization</strong></li><li><strong>Desktop Virtualization</strong></li><li><strong>Network Virtualization</strong></li><li><strong>Storage Virtualization</strong></li><li><strong>Application Virtualization</strong></li><li><strong>Data Virtualization</strong></li><li><strong>GPU Virtualization</strong></li><li><strong>Operating System-Level Virtualization</strong></li><li><strong>Hardware Virtualization</strong></li><li><strong>Memory Virtualization</strong></li><li><strong>I/O Virtualization</strong></li><li><strong>Database Virtualization</strong></li><li><strong>File System Virtualization</strong></li></ol><h3>1. Server Virtualization</h3><p>Server virtualization is the process of restructuring a single server into multiple small, isolated virtual servers. This process does not require new or additional servers; instead, virtualization software or hardware takes the existing server and partitions it into several isolated virtual servers. Each of these servers is capable of running independently.</p><p>Servers are the technology that hosts files and applications, providing functionality for other programs. This device processes requests and delivers data to other computers in a local area network (LAN) or wide area network (WAN). Servers are often very powerful, processing complex tasks with ease.</p><p>A single server can only use one operating system (OS) and is usually dedicated to a single application or task. This is because most applications do not function effectively together on a single server. Because of this, much of a server’s processing capabilities go unused. However, when a server is virtualized it is transformed into multiple virtual servers which can each run different operating systems and applications in an isolated environment. This means less wasted processing power.</p><p>Servers take up space and require maintenance, as well as needing to be housed in an environment that is cool and dust-free. Between hardware costs, maintenance costs, and cooling costs, this can often become a significant cost to organizations.</p><p>In most cases, server virtualization is the best way to manage a data center’s server needs.</p><h4><strong>Types of Server virtualization</strong></h4><p>Server virtualization is widespread as a solution across organizations and industries. This is because it solves some big problems like managing server resources, saving on infrastructure costs, and alleviating demand on IT. There are several types of server virtualization that network administrators rely on. Types of server virtualization examples include:</p><ul><li>Full virtualization.</li><li>Para-virtualization.</li><li>Hardware-assisted virtualization.</li><li>OS-level virtualization.</li><li>Hypervisor virtualization.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bq2h03kG_VAzJbUn1sfLUg.png" /></figure><p><strong><em>A real-world example</em></strong> of server virtualization can be found in a typical enterprise data center. Let’s consider a company, XYZ Corporation, that manages a large-scale IT infrastructure to support its various business operations.</p><p>Before implementing server virtualization, XYZ Corporation operated with dedicated physical servers for each critical application, resulting in underutilized resources, high hardware costs, and limited flexibility in scaling or upgrading.</p><p>After implementing server virtualization, XYZ Corporation adopted a virtualization platform and migrated their applications to virtual machines. This consolidation led to efficient resource utilization, cost savings, and increased flexibility in adding or expanding applications. Additionally, virtualization improved disaster recovery capabilities and allowed for dynamic resource allocation, optimizing performance and ensuring critical applications receive necessary resources.</p><p>Overall, server virtualization enabled XYZ Corporation to enhance resource management, reduce costs, and increase operational efficiency, showcasing its significance in modernizing and streamlining complex IT environments.</p><h3>2. Desktop Virtualization</h3><p>Desktop virtualization includes the replacement of traditional physical desktop computing environments with virtual computing environments. It helps create and store multiple user desktop environments on a single host, residing in the cloud or a data center.</p><p>Desktop virtualization is the one-stop solution to many problems that organizations face today, including regulatory compliance, security, cost control, business continuity and manageability</p><h4><strong>Types of desktop virtualization</strong></h4><p>The three most popular deployment models of desktop virtualization are:</p><blockquote><strong>Virtual Desktop Infrastructure</strong></blockquote><p>A virtual desktop interface (VDI) uses host-based virtual machines (VMs) to run the operating system. It delivers non-persistent and persistent virtual desktops to all connected devices. With a non-persistent virtual desktop, employees can access a virtual desktop from a shared pool, whereas in a persistent virtual desktop, each user gets a unique desktop image that can be customized with data and applications. VDI gives each user their virtual machine and supports only one user per operating system.</p><blockquote><strong>Remote Desktop Services</strong></blockquote><p>Remote desktop services (RDS) or remote desktop session host (RDSH) are beneficial where only limited applications require virtualization. They allow users to remotely access Windows applications and desktops using the Microsoft Windows Server operating system. RDS is a more cost-effective solution, since one Windows server can support multiple users.</p><blockquote><strong>Desktop-as-a-Service</strong></blockquote><p>Desktop-as-a-service (DaaS) is a flexible desktop virtualization solution that uses cloud-based virtual machines backed by a third-party provider. Using DaaS, organizations can outsource desktop virtualization solutions that help a user to access computer applications and desktops from any endpoint platform or device.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3ifdkPmo37MZpOY6QyRV9w.png" /></figure><p><strong><em>A real-world example</em></strong> of desktop virtualization can be found in a large healthcare organization, such as a hospital or a network of clinics. Let’s consider a scenario involving a hospital, “City Regional Hospital,” which implements desktop virtualization to enhance the efficiency and security of its healthcare operations.</p><p>Before implementation, they faced challenges with traditional workstations, requiring manual updates and facing security concerns due to decentralized data. After deploying Virtual Desktop Infrastructure (VDI), the hospital centralized management, significantly improving security and allowing healthcare professionals to access patient data securely from any location. The technology also accommodated BYOD preferences, resulting in improved patient care and regulatory compliance. Overall, desktop virtualization transformed operations, enabling efficient and secure access to critical patient information across the hospital.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*Qw_p9jARnd4YbIqhqTMGxg.png" /></figure><h3>3. Network Virtualization</h3><p>Network virtualization is a technology that abstracts and separates the logical network from the underlying physical network infrastructure. It allows multiple virtual networks to coexist on the same physical network, each operating independently and isolated from one another.</p><p>Network virtualization is particularly valuable in environments where there is a need for segmentation, isolation, and efficient use of network resources. It is widely used in data centers, cloud computing, and environments with complex networking requirements. Popular network virtualization solutions include VMware NSX, Cisco ACI, and open-source platforms like Open vSwitch.</p><h4><strong>Types of network virtualization</strong></h4><ol><li><strong>Internal Virtualization</strong><br>Internal virtualization is designed to use software containers to replicate the functionality of a single network.</li><li><strong>External Virtualization</strong><br>External virtualization combines multiple local networks into a single “virtual” network to improve the network efficiency.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/783/1*JPTNIX0xMJ2bw5VE6hcEFw.png" /></figure><p><strong><em>A real-world example</em></strong> of network virtualization can be found in a large cloud service provider, such as Amazon Web Services (AWS) or Microsoft Azure. Let’s consider a scenario involving AWS, a leading cloud computing platform.</p><p>Before implementation, AWS relied on a robust physical network infrastructure, isolated Virtual Private Clouds (VPCs), and tools like VPC peering for secure communication.</p><p>With network virtualization, AWS leverages overlay networks and SDN principles to create flexible, scalable configurations on top of their physical infrastructure. This enables customers to define their network architectures and policies. Additionally, virtualized load balancers and security groups manage network traffic within a customer’s VPC, enhancing availability and security. Key benefits include isolation and security, scalability, centralized management, and optimized resource utilization, allowing AWS to efficiently serve a multitude of customers and workloads. In essence, network virtualization empowers cloud service providers like AWS to deliver flexible, secure networking solutions, supporting diverse applications and services in an efficient, scalable manner.</p><h3>4. Storage Virtualization</h3><p>Storage virtualization is a technology that abstracts and separates the logical view of storage from its physical implementation. It allows multiple storage devices (such as hard drives, solid-state drives, or storage arrays) from different vendors to be pooled together and managed as a single, unified storage resource.</p><p>Storage virtualization is widely used in data centers, especially in large enterprises and cloud service providers, to improve storage management, enhance flexibility, and optimize resource utilization. Popular storage virtualization solutions include VMware vSAN, IBM SVC (SAN Volume Controller), and software-defined storage platforms like Ceph and OpenStack Swift.</p><h4><strong>Types of Storage Virtualization</strong></h4><p>Three main types of Storage Virtualization exist:</p><blockquote><strong>1. Host-Based Storage Virtualization:</strong></blockquote><p>Host-Based Storage Virtualization occurs at the host level through the installation of software on servers. This software manages the local storage resources, enabling the server’s operating system to abstract and virtualize directly connected storage devices. The host-based virtualization software takes on responsibilities like storage allocation and data replication. This approach is praised for its adaptability and simplicity, as it doesn’t require specialized hardware and can be implemented on existing servers.</p><blockquote><strong>2. Array-Based Storage Virtualization:</strong></blockquote><p>Array-Based Storage Virtualization refers to the incorporation of virtualization features within storage arrays themselves. In this approach, the storage arrays handle the aggregation of storage resources and present them as a unified virtual storage pool to hosts and applications. This feature is typically provided by storage vendors as part of their storage systems. It offers centralized management and integrates seamlessly with the underlying storage hardware. This leads to high performance and efficiency, as the optimization and virtualization processes occur within the storage devices.</p><blockquote><strong>3. Network-Based Storage Virtualization:</strong></blockquote><p>Network-Based Storage Virtualization utilizes a dedicated appliance situated between storage devices and servers. This intermediary abstracts the underlying storage hardware from servers and applications. It offers centralized management for storage resources, enabling administrators to oversee storage through a unified interface. This approach allows the pooling of diverse storage devices, irrespective of the vendor, into a unified virtual storage pool. It facilitates smooth data migration between various storage arrays without causing disruptions to applications. This type of virtualization is favored by large enterprises with intricate storage setups, as the appliance simplifies storage management tasks and improves data mobility within the infrastructure.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/810/1*dUk_3qOVcnYx6B-BAsVu3w.png" /></figure><p><strong><em>A real-world example</em></strong> of storage virtualization can be seen in a large enterprise that manages a complex storage infrastructure. Let’s consider a multinational corporation, “GlobalTech Inc.,” which relies heavily on data storage for its operations.</p><p>Before implementation, they faced disparate storage arrays, isolated storage management, limited flexibility, and complex data handling.</p><p>After adopting storage virtualization, GlobalTech centralized their storage into a virtual pool, providing a unified management interface regardless of underlying hardware. This allowed for dynamic resource allocation, reduced over-provisioning through thin provisioning, and facilitated seamless data mobility and migration. The virtualization platform also simplified data protection and redundancy, offering vendor-agnostic storage solutions. As a result, GlobalTech achieved a more agile and efficient storage infrastructure, enabling quick adaptation to changing storage needs while reducing complexity and maximizing resource utilization. Storage virtualization proved instrumental in modernizing and optimizing their data storage environment.</p><h4>5. Application Virtualization</h4><p>Application virtualization is a technology that separates an application from the underlying operating system, allowing it to run in an isolated environment called a “sandbox.” In this virtualized environment, the application has no direct interaction with the host operating system, which means it can run independently and without conflicts with other applications or system components.</p><p>Application virtualization is widely used in enterprise environments, particularly in scenarios where multiple applications need to coexist on the same system without conflicts. It is also valuable in situations where legacy applications need to be maintained alongside newer software or in environments with strict security requirements. Popular application virtualization solutions include VMware ThinApp, Microsoft App-V, and Citrix Virtual Apps.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*VqiWTvU_6Sg84Cnokhf7mQ.jpeg" /></figure><p><strong><em>A real-world example</em></strong> of application virtualization can be Citrix Virtual Apps (formerly XenApp). It enables users to access and run applications stored on a remote server instead of their local devices. Key features include centralized hosting, user access from diverse devices, real-time remote display, and optimized resource usage. Benefits encompass cross-platform accessibility, resource efficiency, simplified IT management, enhanced security, and compatibility with legacy applications. Enterprises widely employ Citrix Virtual Apps for centralized application management and accessibility across different devices and locations.</p><h3>6. Data Virtualization</h3><p>Data virtualization is a technology that allows for the abstraction, integration, and presentation of data from different sources, making it appear as if it comes from a single, unified source. This is done without physically moving or replicating the data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*4F-aycEV5a9OpwsDzgqj-g.png" /></figure><p><strong><em>A real-world example</em></strong> of data virtualization : GlobalMart, a multinational retail corporation, serves as an illustrative case of data virtualization application. It relies on diverse data sources, including point-of-sale systems, inventory management, CRM, online sales, social media analytics, and supply chain systems. By employing data virtualization, GlobalMart creates a unified data view without physically moving or duplicating it. This integration offers real-time insights, enables agile decision-making, supports customer personalization, optimizes inventory management, aids in market analysis, and results in cost savings by avoiding data replication. Through data virtualization, GlobalMart maximizes the efficiency of its data utilization, leading to informed decisions, enhanced customer experiences, and streamlined global operations.</p><h3>Other Types</h3><ul><li><strong>GPU Virtualization</strong>: Allows a physical GPU to be shared across multiple virtual machines, useful for tasks requiring high-performance graphics.</li><li><strong>Operating System-Level Virtualization</strong>: Allows multiple isolated user spaces (containers) within a single operating system instance.</li><li><strong>Hardware Virtualization</strong>: Creates a virtualized layer between the physical hardware and the operating system, enabling multiple OS instances on a single machine.</li><li><strong>Memory Virtualization</strong>: Aggregates the memory resources of multiple physical systems to create a larger, shared memory pool.</li><li><strong>I/O Virtualization</strong>: Enables multiple virtual machines to share physical I/O resources like network interfaces and storage controllers.</li><li><strong>Database Virtualization</strong>: Abstracts the database layer, allowing multiple databases to run on a single physical machine.</li><li><strong>File System Virtualization</strong>: Abstracts the file system, enabling it to span multiple physical storage devices.</li></ul><h3>Advantages of Virtualization</h3><p>Virtualization offers several key advantages:</p><ol><li><strong>Cost-Efficiency</strong>: Virtualization eliminates the need for physical hardware, making it a more cost-effective option. Instead of investing in expensive on-site resources, users can purchase licenses or access from third-party providers.</li><li><strong>Predictable Costs</strong>: Third-party providers typically offer virtualization services with predictable costs, allowing individuals and organizations to budget more effectively for their IT needs. This can be especially beneficial compared to the potentially high upfront cost of purchasing physical hardware.</li><li><strong>Reduced Workload</strong>: Virtualization providers handle hardware and software updates automatically, relieving local IT professionals from this task. This allows them to focus on other important responsibilities and ultimately saves money.</li><li><strong>Improved Uptime</strong>: Virtualization technologies contribute to significantly improved uptime. Some providers guarantee uptime rates of up to 99.9999%, even with budget-friendly options offering 99.99% uptime.</li><li><strong>Faster Resource Deployment</strong>: Virtualization streamlines resource provisioning, eliminating the need to set up physical machines or local networks. With at least one point of access to the virtual environment, resources can be quickly distributed throughout the organization.</li><li><strong>Facilitates Digital Entrepreneurship</strong>: Virtualization has democratized entrepreneurship in the digital realm. Platforms, servers, and storage solutions are readily available, enabling nearly anyone to start a side hustle or establish their own business. Online platforms like Fiverr and UpWork provide opportunities for freelancers to find work.</li><li><strong>Energy Savings</strong>: Virtualization is generally an energy-efficient system. By eliminating the need for local hardware and software options, energy consumption rates can be reduced. This translates to lower costs associated with cooling data centers and operating equipment, allowing funds to be allocated to other operational expenses and enhancing the overall return on investment (ROI) of virtualization.</li></ol><h3>Disadvantages of Virtualization</h3><p>Virtualization brings various benefits, but it also has drawbacks:</p><ol><li><strong>High Implementation Costs</strong>: Implementing virtualization can be costly for providers due to expenses related to hardware, software development, and procurement.</li><li><strong>Compatibility Limitations</strong>: Not all applications or servers may work optimally in a virtualized environment, potentially requiring a hybrid system. This introduces uncertainty, especially if vendor support is inconsistent.</li><li><strong>Security Risks</strong>: Virtualization poses a security risk due to the high value of data. Data breaches can be costly, and the likelihood of a breach in a virtualized environment is higher compared to some other scenarios.</li><li><strong>Availability Concerns</strong>: Organizations relying on third-party providers for availability may face challenges if assets become inaccessible for an extended period, potentially impacting competitiveness.</li><li><strong>Scalability Challenges</strong>: Virtualization supports rapid growth, but it may not meet aspirations for extensive expansion. Shared resources can lead to congestion within a virtualized network, potentially disadvantaging smaller businesses.</li><li><strong>Complex Chain of Dependencies</strong>: Unlike local equipment, virtualization relies on multiple interdependent links. Dependencies on ISP connections, LAN or Wi-Fi functionality, and online storage availability can disrupt operations if any component fails.</li><li><strong>Time-Intensive Processes</strong>: While virtualization streamlines implementation, it may require more time in the long run compared to local systems. Additional steps are needed to achieve desired outcomes.</li></ol><p>With proper management and awareness of communication issues, many of these disadvantages can be mitigated. Overall, virtualization remains a powerful and effective modern system when used thoughtfully.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d34af8c04cf1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Architectures in Distributed Systems]]></title>
            <link>https://medium.com/@sandzlvu/architectures-in-distributed-systems-4e729389ef0?source=rss-a6a77d69a9d9------2</link>
            <guid isPermaLink="false">https://medium.com/p/4e729389ef0</guid>
            <dc:creator><![CDATA[Sanduni Muthugala]]></dc:creator>
            <pubDate>Thu, 19 Oct 2023 13:33:25 GMT</pubDate>
            <atom:updated>2023-10-19T13:33:25.513Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5Xu7wolYxqDAEHrlc5xGLw.jpeg" /></figure><p>A distributed system is a software system that interconnects a collection of heterogeneous independent computers, where coordination and communication between computers only happen through message passing, with the intention of working towards a common goal. The idea behind distributed systems is to provide a viewpoint of being a single coherent system, to the outside world. So, the set of independent computers or nodes are interconnected through a Local Area Network (LAN) or a Wide Area Network (WAN).</p><h3>Distributed System Architectures</h3><p>Distributed system architectures are bundled up with components and connectors. Components can be individual nodes or important components in the architecture whereas connectors are the ones that connect each of these components.</p><ul><li>Component: A modular unit with well-defined interfaces , replaceable, reusable</li><li>Connector: A communication link between modules which mediates coordination or cooperation among components</li></ul><p>So the idea behind distributed architectures is to have these components presented on different platforms, where components can communicate with each other over a communication network in order to achieve specifics objectives.</p><h3>Architectural Styles</h3><p>Architectural styles are classified into two major architectures as</p><p><strong><em>1.Software Architecture</em></strong></p><p><strong><em>2.System Architecture</em></strong></p><p>when it comes to distributed systems.</p><p>The basic idea is to organize logically different components, and distribute those computers over the various machines.</p><p>Further these architectures are divided into sub concepts such as,</p><p><strong><em>Software Architecture :</em></strong></p><ul><li>Layered Architecture</li><li>Object Based Architecture</li><li>Data-centered Architecture</li><li>Event Based Architecture</li><li>Hybrid Architecture</li></ul><p><strong><em>System Architecture</em></strong></p><ul><li>Client-server Architecture</li><li>Peer to Peer Architecture</li></ul><h3>Software Architecture</h3><p>Software architectures in distributed systems refer to the high-level structures and design patterns that govern the organization of software components and their interactions within a networked environment. These architectures are essential for developing distributed systems that can efficiently process data, handle communication, and provide services across multiple interconnected nodes. Software architecture has main four architectural styles and combination of the architectures as hybrid architecture in distributed systems.</p><h4>1. Layered Architecture</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*Sas7wFg2nEzA8BI1ZuiIKw.png" /></figure><p>Layer architecture allows to organize the different kinds of components, and every layer make the communication in between its adjacent layers by pushing the requests and obtaining the all response. This layered architecture style also separates components into various units then it will be make the sufficient path for communication. Therefore anyone layer is unable to direct makes communication along with other layers. Then a layer is able to interact with its neighboring layers and then further layer for transferring own information to another layer and this process will be continue.</p><p>In some scenario, the layered architecture is in cross-layer coordination; and then in this layer, all adjacent layers are able to skip until it complete the request and offer the better performance output. The request flow path from upper to bottom and response flow towards from bottom to upwards. The main benefit of layered architecture is that every layer easily modified individually without getting any affect the entire system. This architecture style is usually used for OSI (Open System Interconnection) model.</p><p>The image given below, represents the basic architecture style of a distributed system.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1001/1*nilnEDWGcRlH4UCjeKKS4w.png" /></figure><h4>2. Object Based Architecture</h4><p>Object-Based Architecture is a software design approach that shares similarities with Object-Oriented Architecture (OOA) but differs in some fundamental aspects. While Object-Oriented Architecture focuses on creating complex systems using objects that combine data and behavior, Object-Based Architecture primarily emphasizes data encapsulation and abstraction, making it a useful choice for certain types of software systems.</p><p>At the core of Object-Based Architecture is the concept of objects, much like in OOA. These objects encapsulate data or attributes, representing real-world entities or abstract concepts within a software system. However, in Object-Based Architecture, the emphasis lies more on the data itself than on the behaviors associated with the objects.</p><p>One key feature of Object-Based Architecture is data abstraction. Objects in this architecture encapsulate data and provide well-defined interfaces for accessing and manipulating that data. This abstraction shields the internal data representation from external components, enhancing security and promoting data consistency and integrity.</p><p>Unlike Object-Oriented Architecture, Object-Based Architecture does not enforce the encapsulation of behavior (methods or functions) within objects. While objects in OOA often encapsulate both data and methods that operate on that data, Object-Based Architecture primarily focuses on data encapsulation. This means that in Object-Based systems, behaviors may be implemented separately, outside of the objects themselves.</p><p>Object-Based Architecture can be a suitable choice for systems where data modeling and data manipulation are the primary concerns. It is commonly used in databases, data warehouses, and systems that involve extensive data structuring and management. By emphasizing data encapsulation and abstraction, Object-Based Architecture allows for the creation of modular and maintainable systems, particularly when the behaviors associated with data manipulation are straightforward and consistent.</p><p>In summary, Object-Based Architecture is a design approach that centers on encapsulating and abstracting data within objects, while leaving the implementation of behaviors separate. It provides a way to structure and manage data in a modular and organized manner, making it well-suited for systems where data modeling and management are the primary considerations. However, for systems requiring complex behaviors and interactions, Object-Oriented Architecture may be a more suitable choice.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*EZDhlnQrnIpjtVro-tGoOA.png" /></figure><h4>3. Data Centered Architecture</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/590/1*DvWz31o8kdLBJ_A2ZxujtQ.png" /></figure><p>Data-Centered Architecture is a design paradigm that places data at the core of software and system development. Unlike some other architectural patterns that focus on behavior or components, data-centered architecture prioritizes the management, storage, and accessibility of data as the primary concern. This approach is particularly well-suited for systems where data is the central asset, such as databases, information systems, and data warehouses.</p><p>At the heart of Data-Centered Architecture is the idea that data is the most critical element of a system. This data can take various forms, including structured databases, unstructured documents, multimedia files, or even real-time data streams. The architecture emphasizes data modeling, data storage, data retrieval, and data manipulation as its primary components.</p><p>One of the key benefits of Data-Centered Architecture is data consistency. By centralizing data management and providing standardized access points, it ensures that data remains accurate, up-to-date, and coherent across the entire system. This is particularly important in environments where multiple components or services need access to the same data.</p><p>Data-Centered Architecture often relies on robust data management systems, such as relational databases or NoSQL databases, to store and organize data efficiently. These systems are designed to handle data storage, retrieval, indexing, and security, allowing developers to focus on utilizing data rather than building low-level data management components.</p><p>Another advantage is the ability to integrate and exchange data with external systems or services seamlessly. Data is often exposed through well-defined APIs, making it easier for other systems or applications to interact with and consume the data, promoting interoperability.</p><p>Despite its strengths, Data-Centered Architecture is not a one-size-fits-all solution. It’s most effective in scenarios where data is the primary concern, but may be less suitable for systems that require complex behavior or intricate communication patterns. In such cases, complementary architectural patterns, such as service-oriented or event-driven architectures, may be combined with Data-Centered Architecture to create comprehensive solutions.</p><p>In conclusion, Data-Centered Architecture is an architectural approach that prioritizes the management and accessibility of data within a system. It ensures data consistency, reliability, and integration while centralizing data-related concerns. When applied appropriately, it can lead to the development of robust and efficient data-centric systems.</p><h4>4. Event Based Architecture</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/711/1*-J2jV2KOMf4ByjjYNMa9qw.png" /></figure><p>Event-Based Architecture (EBA) is a software design pattern that revolves around the generation, detection, and handling of events within a system. Events represent significant occurrences or state changes, and EBA is particularly suited for building responsive, real-time, and loosely coupled distributed systems.</p><p>At the core of Event-Based Architecture are events, which act as messages or notifications triggered by specific actions or conditions within a software system. These events can range from user interactions in a graphical user interface (GUI) to data updates, sensor readings, or external system events. The central idea is to decouple components by allowing them to communicate indirectly through events, promoting modularity, scalability, and maintainability.</p><p><strong>Key components of Event-Based Architecture include:</strong></p><p><strong>1. Event Producers</strong>: These are entities or components responsible for generating events. They could be user interfaces, sensors, application modules, or external systems. Event producers dispatch events when specific conditions are met or actions are performed.</p><p><strong>2. Event Consumers:</strong> Event consumers subscribe to or register interest in specific types of events. They respond to events by executing predefined actions or event handlers. Consumers can be various software components, services, or even external systems that interact with the event-driven system.</p><p><strong>3. Event Broker or Message Bus: </strong>The event broker acts as an intermediary between event producers and consumers. It’s responsible for routing events to the appropriate consumers based on their subscriptions. Common event brokers include message queues, publish-subscribe systems, and event-driven middleware.</p><p><strong>Advantages of Event-Based Architecture:</strong></p><p><strong>1. Loose Coupling: </strong>EBA reduces dependencies between components, making systems more flexible and easier to evolve. Components can work independently as long as they understand the events they produce and consume.</p><p><strong>2. Scalability:</strong> It is well-suited for distributed and scalable systems. As system load increases, you can add more event consumers to handle events efficiently.</p><p><strong>3. Real-time Responsiveness:</strong> EBA allows for real-time processing and response to events, making it ideal for applications that require immediate action upon certain events, such as IoT, financial systems, and social media platforms.</p><p><strong>4. Modularity and Reusability:</strong> Components are organized around event handling, promoting modular and reusable code. Event-driven design encourages cleaner separation of concerns.</p><p><strong>5. Decentralization:</strong> Events can be generated and consumed by different parts of a system, potentially distributed across various servers or even cloud-based services.</p><p>In summary, Event-Based Architecture is a powerful design pattern for building responsive, scalable, and loosely coupled software systems. It leverages the concept of events to facilitate communication and coordination among system components, making it particularly well-suited for modern, distributed, and real-time applications.</p><h4>5. Hybrid Architecture</h4><p>Hybrid architecture in distributed systems refers to a design approach that combines elements of multiple architectural patterns to address specific requirements and achieve a balance between different system characteristics. It’s essentially a mix-and-match approach that leverages the strengths of various architectural styles to create a customized solution tailored to the needs of a particular application or system.</p><p>In complex distributed systems, it’s often challenging to find a single architectural pattern that perfectly fits all requirements. Each architectural style comes with its own set of advantages and trade-offs. Hybrid architecture recognizes this reality and allows architects and developers to integrate different architectural patterns to optimize system performance, scalability, security, and maintainability.</p><h3>System Architecture</h3><p>System-Level Architecture, also known as high-level architecture or system architecture, is a critical aspect of software and hardware design. It defines the overarching structure, components, and interactions of a complex system. This comprehensive blueprint guides the development, integration, and management of all subsystems, ensuring that they work cohesively to achieve the system’s intended functionality and objectives.</p><p>System-Level Architecture varies based on the type of system being designed. In software engineering, it might involve defining the high-level structure of a software application, including the user interface, data storage, and core processing components. In hardware design, it might outline the arrangement of components, such as processors, memory, and input/output interfaces, in a computer system.</p><p>The two major system level architectures that we use today are <strong>Client-server</strong> and <strong>Peer-to-peer</strong> (P2P). We use these two kinds of services in our day to day lives, but the difference between these two are often misinterpreted.</p><h4><strong>1. Client-Server Architecture</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*eKBWyBm2Abyz9C1ioFA84Q.png" /></figure><p>Client-Server Architecture, often abbreviated as C/S or C/S architecture, is a fundamental computing model used in distributed systems where the responsibilities of processing and managing data are divided between two distinct entities: the client and the server. This architecture underpins much of modern computing, powering everything from web applications and email systems to database management and cloud computing. Below, we’ll delve into the key aspects and advantages of Client-Server Architecture in more detail.</p><p><strong>Basic Structure</strong><br>In a Client-Server Architecture, the client and server are separate software components or machines that interact over a network. The client is responsible for requesting services, data, or resources, while the server is responsible for providing these services and managing data. This division of labor simplifies system design, as it separates concerns and allows for modular development.</p><p><strong>Client</strong><br>- The client, typically a user’s device or software application, initiates requests for specific services or data from the server.<br>- It presents the user interface and handles user input, making it the user-facing part of the system.<br>- Clients can range from web browsers in web applications to desktop software in client-server desktop applications.</p><p><strong>Server</strong><br>- The server is responsible for processing client requests, executing requested actions, and managing data.<br>- It operates in the background, waiting for incoming requests and responding accordingly.<br>- Servers can include web servers, database servers, email servers, and more, each dedicated to specific tasks.</p><p><strong>Advantages </strong><br><strong>1. Scalability:</strong> Client-Server Architecture can be easily scaled by adding more servers to handle increased client demands. This scalability is vital for web applications and services that experience varying levels of traffic.</p><p><strong>2. Centralized Data Management: </strong>Servers centralize data storage and management, ensuring data consistency and security. This centralization is critical for applications requiring secure and controlled access to data.</p><p><strong>3. Security: </strong>Servers can implement security measures to control access, authenticate clients, and protect data. This centralized approach often results in better security management.</p><p><strong>4. Resource Sharing:</strong> Client-Server Architecture enables resource sharing, such as file storage, printing, and processing power. Multiple clients can access and utilize server resources concurrently.</p><p><strong>5. Maintenance and Updates:</strong> Centralized servers allow for easier maintenance and updates, as changes can be applied to the server without affecting clients. This simplifies the task of keeping the system up-to-date and secure.</p><p><strong>Variations:</strong><br>Client-Server Architecture comes in various forms, including two-tier, three-tier, and n-tier architectures. These variations introduce additional layers between the client and server to enhance scalability, separation of concerns, and flexibility.</p><p>In conclusion, Client-Server Architecture is a fundamental model for designing distributed systems. Its division of responsibilities between clients and servers streamlines development, enhances security, and allows for efficient resource management. This architecture remains a cornerstone of modern computing, enabling the delivery of a wide range of services and applications over networks.</p><h4><strong>2. Peer-to-peer (P2P) Architecture</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/601/1*dBiLoFzxdIR7qxUc0cJXFA.png" /></figure><p>Peer-to-Peer (P2P) architecture is a decentralized and distributed system design that plays a fundamental role in networked communication and data sharing. Unlike traditional client-server models, where a central server handles requests and resources, P2P networks enable individual nodes (peers) to act both as consumers and providers of resources, promoting a more distributed and collaborative approach.</p><p><strong>Key Characteristics of Peer-to-Peer Architecture</strong></p><p><strong>1. Decentralization:</strong> In a P2P network, there is no central authority or server that controls resource distribution. Peers interact directly with one another, creating a decentralized system where no single point of failure exists.</p><p><strong>2. Resource Sharing:</strong> Peers in a P2P network can share various resources, including files, processing power, and even internet connectivity. This sharing can occur both actively (intentional sharing) and passively (resources being used by others).</p><p><strong>3. Autonomy: </strong>Each peer in a P2P network is autonomous and responsible for its own actions. This autonomy enhances the network’s fault tolerance and resilience.</p><p><strong>4. Scalability:</strong> P2P networks can easily scale by adding more peers, as each peer contributes to the network’s resources and capabilities. This scalability is a significant advantage in scenarios with variable demand.</p><p><strong>5. Dynamic Topology:</strong> P2P networks often feature dynamic and ever-changing topologies as peers join and leave the network. This adaptability is crucial for networks where nodes frequently come and go.</p><p><strong>Types of P2P Architectures</strong></p><p><strong>1. Pure P2P: </strong>In pure P2P networks, all peers have equal status and contribute resources to the network. Examples include file-sharing networks like BitTorrent, where each peer shares and downloads files <strong>directly from other peers.</strong></p><p><strong>2. Hybrid P2P: </strong>Hybrid P2P networks combine elements of both P2P and client-server architectures. Certain nodes may have specialized roles or additional responsibilities, such as indexing or routing, while others function primarily as peers. Skype, for instance, uses a hybrid P2P architecture.</p><p><strong>3. Structured P2P:</strong> Structured P2P networks impose a specific organization on the network, typically based on a distributed hash table (DHT). Examples include Chord and Kademlia, which enable efficient resource lookup and retrieval in large-scale networks.</p><p><strong>4. Unstructured P2P:</strong> In unstructured P2P networks, there is no strict organization, and peers connect based on various criteria, often through a flood-based search. Early file-sharing networks like Napster and Gnutella were unstructured P2P networks.</p><p><strong>Applications of P2P Architecture</strong></p><p><strong>1. File Sharing: </strong>P2P networks have revolutionized file sharing, allowing users to share and download files directly from one another, reducing the reliance on central servers.</p><p><strong>2. Content Delivery: </strong>P2P-based content delivery networks (CDNs) optimize the distribution of web content, making websites more resilient to high traffic loads.</p><p><strong>3. Collaborative Computing:</strong> P2P architecture enables distributed computing projects like SETI@home and Folding@home, where volunteers contribute their idle computing resources to scientific research.</p><p><strong>4. Communication: </strong>Some VoIP (Voice over Internet Protocol) and messaging applications employ P2P architecture to establish direct connections between users for communication.</p><p><strong>5. Blockchain: </strong>Blockchain technology, used in cryptocurrencies like Bitcoin, relies on P2P networks for consensus, transaction verification, and maintaining a ledger of all transactions.</p><p>In summary, Peer-to-Peer architecture is a versatile and decentralized design approach that has a broad range of applications across various domains, emphasizing autonomy, scalability, and resource sharing among peers. Its resilience and adaptability make it a valuable solution for modern networked systems.</p><h4><strong>Comparison Between Client-Server and Peer-to-Peer Architectures</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/808/1*0UOANyjK2uNGO_Wgn1HGWg.png" /></figure><p>Client-server and peer-to-peer architectures are two fundamental approaches to organizing and distributing computing resources and services in a networked environment. Each architecture has its own set of characteristics, advantages, and disadvantages. Let’s explore a detailed comparison between these two architectural paradigms:</p><p><strong>1. Control and Centralization:</strong></p><p>- Client-Server: In a client-server architecture, there is a clear division of roles. Servers centralize resources and services, managing data, processing requests, and ensuring security. Clients request services from servers but have limited control over the system’s operation.</p><p>- Peer-to-Peer: Peer-to-peer architectures distribute control and resources across all connected nodes. Each node acts as both a client and a server, making decisions collectively. There is no central authority or single point of control.</p><p><strong>2. Scalability:</strong></p><p>- Client-Server: Scaling a client-server architecture typically involves adding more servers to handle increased client demand. This can be efficient for specific use cases but might introduce complexity and cost.</p><p>- Peer-to-Peer: Peer-to-peer architectures are inherently scalable because every peer can contribute resources. As the network grows, the overall capacity and performance can improve without centralized bottlenecks.</p><p><strong>3. Resource Utilization:</strong></p><p>- Client-Server: Servers are responsible for providing services, and clients consume those services. Resources on the server can be efficiently managed and optimized, but unused resources may exist on clients.</p><p>- Peer-to-Peer: Peer-to-peer systems often utilize the idle resources of connected peers, which can lead to more efficient resource utilization across the network. However, resource management can be decentralized and less predictable.</p><p><strong>4. Fault Tolerance:</strong></p><p>- Client-Server: Fault tolerance relies on redundancy and backup servers. If a server fails, clients may experience downtime until the backup server takes over.</p><p>- Peer-to-Peer: Peer-to-peer architectures are often more fault-tolerant because there is no single point of failure. The network can continue to operate even if some peers go offline.</p><p><strong>5. Security:</strong></p><p>- Client-Server: Security can be more easily enforced in client-server architectures, as servers can implement access control, encryption, and other security measures. However, a compromised server can have significant consequences.</p><p>- Peer-to-Peer: Security in peer-to-peer systems can be challenging to manage since each peer may have varying levels of security and trustworthiness. It relies heavily on peer reputation and trust mechanisms.</p><p><strong>6. Use Cases:</strong></p><p>- Client-Server: Ideal for scenarios where centralized control, security, and resource optimization are essential. Commonly used in web applications, email servers, and database systems.</p><p>- Peer-to-Peer: Suited for scenarios where decentralization, scalability, and fault tolerance are priorities. Peer-to-peer networks are often found in file sharing, decentralized communication, and blockchain networks.</p><p><strong>7. Complexity:</strong></p><p>- Client-Server: Typically less complex to set up and manage due to the centralized nature of servers. Easier to implement for applications with well-defined server-client interactions.</p><p>- Peer-to-Peer: More complex to design and maintain, especially in large-scale networks, due to the decentralized nature and the need for peer discovery and coordination.</p><p>In conclusion, the choice between client-server and peer-to-peer architectures depends on the specific requirements and goals of a given application or system. Each architecture offers unique advantages and challenges, and the decision should be based on factors such as scalability, fault tolerance, resource utilization, and security. Ultimately, the appropriate choice will determine the effectiveness and efficiency of the networked system.</p><h3>Conclusion</h3><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4e729389ef0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Software Design Patterns]]></title>
            <link>https://medium.com/@sandzlvu/software-design-patterns-87dcc8f6e377?source=rss-a6a77d69a9d9------2</link>
            <guid isPermaLink="false">https://medium.com/p/87dcc8f6e377</guid>
            <dc:creator><![CDATA[Sanduni Muthugala]]></dc:creator>
            <pubDate>Thu, 24 Aug 2023 16:48:48 GMT</pubDate>
            <atom:updated>2023-08-24T18:27:38.934Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*YUQKGaXHeKLsyyx97kBkpg.jpeg" /></figure><h3>What is a Software Design Pattern?</h3><p><strong><em>Software design patterns are reusable solutions to common problems in software development. These patterns provide a structured and proven way to address recurring design challenges, enhance code maintainability, and promote best practices.</em></strong></p><p>In software engineering, a <strong>software design pattern</strong> is a general, reusable solution of how to solve a common problem when designing an application or system. Unlike a library or framework, which can be inserted and used right away, a design pattern is more of a template to approach the problem at hand.</p><p>Design patterns are used to support object-oriented programming (OOP), a paradigm that is based on the concepts of both objects (instances of a class; data with unique attributes) and classes (user-defined types of data).</p><h3>Why use Software Design Patterns</h3><p>Following are the benefits of using software design patterns:</p><ul><li>It speeds up the process of software development by providing previously used and well-tested solutions to recurring problems.</li><li>It makes the code understandable and readable for coders familiar with the pattern.</li><li>As the solution is previously used and tested, the chances of failures/errors are more petite.</li><li>Common software design patterns can be improved over time by considering more variables to develop more robust solutions.</li><li>Provides faster and easier practices for problem-solving.</li><li>It makes communications among coders and developers easier by using standard techniques and names for solutions.</li><li>It ensures that the final product is reusable and maintainable.</li></ul><h3>Classification of Software Design Patterns</h3><p>Based on purpose and intent, software design patterns are classified into three main categories.</p><p>They are:</p><blockquote><strong>Creational</strong></blockquote><blockquote><strong>Structural</strong></blockquote><blockquote><strong>Behavioral</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*vf8HaB9W6KqKOygcsmtt-w.png" /></figure><p>All the software design patterns can be kept under one of the above three categories. There are around 26 software design patterns.</p><p>Now we will discuss each of the categories in detail.</p><h3><strong>Creational Software Design Patterns</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/380/1*DbKd9be7PcMSko_71TldcQ.png" /></figure><p>These software design patterns are used for object creation, initialization, and class instantiation. What type of object should be initiated, what class object is to be instanced are the few problems solved by creational software design patterns. These can be further classified into class creational and object creational software patterns. These are used to improve the code reusability and flexibility.</p><p><strong>Example</strong></p><p>Suppose we are building a game where new players are joining continuously with new names as a guest. In such a case many instances of players will be created to work as a guest, but as soon as the person closes the game the guest player instance is of no use anymore. Such instances can be stored in an object pool and can be used when a request to create a new guest player is made.</p><p>Following are the Creational Software Design Patterns:</p><ul><li><strong>Singleton:</strong> It ensures that only one object can be created for a class. A global access point is provided to this instance.</li><li><strong>Prototype: </strong>Creating copies/clones of an already existing object without using inheritance. Here the copy does not depend upon the class of the object it is cloned from.</li><li><strong>Abstract Factory:</strong> It creates families of related objects without involving the classes. This helps us create new object variants without manipulating the existing client code.</li><li><strong>Factory Method:</strong> Create an interface with several classes to instantiate an object. The subclasses define the type of object. It can be used when we want to do the same thing, but the method differs on different platforms. Using this, you can gather the code for object creation in one place, making it easier to understand. A new variant can also be created without altering the existing classes.</li><li><strong>Builder: </strong>It breaks the process of complex object creation into steps so that it becomes easier to keep track of the functionalities of the object. This can be used to create objects of the same class with slight differences.</li><li><strong>Object Pool: </strong>The object Pool is also known as a resource pool, containing the objects that are instantiated and not in use. It is helpful in classes where object instantiation is costly and time-consuming. We use an object from the object pool instead of instantiating a new object each time.</li></ul><h3>Structural Software Design Patterns</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/366/1*xn1OxGfxRd0vjhwCqIMAiw.png" /></figure><p>Structural Software Design Patterns are the practices that are used for developing different compositions of classes and objects. Here, you can create new objects with new functionalities that may be a composition of two or more existing classes. They make the software more efficient and flexible.</p><p><strong>Example</strong></p><p>Suppose you are building an application where you get the input in XML format, now if you want to add a new feature to the existing application and that feature needs the data in JSON format. In such situation you can use the Adapter structural design pattern. Adapter allows the objects in an application to adapt to incompatible interfaces/formats and work together.</p><p>Following are the Structural Software Design Patterns:</p><ul><li><strong>Adapter:</strong> It allows the objects to adapt to incompatible interfaces and work together.</li><li><strong>Bridge: </strong>It is used to split the larger or loosely related classes into abstraction and implementation. It is used to create platform-independent software. It reduces the program’s complexity by dividing the errors to be dealt with separately with the higher-level abstraction part and the core implementation.</li><li><strong>Facade: </strong>Provides a streamlined interface to a library, framework, or any other complex collection of classes. It is like a simplified API that abstracts the low-level implementational details. It makes our code more readable and understandable by isolating the complex helper code from the high-level application code.</li><li><strong>Proxy: </strong>Proxy means to substitute an object with another object. It is used mainly when the object is complex and difficult to duplicate in memory.</li><li><strong>Composite: </strong>It is used where you can represent an object as a tree. You can use a tree structure to compose an object and let the clients work with these objects as if it is an individual objects.</li><li><strong>Decorator: </strong>Dynamically attach new functionalities to objects by wrapping the object inside a special wrapper containing those new functions. It allows us to add or remove responsibilities or functionalities at run time.</li><li><strong>Flyweight: </strong>It helps in memory management. Multiple objects share the common space for storing the exact details rather than consuming separate memory.</li><li><strong>Private class data: </strong>Defining data attributes as private will restrict the undesired manipulations. It ensures that no unwanted manipulations are made on data attributes by controlling the write access.</li></ul><blockquote>Behavioral Software Design Pattern</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/543/1*T1L6PvE8j98Tuc45Dn14VA.png" /></figure><p>Behavioral software design patterns are the patterns associated with the communication between objects. These are the patterns that are concerned with the responsibility assigned to objects. By using these patterns, you can get flexibility in communication.</p><p><strong>Example</strong></p><p>Suppose we are building an application where we have a lot of components and there are components inside other components. In such applications when we want to access an information then we can use a chain of responsibility that reaches the outermost component first and then moves inner and inner until it reaches the desired component.</p><p>Following are the Behavioral Software Design Patterns:</p><ul><li><strong>Chain of responsibility:</strong> This pattern creates a chain of handlers responsible for passing the information/request to the desired handler. A handler can either process the request or pass on the request to the next handler.</li><li><strong>Command:</strong> This converts any request into an object. This object contains all the information regarding the request. This allows us to pass the request like an object to functions, delays, or queues.</li><li><strong>Interpreter:</strong> This pattern allows to include of language in the program.</li><li><strong>Iterator:</strong> It is used to traverse the elements in a sequential order without understanding the unlying data structure used.</li><li><strong>Mediator:</strong> This allows the objects to communicate without establishing direct communication. You can introduce new mediators anytime without changing the basic components.</li><li><strong>Memento: </strong>It is used to save and restore the internal state of an object without revealing the inner implementational details. It is like taking a snapshot of an object’s state without violating its encapsulation.</li><li><strong>Null Object: </strong>It is mainly used as a default value to deal with missing values or at the initialization time.</li><li><strong>Observer:</strong> Observers are like reporters for objects that notify multiple other objects about the events associated with the objects they are observing.</li><li><strong>State: </strong>This pattern lets objects know what to do or alter when they change their internal state.</li><li><strong>Strategy:</strong> It lets you define multiple algorithms separated into different classes and make their objects interchangeable.</li><li><strong>Template Method: </strong>It defines the blueprint of an algorithm in the superclass that can be modified in the subclasses without changing its structure. It ensures code reusability.</li><li><strong>Visitor: </strong>It allows you to define new operations on the objects of different classes without redefining or changing the classes.</li></ul><blockquote><strong>Among these lets see 7 best software design patterns in details</strong></blockquote><h3>7 Best Software Design Patterns</h3><p>Although there are 23 design patterns listed in <em>Design Patterns: Elements of Reusable Object-Oriented Software,</em> of those there are 7 that are considered the most influential or important.</p><h4>1. Singleton Design Pattern</h4><p>The singleton design pattern falls under the “creational” type, restricting object creation for a class to only one instance and providing global access to a global variable. For example, many web developers lock up the “sitemap” to a single version that has global scope. Further, other patterns such as factory method, builder, prototype can use singletons. Facade and state objects are also often singletons.</p><p>While you may only have or need one instance of a class, this does not necessarily mean that is the time to use a singleton pattern to lock that object up or to force it into a global state. Singletons are a controversial design pattern, with some even arguing that singletons are an <a href="https://www.contentful.com/blog/singleton-pattern-evil-or-misused/">anti-pattern</a> to be avoided because locking up an object restricts future flexibility.</p><p><strong>Key Characteristics:</strong></p><ol><li><strong>Single Instance:</strong> The Singleton pattern ensures that a class has only one instance, and it provides a way to access that instance from any point in the application.</li><li><strong>Global Access:</strong> The single instance is globally accessible, making it easy to use across different parts of the codebase.</li><li><strong>Lazy Initialization:</strong> The instance is created only when it’s first requested, which helps save resources if the instance isn’t needed immediately.</li><li><strong>Private Constructor:</strong> The Singleton class typically has a private constructor to prevent direct instantiation from outside the class.</li><li><strong>Static Instance Method:</strong> The Singleton class provides a static method to access the single instance. If an instance doesn’t exist, the method creates one; if it already exists, it returns the existing instance.</li></ol><p><strong>Advantages:</strong></p><ol><li><strong>Global Point of Access:</strong> Singleton provides a centralized access point to an instance, making it easier to manage and control that instance’s behavior.</li><li><strong>Resource Management:</strong> Since there’s only one instance, it’s easier to manage resources associated with that instance, such as database connections or configuration settings.</li><li><strong>Avoids Duplicate Instances:</strong> The Singleton pattern ensures that there’s no possibility of accidentally creating multiple instances of a class.</li></ol><p><strong>Use Cases:</strong></p><ol><li><strong>Database Connections:</strong> Singleton can be used to manage a single, shared database connection throughout the application.</li><li><strong>Configuration Settings:</strong> If you have application-wide settings that need to be shared and consistent, Singleton can help manage them.</li><li><strong>Logger Instances:</strong> If you need to maintain a single logging instance, Singleton can ensure all parts of the application log to the same instance.</li></ol><p><strong>Disadvantages:</strong></p><ol><li><strong>Global State:</strong> The use of Singleton can introduce a global state in the application, which can lead to unintended dependencies and make the code harder to reason about.</li><li><strong>Testing Challenges:</strong> Singleton instances can make unit testing more difficult due to their global nature. Mocking and isolating Singleton instances can be complex.</li><li><strong>Tight Coupling:</strong> The Singleton pattern introduces tight coupling between the Singleton class and the rest of the code, making it harder to change or replace the Singleton class without affecting other parts of the code.</li></ol><p>we’ll use the Singleton pattern to create a configuration manager:</p><pre>class ConfigurationManager:<br>    _instance = None<br>    _config = {}<br><br>    def __new__(cls):<br>        if cls._instance is None:<br>            cls._instance = super().__new__(cls)<br>        return cls._instance<br><br>    def set_config(self, key, value):<br>        self._config[key] = value<br><br>    def get_config(self, key):<br>        return self._config.get(key, None)<br><br># Usage<br>config_manager1 = ConfigurationManager()<br>config_manager1.set_config(&quot;timeout&quot;, 30)<br><br>config_manager2 = ConfigurationManager()<br>timeout = config_manager2.get_config(&quot;timeout&quot;)<br>print(&quot;Timeout:&quot;, timeout)  # Output: &quot;Timeout: 30&quot;</pre><p>In summary, the Singleton design pattern is useful when you want to ensure a single instance of a class throughout your application, providing centralized access and resource management. However, its global nature and tight coupling should be carefully considered to avoid potential downsides.</p><h4>2. Factory Method Design Pattern</h4><p>In the factory method, a “creation” design pattern, developers create objects with a common interface but allow a class defer instantiation to subclasses. The factory method promotes loose coupling and code reuse, a “virtual constructor” that works with any class implementing the interface and allowing greater freedom for the sub-classes to choose the objects being created. When new classes are needed, they can be added to the factory.</p><p>The factory method is not appropriate for simple scenarios, an instance where developers risk over-complicating processes in order to use a design pattern.</p><p><strong>Key Components:</strong></p><ol><li><strong>Creator:</strong> This is the abstract class or interface that declares the factory method. It defines the common interface for creating objects, but the actual creation is delegated to concrete subclasses.</li><li><strong>Concrete Creator:</strong> These are the subclasses of the Creator that implement the factory method. Each subclass can create a specific type of object by overriding the factory method.</li><li><strong>Product:</strong> This is the abstract class or interface for the objects that the factory method creates. It defines the interface for the objects that the factory method produces.</li><li><strong>Concrete Product:</strong> These are the subclasses of the Product that are actually created by the concrete creator. Each Concrete Product represents a specific type of object.</li></ol><p><strong>Advantages:</strong></p><ol><li><strong>Flexibility:</strong> The Factory Method pattern allows for easy extensibility and flexibility in creating objects. You can introduce new Concrete Creator subclasses without changing existing client code.</li><li><strong>Encapsulation:</strong> The client code doesn’t need to know the specific class of objects being created. It works with the abstract interface defined by the Creator and Product classes.</li><li><strong>Separation of Concerns:</strong> The Factory Method pattern separates object creation from the client code, promoting a cleaner and more organized architecture.</li><li><strong>Subclass Control:</strong> Subclasses have the freedom to choose and create the appropriate Concrete Product. This allows for specialization and customization of object creation.</li></ol><p><strong>Disadvantages:</strong></p><ol><li><strong>Complexity:</strong> Introducing a Factory Method can add an extra layer of complexity to the code, which might not be necessary for simple applications.</li><li><strong>Increased Number of Classes:</strong> Implementing the Factory Method pattern can lead to an increased number of classes in the codebase, which might be overwhelming for small projects.</li><li><strong>Indirection:</strong> The Factory Method pattern introduces an indirection layer between the client code and the created objects, which could affect performance in situations where object creation is frequent.</li></ol><p>we’ll use the Factory Method pattern to create different shapes:</p><pre>from abc import ABC, abstractmethod<br><br>class Shape(ABC):<br>    @abstractmethod<br>    def draw(self):<br>        pass<br><br>class Circle(Shape):<br>    def draw(self):<br>        print(&quot;Drawing a circle&quot;)<br><br>class Square(Shape):<br>    def draw(self):<br>        print(&quot;Drawing a square&quot;)<br><br>class ShapeFactory(ABC):<br>    @abstractmethod<br>    def create_shape(self):<br>        pass<br><br>class CircleFactory(ShapeFactory):<br>    def create_shape(self):<br>        return Circle()<br><br>class SquareFactory(ShapeFactory):<br>    def create_shape(self):<br>        return Square()<br><br># Usage<br>circle_factory = CircleFactory()<br>square_factory = SquareFactory()<br><br>circle = circle_factory.create_shape()<br>square = square_factory.create_shape()<br><br>circle.draw()  # Output: &quot;Drawing a circle&quot;<br>square.draw()  # Output: &quot;Drawing a square&quot;</pre><p>In summary, the Factory Method design pattern is a powerful tool for creating objects in a flexible and extensible manner. It allows for the separation of object creation logic from the client code, promoting a more modular and maintainable design.</p><h4>3. Facade Design Pattern</h4><p>The facade design pattern is a “structural” design pattern that helps provide one interface (class) for access to a large body of code / various objects. A facade hides complexities of various sub-systems (often organized into a class) with a simple interface. For example, an eCommerce customer only wants one point of interacting with a brand, rather than individually communicating (interfacing) with each system to support the sale such as product inventory, authentication, security, payment processing, order fulfillment, etc. In this case, the Facade has encapsulated all the “order” activities and systems to provide a single interface — the customer remains completely unaware of what’s going on behind the scenes. Facade is an important concept to support the loosely coupled micro services architecture.</p><p><strong>Key Concepts:</strong></p><ol><li><strong>Simplification:</strong> The Facade pattern simplifies the interaction with a complex system by encapsulating its internal components and interactions behind a single, well-defined interface.</li><li><strong>Client Convenience:</strong> It provides a higher-level interface that is more convenient and intuitive for clients to use, hiding the details of how various subsystems work together.</li><li><strong>Subsystems Integration:</strong> The Facade aggregates and coordinates the interactions among various subsystem components, shielding clients from the need to manage these interactions themselves.</li><li><strong>Code Organization:</strong> By grouping related functionalities into a single entry point, the pattern improves the organization of code and enhances its readability and maintainability.</li><li><strong>Reduced Coupling:</strong> The Facade pattern reduces the coupling between clients and the subsystem, as clients interact with the subsystem through a single point of contact, rather than dealing directly with multiple components.</li></ol><p><strong>Example:</strong></p><p>Consider a complex home theater system consisting of an amplifier, DVD player, and projector. Each of these components has its own complex interface for controlling its functions. The Facade pattern can be used to create a simplified control interface that abstracts the interactions with these components. Clients can then control the entire home theater system using this unified interface without needing to understand the intricacies of individual component interactions.</p><p><strong>Advantages:</strong></p><ol><li><strong>Simplicity:</strong> Facades simplify the use of complex systems by providing a straightforward interface that hides implementation details.</li><li><strong>Client-Friendly:</strong> Clients are shielded from the complexities of subsystems, reducing the learning curve and potential errors.</li><li><strong>Decoupling:</strong> Facades promote loose coupling between clients and subsystems, allowing subsystems to evolve independently without affecting clients.</li><li><strong>Code Maintenance:</strong> Changes in the subsystem can be confined to the facade, minimizing the impact on client code.</li></ol><p><strong>Disadvantages:</strong></p><ol><li><strong>Limited Flexibility:</strong> Facades might not cover all possible use cases, limiting advanced or specialized interactions with subsystems.</li><li><strong>Added Abstraction:</strong> Adding an additional layer of abstraction can slightly impact performance due to the extra method call overhead. However, this impact is usually negligible for most applications.</li><li><strong>Potential Overhead:</strong> In some cases, creating a facade might require additional development effort, which could be seen as unnecessary for smaller or simple systems.</li></ol><p>we’ll use the Facade pattern to simplify the process of booking a hotel room:</p><pre>class HotelBookingSystem:<br>    def check_hotel_availability(self, hotel_id, check_in, check_out):<br>        print(f&quot;Checking availability of hotel {hotel_id} from {check_in} to {check_out}&quot;)<br><br>    def book_hotel(self, hotel_id, check_in, check_out):<br>        print(f&quot;Booking hotel {hotel_id} from {check_in} to {check_out}&quot;)<br><br>class TravelFacade:<br>    def __init__(self):<br>        self.hotel_booking_system = HotelBookingSystem()<br><br>    def book_travel(self, hotel_id, check_in, check_out):<br>        self.hotel_booking_system.check_hotel_availability(hotel_id, check_in, check_out)<br>        self.hotel_booking_system.book_hotel(hotel_id, check_in, check_out)<br>        print(f&quot;Travel booked successfully&quot;)<br><br># Usage<br>travel_facade = TravelFacade()<br><br>travel_facade.book_travel(&quot;123&quot;, &quot;2023-09-01&quot;, &quot;2023-09-05&quot;)</pre><p>The Facade pattern strikes a balance between making complex systems more accessible and maintaining a separation between client code and the underlying complexities. It’s particularly useful when dealing with legacy code, third-party libraries, or intricate systems that require a simplified user interface.</p><h4>4. Strategy Design Pattern</h4><p>The strategy design pattern is a “behavioral” software design pattern that is sometimes known as a policy pattern. In the strategy pattern, interchangeable algorithms are encapsulated together into a “family” with one of the algorithms being selected at runtime as needed. For example, a family of algorithms may be related to “sorting” products in an <a href="https://www.netsolutions.com/hub/digital-commerce">eCommerce</a> website — by size, colour, prize, etc. The strategy is implemented based upon the actions of the customer.</p><p>The strategy design pattern is incredibly powerful in personalization marketing strategies, responding to client location, inputs, or actions in order to deliver a different experience to each user.</p><p><strong>Key Components:</strong></p><ol><li><strong>Context:</strong> This is the class that holds a reference to the selected strategy. It provides an interface for clients to set the strategy and invokes the algorithm defined by the chosen strategy.</li><li><strong>Strategy:</strong> This is an interface or an abstract class that declares the common interface for all concrete strategies. It defines the contract that each strategy must adhere to.</li><li><strong>Concrete Strategies:</strong> These are the actual implementations of the strategies defined in the Strategy interface. Each concrete strategy encapsulates a specific algorithm that can be used by the context.</li></ol><p><strong>Advantages of the Strategy Design Pattern:</strong></p><ol><li><strong>Flexibility:</strong> The Strategy pattern allows for easy swapping of algorithms without modifying the client code. This is particularly useful when you have multiple algorithms that need to be used interchangeably.</li><li><strong>Separation of Concerns:</strong> The pattern promotes clean code organization by separating the algorithm implementation from the client code. This enhances modularity and makes code easier to maintain.</li><li><strong>Encapsulation:</strong> Each strategy is encapsulated within its own class, making it easier to manage and maintain. Changes to one strategy do not affect the others.</li><li><strong>Code Reusability:</strong> Since strategies are encapsulated, they can be reused across different contexts without duplicating code.</li><li><strong>Testing:</strong> Strategies can be tested independently, making it easier to verify the correctness of individual algorithms.</li></ol><p><strong>Use Cases:</strong></p><p>The Strategy pattern is useful in scenarios where a class has multiple ways of performing a task, and the selection of a specific approach needs to be flexible and interchangeable. For example, in sorting algorithms, payment processing, or text formatting, you can apply the Strategy pattern to allow various algorithms to be selected and used as needed.</p><p><strong>Example: Sorting Algorithms</strong></p><p>Consider a scenario where you want to sort a list of elements using different sorting algorithms such as QuickSort, MergeSort, and BubbleSort. Instead of implementing each algorithm within the sorting class, you can create separate strategy classes for each sorting algorithm. The sorting class would have a reference to the selected strategy and use it to perform the sorting.</p><p>we’ll use the Strategy pattern to implement different sorting algorithms:</p><pre>from abc import ABC, abstractmethod<br><br>class SortingStrategy(ABC):<br>    @abstractmethod<br>    def sort(self, data):<br>        pass<br><br>class BubbleSort(SortingStrategy):<br>    def sort(self, data):<br>        print(&quot;Bubble sort:&quot;, sorted(data))<br><br>class QuickSort(SortingStrategy):<br>    def sort(self, data):<br>        print(&quot;Quick sort:&quot;, sorted(data))<br><br>class SortingContext:<br>    def __init__(self, strategy):<br>        self._strategy = strategy<br><br>    def set_strategy(self, strategy):<br>        self._strategy = strategy<br><br>    def execute_sort(self, data):<br>        self._strategy.sort(data)<br><br># Usage<br>data = [5, 2, 8, 1, 9]<br><br>bubble_sort = BubbleSort()<br>quick_sort = QuickSort()<br><br>sorting_context = SortingContext(bubble_sort)<br>sorting_context.execute_sort(data)  # Output: &quot;Bubble sort: [1, 2, 5, 8, 9]&quot;<br><br>sorting_context.set_strategy(quick_sort)<br>sorting_context.execute_sort(data)  # Output: &quot;Quick sort: [1, 2, 5, 8, 9]&quot;</pre><p>In summary, the Strategy pattern provides a way to encapsulate algorithms in a flexible and interchangeable manner, promoting clean code organization, reusability, and maintainability. It’s particularly useful when you have multiple approaches to solving a problem and want to switch between them dynamically.</p><h4>5. Observer Design Pattern</h4><p>The observer design pattern is “behavioral,” linking an object (subject) to dependents (observers) in a one-to-many pattern. When any of the observers change, the subject is notified. The observer design pattern is useful in any kind of event-driven programming such as notifying a user of a new comment on Facebook, sending an email when an item ships, etc.</p><p><strong>Key Participants in the Observer Pattern:</strong></p><ol><li><strong>Subject:</strong> This is the object that holds the state and maintains a list of its dependents (observers). It provides methods to attach, detach, and notify observers.</li><li><strong>Observer:</strong> Observers are objects that are interested in the state changes of the subject. They register themselves with the subject to receive updates when the subject’s state changes. They typically implement an update method that is called by the subject when a change occurs.</li><li><strong>Concrete Subject:</strong> A concrete class that inherits from the Subject class and maintains its specific state. It sends notifications to observers when its state changes.</li><li><strong>Concrete Observer:</strong> Concrete classes that implement the Observer interface. They respond to updates from the subject by performing actions based on the new state.</li></ol><p><strong>Advantages of the Observer Design Pattern:</strong></p><ol><li><strong>Decoupling:</strong> The Observer pattern reduces direct coupling between subjects and observers, allowing them to evolve independently without affecting each other.</li><li><strong>Reusability:</strong> Observers can be reused across different subjects, and new observers can be easily added without modifying the subject.</li><li><strong>Flexibility:</strong> The pattern enables dynamic relationships between objects. Subjects can have any number of observers, and observers can subscribe and unsubscribe at runtime.</li><li><strong>Real-time Updates:</strong> The pattern enables real-time communication between objects. Observers are notified as soon as the subject’s state changes, ensuring timely updates.</li><li><strong>Separation of Concerns:</strong> It separates the logic for handling state changes from the rest of the application logic, making the codebase more organized and maintainable.</li></ol><p><strong>Disadvantages of the Observer Design Pattern:</strong></p><ol><li><strong>Performance Overhead:</strong> When subjects have a large number of observers, notifying all of them can introduce a performance overhead.</li><li><strong>Complexity:</strong> In complex systems, managing the relationships between subjects and observers might become challenging.</li><li><strong>Memory Leaks:</strong> Improperly managed observer subscriptions can lead to memory leaks if observers are not detached properly.</li></ol><p>we’ll use the Observer pattern to implement a stock market application that notifies investors about stock price changes:</p><pre>class Observer:<br>    def update(self, stock_name, stock_price):<br>        pass<br><br>class StockMarket:<br>    def __init__(self):<br>        self.observers = {}<br>        self.stocks = {}<br><br>    def add_observer(self, observer, stock_name):<br>        if stock_name not in self.observers:<br>            self.observers[stock_name] = []<br>        self.observers[stock_name].append(observer)<br><br>    def remove_observer(self, observer, stock_name):<br>        if stock_name in self.observers:<br>            self.observers[stock_name].remove(observer)<br><br>    def set_stock_price(self, stock_name, price):<br>        self.stocks[stock_name] = price<br>        self.notify_observers(stock_name, price)<br><br>    def notify_observers(self, stock_name, price):<br>        if stock_name in self.observers:<br>            for observer in self.observers[stock_name]:<br>                observer.update(stock_name, price)<br><br>class Investor(Observer):<br>    def __init__(self, name):<br>        self.name = name<br><br>    def update(self, stock_name, stock_price):<br>        print(f&quot;{self.name}: Stock {stock_name} price is now ${stock_price:.2f}&quot;)<br><br># Usage<br>stock_market = StockMarket()<br>investor1 = Investor(&quot;John&quot;)<br>investor2 = Investor(&quot;Alice&quot;)<br><br>stock_market.add_observer(investor1, &quot;AAPL&quot;)<br>stock_market.add_observer(investor2, &quot;AAPL&quot;)<br><br>stock_market.set_stock_price(&quot;AAPL&quot;, 150.75)  # Output: John and Alice both receive updates</pre><p>The Observer Design Pattern is commonly used in scenarios where there’s a need for real-time updates, event-driven architectures, and maintaining loose coupling between components. It’s often seen in graphical user interfaces, event-driven programming, and systems with multiple interconnected components that need to respond to changes in each other’s state.</p><h4>6. Builder Design Pattern</h4><p>The builder design pattern is “creational,” separating the object construction from the representation. This design pattern allows greater control over the design process (more a step-by-step), but it also decouples the representation to support multiple representations of an object using the same base construction code.</p><p>The builder pattern executes in sequential steps as the object is being built, calling only those steps that are necessary for each iteration of the object.</p><p><strong>Key Concepts:</strong></p><ol><li><strong>Director:</strong> This is responsible for orchestrating the construction process. It works with a builder to build an object step by step according to a specific algorithm or configuration.</li><li><strong>Builder:</strong> The builder interface defines the methods to create the parts of the complex object. Concrete builders implement these methods to construct and assemble the parts. Builders may have methods for setting various attributes or components.</li><li><strong>Product:</strong> The final object that’s constructed. It represents the complex object that the builder constructs.</li></ol><p><strong>Advantages of the Builder Design Pattern:</strong></p><ol><li><strong>Separation of Concerns:</strong> The pattern separates the construction of an object from its representation, promoting a clear separation of concerns between the client code, the director, and the builder.</li><li><strong>Flexibility:</strong> Builders can create different variations of the same complex object by using the same construction process. This allows for easy extension and modification of the product’s features.</li><li><strong>Step-by-Step Control:</strong> The director can guide the construction process step by step, ensuring that the object is constructed in a controlled and consistent manner.</li><li><strong>Readability:</strong> The code that creates complex objects becomes more readable, as the construction process is abstracted into the builder and the director classes.</li></ol><p><strong>Disadvantages of the Builder Design Pattern:</strong></p><ol><li><strong>Overhead:</strong> The pattern introduces additional complexity with the builder hierarchy and the director. In simple cases, this additional structure might be unnecessary.</li><li><strong>Multiple Classes:</strong> The pattern involves creating several classes (director, builder, product) which might be overkill for simple object creation scenarios.</li></ol><p><strong>When to Use the Builder Design Pattern:</strong></p><ol><li><strong>Complex Object Creation:</strong> Use the builder pattern when creating complex objects that require multiple steps or have multiple configuration options.</li><li><strong>Variability in Object Creation:</strong> When you need to create different variations of an object while following the same construction process, the builder pattern is beneficial.</li><li><strong>Avoiding Telescoping Constructors:</strong> If an object has many optional attributes, using the builder pattern can avoid having constructors with numerous parameters.</li><li><strong>Separation of Concerns:</strong> When you want to separate the client code from the details of object construction and representation, the builder pattern is a good choice.</li></ol><p>we’ll use the Builder pattern to create custom sandwiches :</p><pre>class Sandwich:<br>    def __init__(self):<br>        self.bread = &quot;&quot;<br>        self.fillings = []<br>        self.condiments = []<br><br>    def display_info(self):<br>        print(f&quot;Sandwich with {self.bread} bread, {&#39;, &#39;.join(self.fillings)} fillings, and {&#39;, &#39;.join(self.condiments)} condiments&quot;)<br><br>class SandwichBuilder:<br>    def set_bread(self, bread):<br>        self.bread = bread<br><br>    def add_filling(self, filling):<br>        self.fillings.append(filling)<br><br>    def add_condiment(self, condiment):<br>        self.condiments.append(condiment)<br><br>    def build(self):<br>        sandwich = Sandwich()<br>        sandwich.bread = self.bread<br>        sandwich.fillings = self.fillings<br>        sandwich.condiments = self.condiments<br>        return sandwich<br><br># Usage<br>builder = SandwichBuilder()<br><br>builder.set_bread(&quot;Wheat&quot;)<br>builder.add_filling(&quot;Turkey&quot;)<br>builder.add_filling(&quot;Lettuce&quot;)<br>builder.add_condiment(&quot;Mayonnaise&quot;)<br><br>sandwich = builder.build()<br>sandwich.display_info()  # Output: &quot;Sandwich with Wheat bread, Turkey fillings, and Mayonnaise condiments&quot;</pre><p>Overall, the Builder design pattern provides a structured and organized way to construct complex objects while maintaining flexibility and readability in the code. It’s particularly valuable when dealing with objects that have many attributes or configuration options.</p><h4>7. Adapter Design Pattern</h4><p>The adapter design pattern is a “wrapper” that converts one kind of interface into another existing kind of interface. The adapter design pattern helps classes work together when they are incompatible, allowing code to work together. Adapter patterns are useful to take mixed interfaces and make them a consistent API.</p><p><strong>Key Components:</strong></p><ol><li><strong>Target:</strong> This defines the interface that the client expects to interact with. It represents the domain-specific functionality that the client uses.</li><li><strong>Adaptee:</strong> This is the class that has the interface incompatible with the client’s expectations. It contains the actual functionality that needs to be adapted.</li><li><strong>Adapter:</strong> This is the class that implements the Target interface while holding an instance of the Adaptee. It acts as a bridge between the client and the Adaptee, translating calls from the Target interface to the Adaptee’s interface.</li></ol><p><strong>Advantages:</strong></p><ol><li><strong>Compatibility:</strong> The Adapter pattern allows two classes with different interfaces to work together without changing the existing code, promoting code reusability.</li><li><strong>Integration:</strong> It helps integrate legacy or third-party components into new systems that follow a different interface, avoiding code modification in the legacy codebase.</li><li><strong>Flexibility:</strong> The pattern allows for the introduction of new functionality or variations by creating new adapters, without modifying existing code.</li></ol><p><strong>Disadvantages:</strong></p><ol><li><strong>Complexity:</strong> Introducing adapters can lead to an increase in the complexity of the codebase, especially if there are many adapters in use.</li><li><strong>Runtime Overhead:</strong> The additional layer of abstraction introduced by adapters might result in a slight performance overhead.</li><li><strong>Design Decision:</strong> Deciding when and how to use adapters requires careful consideration to ensure they are used effectively and don’t complicate the design unnecessarily.</li></ol><p><strong>Use Cases:</strong></p><ol><li>Integrating legacy systems with modern systems.</li><li>Using third-party libraries or components with different interfaces.</li><li>Reusing existing classes in a new system that follows a different interface.</li></ol><p><strong>Example:</strong></p><p>Consider a scenario where a client expects a specific interface for charging devices, but different charging devices have different voltage levels. An Adapter can be created to provide a common charging interface and adapt the different devices’ voltages to the client’s expectations.</p><p>we’ll use the Object Adapter pattern to adapt different types of shapes to a common drawing interface:</p><pre>from abc import ABC, abstractmethod<br><br>class Shape(ABC):<br>    @abstractmethod<br>    def draw(self):<br>        pass<br><br>class Circle:<br>    def display_circle(self):<br>        print(&quot;Circle&quot;)<br><br>class Square:<br>    def show_square(self):<br>        print(&quot;Square&quot;)<br><br>class ShapeAdapter(Shape):<br>    def __init__(self, shape):<br>        self._shape = shape<br><br>    def draw(self):<br>        if isinstance(self._shape, Circle):<br>            self._shape.display_circle()<br>        elif isinstance(self._shape, Square):<br>            self._shape.show_square()<br><br># Usage<br>circle = Circle()<br>square = Square()<br><br>circle_adapter = ShapeAdapter(circle)<br>square_adapter = ShapeAdapter(square)<br><br>circle_adapter.draw()  # Output: &quot;Circle&quot;<br>square_adapter.draw()  # Output: &quot;Square&quot;</pre><p>In summary, the Adapter pattern helps in bridging the gap between incompatible interfaces, allowing different components to work together harmoniously. It facilitates code reuse, promotes system integration, and enhances flexibility in software design.</p><h3>Advantages and Disadvantages <strong>of Software Design Patterns</strong></h3><h4><strong>Advantages of Software Design Patterns:</strong></h4><ol><li><strong>Reusable Solutions:</strong> Design patterns provide proven solutions to recurring design problems. They encapsulate best practices and offer reusable templates for solving similar problems across different projects.</li><li><strong>Common Vocabulary:</strong> Design patterns establish a common vocabulary and shared understanding among developers. This facilitates communication and collaboration within development teams.</li><li><strong>Modularity and Maintainability:</strong> By promoting modular design and separation of concerns, design patterns enhance code maintainability and make it easier to modify or extend existing systems.</li><li><strong>Speed of Development:</strong> Design patterns accelerate the development process by offering ready-made solutions. Developers can focus more on implementing unique features rather than reinventing the wheel for common design challenges.</li><li><strong>Scalability:</strong> Design patterns help in creating scalable software architectures that can accommodate future changes and additions with minimal impact on existing code.</li><li><strong>Code Consistency:</strong> Using design patterns ensures that similar problems are solved in a consistent manner throughout the codebase, leading to a more coherent and readable code.</li></ol><h4><strong>Disadvantages of Software Design Patterns:</strong></h4><ol><li><strong>Overengineering:</strong> In some cases, applying design patterns might lead to unnecessary complexity, especially if the problem domain is simple. Overusing patterns can result in bloated code that is difficult to understand.</li><li><strong>Learning Curve:</strong> Design patterns require developers to understand and apply specific techniques, which can take time to learn. Inexperienced developers may struggle to grasp their concepts and proper implementation.</li><li><strong>Misapplication:</strong> Choosing the wrong design pattern for a problem or applying it inappropriately can lead to convoluted code that is harder to maintain and understand.</li><li><strong>Increased Abstraction:</strong> While design patterns promote abstraction and modularity, excessive use of patterns can make the codebase harder to debug and trace, as the logic might be scattered across various pattern components.</li><li><strong>Compatibility:</strong> Design patterns might not always seamlessly fit into every project or technology stack. They need to be adapted to fit the specific requirements and constraints of the project.</li><li><strong>Performance Overhead:</strong> Some design patterns introduce additional layers of indirection, which could lead to a slight performance overhead. However, this impact is generally negligible for most applications.</li></ol><p>It’s important to note that design patterns should be used judiciously, considering the specific context and requirements of the project. They are tools that can help improve software quality, but their application should be balanced with a pragmatic approach to ensure that they truly add value.</p><h3>Characteristics of a Good Software Design</h3><p>A good software design is essential for the <strong>optimization</strong> of development time and cost by ensuring that the team is clear on the system’s architecture and structure.</p><p><strong>Following is a list of some main characteristics of a good software design:</strong></p><ol><li>Correctness</li><li>Understandability</li><li>Performance</li><li>Modularity</li><li>Scalability</li><li>Security</li><li>Maintainability</li><li>Usability</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*9g-T-3BSxGpHuG1m.png" /></figure><h4>Correctness</h4><p>Correctness is an essential characteristic of a good software design as the primary goal of a software design is to correctly meet the intended user requirements and specifications without any errors or unexpected behaviors. In order to develop clear software, the software team must be given a clear understanding of the <strong>goals</strong> that are to be met as well as the <strong>potential risks and issues</strong>. Only a correct software design can provide a high-quality user experience to the end user.</p><h4>Understandability</h4><p>A software design that is easily understandable ensures that developers can easily comprehend the design and code, making it easier to maintain, test, and update the software. A good software design should be designed with <strong>simplicity</strong> in mind, ensuring that it is easy to understand and follow. This requires clear and concise documentation, comments, and naming conventions that make the code and design elements easy to comprehend.</p><h4>Performance</h4><p>A well-designed software system should be designed to perform efficiently and effectively, with the ability to handle <strong>high volumes of data and user requests</strong> without performance degradation and with optimization in mind. This requires careful consideration of the architecture, algorithms, and data structures used in the design.</p><p>Additionally, a good software design should be designed with the hardware and infrastructure in mind, ensuring that the software can leverage the available hardware resources and take advantage of the latest technologies for improved performance.</p><h4>Modularity</h4><p>Modularity is a critical characteristic of good software design, enabling developers to break down complex systems into smaller, more <strong>manageable components</strong>. Modularity provides benefits such as improved maintainability, testability, and reusability, making it easier to develop, test, and update software systems. A modular software design provides several benefits, including improved maintainability, testability, and reusability. A well-designed module should be designed with a clear and concise interface, making it easy to understand and use by other developers.</p><h4>Scalability</h4><p>A scalable software design should be designed with scalability in mind, including the ability to add <strong>new hardware resources</strong>, scale up or down depending on demand, and handle high volumes of data and user requests without performance degradation. A good software design should be designed with the ability to handle future growth, without requiring significant modifications or changes to the software system. This requires careful consideration of the architecture, design patterns, and scalability best practices used in the design.</p><h4>Security</h4><p>It refers to the ability of a software system to protect against <strong>unauthorized access</strong>, data breaches, and other security threats. requires careful consideration of security best practices, including threat modeling and risk analysis, to identify potential vulnerabilities and implement appropriate security measures. A secure software design should also include the ability to monitor and detect security threats, such as through the use of <strong>intrusion detection systems </strong>and other security monitoring tools.</p><h4>Maintainability</h4><p>It refers to the ease with which a software system can be modified, updated, or extended over time, while still maintaining its functionality and quality. A good software design should be designed with maintainability in mind, including the use of clear and concise code, well-defined interfaces, and appropriate <strong>documentation.</strong> This makes it easier for developers to understand and modify the code, reducing the potential for errors and simplifying the <strong>debugging process.</strong> Maintainability also requires the use of appropriate design patterns and software architecture, which enable changes to be made to the software system without affecting its overall functionality.</p><h4>Usability</h4><p>A good software design should be designed with usability in mind, including the use of intuitive user interfaces, <strong>clear navigation</strong>, and easy-to-understand documentation. This makes it easier for users to understand how the software system works and how to perform tasks, reducing the potential for errors and improving user satisfaction. Usability also requires the use of appropriate design principles, such as consistency, feedback, and error prevention. This makes it easier for users to learn how to use the software system, reduces the risk of user errors, and enables users to perform tasks more efficiently.</p><h3>Conclusion</h3><p>Since not every problem solution has to be developed by oneself, strategically applied design patterns can save time and resources. They can ensure that programs run effectively. A certain standardization is created. This is especially important for cross-team development. A software product is thereby uniformly and coherently conceived and implemented. Design patterns allow you to access the experience of others, but require your own experience in working with these solutions.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=87dcc8f6e377" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Amazon Web Services (AWS)]]></title>
            <link>https://medium.com/@sandzlvu/amazon-web-services-aws-2e28841743f0?source=rss-a6a77d69a9d9------2</link>
            <guid isPermaLink="false">https://medium.com/p/2e28841743f0</guid>
            <dc:creator><![CDATA[Sanduni Muthugala]]></dc:creator>
            <pubDate>Wed, 21 Sep 2022 01:56:07 GMT</pubDate>
            <atom:updated>2022-09-21T01:56:07.343Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tFl-8wQUENETYLjX5mYWuA.png" /></figure><h3>What is AWS?</h3><p>Amazon Web Services is a comprehensive, evolving cloud computing platform provided by Amazon that includes a mixture of infrastructure as a service, platform as a service and packaged software as a service offerings. AWS services can offer an organization tools such as compute power, database storage and content delivery services.</p><h3>History of AWS</h3><ul><li>In the year 2002 — AWS services were launched</li><li>In the year 2006- AWS cloud products were launched</li><li>In the year 2012 — AWS had its first customer event</li><li>In the year 2015- AWS achieved $4.6 billion</li><li>In the year 2016- Surpassed the $10 billion revenue target</li><li>In the year 2016- AWS snowball and AWS snowmobile were launched</li><li>In the year 2019- Released approximately 100 cloud services</li></ul><h3>How Does AWS Work?</h3><p>AWS usually works in several different configurations depending on the user’s requirements. However, the user must be able to see the type of configuration used and the particular server map with respect to the AWS service.</p><h3>What is AWS used for?</h3><p>AWS offers over 200 fully featured services. It allows you to select the programming language, database, operating system, web application platform, and other needed services. You can build, deploy, and manage applications, websites, and processes on AWS secure platform.</p><h3>Advantages of AWS</h3><ol><li>AWS provides a user-friendly programming model, architecture, database as well as operating system that has been already known to employers.</li><li>AWS is a very cost-effective service. There is no such thing as long-term commitments for anything you would like to purchase.</li><li>It offers billing and management for the centralized sector, hybrid computing, and fast installation or removal of your application in any location with few clicks.</li><li>There is no need to pay extra money on running data servers by AWS.</li><li>AWS offers a total ownership cost at very reasonable rates in comparison to other private cloud servers.</li></ol><h3>Disadvantages of AWS</h3><ol><li>AWS has supportive paid packages for intensive or immediate response. Thus, users might need to pay extra money for that.</li><li>There might be some cloud computing problems in AWS especially when you move to a cloud Server such as backup protection, downtime, and some limited control.</li><li>From region to region, AWS sets some default limitations on resources such as volumes, images, or snapshots.</li><li>If there is a sudden change in your hardware system, the application on the cloud might not offer great performance.</li></ol><h3>Applications of AWS</h3><p>The most common applications of AWS are storage and backup, websites, gaming, mobile, web, and social media applications.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/0*EiE9RMWLI5Oq2yW1.png" /></figure><h4>Storage and Backup</h4><p>One of the reasons why many businesses use AWS is because it offers multiple types of storage to choose from and is easily accessible as well. It can be used for storage and file indexing as well as to run critical business applications.</p><h4>Websites</h4><p>Businesses can host their websites on the AWS cloud, similar to other web applications.</p><h4>Gaming</h4><p>There is a lot of computing power needed to run gaming applications. AWS makes it easier to provide the best online gaming experience to gamers across the world.</p><h4>Mobile, Web and Social Applications</h4><p>A feature that separates AWS from other cloud services is its capability to launch and scale mobile, e-commerce, and SaaS application. API-driven code on AWS can enable companies to build uncompromisingly scalable applications without requiring any OS and other systems.</p><h4>Internet of Things</h4><p>AWS IoT service offers a back-end platform to manage IoT devices as well as data ingestion to database services and AWS storage. AWS IoT Button offers limited IoT functionality to hardware.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/517/1*b9nooXKToVoRTsN2Su-4_A.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2e28841743f0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Keys in DBMS]]></title>
            <link>https://medium.com/@sandzlvu/keys-in-dbms-86b640bd7955?source=rss-a6a77d69a9d9------2</link>
            <guid isPermaLink="false">https://medium.com/p/86b640bd7955</guid>
            <dc:creator><![CDATA[Sanduni Muthugala]]></dc:creator>
            <pubDate>Fri, 02 Sep 2022 15:24:43 GMT</pubDate>
            <atom:updated>2022-09-02T15:24:43.102Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3fkKx2eo8spPOpCSpCRmGA.jpeg" /></figure><h3>What are Keys in DBMS?</h3><p><strong>KEYS in DBMS</strong> is an attribute or set of attributes which helps you to identify a row(tuple) in a relation(table). They allow you to find the relation between two tables. Keys help you uniquely identify a row in a table by a combination of one or more columns in that table. Key is also helpful for finding unique record or row from the table.</p><h3>Types of Keys in DBMS</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NOzmG3EsiwXprmsAqa5sew.png" /></figure><h4>1. Primary Key</h4><p>The primary key refers to a column or a set of columns of a table that helps us identify all the records uniquely present in that table. A table can consist of just one primary key. Also, this primary key cannot consist of the same values reappearing/repeating for any of its rows. All the values of a primary key have to be different, and there should be no repetitions.</p><p>This constraint that we put on a column/set of columns won’t allow these to have a null value or a duplicate. Any table can consist of only a single primary key constraint. A foreign key that refers to it can never change the values present in the primary key.</p><h4>2. Super Key</h4><p>A super key refers to the set of all those keys that help us uniquely identify all the rows present in a table. It means that all of these columns present in a table that can identify the columns of that table uniquely act as the super keys.</p><p>A super key is a candidate key’s superset. We need to pick the primary key of any table from the super key’s set so as to make it the table’s identity attribute.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/450/1*7sWGj7pBFdWQkQXHj7mFqQ.png" /></figure><h4>3. Candidate Key</h4><p>The candidate keys refer to those attributes that identify rows uniquely in a table. In a table, we select the primary key from a candidate key. Thus, a candidate key has similar properties as that of the primary keys that we have explained above. In a table, there can be multiple candidate keys.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/819/1*_Ko_BOdAB1by5AohBZPFOA.jpeg" /></figure><h4>4. Alternate Key</h4><p>Any table can consist of multiple choices for the primary key. But, it can only choose one. Thus, all those keys that did not become a primary key are known as alternate keys.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/604/1*0urkUXsLySaZe3D6fVe06A.png" /></figure><h4>5. Foreign Key</h4><p>We use a foreign key to establish relationships between two available tables. The foreign key would require every value present in a column/set of columns to match the referential table’s primary key. A foreign key helps us to maintain data as well as referential integrity.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*4X3ToUWDOgk6DzRBNTd7Tw.png" /></figure><h4>6. Composite Key</h4><p>The composite key refers to a set of multiple attributes that help us uniquely identify every tuple present in a table. The attributes present in a set may not be unique whenever we consider them separately. Thus, when we take them all together, it will ensure total uniqueness.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*yK2QdFonXATtg3ujeGdCBA.png" /></figure><h4>7. Unique Key</h4><p>A unique key refers to a column/a set of columns that identify every record uniquely in a table. All the values in this key would have to be unique. Remember that a unique key is different from a primary key. It is because it is only capable of having one null value. A primary key, on the other hand, cannot have a null value.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*9EayOIZuUcXQX_4YgoGd7Q.png" /></figure><h3>Advantages of the keys in DBMS:</h3><ul><li><strong>Improved Information Security</strong>: DBMS has the capability to manage users and implement policies for security and compliance control. This controlled user access raises the database protection and makes the information much less weak to security breaches.</li><li><strong>Simple Information Sharing</strong>: DBMS allows users to use the database properly regardless of their location of theirs. As a result, they can deal with any database-related task faster without the necessity for complicated access methods or even stressing about database security. <br>In addition to that, keys in DBMS allow multiple people to collaborate efficiently when interacting with the repository.</li><li><strong>Data Integration</strong>: DBMS enables users to obtain a centralized view of directories dispersed across several locations and control them using a single screen rather than running them as individual entities.</li><li><strong>Abstraction &amp; Independence</strong>: Keys in DBMS allows users to alter the actual physical schema of a data source without altering the rational schema that governs repository relationships. As a result, businesses are able to scale the underlying repository infrastructure without impacting the database operations. In addition, any shift to the rational schema can additionally be completed without affecting programs that use the databases.</li><li><strong>Uniform Management and Monitoring</strong>: DBMS has a single screen to carry out all of the management and monitoring projects, therefore simplifying the workload of the repository administrators. These chores are able to range from database development and schema modifications to reporting and auditing.</li></ul><h3>Conclusion</h3><p>KEYS in DBMS is a characteristic or a set of attributes that allow you to determine a row(tuple) in a relation(table). They let you search for the relation between the 2 tables. Keys help you exclusively recognize a row at a table by a mix of one or more columns in this table.</p><p>Keys in DBMS allow the sharing of details in the database among many apps or people to provide drivers with a single all-encompassing details repository, keys in DBMS play a crucial role.</p><p>The keys in DBMS serve as the intermediary between the user and the database.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*cae2_B5lK81evZnoIyYeJQ.jpeg" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=86b640bd7955" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Evaluation of DBMS]]></title>
            <link>https://medium.com/@sandzlvu/evaluation-of-dbms-8e30da7b6cc2?source=rss-a6a77d69a9d9------2</link>
            <guid isPermaLink="false">https://medium.com/p/8e30da7b6cc2</guid>
            <dc:creator><![CDATA[Sanduni Muthugala]]></dc:creator>
            <pubDate>Thu, 21 Jul 2022 14:27:34 GMT</pubDate>
            <atom:updated>2022-07-21T14:27:34.040Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/894/1*PVpJrrz852Mc1ApHnmIJRg.jpeg" /></figure><h3>Introduction</h3><p>There are various database management systems available in the market. Each type has its features and can be used for different purposes.</p><h4><strong>What is DBMS?</strong></h4><p>A Database Management System (DBMS) is system software for creating and managing databases. A DBMS makes it possible for end users to create, protect, read, update and delete data in a database.</p><p>Ex: MySQL, PostgreSQL, Microsoft Access, SQL Server, FileMaker, Oracle, RDBMS, dBASE, Clipper, and FoxPro etc.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WKQtCEuw4ozCD3BOiknV3w.png" /></figure><p>DBMS history dates back to the 1960’s</p><p><strong>1.Flat files (1960s — 1980s) : </strong>Database that stores information in a single file or table. There is no structural relationship among the records and they cannot contain multiple tables as well.</p><p><strong>2.Hierarchical database (1970s — 1990s) : </strong>Contains data in a hierarchically-arranged data. It can be visualized as a family tree where there is a parent and a child relationship. Each parent can have many children but one child can only have one parent</p><p><strong>3.Network DBMS(1970s -1990s) : </strong>Graph structure which allows multiple parent and child relationships.</p><p><strong>4.Relational DBMS(1980s-present) : </strong>Allows the entities to be related through a common attribute. In the table there are alternative keys. This property makes this model extremely flexible.</p><p><strong>5.Object — oriented DBMS(1990s -present) : </strong>The data or information is presented in the form of objects, much like in object-Oriented programming language.</p><p><strong>6. Object- relational DBMS(1990s-present) : </strong>Displays a modified object- oriented user- display over the already implemented relationship database management system.(composed of both a relational dbms(RDBMS) and an object-oriented dbms(OODBMS))</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/558/1*4QZxeRNkeeEkRUpNibQ5og.png" /></figure><h3>Types of DBMS</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/594/0*GpsnTlPM-Sv28_7t.png" /></figure><h4>1 ~ Hierarchical DBMS</h4><p>In a Hierarchical database, model data is organized in a tree-like structure. Data is Stored Hierarchically (top down or bottom up) format. Data is represented using a parent-child relationship. In Hierarchical DBMS parent may have many children, but children have only one parent.</p><h4>2 ~ Network Model</h4><p>The network database model allows each child to have multiple parents. It helps you to address the need to model more complex relationships like as the orders/parts many-to-many relationship. In this model, entities are organized in a graph which can be accessed through several paths.</p><h4>3 ~ Relational Model</h4><p>Relational DBMS is the most widely used DBMS model because it is one of the easiest. This model is based on normalizing data in the rows and columns of the tables. Relational model stored in fixed structures and manipulated using SQL.</p><h4>4 ~ Object-Oriented Model</h4><p>In Object-oriented Model data stored in the form of objects. The structure which is called classes which display data within it. It is one of the components of DBMS that defines a database as a collection of objects which stores both data members values and operations.</p><h3>Components of DBMS</h3><p>The database management system can be divided into six major components, they are:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2l5QKb7vCyzLX8yrRmaTEA.png" /></figure><ol><li><strong>Hardware : </strong>Computer, hard disks, I/O channels for data, and any other physical component involved before any data is successfully stored into the memory. When running Oracle or MySQL on computer, then computer’s Hard Disk, Keyboard, RAM, ROM all become a part of the DBMS hardware.</li><li><strong>Software </strong>:The DBMS software provides with an easy-to-use interface to store, access and update data. The DBMS software is capable of understanding the Database Access Language and interpret it into actual database commands to execute them on the DB.</li><li><strong>Data </strong>: Data is that resource, for which DBMS was designed. The motive behind the creation of DBMS was to store and utilize data. In a typical Database, the user saved Data is present and <strong>meta data</strong> is stored.</li><li><strong>Procedure </strong>: General instructions to use a database management system. This includes procedures to setup and install a DBMS, To login and logout of DBMS software, to manage databases, to take backups, generating reports etc.</li><li><strong>Database Access Language</strong> : Simple language designed to write commands to access, insert, update and delete data stored in any database.</li><li><strong>People </strong>: The people who control and manage the databases and perform different types of operations on the database in the DBMS. The people include database administrator, software developer and End user.</li></ol><h3>Evaluation of DBMS</h3><p>To choose the most suitable DBMS, we need to evaluate from various systems. We perform a structured approach to evaluate the database systems.</p><h4>~ Evaluation Methodology</h4><p>This step involves two analyses. Both these analyses should be performed to determine the most suited DBMS.</p><ol><li><strong>Feature analysis</strong></li></ol><p>In here, we determine whether the DBMS provides all the features required for the operations that are to be performed on the data and shortlist the DBMS. This analysis serves two purposes:</p><ul><li>It directly eliminates the DBMS that is not competent to fulfill all the needs of the user.</li><li>We can rank the remaining systems based on the features provided by them.</li></ul><p><strong>2. Performance Analysis</strong></p><p>In here, we analyze only those shortlisted DBMS, evaluate the systems’ efficiency, and choose one with maximum efficiency. The purpose of this analysis is:</p><ul><li>To analyze the behavior of the database management system in the user system.</li><li>To gather the data on the performance of the DBMS and rank them accordingly.</li></ul><p>There are various methods to judge the performance of the database management system. Some of the most used methods are Analytical and Stimulation modelling and Benchmarking.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*pQbUoTKuWaQl34zzobDTSg.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8e30da7b6cc2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[File System vs DBMS]]></title>
            <link>https://medium.com/@sandzlvu/file-system-vs-dbms-d5d838ca326a?source=rss-a6a77d69a9d9------2</link>
            <guid isPermaLink="false">https://medium.com/p/d5d838ca326a</guid>
            <dc:creator><![CDATA[Sanduni Muthugala]]></dc:creator>
            <pubDate>Fri, 08 Jul 2022 10:01:16 GMT</pubDate>
            <atom:updated>2022-07-08T10:01:16.823Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/570/1*whFWiUgLYyIvUbD-VS9SSw.jpeg" /></figure><h3><strong>Introduction</strong></h3><p>A<strong> file system</strong> is a software that manages and organizes the files in a storage medium, whereas <strong>DBMS (Database Management System)</strong> is a software application that is used for accessing, creating, and managing databases. File system was used before DBMS which means problems occurred in file system has been solved in the DBMS. So DBMS is actually better than file system.</p><p><strong><em>File System</em></strong></p><p>A file system is a technique of arranging the files in a storage medium such as hard disk, pen drive, DVD, etc. It helps you to organizes the data and allows easy retrieval of files when they are required. A file system enables you to handle the way of reading and writing data to the storage medium. It’s directly installed into the computer with the OS.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/697/1*bIJAhHGZIzvP14laVDoTrw.png" /></figure><p><strong><em>Database Management System</em></strong></p><p>DBMS software that manages the collection of related data. It’s used for storing data and retrieving the data effectively when it is needed. It also provides proper security measures for protecting the data from unauthorized access. In DBMS the data can be fetched by SQL queries and relational algebra. It also provides mechanisms for data recovery and data backup.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/710/1*SJaWgwkXbeYLnXCxtt-X0A.jpeg" /></figure><p>Examples of popular DBMS softwares are Oracle, MySQL, PostgreSQL, MS SQL Server, DB2, Microsoft Access, File maker, RDBMS, dBASE, Clipper, Foxpro etc.</p><h3>Difference between File System and DBMS</h3><p>Now, we will differentiate a file processing system and database management system in terms of certain aspects.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/820/1*lJreN06KkrNbNYLKEccdwA.png" /></figure><p><strong>1.Data Redundancy and Consistency</strong></p><p>In <strong>file system</strong>, files are created in different formats and in different programming languages. Also, they are also duplicated at times, leading to redundancy of data, which need more storage.</p><p>Whereas <strong>DBMS </strong>controls redundancy, as one item is stored at only one place in a DBMS, so there is no redundancy or inconsistency, So this saves a lot of storage space.</p><p><strong>2.Accessing and sharing of data</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*A77wAyq6bwZ-bJ3YvYYQ-g.jpeg" /></figure><p>In <strong>file system</strong>, data is distributed in many files, and it may be of different formats, so it isn’t easy to access and share data.</p><p>whereas in <strong>DBMS </strong>due to the centralized approach, data sharing and accessing is easy compared to file system.</p><p><strong>3.Data Abstraction</strong></p><p><strong>DBMS </strong>gives an abstract view of data that hides the details.</p><p>The<strong> file system</strong> provides the detail of the data representation and storage of data.</p><p><strong>4.Security of Data</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/767/1*XMlXVi3Wy_tRdZTxvH-ylg.jpeg" /></figure><p>In <strong>file system</strong>, application programs are added in ad-hoc manner, and enforcing such security constraints is difficult.</p><p>Whereas, in <strong>DBMS </strong>provides security and authorization system, which ensures that some users are not authorized to access all the data in the database. So more reliable than file system.</p><p><strong>5.Recovery Mechanism</strong></p><p>Data lost situations could happen due to software failures or other reasons. In such situation<strong> file system</strong> doesn’t provide the facility of recovery.</p><p>But in <strong>DBMS</strong>, it does provide users the facilities of backup and recovery of data so that the valuable data isn’t lost.</p><p><strong>6.Manipulation Techniques</strong></p><p><strong>DBMS </strong>contains a wide variety of sophisticated techniques to store and retrieve the data.</p><p>But in<strong> file system </strong>can’t efficiently store and retrieve the data.</p><p><strong>7.Cost</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/848/1*YYCRGhpTJuhDN3S1eEz5_w.jpeg" /></figure><p>The <strong>DBMS</strong> is expensive to design.</p><p><strong>File system </strong>is relatively cheaper as compared to DBMS.</p><p><strong>8.Concurrency control</strong></p><p><strong>DBMS </strong>has concurrency control.</p><p>In the <strong>file system</strong>, concurrent access has many problems like redirecting the file while deleting some information or updating some information.</p><p><strong>9.Data Independence</strong></p><p>In the <strong>file system</strong> approach, there exists no data independence.</p><p>But in <strong>DBMS </strong>data independence exists as logical data independence and physical data independence.</p><p><strong>10.Flexibility</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D5ThwKgms4e_FXyawmqR_g.jpeg" /></figure><p>Changes are often a necessity to the content of the data stored in any system, and these changes are more easily with a <strong>DBMS </strong>approach.</p><p>The flexibility of the<strong> file system</strong> is less as compared to the DBMS approach.</p><h3>Conclusion</h3><p>Both database management systems and file systems have their own advantages and disadvantages. But Database Management System is much better than a File System, as a DBMS holds several advantages over File System.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*E3bMrjSEVqVZdQgWk5uGwQ.jpeg" /></figure><p>Even though DBMS better than file system in work it depends on the requirements as to which would be a better choice to go ahead with. For a small business, a file system would be the better option whereas, for a big scale business, a DBMS would be much better.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d5d838ca326a" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>