<?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 AyeshwerySamarakoon on Medium]]></title>
        <description><![CDATA[Stories by AyeshwerySamarakoon on Medium]]></description>
        <link>https://medium.com/@ayeshwery?source=rss-dd4230614455------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*-jwTKlkp4NBgd0IW</url>
            <title>Stories by AyeshwerySamarakoon on Medium</title>
            <link>https://medium.com/@ayeshwery?source=rss-dd4230614455------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 11:01:23 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ayeshwery/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[Mobile App Testing]]></title>
            <link>https://medium.com/@ayeshwery/mobile-app-testing-84313c5c2a6b?source=rss-dd4230614455------2</link>
            <guid isPermaLink="false">https://medium.com/p/84313c5c2a6b</guid>
            <category><![CDATA[mobile-app-testing]]></category>
            <category><![CDATA[quality-assurance]]></category>
            <category><![CDATA[software-testing]]></category>
            <category><![CDATA[mobile-app-development]]></category>
            <dc:creator><![CDATA[AyeshwerySamarakoon]]></dc:creator>
            <pubDate>Sat, 29 Jun 2024 18:56:40 GMT</pubDate>
            <atom:updated>2024-06-29T18:56:40.497Z</atom:updated>
            <content:encoded><![CDATA[<p>The systematic process of assessing a mobile application’s functionality, usability, and performance is known as mobile app testing.Examining the app’s functionality, user experience, security, and compatibility with different systems and devices is part of this process.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/590/1*7cIN4WzVb16A2rast8TR6w.jpeg" /></figure><p>It involves evaluating and validating mobile applications across various devices, platforms, and operating systems to uncover defects, optimize performance, and deliver a seamless user experience.</p><p>Let see the different mobile app testing types and how they uniquely contribute to delivering an exceptional end-user experience</p><p><strong>Types of Mobile Applications</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/283/1*Cv6Emnih_WrR3_su7JZ3bA.png" /></figure><p><strong>Native apps</strong></p><p>These are created with programming languages (Java/Kotlin for Android, Swift for iOS) specifically for the respective platforms (iOS or Android). Native applications frequently use characteristics unique to the device and perform better.</p><p>Example: <strong>Instagram:</strong> Developed using Swift and Objective-C for iOS, Instagram offers smooth performance and a rich user experience, taking full advantage of iOS features. <strong>Google Maps:</strong> Built using Java and Kotlin, Google Maps on Android is highly optimised for the platform, providing excellent functionality and integration with Android features.</p><p><strong>Web apps</strong></p><p>They are web pages that have been tailored to work with mobile browsers. A web browser is needed to view them, and an internet connection is necessary.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*_i9vmrg6g18D_SK3ai_NvA.jpeg" /></figure><p>Example:<strong>Amazon-</strong>The mobile website of Amazon (m.amazon.com) is a web app that users can access through their mobile browser. It provides a responsive design that adjusts to different screen sizes and offers a functional shopping experience without requiring a download.</p><p><strong>Hybrid Apps</strong></p><p>Developed with web technologies (HTML, CSS, JavaScript), hybrid apps combine components of web and native applications and are distributed within a native container.</p><p>Example: <strong>Twitter-</strong> Twitter is built using a hybrid approach, combining web technologies with native code to deliver a consistent user experience across platforms while allowing for faster development and updates.</p><p><strong>Mobile Application Testing Types</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DM8UjZIe0NDFah3e3Kj74A.png" /></figure><p><strong>Functional Testing</strong></p><ul><li>In this testing, we evaluate application features and functions to ensure they work as expected.</li><li>defined as a type of black-box testing method that focuses on the functionality of a software product.</li><li>Functional testing is designed to ensure a web or mobile software application meets its requirements and specifications by executing test cases from the user’s perspective.</li></ul><p>Types of Functional Testing</p><ul><li><strong>Unit Testing</strong></li></ul><p>Unit testing focuses on the smallest testable parts of an application</p><ul><li><strong>Regression testing</strong></li></ul><p>In software development, whenever something new is implemented — new features, updates, or bug fixes — there’s a chance something will break. Regression testing helps to avoid this .it helps to new changes did not introduce new defects.</p><ul><li><strong>Integration Testing</strong></li></ul><p>It can be call as Combination of unit testing. Because when individual part integrate with each other components it can be introduce new issues when they work together,so we need do integration testing to avoid this new issues.</p><ul><li><strong>Smoke Testing</strong></li></ul><p>checking the basic functions of the software to see if it’s stable enough for further testing.Quick Check up.</p><p>If we are testing a new messaging app, smoke testing might involve checking if user can log in, send a message, and receive a message. If these basic functions work fine, we proceed with more detailed testing.</p><ul><li><strong>Sanity Testing</strong></li></ul><p>The purpose of sanity testing is to ensure that no new defects are introduced when minor changes are made to software functionality or features.</p><p>We ensure that the recent changes made to the software haven’t messed up the crucial functions.</p><p>If we add a new feature like voice message we check that ,after adding a new feature,sanity testing would involve making sure that this new feature works as expected and doesn’t break the existing functionalities like sending text messages.</p><p><strong>Example of functional testing:</strong></p><ul><li>The application installs and launches correctly</li><li>Users can sign up and log in</li><li>Text boxes and buttons function properly</li><li>Push notifications render correctly</li></ul><p><strong>Compatibility Testing</strong></p><p>checks if an application functions as intended across various platforms (e.g., a combination of different devices, operating systems, browsers, databases, and network environments).</p><p><strong>Cross-Browser Compatibility Testing:</strong></p><p>Cross-browser compatibility testing is like making sure a website or application works well on different web browsers like Chrome, Firefox, or Safari. checking to see if the website looks and functions the same across all these browsers</p><p><strong>Database Compatibility Testing:</strong></p><p>Database compatibility testing is like making sure the application works smoothly with different types of databases or database management systems (DBMS) like MySQL, PostgreSQL, or Oracle. We are checking to ensure that the application can store and retrieve data correctly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/225/1*CjY64cRZlxTTXkoXhhXvVA.png" /></figure><p><strong>Localization Testing</strong></p><p>Localization testing is like making sure that a mobile app is just as enjoyable and understandable for people all around the world, no matter what language they speak or culture they come from.</p><p><strong>Performance Testing</strong></p><p>making sure the app can handle all kinds of situations without slowing down or crashing.</p><p><strong>Types of Performance testing</strong></p><ul><li><strong>Load testing:</strong> Assess whether the application can handle the expected maximum number of users or transactions</li><li><strong>Endurance testing: </strong>Evaluate application performance and stability over an extended period</li><li><strong>Stress testing: </strong>Evaluate the application’s behaviour under extreme conditions to determine failure thresholds or breaking points</li><li><strong>Spike testing:</strong> Assess whether the application can handle sudden increases in user activity</li></ul><p><strong>Security Testing</strong></p><p>It’s about making sure your app is strong enough to withstand attacks from hackers and keep your users’ information safe.</p><p><strong>Usability Testing</strong></p><p>mobile app test that evaluates the ease of use the mobile application</p><p><strong>Device Testing</strong></p><p>Mobile device testing ensures a high-quality application experience across the vast array of devices, configurations, and OS versions in your end-user population’s hands and pockets</p><p><strong>API Testing</strong></p><p>API testing for mobile apps is a type of software testing that focuses on the application programming interfaces (APIs) that connect the different parts of a mobile app. It is used to ensure that the APIs are functioning correctly and can communicate with the various components of the app, such as the user interface, databases, and external services.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=84313c5c2a6b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is Automation Testing?]]></title>
            <link>https://medium.com/@ayeshwery/what-is-automation-testing-5442fad91c9a?source=rss-dd4230614455------2</link>
            <guid isPermaLink="false">https://medium.com/p/5442fad91c9a</guid>
            <category><![CDATA[automation-testing]]></category>
            <category><![CDATA[software-testing]]></category>
            <dc:creator><![CDATA[AyeshwerySamarakoon]]></dc:creator>
            <pubDate>Sat, 08 Jun 2024 16:03:01 GMT</pubDate>
            <atom:updated>2024-06-08T16:03:01.346Z</atom:updated>
            <content:encoded><![CDATA[<p>Automation testing refers as the use of software or tools to test a product, ensuring it meets the required quality standards. Testers typically need programming knowledge, with Java and Python being commonly used languages.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*7C4v19rcGagRtQWu2Rx7IA.jpeg" /></figure><h3><strong>Why Use Automation Testing?</strong></h3><p>Automation testing saves time and allows faster and more reliable testing than manual testing. It also facilitates retesting and regression testing with ease.</p><p><em>Retesting:</em> This involves rerunning tests to verify whether previously fixed defects have been resolved successfully.</p><p><em>Regression Testing:</em> This ensures that new code changes haven’t adversely affected existing functionalities.</p><h3><strong>Automation Testing Tools:</strong></h3><p>Automation testing tools can be categorised based on the application being tested, such as web testing, mobile app testing, desktop testing, and API testing.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*k9t5iPJDDWgkjQi3nJHqFQ.png" /></figure><p>Advantages of Automation Testing:</p><ul><li>Cost Savings.</li><li>Faster Feedback Loop.</li><li>Optimal Resource Allocation.</li><li>Higher Accuracy.</li><li>Increased Test Coverage.</li><li>Early Bug Detection.</li><li>Scalability.</li><li>Enhanced ROI.</li></ul><p>Disadvantages of Automation Testing:</p><ul><li>Complexity.</li><li>Initial setup expenses.</li><li>Need for adaptation to new environments.</li><li>Potential for false positives and negatives.</li><li>Challenges in developing maintainable tests.</li><li>Limitations in testing GUI components.</li></ul><h3><strong>Automation Tool Trending:</strong></h3><p><strong>TestCafe:</strong></p><p>TestCafe is open-source and free to use.allows testers to write tests in JavaScript or TypeScript and provides features like automatic waiting and built-in assertions.</p><p><strong>Applitools:</strong></p><p>Applitools offers both free and paid versions. The free version may have limitations, while the paid versions provide additional features and support.offers AI-powered visual testing and monitoring solutions for web and mobile applications. Its visual testing capabilities enable testers to quickly identify UI bugs and visual regressions across different browsers and devices.</p><p><strong>Puppeteer:</strong></p><p>Puppeteer is open-source and free to use.Puppeteer is a Node.js library developed by Google for controlling Chrome and Chromium browsers. It’s widely used for browser automation, testing, and web scraping.</p><p><strong>Playwright:</strong></p><p>Playwright is open-source and free to use.automation tool developed by Microsoft, offering cross-browser testing capabilities for web applications. It supports multiple programming languages like JavaScript, Python, and C#</p><p><strong>Selenium:</strong></p><p>Selenium is a widely used open-source automation testing framework for web applications. It supports various programming languages like Java, Python, and C#, allowing testers to write automation scripts to interact with web elements and perform actions like clicking buttons, entering text, and validating results.</p><p><strong>Appium:</strong></p><p>Appium is an open-source automation tool used for testing mobile applications across different platforms like Android and iOS. It allows testers to write automation scripts using languages such as Java, Python, and JavaScript, and it supports native, hybrid, and mobile web applications.</p><p><strong>Postman:</strong></p><p>Postman is a popular automation tool primarily used for testing APIs.Postman offers both free and paid versions. It provides a user-friendly interface for sending requests, inspecting responses, and validating API behaviour. Postman supports automated testing through the creation of test scripts using JavaScript, allowing testers to automate API testing workflows.</p><p><strong>Cypress:</strong></p><p>Cypress is a modern JavaScript-based automation tool specifically designed for testing web applications.It is open-source software It provides a rich set of features, including a built-in test runner, automatic waiting, and real-time debugging. Cypress is known for its fast execution and reliable test results.</p><p><strong>Katalon Studio:</strong></p><p>Katalon Studio it is a commercial automation testing tool.it offers a free version with basic features, as well as paid versions with additional functionalities and support. tool that offers a range of features for web, mobile, API, and desktop application testing. It provides a user-friendly interface for creating and executing test cases, along with built-in test data management and reporting capabilities.</p><p><strong>TestComplete:</strong></p><p>TestComplete is a commercial automation tool that supports web, desktop, and mobile application testing. It offers a record-and-playback feature for creating test scripts without coding, along with advanced scripting capabilities for more complex scenarios. TestComplete also provides built-in integrations with popular CI/CD tools.</p><p><strong>7. Robot Framework:</strong></p><p>Robot Framework is a generic open-source automation framework that supports both web and mobile application testing. It uses a keyword-driven approach, making it easy to write and understand test cases. It also supports various libraries and integrations, making it versatile and suitable for different testing needs.</p><h3><strong>Automation Trending Nowadays:</strong></h3><p><strong>Integration of AI and ML</strong></p><p>Artificial Intelligence (AI) and Machine Learning (ML) are being used to make testing processes smarter and more accurate. They can predict issues and improve testing strategies.</p><p><strong>Continuous Testing in DevOps</strong></p><p>Testing is happening continuously throughout the development process, ensuring high quality with each release.</p><p><strong>Code-less Automation Tools</strong></p><p>New tools make automation easier for everyone, even those without coding experience, by providing simple interfaces and drag-and-drop features.</p><p><strong>Increased Focus on Security Testing</strong></p><p>With cyber threats on the rise, automated tools are being used to find and fix security issues early in development.</p><p><strong>Customised Testing Solutions</strong></p><p>Instead of one-size-fits-all approaches, businesses are looking for testing solutions tailored to their specific needs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TuU9M6VBFmdKvNtUtTnVVA.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5442fad91c9a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Architectures in Distributed System]]></title>
            <link>https://medium.com/@ayeshwery/architectures-in-distributed-system-b2ace2fca6bb?source=rss-dd4230614455------2</link>
            <guid isPermaLink="false">https://medium.com/p/b2ace2fca6bb</guid>
            <dc:creator><![CDATA[AyeshwerySamarakoon]]></dc:creator>
            <pubDate>Sat, 28 Oct 2023 14:44:35 GMT</pubDate>
            <atom:updated>2023-10-28T14:44:35.162Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>What is a Distributed System?</strong></p><p>Also known as distributed computing, distributed systems are a collection of independent components located on different systems, communicating in order to operate as a single unit.</p><p>Also known as distributed computing and distributed databases, a distributed system is a collection of independent components located on different machines that share messages with each other in order to achieve common goals.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/806/1*BRKuB9uJj-wBgvaLPW-p0g.jpeg" /></figure><p>As such, the distributed system will appear as if it is one interface or computer to the end-user. The hope is that together, the system can maximize resources and information while preventing failures, as if one system fails, it won’t affect the availability of the service.</p><p>Today, data is more distributed than ever, and modern applications no longer run in isolation. The vast majority of products and applications rely on distributed systems.</p><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><p>Historically, distributed computing was expensive, complex to configure and difficult to manage. Thanks to SaaS solutions, however, distributed computing has become more streamlined and affordable for businesses of all stripes and sizes.</p><p>Today, all types of computing jobs — from database management to video games — use distributed computing. In fact, many types of software, such as cryptocurrency systems, scientific simulations, blockchain technologies and AI platforms, wouldn’t be possible at all without these platforms.</p><p>Distributed systems are used when a workload is too great for a single computer or device to handle. Distributed systems are essential in situations when the workload is subject to change, such as e-commerce traffic on Cyber Monday or lots of web traffic in response to news about your organization.</p><p>Because they draw on the capabilities of other computing devices and processes, distributed systems can offer features that would be difficult or impossible to develop on a single system.</p><p>This includes things like performing an off-site server and application backup — if the master catalog doesn’t see the segment bits it needs for a restore, it can ask the other off-site node or nodes to send the segments. Virtually everything you do now with a computing device takes advantage of the power of distributed systems, whether that’s sending an email, playing a game or reading this article on the web.</p><p>Here are some very common examples of distributed systems:</p><ul><li>Telecommunications networks that support mobile and internet networks</li><li>Graphical and video-rendering systems</li><li>Scientific computing, such as protein folding and genetic research</li><li>Airline and hotel reservation systems</li><li>Multiuser video conferencing systems</li><li>Cryptocurrency processing systems (e.g. Bitcoin)</li><li>Peer-to-peer file-sharing systems</li><li>Distributed community compute systems</li><li>Multiplayer video games</li><li>Global, distributed retailers and supply chain management</li></ul><p><strong>Examples of distributed systems at work</strong></p><p>A distributed system begins with a task. Let’s pretend you need to render a video to create a finished product.</p><p>The application, or distributed applications, managing this task — like a video editor on a client computer — splits the job into pieces. In this simple example, the algorithm gives one frame of the video to each of a dozen different computers (or nodes) to complete the rendering. Once the frame is complete, the managing application gives the node a new frame to work on. This process continues until the video is finished and all the pieces are put back together.</p><p>A system like this doesn’t have to stop at just 12 nodes: the job may be distributed among hundreds or thousands of nodes, turning a task that might have taken days for a single computer to complete into one that is finished in a matter of minutes.</p><h4>Benefits Of Distributed Systems</h4><ul><li><strong>Scalability:</strong> Distributed database systems offer improved scalability as they can add more nodes to easily accommodate the increase in workload<strong>.</strong></li><li><strong>Improved reliability:</strong> It eliminates central points of failure and bottlenecks. The redundancy of nodes ensures that even if one node fails, others can take over its tasks.</li><li><strong>Enhanced performance:</strong> These systems can easily scale horizontally by adding more nodes or vertically by increasing a node’s capacity. This scalability results in enhanced performance and optimum output.</li></ul><h4>Drawbacks &amp; Risks Of Distributed Systems</h4><ul><li><strong>Requirement for specialized tools:</strong> Management of multiple repositories in a distributed system requires the use of specialized tools.</li><li><strong>Development sprawl and complexity</strong>: As the system’s complexity grows, organizing, managing, and improving a distributed system can become challenging.</li><li><strong>Security risks: </strong>A distributed system is more vulnerable to cyber attacks, as data processing is distributed across multiple nodes that communicate with each other.</li></ul><h4>What Are Distributed Architectures? Understanding Their Components &amp; Types</h4><p>Distributed architecture refers to a model where <strong>software components that reside on networked computers communicate and coordinate their actions to achieve a common goal.</strong> In this approach, computation tasks are divided among several machines rather than relying on a central server. This spreading out of the workload by distributed architectures enhances a system’s performance, scalability, and resilience.</p><p>A key advantage of distributed architecture is its fault tolerance. <strong>If one node in the system fails, others can take over its tasks</strong>, ensuring uninterrupted service. Moreover, this architecture can easily be scaled up by adding more machines which makes it an excellent choice for large, complex applications.</p><h4>6 Key Components Of Distributed Architectures</h4><p>Distributed systems are complex and can vary greatly depending on their specific use case and architecture. However, the following core components are present in most distributed systems:</p><p>Nodes</p><p>These are the individual computers or servers that make up the distributed system. Each node <strong>runs its own instances of the applications and services</strong> that make up the system.</p><p>Network</p><p>This is the<strong> communication infrastructure that connects all nodes.</strong> The network enables data and information to be exchanged between nodes.</p><p>Middleware</p><p>This software layer <strong>provides a programming model for developers and masks the heterogeneity </strong>of the underlying network, hardware, and operating systems. It provides useful abstractions and services which simplify the process of creating complex distributed systems.</p><p>Shared Data/Database</p><p><strong>This is where the system stores and retrieves data. </strong>Depending on the specific design of the distributed system, the data could be distributed across multiple nodes, replicated, or partitioned.</p><p>Distributed Algorithms</p><p>These are the <strong>rules and procedures nodes follow to communicate and coordinate</strong> with each other. They enable nodes to work together, even when some nodes fail or network connections are unreliable.</p><p>System Management Tools</p><p>These tools <strong>help manage, monitor, and troubleshoot the distributed system.</strong> They provide functionality for load balancing, fault tolerance, system configuration, and more.</p><h3>What is a distributed architecture?</h3><p>I would like to talk about the available Distributed System architectures that we see today and how they are being utilized in our day to day applications. 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><figure><img alt="" src="https://cdn-images-1.medium.com/max/360/0*wnvP9GRT3hjitkYS.png" /></figure><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><p><strong>Distributed systems must have a network that connects all components (machines, hardware, or software) together so they can transfer messages to communicate with each other.</strong></p><ul><li>That network could be connected with an IP address or use cables or even on a circuit board.</li><li>The messages passed between machines contain forms of data that the systems want to share like databases, objects, and files.</li><li>The way the messages are communicated reliably whether it’s sent, received, acknowledged or how a node retries on failure is an important feature of a distributed system.</li><li>Distributed systems were created out of necessity as services and applications needed to scale and new machines needed to be added and managed. In the design of distributed systems, the major trade-off to consider is complexity vs performance.</li></ul><p>Distributed architectures have become an integral part of technological infrastructures. With the proliferation of cloud computing, <a href="https://estuary.dev/big-data-analytics/">big data</a>, and highly available systems, traditional monolithic architectures have given way to more distributed, scalable, and resilient designs.</p><p>These architectures allow applications to deliver high-performance, reliable services across vast geographical spans, dealing with vast amounts of data and numerous concurrent users.</p><p>There are several types of distributed architectures, each serving unique needs and overcoming different challenges. Having a clear understanding of these architectures is key to designing robust and scalable systems. It also helps leverage the strengths of different architectural approaches for innovative solutions that optimize performance, reliability, and user experience.</p><h3><strong>Type of Architechtures</strong></h3><p>There are four different architectural styles, plus the hybrid architecture when it comes to distributed systems. The basic idea is to organize logically different components and distribute those computers over the various machines.</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>Layered Architecture</strong></p><p>The layered architecture separates layers of components from each other, giving it a much more modular approach. A well known example for this is the OSI model that incorporates a layered architecture when interacting with each of the components. Each interaction is sequential where a layer will contact the adjacent layer and this process continues, until the request is been catered to. But in certain cases, the implementation can be made so that some layers will be skipped, which is called cross-layer coordination. Through cross-layer coordination, one can obtain better results due to performance increase.</p><p>The layers on the bottom provide a service to the layers on the top. The request flows from top to bottom, whereas the response is sent from bottom to top. The advantage of using this approach is that, the calls always follow a predefined path, and that each layer can be easily replaced or modified without affecting the entire architecture. The following image is the basic idea of a layered architecture style.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/360/0*S8DTcuoKQ1qESiak.png" /></figure><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/360/0*CesHc4fF8DdfjnYy.png" /></figure><p><strong>Object Based Architecture</strong></p><p>This architecture style is based on loosely coupled arrangement of objects. This has no specific architecture like layers. Like in layers, this does not have a sequential set of steps that needs to be carried out for a given call. Each of the components are referred to as objects, where each object can interact with other objects through a given connector or interface. These are much more direct where all the different components can interact directly with other components through a direct method call.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/360/0*bAcc8ArCJ_Z5YpHo.png" /></figure><p>As shown in the above image, communication between object happen as method invocations. These are generally called Remote Procedure Calls (RPC). Some popular examples are Java RMI, Web Services and REST API Calls. This has the following properties.</p><ul><li>This architecture style is less structured.</li><li>component = object</li><li>connector = RPC or RMI</li></ul><p>When decoupling these processes in space, people wanted the components to be anonymous and replaceable. And the synchronization process needed to be asynchronous, which has led to <strong>Data Centered Architectures </strong>and <strong>Event Based Architectures</strong>.</p><p>Distributed systems play a pivotal role in the modern computing landscape, powering everything from cloud services to IoT networks. They offer the capability to distribute computational tasks and data across multiple interconnected nodes, enabling high availability, scalability, and efficient resource utilization. Object-based architecture is a particular approach within distributed systems design that leverages the concept of objects as the central building blocks for creating, managing, and interacting with distributed resources. In this in-depth exploration, we will dissect the intricacies of object-based architecture in distributed systems, examining its principles, benefits, challenges, and real-world applications.</p><p>Understanding Object-Based Architecture</p><p>Object-based architecture is a fundamental design principle that aims to simplify the development, management, and interaction of distributed resources by representing them as objects. These objects encapsulate both data and the methods that operate on that data, providing a unified and consistent way to access and manipulate distributed resources. In the context of distributed systems, these resources can include files, databases, services, or any other entities that need to be shared and accessed across multiple nodes.</p><p>Core Principles of Object-Based Architecture</p><p>The key principles of object-based architecture in distributed systems include:</p><ul><li>Abstraction: Objects abstract the underlying complexity of distributed resources, making it easier for developers and users to work with them without needing to understand the intricate details of the distributed environment.</li><li>Encapsulation: Objects encapsulate both data and behavior, ensuring that the data remains consistent and providing controlled access to the methods that operate on the data.</li><li>Interoperability: Objects are designed to be accessible and usable across a wide range of platforms, languages, and technologies, promoting interoperability in heterogeneous distributed environments.</li><li>Distribution Transparency: Object-based systems aim to provide distribution transparency, meaning that users and applications interact with objects in the same way, regardless of whether the object is located locally or on a remote node.</li></ul><p>Object Models in Distributed Systems</p><p>Object-based architecture can be implemented using various object models. Two of the most common models are:</p><ul><li>Remote Procedure Call (RPC): RPC is a mechanism for invoking methods on remote objects as if they were local. It abstracts the communication details, allowing developers to make method calls on remote objects with minimal awareness of the underlying distribution.</li><li>Message Passing: In message-passing-based object systems, objects communicate by sending messages to each other. These messages contain both the method to execute and the necessary data. This model is often used in distributed systems that prioritize asynchronous and event-driven communication.</li></ul><p><strong>Benefits of Object-Based Architecture</strong></p><p>Object-based architecture offers a plethora of advantages in the design and implementation of distributed systems. Here are some of the key benefits:</p><p>Simplified Development</p><p>By encapsulating data and behavior into objects, developers can focus on writing clean, reusable code without the need to manage complex distribution mechanisms. This simplifies the development process and accelerates time-to-market for distributed applications.</p><p>Improved Maintainability</p><p>Object-based architecture promotes modularity and encapsulation, making it easier to maintain and update distributed systems. Changes to the underlying implementation of objects can be made without affecting the external interfaces, ensuring that other components continue to work seamlessly.</p><p>Interoperability</p><p>Objects can be designed to be language and platform-agnostic, enabling interoperability in heterogeneous distributed environments. This is especially valuable in scenarios where different nodes run on different operating systems or use various programming languages.</p><p>Scalability</p><p>Object-based architecture supports the creation and distribution of objects across multiple nodes, making it inherently scalable. New nodes can be added to the system, and objects can be replicated or distributed as needed to handle increased workloads.</p><p>Distribution Transparency</p><p>One of the primary goals of object-based architecture is to provide distribution transparency. Users and applications interact with objects in a consistent manner, regardless of the object’s physical location. This transparency simplifies the development and usage of distributed systems.</p><p>Reusability</p><p>Objects can be designed as reusable components, offering a significant advantage for system designers. Reusable objects can save time and effort by providing pre-built, tested, and reliable building blocks for distributed applications.</p><p><strong>Challenges and Considerations</strong></p><p>While object-based architecture in distributed systems offers numerous benefits, it also presents several challenges and considerations that must be addressed to ensure its successful implementation.</p><p>Object Migration</p><p>Object migration refers to the process of moving an object from one node to another. It can be challenging to maintain the state and consistency of migrating objects, especially in the presence of failures or network issues.</p><p>Data Consistency</p><p>Ensuring data consistency across distributed objects can be complex. Concurrent access to shared objects may lead to data inconsistencies, and managing distributed transactions can be challenging.</p><p>Object Lifecycle Management</p><p>Objects in distributed systems may have complex lifecycles, including creation, activation, deactivation, and garbage collection. Managing these lifecycles while maintaining system reliability can be a non-trivial task.</p><p>Network Latency</p><p>Network latency can significantly impact the performance of object-based systems. Remote method invocations or message passing between objects may introduce delays, affecting the system’s responsiveness.</p><p>Security and Access Control</p><p>Securing distributed objects and controlling access to them is a critical consideration. Object-based systems must implement robust authentication and authorization mechanisms to protect sensitive data and resources.</p><p>Fault Tolerance</p><p>Ensuring fault tolerance in object-based architecture is crucial. In the event of node failures or network disruptions, the system must be designed to recover gracefully and maintain the integrity of distributed objects.</p><p><strong>Real-World Applications of Object-Based Architecture</strong></p><p>Object-based architecture is prevalent in a wide range of real-world applications, each showcasing its adaptability and versatility.</p><p>Distributed Databases</p><p>Distributed database management systems often employ object-based architecture to abstract data storage and retrieval. This allows applications to interact with databases using objects, abstracting the complexity of data distribution.</p><p>Cloud Computing</p><p>Cloud platforms, such as Amazon Web Services (AWS) and Microsoft Azure, leverage object-based architecture to provide cloud services. Developers can access a wide array of resources, such as virtual machines, storage, and databases, as objects through APIs.</p><p>Internet of Things (IoT)</p><p>IoT ecosystems frequently use object-based architecture to model and interact with IoT devices as objects. This abstraction simplifies the development of applications that monitor, control, and analyze IoT data.</p><p>Middleware Services</p><p>Middleware services, including message queues and event buses, often use object-based architecture to facilitate communication between distributed components. These services abstract the communication complexities by allowing objects to exchange messages.</p><p>Distributed File Systems</p><p>Distributed file systems like the Network File System (NFS) and the Andrew File System (AFS) employ object-based principles to provide remote access to files and directories. Users can interact with remote files as if they were local.</p><p>Microservices</p><p>Microservices architecture, a modern approach to building distributed systems, frequently relies on object-based principles. Each microservice can be viewed as an object, encapsulating its functionality and data while communicating with other microservices through APIs.</p><p>Emerging Trends in Object-Based Architecture</p><p>The landscape of distributed systems and object-based architecture continues</p><p><strong>Data Centered Architecture</strong></p><p>As the title suggests, this architecture is based on a data center, where the primary communication happens via a central data repository. This common repository can be either active or passive. This is more like a producer consumer problem. The producers produce items to a common data store, and the consumers can request data from it. This common repository, could even be a simple database. But the idea is that, the communication between objects happening through this shared common storage. This supports different components (or objects) by providing a persistent storage space for those components (such as a MySQL database). All the information related to the nodes in the system are stored in this persistent storage. In event-based architectures, data is only sent and received by those components who have already subscribed.</p><p>Some popular examples are distributed file systems, producer consumer, and web based data services.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/360/0*oufb79sKrurvYrtr.png" /></figure><p><strong>Event Based Architecture</strong></p><p>The entire communication in this kind of a system happens through events. When an event is generated, it will be sent to the bus system. With this, everyone else will be notified telling that such an event has occurred. So, if anyone is interested, that node can pull the event from the bus and use it. Sometimes these events could be data, or even URLs to resources. So the receiver can access whatever the information is given in the event and process accordingly. processes communicate through the propagation of events.</p><p>These events occasionally carry data. An advantage in this architectural style is that, components are loosely coupled. So it is easy to add, remove and modify components in the system. Some examples are, publisher — subscriber system, Enterprise Services Bus (ESB) and <a href="http://akka.io/">akka.io</a>.</p><p>One major advantage is that, these heterogeneous components can contact the bus, through any communication protocol. But an ESB or a specific bus, has the capability to handle any type of incoming request and process accordingly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/360/0*YPOrTdwlmTX2HylF.png" /></figure><p>This architectural style is based on the publisher-subscriber architecture. Between each node there is no direct communication or coordination. Instead, objects which are subscribed to the service communicate through the event bus.</p><p>The event based architecture supports, several communication styles.</p><ul><li>Publisher-subscriber</li><li>Broadcast</li><li>Point-to-Point</li></ul><p>The major advantages of this architecture is that the <em>Components are decoupled in space — loosely coupled.</em></p><p>Event-based architecture is a design paradigm that centers on the generation, propagation, and consumption of events within a distributed system. In this approach, events are used as first-class entities to represent occurrences or changes in the system. Events can include user actions, system alerts, data updates, or any other significant incident that needs to be communicated across the distributed network. The key principles of event-based architecture are as follows:</p><p>1. Event-Driven Approach:</p><ul><li>The architecture is inherently event-driven, meaning that it responds to events and triggers actions or reactions based on these events.</li></ul><p>2. Loosely Coupled Components:</p><ul><li>Components in an event-based system are loosely coupled. They interact with each other through events, making it easier to add, modify, or remove components without disrupting the entire system.</li></ul><p>3. Asynchronous Communication:</p><ul><li>Event-based systems typically rely on asynchronous communication, where components do not need to wait for immediate responses but can continue their work while processing events.</li></ul><p>4. Scalability and Responsiveness:</p><ul><li>Event-based architecture is well-suited for building highly scalable and responsive systems, as components can react in near real-time to incoming events.</li></ul><p>5. Event Broker or Hub:</p><ul><li>Event-based systems often feature an event broker or hub responsible for receiving, routing, and delivering events to appropriate consumers.</li></ul><p>6. Event Lifecycle:</p><ul><li>Events have a lifecycle that includes creation, propagation, and consumption. This lifecycle can involve multiple stages, including filtering, transformation, and storage.</li></ul><h4>Key Components of Event-Based Architecture</h4><p>Event-based architecture involves several essential components that work together to create a responsive and scalable system:</p><p>1. Event Producer:</p><ul><li>Event producers are responsible for generating events. These producers can be sensors, user interfaces, applications, or any entity capable of detecting and creating events.</li></ul><p>2. Event Consumer:</p><ul><li>Event consumers are components or entities that react to and consume events. These consumers can be applications, services, or devices that respond to specific events by triggering actions.</li></ul><p>3. Event Broker or Hub:</p><ul><li>The event broker acts as an intermediary between producers and consumers. It receives events from producers and routes them to the appropriate consumers based on predefined rules.</li></ul><p>4. Event Metadata and Payload:</p><ul><li>Events typically consist of metadata and payload. Metadata includes information about the event, such as its type, source, and timestamp, while the payload contains the data associated with the event.</li></ul><p>5. Event Processing and Rules Engine:</p><ul><li>Event processing and rules engines allow for the filtering, transformation, and enrichment of events before they are delivered to consumers. Rules can be defined to determine which events are relevant to specific consumers.</li></ul><h4>Advantages of Event-Based Architecture</h4><p>Event-based architecture offers numerous advantages that make it a compelling choice for many distributed systems:</p><p>1. Loose Coupling:</p><ul><li>Event-based systems are loosely coupled, meaning that components are independent of each other. This loose coupling allows for greater flexibility and ease of system evolution.</li></ul><p>2. Scalability:</p><ul><li>Event-based architecture is inherently scalable. As system loads increase, additional event consumers can be added to handle the increased event flow, ensuring that the system can grow as needed.</li></ul><p>3. Responsiveness:</p><ul><li>Events are processed asynchronously, enabling systems to respond quickly to real-time changes. This makes event-based architecture suitable for applications requiring near-instantaneous reactions.</li></ul><p>4. Extensibility:</p><ul><li>New components or services can be easily added to an event-based system without requiring major architectural changes. This facilitates extensibility and the integration of third-party services.</li></ul><p>5. Fault Tolerance:</p><ul><li>Loosely coupled components are less likely to cause cascading failures. If one component fails, it does not necessarily impact the entire system, enhancing fault tolerance.</li></ul><p>6. Real-time Data Processing:</p><ul><li>Event-based systems excel at processing real-time data, making them ideal for applications where data updates need to be instantly reflected.</li></ul><p>7. Complex Event Processing:</p><ul><li>Complex event processing (CEP) allows event-based systems to detect and react to patterns and sequences of events, enabling applications like fraud detection, monitoring, and alerting.</li></ul><p>8. Decoupling of Components:</p><ul><li>Event-based architecture encourages the decoupling of components. This makes it easier to develop, test, and maintain individual components independently.</li></ul><h4>Challenges and Considerations in Event-Based Architecture</h4><p>While event-based architecture offers many advantages, it is not without challenges and considerations:</p><p>1. Event Ordering:</p><ul><li>Maintaining the order of events can be critical in some applications. Ensuring correct sequencing of events may require additional complexity and coordination.</li></ul><p>2. Event Duplication and Loss:</p><ul><li>Event-based systems must address potential issues such as event duplication and loss, which can occur due to network problems or system failures.</li></ul><p>3. Complex Event Routing:</p><ul><li>Determining the appropriate consumers for events and efficiently routing them can be complex, especially in large-scale systems.</li></ul><p>4. Monitoring and Debugging:</p><ul><li>Monitoring and debugging event-based systems can be more challenging than in traditional systems, as events may traverse multiple components.</li></ul><p>5. Event Schemas:</p><ul><li>Defining and maintaining consistent event schemas across the system is crucial for effective communication between producers and consumers.</li></ul><p>6. Scalability and Load Balancing:</p><ul><li>Ensuring that the event broker can handle the increased load as the system scales requires careful planning and load balancing.</li></ul><p>7. Error Handling:</p><ul><li>Event-based systems must implement robust error-handling mechanisms to deal with events that fail to process correctly.</li></ul><h4>Real-World Applications of Event-Based Architecture</h4><p>Event-based architecture is widely used in various real-world applications due to its versatility and ability to handle dynamic and real-time data. Some notable examples include:</p><p>1. Internet of Things (IoT):</p><ul><li>IoT platforms leverage event-based architecture to handle data from numerous devices, sensors, and actuators in real-time, enabling applications like smart cities and industrial automation.</li></ul><p>2. Financial Services:</p><ul><li>Event-based systems are used for real-time trading, fraud detection, and risk management in financial services, where timely decisions are critical.</li></ul><p>3. Social Media:</p><ul><li>Social media platforms use event-based architecture to manage user-generated content, notifications, and real-time interactions among users.</li></ul><p>4. E-commerce:</p><ul><li>E-commerce platforms utilize event-based systems to handle order processing, inventory management, and customer interactions in real-time.</li></ul><p>5. Cloud Services:</p><ul><li>Cloud providers use event-based architecture to manage resource provisioning, auto-scaling, and event-driven functions in their platforms.</li></ul><p>6. Real-time Analytics:</p><ul><li>Event-based systems enable real-time analytics for applications like clickstream analysis, user behavior tracking, and performance monitoring.</li></ul><p>7. Streaming Data Processing:</p><ul><li>Systems that process streaming data, such</li></ul><h4>System Level Architecture</h4><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><p><strong>Client Server Architecture</strong></p><p>The client server architecture has two major components. The client and the server. The Server is where all the processing, computing and data handling is happening, whereas the Client is where the user can access the services and resources given by the Server (Remote Server). The clients can make requests from the Server, and the Server will respond accordingly. Generally, there is only one server that handles the remote side. But to be on the safe side, we do use multiple servers will load balancing techniques.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/360/0*R9IUzOD23GfyN2Ge.jpg" /></figure><p>As one common design feature, the Client Server architecture has a centralized security database. This database contains security details like credentials and access details. Users can’t log in to a server, without the security credentials. So, it makes this architecture a bit more stable and secure than Peer to Peer. The stability comes where the security database can allow resource usage in a much more meaningful way. But on the other hand, the system might get low, as the server only can handle a limited amount of workload at a given time.</p><p>The client-server architecture is a fundamental model in distributed systems. It breaks down the system into <strong>2 main components: the client and the server.</strong></p><p>The client-server model <strong>describes how various network devices, known as clients, interact with servers</strong>. These clients, which include workstations, laptops, and IoT devices, create requests that are completed by servers.</p><p>While servers were traditionally physical devices, the current trend is towards deploying virtual servers for diverse workloads. The client sends a request to the server which <strong>handles the business logic and state management.</strong></p><p>On the other hand, when the server receives and processes the client’s request, it sends back a response. These interactions often involve messaging, data collection, and calculations. <strong>While the servers need not know about clients, clients should be aware of the servers’ identities.</strong></p><p>A truly distributed client-server system <strong>includes multiple server nodes to distribute client connections</strong> which prevents the structure from degrading into a centralized one. These systems are prevalent in modern enterprises and data centers, serving various processes such as email, internet connections, application hosting, and more.</p><p><strong>Advantages:</strong></p><ul><li>Easier to Build and Maintain</li><li>Better Security</li><li>Stable</li></ul><p><strong>Disadvantages:</strong></p><ul><li>Single point of failure</li><li>Less scalable</li></ul><p><strong>Peer to Peer (P2P)</strong></p><p>The general idea behind peer to peer is where there is no central control in a distributed system. The basic idea is that, each node can either be a client or a server at a given time. If the node is requesting something, it can be known as a client, and if some node is providing something, it can be known as a server. In general, each node is referred to as a Peer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/360/0*1fEDKfzW6859DgV6.png" /></figure><p>In this network, any new node has to first join the network. After joining in, they can either request a service or provide a service. The initiation phase of a node (Joining of a node), can vary according to implementation of a network. There are two ways in how a new node can get to know, what other nodes are providing.</p><ul><li><strong>Centralized Lookup Server </strong>— The new node has to register with the centralized look up server an mention the services it will be providing, on the network. So, whenever you want to have a service, you simply have to contact the centralized look up server and it will direct you to the relevant service provider.</li><li><strong>Decentralized System</strong> — A node desiring for specific services must, broadcast and ask every other node in the network, so that whoever is providing the service will respond.</li></ul><p>The <a href="https://www.techopedia.com/definition/454/peer-to-peer-architecture-p2p-architecture">peer-to-peer (P2P)</a> architecture is a unique type of distributed system that <strong>operates without centralized control.</strong> In this architecture, any node, also referred to as a peer, can <strong>function as either a client or a server.</strong> When a node requests a service, it acts as a client and when it offers a service, it’s considered a server.</p><p>P2P networks can be broadly categorized into 3 types:</p><ul><li><strong>Structured P2P</strong>: Nodes adhere to a predefined distributed data structure.</li><li><strong>Unstructured P2P</strong>: Networks feature nodes that randomly select their neighbors.</li><li><strong>Hybrid P2P</strong>: Systems combine elements of both, with certain nodes assigned unique, organized functions.</li></ul><p>An important feature of the P2P system is its <strong>inherent redundancy</strong>. Each node carries the full application instance, containing both the presentation and <a href="https://estuary.dev/batch-data-processing/">data processing</a> layers. When a new peer is introduced to the system, it<strong> discovers and connects to other peers for synchronizing its local state with the wider system</strong>. This redundancy ensures the system’s resilience with the failure of a single node having minimal impact on the overall network.</p><p>A key advantage of P2P networks is the <strong>increase in system capacity as more nodes join the network</strong>. This yields shared resources such as bandwidth, storage, and processing power.<strong> </strong>Compared to typical client-server networks where increased demands cause fewer available resources per client, <strong>P2P networks become more robust and resilient with each additional node.</strong></p><h4>Components Of Peer-to-Peer Architecture</h4><p>The following are the main components of a P2P architecture:</p><p>Peers Or Nodes</p><p>The foundation of any Peer-to-Peer (P2P) network is the peers or nodes. These are <strong>individual computers that can both request and provide services.</strong> This dual role of each participant sets P2P apart from traditional client-server models.</p><p>Network Infrastructure</p><p>This element refers to the connection medium that links all nodes in the system. It can range from a local communication network to the expansive internet. The network<strong> allows the nodes to communicate and enables the sharing of resources.</strong></p><p>Distributed Data</p><p>In a P2P system, data is not stored in a central location but is spread across the network. <strong>Each peer holds a part of the overall data.</strong> This distributed nature of data is one of the key aspects that enhances the resilience and efficiency of P2P systems.</p><p>Directory Services</p><p>While P2P networks fundamentally lack central control, <strong>some incorporate a directory service. </strong>This service helps locate resources in the network which enhances its overall efficiency.</p><p>Communication Protocols</p><p>Protocols form the rules of interaction within the network. They <strong>allow peers to discover other nodes, ask for services, offer services, and synchronize their data. </strong>These protocols are vital for smooth operations and communications in the P2P network.</p><h4>A Comparison Between Client Server and Peer to Peer Architectures</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/740/0*B5_NACOhMDPGNmZJ.png" /></figure><p>Distributed architectures empower organizations to break free from traditional limitations and pave the way for limitless innovation and technological advancements.</p><p>Ignoring the potential of distributed architectures means missing out on the opportunity to harness their immense power. However, distributed architectures also introduce complexity in terms of deployment, management, monitoring, and troubleshooting. For this, you need a modern solution, such as Estuary Flow.</p><p>Estuary Flow is a distributed system that connects to your databases, SaaS tools, and other data sources. You don’t have to worry about the complexity of managing a distributed system, as Flow handles it for you. The platform also gives you real-time visibility and insights into your data pipelines, helping you to detect and resolve issues, optimize performance, and make data-driven decisions.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b2ace2fca6bb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Virtualization]]></title>
            <link>https://medium.com/@ayeshwery/virtualization-6362dd17b338?source=rss-dd4230614455------2</link>
            <guid isPermaLink="false">https://medium.com/p/6362dd17b338</guid>
            <category><![CDATA[virtualization]]></category>
            <dc:creator><![CDATA[AyeshwerySamarakoon]]></dc:creator>
            <pubDate>Mon, 16 Oct 2023 16:57:36 GMT</pubDate>
            <atom:updated>2023-10-16T16:57:36.493Z</atom:updated>
            <content:encoded><![CDATA[<h3>What is virtualization?</h3><p>Virtualization is the creation of a virtual — rather than actual — version of something, such as an operating system (OS), a server, a storage device or network resources.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/289/1*n9vHaMBBVRbMQRKruGdyhA.jpeg" /></figure><p>Virtualization uses software that simulates hardware functionality to create a virtual system. This practice allows IT organizations to operate multiple operating systems, more than one virtual system and various applications on a single server. The benefits of virtualization include greater efficiencies and economies of scale.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kKoh2zrDMakxgzL1Uz_gwg.jpeg" /></figure><p>OS virtualization is the use of software to allow a piece of hardware to run multiple operating system images at the same time. The technology got its start on mainframes decades ago, allowing administrators to avoid wasting expensive processing power.</p><p>The virtualization process follows the steps listed below:</p><ol><li>Hypervisors detach the physical resources from their physical environments.</li><li>Resources are taken and divided, as needed, from the physical environment to the various virtual environments.</li><li>System users work with and perform computations within the virtual environment.</li><li>Once the virtual environment is running, a user or program can send an instruction that requires extra resources form the physical environment. In response, the hypervisor relays the message to the physical system and stores the changes. This process will happen at an almost native speed.</li></ol><p>The virtual environment is often referred to as a guest machine or virtual machine. The VM acts like a single data file that can be transferred from one computer to another and opened in both; it is expected to perform the same way on every computer.</p><h3>Types of virtualization</h3><p>You probably know a little about virtualization if you have ever divided your hard drive into different partitions. A partition is the logical division of a hard disk drive to create, in effect, two separate hard drives.</p><p>There are eight areas of IT where virtualization is making headway:</p><ol><li><strong>Network virtualization</strong> is a method of combining the available resources in a network by splitting up the available bandwidth into channels, each of which is independent from the others and can be assigned — or reassigned — to a particular server or device in real time. The idea is that virtualization disguises the true complexity of the network by separating it into manageable parts, much like your partitioned hard drive makes it easier to manage your files.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/302/1*KeB1W-Yt86KJYEK4Tc6WdA.jpeg" /><figcaption>network virtualization</figcaption></figure><p><strong>Tools for Network Virtualization :</strong></p><ol><li><strong>Physical switch OS</strong> — <br>It is where the OS must have the functionality of network virtualization.</li><li><strong>Hypervisor –</strong><br>It is which uses third-party software or built-in networking and the functionalities of network virtualization.</li></ol><p>The basic functionality of the OS is to give the application or the executing process with a simple set of instructions. System calls that are generated by the OS and executed through the libc library are comparable to the service primitives given at the interface between the application and the network through the SAP (Service Access Point).</p><p><strong>Examples of Network Virtualization :</strong></p><p><strong>Virtual LAN (VLAN) –</strong></p><ul><li>The performance and speed of busy networks can be improved by VLAN.</li><li>VLAN can simplify additions or any changes to the network.</li></ul><p><strong>Network Overlays –</strong></p><ul><li>A framework is provided by an encapsulation protocol called VXLAN for overlaying virtualized layer 2 networks over layer 3 networks.</li><li>The Generic Network Virtualization Encapsulation protocol (GENEVE) provides a new way to encapsulation designed to provide control-plane independence between the endpoints of the tunnel.</li></ul><p><strong>Network Virtualization Platform: VMware NSX –</strong></p><ul><li>VMware NSX Data Center transports the components of networking and security such as switching, firewalling and routing that are defined and consumed in software.</li><li>It transports the operational model of a virtual machine (VM) for the network.</li></ul><p><strong>Applications of Network Virtualization :</strong></p><ul><li>Network virtualization may be used in the development of application testing to mimic real-world hardware and system software.</li><li>It helps us to integrate several physical networks into a single network or separate single physical networks into multiple analytical networks.</li><li>In the field of application performance engineering, network virtualization allows the simulation of connections between applications, services, dependencies, and end-users for software testing.</li><li>It helps us to deploy applications in a quicker time frame, thereby supporting a faster go-to-market.</li><li>Network virtualization helps the software testing teams to derive actual results with expected instances and congestion issues in a networked environment.</li></ul><p><strong>2. Storage virtualization</strong> is the pooling of physical storage from multiple network storage devices into what appears to be a single storage device that is managed from a central console. Storage virtualization is commonly used in storage area networks.</p><p>Storage virtualization is the pooling of physical storage from multiple storage devices into what appears to be a single storage device — or pool of available storage capacity. A central console manages the storage.</p><p>The technology relies on software to identify available storage capacity from physical devices and to then aggregate that capacity as a pool of storage that can be used by traditional architecture servers or in a virtual environment by virtual machines (<a href="https://www.techtarget.com/searchitoperations/definition/host-virtual-machine-host-VM">VMs</a>).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/520/1*GgPJ5OioYWX0k2UXuQILxQ.jpeg" /></figure><p>The virtual storage software intercepts input/output (I/O) requests from physical or virtual machines and sends those requests to the appropriate physical location of the storage devices that are part of the overall pool of storage in the virtualized environment. To the user, the various storage resources that make up the pool are unseen, so the virtual storage appears like a single physical drive, share or logical unit number (LUN) that can accept standard reads and writes</p><p><strong>3. Server virtualization</strong> is the masking of server resources — including the number and identity of individual physical servers, processors and operating systems — from server users. The intention is to spare the user from having to understand and manage complicated details of server resources while increasing resource sharing and utilization and maintaining the capacity to expand later.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/285/1*vd17q8v31AC5ZCKB7FdV3g.png" /></figure><p>The layer of software that enables this abstraction is often referred to as the hypervisor. The most common hypervisor — Type 1 — is designed to sit directly on bare metal and provide the ability to virtualize the hardware platform for use by the virtual machines. KVM virtualization is a Linux kernel-based virtualization hypervisor that provides Type 1 virtualization benefits like other hypervisors. KVM is licensed under open source. A Type 2 hypervisor requires a host operating system and is more often used for testing and labs.</p><p><strong>4. Data virtualization</strong> is abstracting the traditional technical details of data and data management, such as location, performance or format, in favor of broader access and more resiliency tied to business needs.Data virtualization provides a modern data layer that enables users to access, combine, transform, and deliver datasets with breakthrough speed and cost-effectiveness. Data virtualization technology gives users fast access to data housed throughout the enterprise — including in traditional databases, big data sources, and cloud and IoT systems — at a fraction of physical warehousing and extract/transform/load (ETL) time and cost.</p><h4>Common systems used with data virtualization</h4><ul><li>Oracle</li><li>SQL Server</li><li>Teradata</li><li>Netezza</li><li>DB2</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/274/1*BxYeVmEHJq3bGM3vkfW9AQ.png" /></figure><p><strong>5. Desktop virtualization</strong> is virtualizing a workstation load rather than a server. This allows the user to access the desktop remotely, typically using a thin client at the desk. Since the workstation is essentially running in a data center server, access to it can be both more secure and portable. The operating system license does still need to be accounted for as well as the infrastructure.</p><p>Desktop virtualization is a method of simulating a user workstation so it can be accessed from a remotely connected device. By abstracting the user desktop in this way, organizations can allow users to work from virtually anywhere with a network connecting, using any desktop laptop, tablet, or smartphone to access enterprise resources without regard to the device or operating system employed by the remote user.</p><p>Remote desktop virtualization is also a key component of digital workspaces Virtual desktop workloads run on desktop virtualization servers which typically execute on virtual machines (VMs) either at on-premises data centers or in the public cloud.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/233/1*90gaz0iGxN-DbRhFbF3oMA.jpeg" /></figure><p>Since the user devices is basically a display, keyboard, and mouse, a lost or stolen device presents a reduced risk to the organization. All user data and programs exist in the desktop virtualization server, not on client devices.</p><h4><strong>Type of desktop virtualization</strong></h4><p><strong>Virtual desktop infrastructure (VDI)</strong></p><p>VDI simulates the familiar desktop computing model as virtual desktop sessions that run on VMs either in on-premises data center or in the cloud. Organizations who adopt this model manage the desktop virtualization server as they would any other application server on-premises. Since all end-user computing is moved from users back into the data center, the initial deployment of servers to run VDI sessions can be a considerable investment, tempered by eliminating the need to constantly refresh end-user devices.</p><p><strong>Remote desktop services (RDS)</strong></p><p>VDI simulates the familiar desktop computing model as virtual desktop sessions that run on VMs either in on-premises data center or in the cloud. Organizations who adopt this model manage the desktop virtualization server as they would any other application server on-premises. Since all end-user computing is moved from users back into the data center, the initial deployment of servers to run VDI sessions can be a considerable investment, tempered by eliminating the need to constantly refresh end-user devices.</p><p><strong>Desktop-as-a-Service (DaaS)</strong></p><p>DaaS shifts the burden of providing desktop virtualization to service providers, which greatly alleviates the IT burden in providing virtual desktops. Organizations that wish to move IT expenses from capital expense to operational expenses will appreciate the predictable monthly costs that DaaS providers base their business model on</p><p><strong>6. Application virtualization</strong> is abstracting the application layer away from the operating system. This way, the application can run in an encapsulated form without being depended upon on by the operating system underneath. This can allow a Windows application to run on Linux and vice versa, in addition to adding a level of isolation.</p><p>Application virtualization is a process that deceives a standard app into believing that it interfaces directly with an operating system’s capacities when, in fact, it does not.</p><p>This ruse requires a virtualization layer inserted between the app and the OS. This layer, or framework, must run an app’s subsets virtually and without impacting the subjacent OS. The virtualization layer replaces a portion of the runtime environment typically supplied by the OS, transparently diverting files and registry log changes to a single executable file.</p><p>By diverting the app’s processes into one file instead of many dispersed across the OS, the app easily operates on a different device, and formerly incompatible apps can now run adjacently.</p><p>Used in conjunction with application virtualization is desktop virtualization — the abstraction of the physical desktop environment and its related app software from the end-user device that accesses it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*VqiWTvU_6Sg84Cnokhf7mQ.jpeg" /></figure><p><strong>7. Operating system Virtualization</strong></p><p>With the technique of virtualized OS, nothing is required to be pre-installed or permanently loaded on the local storage device. Everything runs from network using a virtual; simulation &amp; that virtual disk is a disk-image (file) that remotely stored on a server i.e. Storage Area Network (SAN) or Non-Volatile Attached Storage (NAS).</p><p>It is also called OS-level virtualization is a type of virtualization technology which work on OS layer. Here the kernel of an OS allows more than one isolated user-space instances to exist. Such instances are called containers/software containers or virtualization engines. In other words, OS kernel will run a single operating system &amp; provide that operating system’s functionality to replicate on each of the isolated partitions.</p><h4>Uses of OS Virtualization</h4><ul><li>Used for virtual hosting environment.</li><li>Used for securely allocation of finite hardware resources among a large number of distrusting users.</li><li>System administrator uses it to integrate server hardware by moving services on separate hosts.</li><li>To improvised security by separating several applications to several containers.</li><li>These forms of virtualization don’t require hardware to work efficiently.</li></ul><p><strong>8. CPU Virtualization</strong></p><p>CPU Virtualization is one of the cloud-computing technology that requires a single CPU to work, which acts as multiple machines working together. Virtualization got its existence since the 1960s that became popular with hardware virtualization or CPU virtualization. To work efficiently and utilize all the computing resources to work together, CPU virtualization was invented to manage things by running every OS in one machine easily. Virtualization mainly focuses on efficiency and performance-related operations by saving time. When needed, the hardware resources are used, and the underlying layer process instructions to make virtual machines work.</p><p>CPU Virtualization emphasizes running programs and instructions through a virtual machine, giving the feeling of working on a physical workstation. All the operations are handled by an emulator that controls software to run according to it. Nevertheless, CPU Virtualization does not act as an emulator. The emulator performs the same way as a normal computer machine does. It replicates the same copy or data and generates the same output just like a physical machine does. The emulation function offers great portability and facilitates working on a single platform, acting like working on multiple platforms.</p><p>With CPU Virtualization, all the virtual machines act as physical machines and distribute their hosting resources like having various virtual processors. Sharing of physical resources takes place to each virtual machine when all hosting services get the request. Finally, the virtual machines get a share of the single CPU allocated to them, being a single-processor acting as a dual-processor.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/667/1*TxBIPl-dPZF-kvgtt1LZZg.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6362dd17b338" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Design patterns in software industry]]></title>
            <link>https://medium.com/@ayeshwery/design-patterns-in-software-industry-8743aa279194?source=rss-dd4230614455------2</link>
            <guid isPermaLink="false">https://medium.com/p/8743aa279194</guid>
            <dc:creator><![CDATA[AyeshwerySamarakoon]]></dc:creator>
            <pubDate>Wed, 30 Aug 2023 18:26:25 GMT</pubDate>
            <atom:updated>2023-08-30T18:26:25.493Z</atom:updated>
            <content:encoded><![CDATA[<blockquote><strong>What is a software design pattern?</strong></blockquote><p>A Design pattern is a walkthrough of a well-tested approach that can be used to solve a generally occurring and recurring problem in object-oriented software design.</p><p>It helps the developer community to collaborate and develop software with the help of a common vocabulary. There are a total of 23 design patterns that are categorized into 3 groups : creational, structural, and behavioral design patterns.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/686/1*bPsAiJtIU9uMzyC2S2-XYg.jpeg" /><figcaption>design patterns</figcaption></figure><p>While developing a software solution, various discussions take place to plan and determine the best possible procedure for the product development process. In this process, the group of developers may be unable to come up with a commonly accepted approach to solve a specified real-world problem. Due to differences in their problem-solving approach, software developers provide various unique ways of building object-oriented software applications that solve a particular problem.</p><p>This uniqueness can lead to developer-favored variations in source code that can make the software difficult to distribute, extend, reuse, and manage by fellow developers. Hence, there is a need for standardization in the case of object-oriented software.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xno3Zpv8nZhXb_z99gWJZw.jpeg" /><figcaption>type of design patterns</figcaption></figure><p>Design Patterns are a common solution to a common programming problem.</p><p>They are techniques used for making code more flexible and having it meet certain criteria.</p><p>A design or implementation structure that achieves a particular purpose.</p><p>The three main types of design patterns are Creational, Structural, and Behavioral, and within those types are quite a few sub design patterns. See the image below for a breakdown in the different design pattern and their sub categories.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*AjF8h-s90wAWXgMR.png" /></figure><blockquote><strong>Creational patterns</strong></blockquote><p>Creational design patterns deal with various object creation mechanisms. These kind of mechanims allows for more flexible and reusable code, they allow for the abstracting of complex logic by creating objects from a client and provide a cleaner interface to solve problems as they arise.</p><p>Let’s focus on the <strong>Factory Method Pattern</strong>. A factory method is a method that manufactures objects of a particular type.</p><p><strong>Some Creational Patterns:</strong></p><ul><li><strong>Factory Method</strong>. The factory pattern is used to replace class constructors, abstracting the process of object generation so that the type of the object instantiated can be determined at run-time.</li><li><strong>Singleton</strong>. The singleton pattern ensures that only one object of a particular class is ever created. All further references to objects of the singleton class refer to the same underlying instance.</li><li><strong>Abstract Factory</strong>. The abstract factory pattern is used to provide a client with a set of related or dependent objects. The “family” of objects created by the factory are determined at run-time.</li></ul><h4>Advantages of Creational Design Pattern</h4><ul><li>It reduces the complexity of object creation. Creating and managing the objects is a tedious process which will be governed by these Design Patterns. If we follow a proper structure, it will also reduce complexity.</li><li>It defines the best possible way to reuse the objects. We create the objects by using the number of objects like time and memory. If we use these patterns, we can efficiently reuse the already created objects for our code.</li><li>It saves the number of resources. By saving the number of resources, we can serve particular clients in a particular amount of time.</li></ul><blockquote><strong>Structural patterns</strong></blockquote><p>The structural design patterns let us compose different objects in a large structure. These patterns help in building relationships between different objects while making the structure flexible and efficient.</p><p><strong>Adapter Pattern: </strong>Let’s say you have to build a charts library and it accepts data in a structured JSON object to render beautiful charts. You have one legacy API that returns the response in XML format. We have to use this response and generate charts, but the charts library accepts a JSON object. We will write a function to convert this XML to JSON as required. This very function that lets us connect two incompatible structures is an adapter.</p><p><strong>Some Structural Patterns:</strong></p><ul><li><strong>Facade</strong>. The facade pattern is used to define a simplified interface to a more complex subsystem.</li><li><strong>Adapter</strong>. The adapter pattern is used to provide a link between two otherwise incompatible types by wrapping the “adaptee” with a class that supports the interface required by the client.</li><li><strong>Decorator</strong>. The decorator pattern is used to extend or alter the functionality of objects at run-time by wrapping them in an object of a decorator class. This provides a flexible alternative to using inheritance to modify behavior.</li></ul><p><strong>Structural patterns have many beneficial effects including:</strong></p><ol><li>Increased efficiency (Decorator, Flyweight, Proxy)</li><li>Enhanced reusability (Adapter, Bridge, Decorator)</li><li>Separating implementation from interface (Adapter, Bridge, Façade, Proxy)</li><li>Reducing complexity by providing cleaner, simpler interfaces to a system that are easier for client programmers to understand (Adapter, Bridge, Composite, Facade, Proxy)</li></ol><blockquote><strong>Behavioral patterns</strong></blockquote><p>The behavioral design patterns focus on improving communication between different objects in a system.</p><p><strong>The Chain of Responsiblity Pattern:</strong> This design pattern lets us build a system where each request passes through a chain of handlers. The handler either processes the request and passes it to another one in the chain, or it simply rejects the request. This pattern is commonly used in systems where sequential checks are required to be performed on the incoming requests.</p><p><strong>Some Behavioral Patterns:</strong></p><ul><li><strong>Observer</strong>. The observer pattern is used to allow an object to publish changes to its state. Other objects subscribe to be immediately notified of any changes.</li><li><strong>Mediator</strong>. The mediator pattern is used to reduce coupling between classes that communicate with each other. Instead of classes communicating directly, and thus requiring knowledge of their implementation, the classes send messages via a mediator object.</li><li><strong>Chain of Responsibility</strong>. The chain of responsibility pattern is used to process varied requests, each of which may be dealt with by a different handler.</li></ul><h4>Advantages of Behavioral Design Patterns</h4><ul><li>It reduces the complexity of communication between the objects.</li><li>It defines the best possible way to communicate between the objects.</li><li>It saves the number of resources. By saving the number of resources, we can serve particular clients in a particular amount of time.</li></ul><h4><strong>why do we use design patterns in software industry?</strong></h4><p>They aim to address common challenges in software development, such as code complexity, flexibility, extensibility, and maintainability. By applying design patterns, developers can achieve modular, scalable, and robust code structures that are easier to understand, modify, and enhance over time.</p><p>For a very long time there was a serious problem in software engineering: you hire a newcomer to a project and no matter how well they know the programming language, it takes them months to get up to speed with how things are done in your project before they can be productive. In hardware engineering, they solved this problem a very long time ago. They have a common terminology called ‘schematic diagrams’. You hire a hardware engineer, give them the schematics of your hardware project in the morning, allow them to study it, and by evening before it is time to call it a day they can pick up the soldering gun and become productive. The software industry has been trying to come up with ways to improve this. Standardization of programming languages was one way. Standard libraries (class libraries nowadays) has been another way; however, one of the most important ways has perhaps been design patterns. So, are design patterns important? Very.</p><blockquote><strong>The Most Important Design Patterns</strong></blockquote><h3><strong>1.Singleton pattern</strong></h3><p>The singleton pattern is used to limit creation of a class to only one object. This is beneficial when one (and only one) object is needed to coordinate actions across the system. There are several examples of where only a single instance of a class should exist, including caches, thread pools, and registries.</p><p>It’s trivial to initiate an object of a class — but how do we ensure that only one object ever gets created? The answer is to make the constructor ‘private’ to the class we intend to define as a singleton. That way, only the members of the class can access the private constructor and no one else.</p><p><strong><em>Important consideration</em></strong>: It’s possible to subclass a singleton by making the constructor protected instead of private. This might be suitable under some circumstances. One approach taken in these scenarios is to create a <strong>register of singletons</strong> of the subclasses and the <strong>getInstance</strong> method can take in a parameter or use an environment variable to return the desired singleton. The registry then maintains a mapping of string names to singleton objects, which can be accessed as needed.</p><p>The Singleton pattern solves two problems at the same time, violating the <em>Single Responsibility Principle</em>:</p><ol><li><strong>Ensure that a class has just a single instance</strong>. Why would anyone want to control how many instances a class has? The most common reason for this is to control access to some shared resource — for example, a database or a file.</li></ol><p>Here’s how it works: imagine that you created an object, but after a while decided to create a new one. Instead of receiving a fresh object, you’ll get the one you already created.</p><p>Note that this behavior is impossible to implement with a regular constructor since a constructor call <strong>must</strong> always return a new object by design.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*LLcLRJOaWobb8kH3" /></figure><p><em>Clients may not even realize that they’re working with the same object all the time.</em></p><p><strong>2.Provide a global access point to that instance</strong>. Remember those global variables that you (all right, me) used to store some essential objects? While they’re very handy, they’re also very unsafe since any code can potentially overwrite the contents of those variables and crash the app.</p><p>Just like a global variable, the Singleton pattern lets you access some object from anywhere in the program. However, it also protects that instance from being overwritten by other code.</p><p>There’s another side to this problem: you don’t want the code that solves problem #1 to be scattered all over your program. It’s much better to have it within one class, especially if the rest of your code already depends on it.</p><h4>Real-World Analogy</h4><p>The government is an excellent example of the Singleton pattern. A country can have only one official government. Regardless of the personal identities of the individuals who form governments, the title, “The Government of X”, is a global point of access that identifies the group of people in charge.</p><h4>Structure</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/430/0*tufjBKi4_P7Sx86h" /></figure><h4>Singleton.java: Singleton</h4><p><strong>package</strong> refactoring_guru.singleton.example.non_thread_safe;</p><p><strong>public</strong> <strong>final</strong> <strong>class</strong> <strong>Singleton</strong> {</p><p><strong>private</strong> <strong>static</strong> Singleton instance;</p><p><strong>public</strong> <strong>String</strong> value;</p><p><strong>private</strong> Singleton(<strong>String</strong> value) {</p><p>// The following code emulates slow initialization.</p><p><strong>try</strong> {</p><p>Thread.sleep(1000);</p><p>}</p><p><strong>catch</strong> (InterruptedException ex) {</p><p>ex.printStackTrace();</p><p>}</p><p><strong>this</strong>.value = value;</p><p>}</p><p><strong>public</strong> <strong>static</strong> Singleton getInstance(<strong>String</strong> value) {</p><p><strong>if</strong> (instance == <strong>null</strong>) {</p><p>instance = <strong>new</strong> Singleton(value);</p><p>}</p><p><strong>return</strong> instance;</p><p>}</p><p>}</p><h4>Pros and Cons</h4><ul><li>You can be sure that a class has only a single instance.</li><li>You gain a global access point to that instance.</li><li>The singleton object is initialized only when it’s requested for the first time.</li></ul><p>cons:</p><ul><li>Violates the <em>Single Responsibility Principle</em>. The pattern solves two problems at the time.</li><li>The Singleton pattern can mask bad design, for instance, when the components of the program know too much about each other.</li><li>The pattern requires special treatment in a multithreaded environment so that multiple threads won’t create a singleton object several times.</li><li>It may be difficult to unit test the client code of the Singleton because many test frameworks rely on inheritance when producing mock objects. Since the constructor of the singleton class is private and overriding static methods is impossible in most languages, you will need to think of a creative way to mock the singleton. Or just don’t write the tests. Or don’t use the Singleton pattern.</li></ul><h3><strong>2. Factory Method</strong></h3><p>A normal factory produces goods; a software factory produces objects. And not just that — it does so without specifying the exact class of the object to be created. To accomplish this, objects are created by calling a factory method instead of calling a constructor.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/346/0*H9G3ehlh7kSihVmE.png" /></figure><p>Usually, object creation in Java takes place like so:</p><blockquote><em>SomeClass someClassObject = new SomeClass();</em></blockquote><p>The problem with the above approach is that the code using the <strong>SomeClass</strong>’s object, suddenly now becomes dependent on the concrete implementation of <strong>SomeClass</strong>. There’s nothing wrong with using <strong>new</strong> to create objects but it comes with the baggage of tightly coupling our code to the concrete implementation class, which can occasionally be problematic.</p><h4>Problem</h4><p>Imagine that you’re creating a logistics management application. The first version of your app can only handle transportation by trucks, so the bulk of your code lives inside the Truck class.</p><p>After a while, your app becomes pretty popular. Each day you receive dozens of requests from sea transportation companies to incorporate sea logistics into the app.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*zxBrmHu5sA_M7r4C.png" /></figure><p><em>Adding a new class to the program isn’t that simple if the rest of the code is already coupled to existing classes.</em></p><p>Great news, right? But how about the code? At present, most of your code is coupled to the Truck class. Adding Ships into the app would require making changes to the entire codebase. Moreover, if later you decide to add another type of transportation to the app, you will probably need to make all of these changes again.</p><p>As a result, you will end up with pretty nasty code, riddled with conditionals that switch the app’s behavior depending on the class of transportation objects.</p><h4>Solution</h4><p>The Factory Method pattern suggests that you replace direct object construction calls (using the new operator) with calls to a special <em>factory</em> method. Don’t worry: the objects are still created via the new operator, but it’s being called from within the factory method. Objects returned by a factory method are often referred to as <em>products.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/620/0*egi-F2GEW4FZeXM7.png" /></figure><p><em>Subclasses can alter the class of objects being returned by the factory method.</em></p><p>At first glance, this change may look pointless: we just moved the constructor call from one part of the program to another. However, consider this: now you can override the factory method in a subclass and change the class of products being created by the method.</p><p>There’s a slight limitation though: subclasses may return different types of products only if these products have a common base class or interface. Also, the factory method in the base class should have its return type declared as this interface.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/490/0*PB7jTXkBvyx0z5IG.png" /></figure><p><em>All products must follow the same interface.</em></p><p>For example, both Truck and Ship classes should implement the Transport interface, which declares a method called deliver. Each class implements this method differently: trucks deliver cargo by land, ships deliver cargo by sea. The factory method in the RoadLogistics class returns truck objects, whereas the factory method in the SeaLogistics class returns ships.</p><h4>Structure</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/660/0*fKthrrfIg8Eq6Cib.png" /></figure><h4>buttons/Button.java: Common product interface</h4><p><strong>package</strong> refactoring_guru.factory_method.example.buttons;</p><p>/** * Common interface for all buttons. */</p><p><strong>public</strong> <strong>interface</strong> <strong>Button</strong> {</p><p><strong>void</strong> render();</p><p><strong>void</strong> onClick();</p><p>}</p><h4>buttons/HtmlButton.java: Concrete product</h4><p><strong>package</strong> refactoring_guru.factory_method.example.buttons;</p><p>/** * HTML button implementation. */</p><p><strong>public</strong> <strong>class</strong> <strong>HtmlButton</strong> <strong>implements</strong> Button {</p><p><strong>public</strong> <strong>void</strong> render() {</p><p>System.out.println(“&lt;button&gt;Test Button&lt;/button&gt;”);</p><p>onClick();</p><p>}</p><p><strong>public</strong> <strong>void</strong> onClick() {</p><p>System.out.println(“Click! Button says — ‘Hello World!’”);</p><p>}</p><p>}</p><h4>Pros and Cons</h4><ul><li>You avoid tight coupling between the creator and the concrete products.</li><li><em>Single Responsibility Principle</em>. You can move the product creation code into one place in the program, making the code easier to support.</li><li><em>Open/Closed Principle</em>. You can introduce new types of products into the program without breaking existing client code.</li></ul><p>cons:</p><ul><li>The code may become more complicated since you need to introduce a lot of new subclasses to implement the pattern. The best case scenario is when you’re introducing the pattern into an existing hierarchy of creator classes.</li></ul><h3><strong>3. Strategy</strong></h3><p>The strategy pattern allows grouping related algorithms under an abstraction, which allows switching out one algorithm or policy for another without modifying the client. Instead of directly implementing a single algorithm, the code receives runtime instructions specifying which of the group of algorithms to run.</p><h4>Problem</h4><p>One day you decided to create a navigation app for casual travelers. The app was centered around a beautiful map which helped users quickly orient themselves in any city.</p><p>One of the most requested features for the app was automatic route planning. A user should be able to enter an address and see the fastest route to that destination displayed on the map.</p><p>The first version of the app could only build the routes over roads. People who traveled by car were bursting with joy. But apparently, not everybody likes to drive on their vacation. So with the next update, you added an option to build walking routes. Right after that, you added another option to let people use public transport in their routes.</p><p>However, that was only the beginning. Later you planned to add route building for cyclists. And even later, another option for building routes through all of a city’s tourist attractions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/330/0*d7SGRzeRvNJcvV8N.png" /></figure><p><em>The code of the navigator became bloated.</em></p><p>While from a business perspective the app was a success, the technical part caused you many headaches. Each time you added a new routing algorithm, the main class of the navigator doubled in size. At some point, the beast became too hard to maintain.</p><p>Any change to one of the algorithms, whether it was a simple bug fix or a slight adjustment of the street score, affected the whole class, increasing the chance of creating an error in already-working code.</p><p>In addition, teamwork became inefficient. Your teammates, who had been hired right after the successful release, complain that they spend too much time resolving merge conflicts. Implementing a new feature requires you to change the same huge class, conflicting with the code produced by other people.</p><h4>Solution</h4><p>The Strategy pattern suggests that you take a class that does something specific in a lot of different ways and extract all of these algorithms into separate classes called <em>strategies</em>.</p><p>The original class, called <em>context</em>, must have a field for storing a reference to one of the strategies. The context delegates the work to a linked strategy object instead of executing it on its own.</p><p>The context isn’t responsible for selecting an appropriate algorithm for the job. Instead, the client passes the desired strategy to the context. In fact, the context doesn’t know much about strategies. It works with all strategies through the same generic interface, which only exposes a single method for triggering the algorithm encapsulated within the selected strategy.</p><p>This way the context becomes independent of concrete strategies, so you can add new algorithms or modify existing ones without changing the code of the context or other strategies.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/570/0*v9iYUWLbMCHOqoxw.png" /></figure><p><em>Route planning strategies.</em></p><p>In our navigation app, each routing algorithm can be extracted to its own class with a single buildRoute method. The method accepts an origin and destination and returns a collection of the route’s checkpoints.</p><p>Even though given the same arguments, each routing class might build a different route, the main navigator class doesn’t really care which algorithm is selected since its primary job is to render a set of checkpoints on the map. The class has a method for switching the active routing strategy, so its clients, such as the buttons in the user interface, can replace the currently selected routing behavior with another one.</p><h4>Real-World Analogy</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/0*F2jVxL8pHXigYXse.png" /></figure><p><em>Various strategies for getting to the airport.</em></p><p>Imagine that you have to get to the airport. You can catch a bus, order a cab, or get on your bicycle. These are your transportation strategies. You can pick one of the strategies depending on factors such as budget or time constraints.</p><h4>Structure</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/440/0*vYmManE6NDoluRPn.png" /></figure><ol><li>The <strong>Context</strong> maintains a reference to one of the concrete strategies and communicates with this object only via the strategy interface.</li><li>The <strong>Strategy</strong> interface is common to all concrete strategies. It declares a method the context uses to execute a strategy.</li><li><strong>Concrete Strategies</strong> implement different variations of an algorithm the context uses.</li><li>The context calls the execution method on the linked strategy object each time it needs to run the algorithm. The context doesn’t know what type of strategy it works with or how the algorithm is executed.</li><li>The <strong>Client</strong> creates a specific strategy object and passes it to the context. The context exposes a setter which lets clients replace the strategy associated with the context at runtime.</li></ol><h4>strategies/CreditCard.java: A credit card class</h4><p><strong>package</strong> refactoring_guru.strategy.example.strategies;</p><p>/** * Dummy credit card class. */</p><p><strong>public</strong> <strong>class</strong> <strong>CreditCard</strong> {</p><p><strong>private</strong> <strong>int</strong> amount;</p><p><strong>private</strong> <strong>String</strong> number;</p><p><strong>private</strong> <strong>String</strong> date;</p><p><strong>private</strong> <strong>String</strong> cvv;</p><p>CreditCard(<strong>String</strong> number, <strong>String</strong> date, <strong>String</strong> cvv) {</p><p><strong>this</strong>.amount = 100_000; <strong>this</strong>.number = number;</p><p><strong>this</strong>.date = date; <strong>this</strong>.cvv = cvv;</p><p>}</p><p><strong>public</strong> <strong>void</strong> setAmount(<strong>int</strong> amount) {</p><p><strong>this</strong>.amount = amount;</p><p>}</p><p><strong>public</strong> <strong>int</strong> getAmount() {</p><p><strong>return</strong> amount;</p><p>}</p><p>}</p><h4>Pros and Cons</h4><ul><li>You can swap algorithms used inside an object at runtime.</li><li>You can isolate the implementation details of an algorithm from the code that uses it.</li><li>You can replace inheritance with composition.</li><li><em>Open/Closed Principle</em>. You can introduce new strategies without having to change the context.</li></ul><p>cons:</p><ul><li>If you only have a couple of algorithms and they rarely change, there’s no real reason to overcomplicate the program with new classes and interfaces that come along with the pattern.</li><li>Clients must be aware of the differences between strategies to be able to select a proper one.</li><li>A lot of modern programming languages have functional type support that lets you implement different versions of an algorithm inside a set of anonymous functions. Then you could use these functions exactly as you’d have used the strategy objects, but without bloating your code with extra classes and interfaces.</li></ul><h3><strong>4. Observer</strong></h3><p>This pattern is a one-to-many dependency between objects so that when one object changes state, all its dependents are notified. This is typically done by calling one of their methods.</p><p>For the sake of simplicity, think about what happens when you follow someone on Twitter. You are essentially asking Twitter to send you (<strong>the observer</strong>) tweet updates of the person (<strong>the subject</strong>) you followed. The pattern consists of two actors, <em>the observer</em> who is interested in the updates and <em>the subject</em> who generates the updates.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/231/0*d0JwJRAfnqfuT9Pp.png" /></figure><p>A subject can have many observers and is a one to many relationship. However, an observer is free to subscribe to updates from other subjects too. You can subscribe to news feed from a Facebook page, which would be the subject and whenever the page has a new post, the subscriber would see the new post.</p><p>Key consideration: In case of many subjects and few observers, if each subject stores its observers separately, it’ll increase the storage costs as some subjects will be storing the same observer multiple times.</p><p><strong>Observer</strong> is a behavioral design pattern that lets you define a subscription mechanism to notify multiple objects about any events that happen to the object they’re observing.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/0*8ysfBOgHZp4DCQWM.png" /></figure><h4>Problem</h4><p>Imagine that you have two types of objects: a Customer and a Store. The customer is very interested in a particular brand of product (say, it’s a new model of the iPhone) which should become available in the store very soon.</p><p>The customer could visit the store every day and check product availability. But while the product is still en route, most of these trips would be pointless.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*fVLB6Mv20ApSxqGH.png" /></figure><p><em>Visiting the store vs. sending spam</em></p><p>On the other hand, the store could send tons of emails (which might be considered spam) to all customers each time a new product becomes available. This would save some customers from endless trips to the store. At the same time, it’d upset other customers who aren’t interested in new products.</p><p>It looks like we’ve got a conflict. Either the customer wastes time checking product availability or the store wastes resources notifying the wrong customers.</p><h4>Solution</h4><p>The object that has some interesting state is often called <em>subject</em>, but since it’s also going to notify other objects about the changes to its state, we’ll call it <em>publisher</em>. All other objects that want to track changes to the publisher’s state are called <em>subscribers</em>.</p><p>The Observer pattern suggests that you add a subscription mechanism to the publisher class so individual objects can subscribe to or unsubscribe from a stream of events coming from that publisher. Fear not! Everything isn’t as complicated as it sounds. In reality, this mechanism consists of 1) an array field for storing a list of references to subscriber objects and 2) several public methods which allow adding subscribers to and removing them from that list.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/470/0*F2DdtYftUTPpRXXA.png" /></figure><p><em>A subscription mechanism lets individual objects subscribe to event notifications.</em></p><p>Now, whenever an important event happens to the publisher, it goes over its subscribers and calls the specific notification method on their objects.</p><p>Real apps might have dozens of different subscriber classes that are interested in tracking events of the same publisher class. You wouldn’t want to couple the publisher to all of those classes. Besides, you might not even know about some of them beforehand if your publisher class is supposed to be used by other people.</p><p>That’s why it’s crucial that all subscribers implement the same interface and that the publisher communicates with them only via that interface. This interface should declare the notification method along with a set of parameters that the publisher can use to pass some contextual data along with the notification.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/460/0*417_9QcjIem0IOWT.png" /></figure><p><em>Publisher notifies subscribers by calling the specific notification method on their objects.</em></p><p>If your app has several different types of publishers and you want to make your subscribers compatible with all of them, you can go even further and make all publishers follow the same interface. This interface would only need to describe a few subscription methods. The interface would allow subscribers to observe publishers’ states without coupling to their concrete classes.</p><h4>Real-World Analogy</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*w3U0DZn0PC3G2lvT.png" /></figure><p><em>Magazine and newspaper subscriptions.</em></p><p>If you subscribe to a newspaper or magazine, you no longer need to go to the store to check if the next issue is available. Instead, the publisher sends new issues directly to your mailbox right after publication or even in advance.</p><p>The publisher maintains a list of subscribers and knows which magazines they’re interested in. Subscribers can leave the list at any time when they wish to stop the publisher sending new magazine issues to them.</p><h4>Structure</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/610/0*bqjV1p1uQfTgNj1J.png" /></figure><h4>publisher/EventManager.java: Basic publisher</h4><p><strong>package</strong> refactoring_guru.observer.example.publisher;</p><p><strong>import</strong> refactoring_guru.observer.example.listeners.EventListener;</p><p><strong>import</strong> java.io.File;</p><p><strong>import</strong> java.util.ArrayList;</p><p><strong>import</strong> java.util.HashMap;</p><p><strong>import</strong> java.util.List;</p><p><strong>import</strong> java.util.Map;</p><p><strong>public</strong> <strong>class</strong> <strong>EventManager</strong> {</p><p>Map&lt;<strong>String</strong>, List&lt;EventListener&gt;&gt; listeners = <strong>new</strong> HashMap&lt;&gt;();</p><p><strong>public</strong> EventManager(<strong>String</strong>… operations) {</p><p><strong>for</strong> (<strong>String</strong> operation : operations) {</p><p><strong>this</strong>.listeners.put(operation, <strong>new</strong> ArrayList&lt;&gt;());</p><p>}</p><p>}</p><p><strong>public</strong> <strong>void</strong> subscribe(<strong>String</strong> eventType, EventListener listener) { List&lt;EventListener&gt; users = listeners.get(eventType); users.add(listener);</p><p>}</p><p><strong>public</strong> <strong>void</strong> unsubscribe(<strong>String</strong> eventType, EventListener listener) { List&lt;EventListener&gt; users = listeners.get(eventType); users.remove(listener);</p><p>}</p><p><strong>public</strong> <strong>void</strong> notify(<strong>String</strong> eventType, File file) {</p><p>List&lt;EventListener&gt; users = listeners.get(eventType);</p><p><strong>for</strong> (EventListener listener : users) {</p><p>listener.update(eventType, file);</p><p>}</p><p>}</p><p>}</p><h4>Pros and Cons</h4><ul><li><em>Open/Closed Principle</em>. You can introduce new subscriber classes without having to change the publisher’s code (and vice versa if there’s a publisher interface).</li><li>You can establish relations between objects at runtime.</li></ul><p>cons:</p><ul><li>Subscribers are notified in random order.</li></ul><h3><strong>5. Builder</strong></h3><p>As the name implies, a builder pattern is used to build objects. Sometimes, the objects we create can be complex, made up of several sub-objects or require an elaborate construction process. The exercise of creating complex types can be simplified by using the builder pattern. A <em>composite</em> or an <em>aggregate</em> object is what a builder generally builds.</p><p>Key consideration: The builder pattern might seem similar to the ‘abstract factory’ pattern but one difference is that the builder pattern creates an object step by step whereas the abstract factory pattern returns the object in one go.</p><p><strong>Builder</strong> is a creational design pattern that lets you construct complex objects step by step. The pattern allows you to produce different types and representations of an object using the same construction code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/0*RTPLZm3bPcRe1m0R.png" /></figure><h4>Problem</h4><p>Imagine a complex object that requires laborious, step-by-step initialization of many fields and nested objects. Such initialization code is usually buried inside a monstrous constructor with lots of parameters. Or even worse: scattered all over the client code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*YJiETtiA-7d4Bq3f.png" /></figure><p><em>You might make the program too complex by creating a subclass for every possible configuration of an object.</em></p><p>For example, let’s think about how to create a House object. To build a simple house, you need to construct four walls and a floor, install a door, fit a pair of windows, and build a roof. But what if you want a bigger, brighter house, with a backyard and other goodies (like a heating system, plumbing, and electrical wiring)?</p><p>The simplest solution is to extend the base House class and create a set of subclasses to cover all combinations of the parameters. But eventually you’ll end up with a considerable number of subclasses. Any new parameter, such as the porch style, will require growing this hierarchy even more.</p><p>There’s another approach that doesn’t involve breeding subclasses. You can create a giant constructor right in the base House class with all possible parameters that control the house object. While this approach indeed eliminates the need for subclasses, it creates another problem.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*ET53wd8I8l9zCK4i.png" /></figure><p><em>The constructor with lots of parameters has its downside: not all the parameters are needed at all times.</em></p><p>In most cases most of the parameters will be unused, making <a href="https://refactoring.guru/smells/long-parameter-list"><strong>the constructor calls pretty ugly</strong></a>. For instance, only a fraction of houses have swimming pools, so the parameters related to swimming pools will be useless nine times out of ten.</p><h4>Solution</h4><p>The Builder pattern suggests that you extract the object construction code out of its own class and move it to separate objects called <em>builders</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/410/0*kQN8CnjY6ShVm7Vf.png" /></figure><p><em>The Builder pattern lets you construct complex objects step by step. The Builder doesn’t allow other objects to access the product while it’s being built.</em></p><p>The pattern organizes object construction into a set of steps (buildWalls, buildDoor, etc.). To create an object, you execute a series of these steps on a builder object. The important part is that you don’t need to call all of the steps. You can call only those steps that are necessary for producing a particular configuration of an object.</p><p>Some of the construction steps might require different implementation when you need to build various representations of the product. For example, walls of a cabin may be built of wood, but the castle walls must be built with stone.</p><p>In this case, you can create several different builder classes that implement the same set of building steps, but in a different manner. Then you can use these builders in the construction process (i.e., an ordered set of calls to the building steps) to produce different kinds of objects.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*IM8narFhEV8A-kRJ.png" /></figure><p><em>Different builders execute the same task in various ways.</em></p><p>For example, imagine a builder that builds everything from wood and glass, a second one that builds everything with stone and iron and a third one that uses gold and diamonds. By calling the same set of steps, you get a regular house from the first builder, a small castle from the second and a palace from the third. However, this would only work if the client code that calls the building steps is able to interact with builders using a common interface.</p><h4>Director</h4><p>You can go further and extract a series of calls to the builder steps you use to construct a product into a separate class called <em>director</em>. The director class defines the order in which to execute the building steps, while the builder provides the implementation for those steps.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/343/0*0jTir_43F8rDl6Ww.png" /></figure><p><em>The director knows which building steps to execute to get a working product.</em></p><p>Having a director class in your program isn’t strictly necessary. You can always call the building steps in a specific order directly from the client code. However, the director class might be a good place to put various construction routines so you can reuse them across your program.</p><p>In addition, the director class completely hides the details of product construction from the client code. The client only needs to associate a builder with a director, launch the construction with the director, and get the result from the builder.</p><h4>Structure</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/460/0*gw_2VC82PVdXE24o.png" /></figure><h4>Pros and Cons</h4><ul><li>You can construct objects step-by-step, defer construction steps or run steps recursively.</li><li>You can reuse the same construction code when building various representations of products.</li><li><em>Single Responsibility Principle</em>. You can isolate complex construction code from the business logic of the product.</li></ul><p>cons:</p><ul><li>The overall complexity of the code increases since the pattern requires creating multiple new classes.</li></ul><h3><strong>6. Adapter</strong></h3><p>This allows incompatible classes to work together by converting the interface of one class into another. Think of it as a sort of translator: when two heads of states who don’t speak a common language meet, usually an interpreter sits between the two and translates the conversation, thus enabling communication.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/194/0*pcFQD9KwmkmYPdWP.png" /></figure><p>If you have two applications, with one spitting out output as XML with the other requiring JSON input, then you’ll need an adapter between the two to make them work seamlessly.</p><p><strong>Adapter</strong> is a structural design pattern that allows objects with incompatible interfaces to collaborate.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/0*trVw-qGKCEXTjJ_y.png" /></figure><h4>Problem</h4><p>Imagine that you’re creating a stock market monitoring app. The app downloads the stock data from multiple sources in XML format and then displays nice-looking charts and diagrams for the user.</p><p>At some point, you decide to improve the app by integrating a smart 3rd-party analytics library. But there’s a catch: the analytics library only works with data in JSON format.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/530/0*xFFCupwyIiPC1_m5.png" /></figure><p><em>You can’t use the analytics library “as is” because it expects the data in a format that’s incompatible with your app.</em></p><p>You could change the library to work with XML. However, this might break some existing code that relies on the library. And worse, you might not have access to the library’s source code in the first place, making this approach impossible.</p><h4>Solution</h4><p>You can create an <em>adapter</em>. This is a special object that converts the interface of one object so that another object can understand it.</p><p>An adapter wraps one of the objects to hide the complexity of conversion happening behind the scenes. The wrapped object isn’t even aware of the adapter. For example, you can wrap an object that operates in meters and kilometers with an adapter that converts all of the data to imperial units such as feet and miles.</p><p>Adapters can not only convert data into various formats but can also help objects with different interfaces collaborate. Here’s how it works:</p><ol><li>The adapter gets an interface, compatible with one of the existing objects.</li><li>Using this interface, the existing object can safely call the adapter’s methods.</li><li>Upon receiving a call, the adapter passes the request to the second object, but in a format and order that the second object expects.</li></ol><p>Sometimes it’s even possible to create a two-way adapter that can convert the calls in both directions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/530/0*sLfpzP2-YpeTt2SF.png" /></figure><p>Let’s get back to our stock market app. To solve the dilemma of incompatible formats, you can create XML-to-JSON adapters for every class of the analytics library that your code works with directly. Then you adjust your code to communicate with the library only via these adapters. When an adapter receives a call, it translates the incoming XML data into a JSON structure and passes the call to the appropriate methods of a wrapped analytics object.</p><h4>Real-World Analogy</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/533/0*DnRSI0-zwTvoix1Z.png" /></figure><p><em>A suitcase before and after a trip abroad.</em></p><p>When you travel from the US to Europe for the first time, you may get a surprise when trying to charge your laptop. The power plug and sockets standards are different in different countries. That’s why your US plug won’t fit a German socket. The problem can be solved by using a power plug adapter that has the American-style socket and the European-style plug.</p><h4>Structure</h4><p>Object adapter</p><p>This implementation uses the object composition principle: the adapter implements the interface of one object and wraps the other one. It can be implemented in all popular programming languages.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/580/0*5Q4n_OnhQmBfLein.png" /></figure><h4>Pros and Cons</h4><ul><li><em>Single Responsibility Principle</em>. You can separate the interface or data conversion code from the primary business logic of the program.</li><li><em>Open/Closed Principle</em>. You can introduce new types of adapters into the program without breaking the existing client code, as long as they work with the adapters through the client interface.</li><li>The overall complexity of the code increases because you need to introduce a set of new interfaces and classes. Sometimes it’s simpler just to change the service class so that it matches the rest of your code.</li></ul><h3><strong>7. State</strong></h3><p>The state pattern encapsulates the various states a machine can be in, and allows an object to alter its behavior when its internal state changes. The machine or the <strong><em>context</em></strong>, as it is called in pattern-speak, can have actions taken on it that propel it into different states. Without the use of the pattern, the code becomes inflexible and littered with if-else conditionals.</p><p><strong>State</strong> is a behavioral design pattern that lets an object alter its behavior when its internal state changes. It appears as if the object changed its class.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/0*IULFCn68rTSNCJhv.png" /></figure><h4>Problem</h4><p>The State pattern is closely related to the concept of a <em>Finite-State Machine</em> .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/320/0*Lr7WkHT_yzSqcPCq.png" /></figure><p><em>Finite-State Machine.</em></p><p>The main idea is that, at any given moment, there’s a <em>finite</em> number of <em>states</em> which a program can be in. Within any unique state, the program behaves differently, and the program can be switched from one state to another instantaneously. However, depending on a current state, the program may or may not switch to certain other states. These switching rules, called <em>transitions</em>, are also finite and predetermined.</p><p>You can also apply this approach to objects. Imagine that we have a Document class. A document can be in one of three states: Draft, Moderation and Published. The publish method of the document works a little bit differently in each state:</p><ul><li>In Draft, it moves the document to moderation.</li><li>In Moderation, it makes the document public, but only if the current user is an administrator.</li><li>In Published, it doesn’t do anything at all.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/560/0*kzvGe7FLAW2tND4B.png" /></figure><p><em>Possible states and transitions of a document object.</em></p><p>State machines are usually implemented with lots of conditional statements (if or switch) that select the appropriate behavior depending on the current state of the object. Usually, this “state” is just a set of values of the object’s fields. Even if you’ve never heard about finite-state machines before, you’ve probably implemented a state at least once. Does the following code structure ring a bell?</p><p><strong>class</strong> <strong>Document</strong> <strong>is</strong> <strong>field</strong> state: string // … <strong>method</strong> publish() <strong>is</strong> switch (state) “draft”: state = “moderation” break “moderation”: <strong>if</strong> (currentUser.role == “admin”) state = “published” break “published”: // Do nothing. break // …</p><p>The biggest weakness of a state machine based on conditionals reveals itself once we start adding more and more states and state-dependent behaviors to the Document class. Most methods will contain monstrous conditionals that pick the proper behavior of a method according to the current state. Code like this is very difficult to maintain because any change to the transition logic may require changing state conditionals in every method.</p><p>The problem tends to get bigger as a project evolves. It’s quite difficult to predict all possible states and transitions at the design stage. Hence, a lean state machine built with a limited set of conditionals can grow into a bloated mess over time.</p><h4>Solution</h4><p>The State pattern suggests that you create new classes for all possible states of an object and extract all state-specific behaviors into these classes.</p><p>Instead of implementing all behaviors on its own, the original object, called <em>context</em>, stores a reference to one of the state objects that represents its current state, and delegates all the state-related work to that object.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/490/0*bNDnvZYaSWtUGK9E.png" /></figure><p><em>Document delegates the work to a state object.</em></p><p>To transition the context into another state, replace the active state object with another object that represents that new state. This is possible only if all state classes follow the same interface and the context itself works with these objects through that interface.</p><p>This structure may look similar to the <a href="https://refactoring.guru/design-patterns/strategy"><strong>Strategy</strong></a> pattern, but there’s one key difference. In the State pattern, the particular states may be aware of each other and initiate transitions from one state to another, whereas strategies almost never know about each other.</p><h4>Real-World Analogy</h4><p>The buttons and switches in your smartphone behave differently depending on the current state of the device:</p><ul><li>When the phone is unlocked, pressing buttons leads to executing various functions.</li><li>When the phone is locked, pressing any button leads to the unlock screen.</li><li>When the phone’s charge is low, pressing any button shows the charging screen.</li></ul><h4>Structure</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/540/0*HKDo6ZnSvjtsGIqd.png" /></figure><h4>states/State.java: Common state interface</h4><p><strong>package</strong> refactoring_guru.state.example.states;</p><p><strong>import</strong> refactoring_guru.state.example.ui.Player;</p><p>/** * Common interface for all states. */</p><p><strong>public</strong> <strong>abstract</strong> <strong>class</strong> <strong>State</strong> {</p><p>Player player;</p><p>/** * Context passes itself through the state constructor. This may help a * state to fetch some useful context data if needed. */</p><p>State(Player player) {</p><p><strong>this</strong>.player = player;</p><p>}</p><p><strong>public</strong> <strong>abstract</strong> <strong>String</strong> onLock();</p><p><strong>public</strong> <strong>abstract</strong> <strong>String</strong> onPlay();</p><p><strong>public</strong> <strong>abstract</strong> <strong>String</strong> onNext();</p><p><strong>public</strong> <strong>abstract</strong> <strong>String</strong> onPrevious();</p><p>}</p><h4>Pros and Cons</h4><ul><li><em>Single Responsibility Principle</em>. Organize the code related to particular states into separate classes.</li><li><em>Open/Closed Principle</em>. Introduce new states without changing existing state classes or the context.</li><li>Simplify the code of the context by eliminating bulky state machine conditionals.</li><li>Applying the pattern can be overkill if a state machine has only a few states or rarely changes.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8743aa279194" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AMAZON WEB SERVER]]></title>
            <link>https://medium.com/@ayeshwery/amazon-web-server-4b0b62243715?source=rss-dd4230614455------2</link>
            <guid isPermaLink="false">https://medium.com/p/4b0b62243715</guid>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[AyeshwerySamarakoon]]></dc:creator>
            <pubDate>Wed, 21 Sep 2022 01:59:38 GMT</pubDate>
            <atom:updated>2022-09-21T01:59:38.083Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Qy7g2pY9eLZtXFYPQ_2SmQ.png" /></figure><p>In 2006, Amazon Web Services (AWS) began offering IT infrastructure services to businesses in the form of web services — now commonly known as cloud computing. One of the key benefits of cloud computing is the opportunity to replace up-front capital infrastructure expenses with low variable costs that scale with your business. With the Cloud, businesses no longer need to plan for and procure servers and other IT infrastructure weeks or months in advance. Instead, they can instantly spin up hundreds or thousands of servers in minutes and deliver results faster.</p><p>Today, Amazon Web Services provides a highly reliable, scalable, low-cost infrastructure platform in the cloud that powers hundreds of thousands of businesses in 190 countries around the world. With data center locations in the U.S., Europe, Brazil, Singapore, Japan, and Australia, customers across all industries.</p><h3><strong>What is AWS?</strong></h3><p>Amazon Web Services (AWS) is the world’s most comprehensive and broadly adopted cloud platform, offering over 200 fully featured services from data centers globally. Millions of customers — including the fastest-growing startups, largest enterprises, and leading government agencies — are using AWS to lower costs, become more agile, and innovate faster..</p><h3><strong>Benifits of aws</strong></h3><h4>Agility</h4><p>The cloud gives you easy access to a broad range of technologies so that you can innovate faster and build nearly anything that you can imagine. You can quickly spin up resources as you need them–from infrastructure services, such as compute, storage, and databases, to Internet of Things, machine learning, data lakes and analytics, and much more.</p><h4>Elasticity</h4><p>With cloud computing, you don’t have to over-provision resources up front to handle peak levels of business activity in the future. Instead, you provision the amount of resources that you actually need. You can scale these resources up or down to instantly grow and shrink capacity as your business needs change.</p><h4>Cost savings</h4><p>The cloud allows you to trade fixed expenses (such as data centers and physical servers) for variable expenses, and only pay for IT as you consume it. Plus, the variable expenses are much lower than what you would pay to do it yourself because of the economies of scale.</p><h3>Deploy globally in minutes</h3><p>With the cloud, you can expand to new geographic regions and deploy globally in minutes. For example, AWS has infrastructure all over the world, so you can deploy your application in multiple physical locations with just a few clicks. Putting applications in closer proximity to end users reduces latency and improves their experience.</p><h3><strong>Disadvantages of AWS</strong></h3><h4>Limitations</h4><p>This comes first in the list of a few disadvantages of AWS Cloud Computing. In AWS, there are some limitations regarding EC2 and security. Companies that are using AWS will have default resources to use, but the problem comes when default resource limits vary from region to region. Although they can submit a request for more resources, companies find it a disadvantage of AWS.</p><h4>Lack of Experts</h4><p>AWS is the latest invention with a complex infrastructure. Companies using AWS as their Cloud Computing platform are looking to hire professionals to work on the cloud infrastructure. However, only a few professionals are skilled in AWS or any cloud provider. Companies are ready to invest in them but are facing difficulty in finding the right professionals to work on AWS who can lead these organizations to better performance. This can be a disadvantage of AWS in terms of time and money.</p><h4>Price Variations</h4><p>The price of AWS services varies based on factors such as the cost of land, fiber, electricity, and taxes from region to region. Variations also occur when you need additional tech support. Developer, Business, and Enterprise are the three available packages you can choose from, and the price varies accordingly. This will impact your monthly bill. But with services like <a href="https://intellipaat.com/blog/what-is-cloudwatch-in-aws/">Amazon CloudWatch</a>, you can monitor your service consumption, and Serverless Data Lake helps you calculate the cost of the services in your region.</p><h4>General Issues</h4><p>Amazon is a huge family with millions of customers, so it has some temporary <a href="https://intellipaat.com/blog/what-is-cloud-computing/">Cloud Computing</a> issues. Users sometimes face downtime with servers. It may be because of the power loss or network connectivity with the cloud provider. Anyway, it can be rectified eventually</p><h3>How does AWS work?</h3><p>There are a variety of services provided by AWS AWS which can be configured as per the requirement of the users. Based on the demand and requirements, the users can have a look at the geographical locations for the individual server with the configuration options provided in that particular location. Here in this blog, I will be discussing some of the services of the AWS.</p><h3>Some of the services of AWS</h3><p>AWS offers its user a variety of services. These services can be used for developing various global cloud-based products. With that being said, now, let’s have a look at some of the services of AWS.</p><h3>Amazon EC2</h3><p>Amazon Elastic Compute Cloud (Amazon EC2) is a service that allows individuals to run various application programs in the computing environment. It is an AWS service that provides scalable computing capacity, allowing us to scale up or down as per the change in requirement and minimizes the need to forecast the traffic.</p><h3>Amazon S3</h3><p>Amazon Simple Storage Service (Amazon S3) is one of the services of AWS which allows individuals to store and protect various data and information. Here, using Amazon S3, individuals can easily organize their data and also configure the access as per their requirements. Amazon S3 storing of data and information of any volume to be stored and accessible at any time and from any parts of the world.</p><h3>AWS CodePipeline</h3><p>AWS CodePipeline is a fully managed continuous delivery service that allows individuals to automate the release pipelines for fast and reliable applications and infrastructure updates. CodePipeline automates the build, test, and deploy phases of your release process whenever a code change occurs, based on the type of release which individuals define. This allows individuals to deliver features and updates quickly and reliably.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4b0b62243715" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[KEYS IN DBMS]]></title>
            <link>https://medium.com/@ayeshwery/keys-in-dbms-dd3ab16188ed?source=rss-dd4230614455------2</link>
            <guid isPermaLink="false">https://medium.com/p/dd3ab16188ed</guid>
            <dc:creator><![CDATA[AyeshwerySamarakoon]]></dc:creator>
            <pubDate>Fri, 02 Sep 2022 15:27:44 GMT</pubDate>
            <atom:updated>2022-09-02T15:27:44.502Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>What is a key in DBMS?</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/285/1*FBD_SINCB2qsf-wuC-cRsg.jpeg" /><figcaption>keys in DBMS</figcaption></figure><p>Keys are a very important part of the Relational database model. They are used to establish and identify relationships between tables and also to uniquely identify any record or row of data inside a table.=A Key can be a single attribute or a group of attributes, where the combination may act as a key. A key refers to an attribute/a set of attributes that help us identify a row (or tuple) uniquely in a table (or relation). A key is also used when we want to establish relationships between the different columns and tables of a relational databaseගThey allow you to find the relation between two tables. Keys help you uniquely identify a row in a table by combining one or more columns in that table. Key is also helpful for finding unique records or rows from the table.</p><h3><strong>TYPE OF KEYS</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/469/1*_b6cs9j9ZFWtl2qIEDkYRQ.png" /></figure><p>Keys are of seven broad types in DBMS:<br>1. super Key<br>2. Primary Key<br>3. Foreign Key<br>4. Candidate Key<br>5. Alternate Key<br>6. Composite Key<br>7. Compound Key</p><h3>Super Key</h3><p>A superkey is a group of single or multiple keys that identifies rows in a table. A Super key may have additional attributes that are not needed for unique identification.is defined as a set of points within a table that can uniquely identify each record within a table. Super Key is a superset of a Candidate key.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/772/1*FBYRX6iCPAaMRQDKcx3K4Q.jpeg" /></figure><p>In the table defined above, super key would include student_id, (student_id, name), phone etc.</p><h3><strong>Primary key</strong></h3><p>The primary key is a candidate key that is most appropriate to become the main key for any table. It is a key that can uniquely identify each record in a table.is a column or group of columns in a table that uniquely identifies every row in that table. The Primary Key can’t be an exact meaning the same value can’t appear more than once in the table. A table cannot have more than one primary key.</p><h3>Rules for defining Primary key:</h3><ul><li>Two rows can’t have the same primary key value</li><li>It must be for every row have a primary key value.</li><li>The primary key field cannot be null.</li><li>The value in a primary key column can never be modified or updated if any foreign key refers to that primary key</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/450/1*7tSRTNn6rcoAVhF4tyt9NA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/589/1*hIybKtNDQaDCt_AbrnyBKg.jpeg" /></figure><h3><strong>Candidate key</strong></h3><p>Candidate keys are defined as the minimal set of fields that can uniquely identify each record in a table. It is an attribute or a set of attributes that can act as a Primary Key for a table to uniquely identify each record in that table. There can be more than one candidate key. In our example, student_id and phone both are candidate keys for table <strong>Student</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/772/1*FBYRX6iCPAaMRQDKcx3K4Q.jpeg" /></figure><ul><li>A candidate key can never be NULL or empty. And its value should be unique.</li><li>There can be more than one candidate key for a table.</li><li>A candidate key can be a combination of more than one column (attributes).</li></ul><h3><strong>Foreign Key</strong></h3><p>is a column that creates a relationship between two tables. The purpose of Foreign keys is to maintain data integrity and allow navigation between two different instances of an entity.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*4X3ToUWDOgk6DzRBNTd7Tw.png" /></figure><h3><strong>Alternate Key</strong></h3><p>It is a column or group of columns in a table that uniquely identify every row in that table. A table can have multiple choices for a primary key but only one can be set as the primary key. All the keys which are not primary key are called an Alternate Key. In this table, StudID, Roll No, and Email are qualified to become a primary key. But since StudID is the primary key, Roll No, Email becomes the alternative key.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/811/1*SrIDeyCw_u1s0l-s0Jj_2A.jpeg" /></figure><h3><strong>Composite Key</strong></h3><p>It is a combination of two or more columns that uniquely identify rows in a table. The combination of columns guarantees uniqueness, though individual uniqueness is not guaranteed. Hence, they are combined to uniquely identify records in a table.</p><p>The difference between a compound and a composite key is that any part of the compound key can be a foreign key, but the composite key may or maybe not be a part of the foreign key.</p><h3><strong>Compound Key</strong></h3><p>has two or more attributes that allow you to uniquely recognize a specific record. It is possible that each column may not be unique by itself within the database. However, when combined with the other column or columns the combination of composite keys become unique. The purpose of the compound key in a database is to uniquely identify each record in the table.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/798/1*TWib18Pn_sGPp9SpvslnEQ.jpeg" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dd3ab16188ed" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Evaluation of DBMS]]></title>
            <link>https://medium.com/@ayeshwery/evaluation-of-dbms-e16de0d1818?source=rss-dd4230614455------2</link>
            <guid isPermaLink="false">https://medium.com/p/e16de0d1818</guid>
            <category><![CDATA[mysql]]></category>
            <category><![CDATA[dbms]]></category>
            <category><![CDATA[evolution-of-dbms]]></category>
            <dc:creator><![CDATA[AyeshwerySamarakoon]]></dc:creator>
            <pubDate>Thu, 21 Jul 2022 16:09:34 GMT</pubDate>
            <atom:updated>2022-07-21T16:09:34.725Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/311/1*y-cUhqZn7D-5rxQvfu5L1A.png" /><figcaption>Database Management System</figcaption></figure><h3><strong>What is the DBMS?</strong></h3><p>A database management system (DBMS) is software for creating and managing databases. A DBMS makes it possible…</p><h3><strong>What is the evaluation of DBMS?</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*BJpvRNkdxLm0MEM-oI5Iew.png" /><figcaption>Evaluation of DBMS</figcaption></figure><p>Performance evaluation of database systems is made difficult by the existence of different database management systems, which serve different requirements. As DBMSes are limited in speed, they need to be highly efficient in its performance. A DBMS provides facilities for controlling data access, enforcing data integrity, managing concurrency control, recovering the database after failures, and restoring it from backup files, as well as maintaining database security. It is a set of software programs that controls the system organization, storage, management, and retrieval of data in a database. That is why they need to be efficient in storage and speed. This is the same reason why DBMSes need to be evaluated based on their performances. Different DBMSs performs differently in a different environment. This paper, assess the performance of Three different database management systems(MySql, SQLite, PostgreSQL). Based on that, a comparison of different DBMSs in the same environment is possible. This performance evaluation is done based on response time and memory capacity. There are various database management systems available in the market. Each type has its features and can be used for varied purposes. The large number of DBMS makes it difficult to choose the DBMS that should be implemented to solve our problem. To choose the most suitable DBMS, we need to evaluate various systems. We perform a structured approach to assess the database systems.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/232/1*zuOLF_aBhdcnRkWxj9jhOw.jpeg" /></figure><h3>Evaluation Methodology</h3><p>This step involves two analyses; both these analyses should be performed to determine the most suited DBMS.</p><p><strong>Feature analysis:</strong> In this phase, 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.</p><p><strong>Performance Analysis:</strong> In this phase, we analyze only those shortlisted DBMS, evaluate the systems’ efficiency, and choose one with maximum efficiency.</p><h3>Evaluation of data models.</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vhG-MecvLPAl4diYcEn2_w.png" /></figure><p><strong>Queuing Models: </strong>These models are effective to study the dynamics of a database system when it is modeled as a multi-component system with resource allocation constraints and jobs moving around from one component to another. Examples of such dynamic studies are concurrent transaction control algorithms, data allocation, and management in distributed database systems, etc.</p><p><strong>Cost Models: </strong>Cost Models are useful in studying the cost in terms of Physical storage and query processing time. The cost model gives some real insight into a database system&#39;s actual physical structure and performance.</p><p><strong>Simulation Modelling:</strong> Simulation modelling is more effective for obtaining better estimates since it not only analyses the database system in isolation but can effectively analyze the database system with the application program running on top of it and the database system itself operating within the constrained environment of an operating system on real physical hardware.</p><p><strong>Benchmarking: </strong>Benchmarking is the best method when multiple database systems need to be evaluated against each other but suffer the inherent setback that it assumes all systems to be fully installed and operational. Benchmarking relies on the effectiveness of the synthetic workloads. Real workloads are non repeatable and hence not good for effective benchmarking.</p><h3>Performance Evaluation Concept.</h3><p>Two approaches have been taken to early performance analysis of dbms. The first approach is a qualitative analysis in terms of possible impacts of system aspects on product qualities such as performance... The second approach is quantitative, using models. Smith developed an approach to building a queuing model based on scenario-like ―execution graphs‖ that are specially built for performance analysis.</p><p><strong>Response time</strong> Response time is defined as the time interval from the instant a command is input to the system to the instant the corresponding reply begins to appear at the terminal.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/621/1*O67vPe6l0E8u6Cm_yx61OQ.png" /><figcaption>Response time calculate inaccordance with the queries</figcaption></figure><p><strong>Throughput</strong>:Throughput is the overall capability of the computer to process data. It is the combination of IO speed, CPU speed, parallel capabilities of the machine and efficiency of the operating system and system software.</p><p><strong>Resources</strong> Hardware and software tools, which include memory, disk speed, cache controller etc.</p><p><strong>Memory </strong>The total space required by a query to complete its execution. The values it takes for the completion of its execution The workload parameters are partly specifications that must be taken as assumptions (such as the number of clients, types of query, query response time, execution time etc.) and partly predictions (such as CPU time for the operations to be implemented, the number of disk accesses and their cache hit ratio).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/671/1*g787GMsxHZcPlCOAtOk3zA.jpeg" /><figcaption>Performance comparison of MySQL,PostgreSQL and Sqlite against different query types</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e16de0d1818" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[FILE SYSTEM vs DBMS]]></title>
            <link>https://medium.com/@ayeshwery/file-system-vs-dbms-5b3e2fd6ea49?source=rss-dd4230614455------2</link>
            <guid isPermaLink="false">https://medium.com/p/5b3e2fd6ea49</guid>
            <category><![CDATA[mysql]]></category>
            <category><![CDATA[database]]></category>
            <category><![CDATA[database-management-sys]]></category>
            <category><![CDATA[oracle]]></category>
            <category><![CDATA[filesystem]]></category>
            <dc:creator><![CDATA[AyeshwerySamarakoon]]></dc:creator>
            <pubDate>Fri, 08 Jul 2022 17:41:26 GMT</pubDate>
            <atom:updated>2022-07-08T17:41:26.659Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WhMk67Jl6I7qqfk9975r0A.jpeg" /><figcaption>File system vs DBMS</figcaption></figure><h3><strong>what is a file system?</strong></h3><p>We can call this as a traditional system. A file system is a software that manages the data files in a computer system . the file system manages the file or data that we are going to store. the file can be a Text file, excel file, notepad file, images, numbers, etc. as well as the file system can use as an interface. That means if we create a word file we have to store it inside the hard drive.in this situation file system work as an interface between this word file and the hard disk.</p><p>we can only store unstructured data. that means raw data.to find our data we have to create a program and compile it. we can use any programming language.</p><p>ex: java, c++,c</p><p>as well as we need to know the location of the file that we want. after that, we can access the system. if we need one piece of information we have to read the whole file.</p><p>doesn’t provide backup and recovery of data if it is lost.</p><figure><img alt="Microsoft Excel data sheet" src="https://cdn-images-1.medium.com/max/284/1*YxYN7Xlq6zOPoNERozB1KQ.jpeg" /><figcaption>Microsoft Excel Data Sheet</figcaption></figure><h4><strong>advantages of the file system.</strong></h4><ul><li><strong>Compactness</strong>: Data can be stored in a small amount of space.</li><li><strong>Data Retrieval</strong>: Computer-based systems offer improved data retrieval techniques that make it simple and efficient to retrieve data from files.</li><li>easy to use.</li><li>low budget.</li></ul><h4><strong>Disadvantages of the file system.</strong></h4><ul><li><strong>Data Redundancy</strong>: The same data may be duplicated in many files. This results in data redundancy and memory waste.</li><li><strong>Data Inconsistency</strong>: Due to data redundancy, probably, data won’t be consistent.</li><li><strong>Accessing Data Is Difficult</strong>: It’s not simple to get data out of a file management system. It isn’t as convenient as it should be. When a user needs to access information, they must run specialized software. For example, we have a graphical user interface in our computers installed using which we access the files stored.</li></ul><h3>What is Database Management System (DBMS)?</h3><p>DBMS is software for managing the database. we use to manage a huge amount of relational data. we store predefined data so searching will be very easy. as well as we don’t need to know the location. offering an easy way to create a database, update tables, retrieve information, and enhance data. A DBMS is where data is accessed, modified and locked to prevent conflicts.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/259/1*Taf_sVF4qoYb63kTHz8yNw.png" /><figcaption>DBMS</figcaption></figure><p>It also provides proper security measures for protecting the data from unauthorized access.</p><p>In Database Management System the data can be fetched by SQL queries and relational algebra. It also provides mechanisms for data recovery and data backup.</p><p>The various operations performed by the DBMS system are Insertion, deletion, selection, sorting, etc.</p><p>DBMS provides a crash recovery mechanism, i.e., DBMS protects the user from system failure.</p><p>Due to the centralized approach, data sharing is easy.</p><p>Changes are often a necessity to the content of the data stored in any system, and these changes are more easily with a database approach.</p><p>It provides backup and recovery of data even if it is lost.</p><h4><strong>ex: </strong>MySQL, PostgreSQL, Microsoft Access, SQL Server</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/283/1*ybU7QHavOioyb9tfPb-Cvw.jpeg" /><figcaption>Examples for DBMS</figcaption></figure><p><strong>Advantages of DBMS.</strong></p><ul><li>Improved data sharing and data security</li><li>Effective data integration</li><li>Consistent, reliable data</li><li>Increased productivity</li><li>Data security is high</li><li>Data searching</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/307/1*-caeXq8vzF3bVyaxnoN1gA.jpeg" /><figcaption>Advantages of DBMS</figcaption></figure><p><strong>Disadvantages of DBMS.</strong></p><ul><li>High cost</li><li>database failure</li><li>Complexity</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/308/1*zOX7wlHyBeVJDEXb41E-kA.jpeg" /><figcaption>Disadvantages of DBMS</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5b3e2fd6ea49" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>