<?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 Pavani madushani on Medium]]></title>
        <description><![CDATA[Stories by Pavani madushani on Medium]]></description>
        <link>https://medium.com/@pavanimadushani9?source=rss-628d05f82adb------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*cxFlbq411LYX5mIu</url>
            <title>Stories by Pavani madushani on Medium</title>
            <link>https://medium.com/@pavanimadushani9?source=rss-628d05f82adb------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 11:28:01 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@pavanimadushani9/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[Software Design patterns]]></title>
            <link>https://medium.com/@pavanimadushani9/software-design-patterns-1e2c14ee2eb6?source=rss-628d05f82adb------2</link>
            <guid isPermaLink="false">https://medium.com/p/1e2c14ee2eb6</guid>
            <dc:creator><![CDATA[Pavani madushani]]></dc:creator>
            <pubDate>Sat, 26 Aug 2023 05:54:12 GMT</pubDate>
            <atom:updated>2023-08-26T07:22:16.278Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*5bUZLs6THlVHaTOs.png" /></figure><p>Software development is a complex and creative endeavor, aiming to transform abstract concepts into functional and efficient digital solutions. As the scale and intricacy of software systems have grown over the years, so too have the challenges associated with building and maintaining them. In this context, software patterns have emerged as essential tools for guiding developers in creating reliable, scalable, and maintainable software.It is important to understand that Design Patterns are not finished pieces of code that can be transformed and directly applied to your software. Rather they are more like a template, a description, or a concept that can give you an idea of how to solve a problem that can be used in many different situations.</p><p>They can incredibly useful when used in the right places and for the right reasons. When used strategically, they enhance your software and make it more efficient by methods, already refined by a myriad of developers.</p><h3>Software design patterns: the definition</h3><p>A software pattern is a reusable and proven solution to a common problem encountered in software design and development. It represents distilled experience and collective wisdom from seasoned developers who have faced similar challenges in the past. These patterns provide a template for solving recurring issues, offering a shared vocabulary and a systematic approach to tackle complex software design problems. Note that you can’t just find a suitable design pattern and copy paste it into your code, as you’d do with off-the-shelf functions or libraries. Instead, you need to follow the details of a pattern, understand the way it works, and, based on that pattern, come up with a solution. In other words, you need to figure out how and where to properly apply this approach.However, there are several main sections that are usually included in a pattern description:</p><ul><li>Pattern name and classification: a descriptive and unique name that helps identify and reference the pattern;</li><li>Intent: briefly describes the problem and solution that the pattern offers;</li><li>Motivation: a scenario illustrating the problem;</li><li>Structure: a diagram using an object modeling technique (OMT);</li><li>Implementation: implementation details to consider, language-specific issues;</li><li>Example code: executed in one of the popular programming languages, code example makes it easy to understand the idea behind the pattern.</li></ul><p>Due to the fact that patterns describe frequently encountered issues they can sometimes be confused with algorithms. The difference between the two is that an algorithm is a clear set of actions to solve a specific problem that is broken down into steps. Whereas software design patterns are more of “blueprints” of solutions to common problems that arise when creating a software solution.</p><h4>Patterns in the real world</h4><p>The easiest way to understand design patterns is to first consider patterns in their simplest form. A pattern is a repetition or sequence that carries meaning to us. In our everyday lives, patterns can help us achieve our aims faster and with the right outcome. It is probably easier and more efficient (not to mention less stressful) if we plan the journey to the apartment we’ve rented for our holiday, than to just leave home and figure it out as we go, deciding which way to turn and which form of transport to take as each possibility arises.</p><p><strong><em>Real-World Example</em></strong></p><p><strong><em>Do you love food? (Everyone loves that)</em></strong>… Which one is your favorite restaurant? Where do you visit most? Do you love street food or you prefer some online app Zomato and Swiggy? You might have tried different cuisines and you might have experimented with different places as well. If there is a favorite restaurant in your list where most of the time you love to eat your favorite dish then what’s the reason behind that?. Of course, the <strong>experienced chef</strong> of that restaurant might be using a <strong>specific technique</strong> to prepare the dish. What if you also want to prepare the same food with the same test at home? what do you need to do now? You need to follow the same approach or technique used by the experienced chef. They might have <strong>tried many recipes</strong> and they might have <strong>changed their approach</strong> to preparing that dish. Finally, at one point they stopped when they learned a particular technique to prepare that specific dish and it tastes good.</p><p>Well if you also want to prepare the same dish that tastes good like in your favorite restaurant then you need to follow the same approach and techniques given by experienced chefs or you need to approach your friend who <strong>cooks good</strong> and prepares dishes using some specific technique.</p><p><em>Enough talking about food, let’s come to the design patterns</em>. Notice the words highlighted above, <strong>tried many recipes</strong>, <strong>changed their approach</strong>, <strong>experienced chef</strong> and <strong>cook really good</strong>. The same is the case with design patterns. <a href="https://en.wikipedia.org/wiki/Design_Patterns">Design Patterns</a> are like some of the best practices used by chefs (<strong>Gang of Four (GoF)</strong>) to prepare a dish so that it tastes the best.</p><ul><li>Design patterns are some design practices used by experienced object-oriented software developers (experienced chefs or friends in our context). They are general solutions to problems faced during software development.</li><li>They are the solutions obtained by trial and error (trying many recipes) by numerous software developers over a substantial period.</li></ul><h4>Design patterns as travel guides</h4><p>Let’s apply this to software development. There are often a seemingly endless number of ways to complete a given task or solve a problem. How do we approach choosing a strategy? Design patterns can be thought of as guides provided by other developers that show us the way.</p><p>Of all the possible routes to our holiday apartment, we’ve narrowed it down to a few that are most recommended by others. This bring us to one of the key reasons for the existence of design patterns. Like an Ordinance-Survey map or great recipe, a design pattern used by software developers around the world is used for reason — it’s tried and tested.</p><h4>Design patterns are not instructions</h4><p>It’s important to highlight the flexibility of such guides. Design patterns are not there to give step by step instructions, but to provide a template. Depending on what we want out of our route (do we want the prettiest views or the cheapest ticket?) our choice will vary. It’s unlikely that we will get everything we want in a single route and we need to consider if the route will work in every context — if we need a route suitable for wheelchair users, a route suitable for some will not be suitable for us. In the same way, a design pattern might be suitable for one context but not another. However, by having a variety of approaches available to us means we have a good chance of choosing something that solves our problem.</p><h3>Software design patterns: History and Evolution</h3><p>The concept of patterns was popularized by Christopher Alexander, an architect, in his book “A Pattern Language” in 1977. While he initially focused on architectural patterns in the physical world, the idea was embraced by the software community in the 1990s. The Gang of Four (Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides) brought the concept into the software realm with their seminal book “Design Patterns: Elements of Reusable Object-Oriented Software” in 1994. This work introduced 23 foundational design patterns that addressed common challenges in object-oriented software development.</p><h3>Software design patterns: Benefits and Importance</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*d5eVSNlU8Qe1UIAV.jpg" /></figure><p>Software patterns offer several significant benefits to the software development process. First and foremost, they accelerate the learning curve for developers. By following established patterns, developers can avoid reinventing the wheel and benefit from proven solutions, enhancing efficiency and reducing the likelihood of errors. Moreover, patterns enhance communication among development teams. Using a common pattern vocabulary allows developers to express design ideas succinctly and effectively, fostering collaboration and understanding.</p><p>In the realm of software development, building maintainable code is an ongoing challenge that every developer faces.</p><p>As projects grow in complexity and scale, the need for robust and adaptable solutions becomes increasingly evident. This is where software design patterns come into play, offering a systematic approach to organizing code and solving common programming problems.</p><p>Design Patterns have become an object of some controversy in the programming world in recent times, largely due to their perceived ‘over-use’ leading to code that can be harder to understand and manage.</p><p>It’s important to understand that Design Patterns were never meant to be hacked together shortcuts to be applied in a haphazard, ‘one-size-fits-all’ manner to your code. There is ultimately no substitute for genuine problem solving ability in software engineering.</p><p>The fact remains, however, that Design Patterns can be incredibly useful if used in the right situations and for the right reasons. When used strategically, they can make a programmer significantly more efficient by allowing them to avoid reinventing the proverbial wheel, instead using methods refined by others already. They also provide a useful common language to conceptualize repeated problems and solutions when discussing with others or managing code in larger teams.</p><h3>Software design patterns: Adaptability and Anti-Patterns</h3><blockquote><em>An anti-pattern is a common response to a recurring problem that is usually ineffective and risks being highly counterproductive.</em></blockquote><p>As the name might suggest Anti-Patterns are common solutions to commonly occurring problems which give bad results. These Anti-Pattern solutions may appear effective and appropriate in the beginning but fail to give good results. They have more bad consequences than good ones.</p><p>Anti-patterns are some patterns in Software Engineering that are considered as bad programming practices. Contrary to design patterns which are common ways to solve common problems which have been formalized and are generally considered a good development practice, anti-patterns are the opposite and are undesirable.</p><p>For every Anti-Patterns there generally is an effective, documented &amp; proven solution. Anti-Patterns are often result of insufficient knowledge. These Anti-Patterns have been used in real-world projects and found to be ineffective.</p><blockquote><em>There must be at least two key elements present to formally distinguish an actual anti-pattern from a simple bad habit, bad practice, or bad idea:</em></blockquote><blockquote><em>A commonly used process, structure, or pattern of action that despite initially appearing to be an appropriate and effective response to a problem, has more bad consequences than good ones.</em></blockquote><blockquote><em>Another solution exists that is documented, repeatable, and proven to be effective.</em></blockquote><p>A common example of Anti-Pattern is God object or Kitchen sink class. Having one class to do a number of things.</p><p>While patterns provide invaluable guidance, it’s important to note that they are not one-size-fits-all solutions. Successful software design requires an understanding of when and how to apply patterns appropriately. Blindly applying patterns without considering the context can lead to what are known as “anti-patterns” — solutions that seem initially appealing but result in poor design, inefficiency, or maintenance challenges.</p><h3>Understanding Software Design Patterns</h3><p>Design patterns are proven solutions to recurring design problems that software developers encounter. They serve as reusable templates that provide a structured approach to designing software systems. These patterns encapsulate best practices and years of collective experience from software engineering experts, allowing developers to leverage existing knowledge rather than reinventing the wheel.</p><p>But keep in mind, these are templates you have to adapt to your own problem and your own architecture. None of these patterns is “copy&amp;paste ready”, so there are no shortcuts!</p><p>The purpose of design patterns extends beyond mere code organization though. 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>Software design patterns are essential in improving code reusability and maintainability. By using design patterns, developers can create efficient, modular, and extensible software that is easy to maintain and modify. The benefits of design patterns include code reusability, maintainability, scalability, and modularity. In this article, we have discussed some common design patterns, including the Singleton pattern, Factory pattern, and Observer pattern. We have also provided examples in PHP code to demonstrate the implementation of these patterns.</p><p>Overall, software design patterns provide a powerful toolset for software development, allowing developers to create complex systems while maintaining flexibility and adaptability. Whether you are a seasoned developer or just starting in software development, understanding and using software design patterns can help you create better, more efficient software.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*cQEahBP7-6V66Vyr.jpeg" /><figcaption>figure 3</figcaption></figure><h3>Why Should We Use A Design Pattern?</h3><p>Using Design Patterns in software development has several benefits:</p><ul><li><strong>They are proven solutions:</strong> Design patterns are often used by many different developers, so you can be sure that they work as intended. Furthermore, you can be confident that they were revised multiple times and optimization has taken place already.</li><li><strong>They are easily reusable:</strong> Design patterns document a reusable solution that can be modified to solve multiple particular problems because they are not tied to a specific problem.</li><li><strong>They are expressive:</strong> Large solutions can be explained elegantly by Design Patterns.</li><li><strong>They ease communication:</strong> Many developers are familiar with Design Patterns and use them easily to communicate about possible solutions to given problems with each other.</li><li><strong>They prevent the need for refactoring code:</strong> Often if you use Design Patterns while developing software you could avoid refactoring it later. This only applies if you use the correct one for a given problem because it describes already an optimal solution.</li><li><strong>They lower the size of the codebase:</strong> Because Design Patterns are usually elegant, optimized, and well-documented solutions they require less code than other solutions.</li></ul><p>There are two things that you need to learn to<strong> be successful in creating software</strong>. The first one is usually a language, a programming language, the second one design.No, I am not talking about graphics design. I am talking about engineering design.</p><p>Your goal when creating software is to tell the computer what to do. Thus, knowing<strong> a programming language makes an excellent first need</strong>. By learning a programming language, you become a coder or a programmer. That is just the first step. Any kid who finishes elementary school can write, but that does not mean that any kid that finish elementary school can write a book. Most people can kick a ball, but only a few became professional players.</p><p>A software engineer aims to be as proficient as that book writer or professional player. As engineers, our work is to deal with complexity, i.e., with things <em>consisting of</em><strong><em> many different and connected parts</em></strong><em>. </em>For instance, in writing a book, know the language is essential, but it is not enough; the complexity is not writing sentences. The complexity exists elsewhere: the structure of the ideas, what are we going to talk about, how we divide the topic, and more importantly, how we connect these parts. Design Patterns help us to deal with that — the parts and their connections.</p><h4>Patterns with principles</h4><p>There are many best-practices and principles to consider when designing software which we will not cover here, but which the recommended and most popular design patterns tend to embody. Basically — regardless of the pattern you choose, you should be able to describe your code using good principles (e.g. SOLID). If you’re not sure what the SOLID principles are, it’s worth brushing up.</p><h4>Patterns as communication</h4><p>One of the things I like about design patterns is that they provide ubiquitous terminology. If we’ve chosen a well known pattern, we can effectively and quickly communicate to other developers which approach we’re considering or the structure of something we’ve built. This means we can get straight down to speaking specifically.</p><h4>Documentation for all developers</h4><p>Due to the well-documented nature of design patterns, developers at any level can try out a pattern and see if it works for their given problem. I’ll be concentrating on specific patterns in future posts in the hopes of adding to the wealth of resources already available.</p><h3>What?</h3><p>A pattern is a template. Solving a problem by customizing a template is more comfortable than starting from scratch. There are templates for how a house should be structured, its parts, and connections. Same for vehicles and electrical circuits. Just follow the template, and you will have a solution. The template warranty good results.</p><p>What about innovation and creativity? Well, let put this in this way: on the one hand, you have<strong> a template that had been used several times and had successfully created products with some level of quality</strong>. On the other hand, you can take the risk of developing something new. Both options are available. What do you prefer? What can you afford?</p><p>Most of the time, civil, electrical, and mechanical engineers follow a pattern, i.e., go for the proven solution. Cars has 4 wheels. Homes has doors and windows, etc.</p><p>What about the software?</p><p>Engineers have been developing software for more than 50 years. For sure, some problems have reappeared again and again with a wide variety of solutions. There is likely one that became “the solution” for a given scenario. Therefore, a pattern emerged. What kind of problems are we discussing? Well, for instance, in object-oriented programming:</p><p>a) What if we have a data source (a component) and other(s) components need continuous access to that data?</p><p>b) What if we need to ensure that only one object exists from a particular class?</p><p>c) What is the best way to select the algorithm to be applied to a specific input in runtime?</p><p>d) How to be sure that we created an object with values in all its attributes?</p><p>e) and so on.</p><p>Patterns are templates to solve problems. Patterns help us to define the parts involved, and the relationships among these parts. Moreover, we name patterns to make them easy to be remembered. For example, we have <strong>Observer</strong>, <strong>Singleton</strong>, <strong>Strategy</strong>, <strong>Builder</strong>, <strong>Factory</strong>, <strong>Adapter</strong>, <strong>Memento</strong>, and so forth. Let us review an example.</p><h3>How?</h3><p>Enough theoretical background. Let me introduce one design pattern to connect the dots between theory and practice: The Observer Pattern.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*M2sAVAnOei8lIJ5V.jpeg" /></figure><p>Figure 1. Observer Pattern: class diagram decorated with some cartoons</p><p><strong>Problem</strong>: <em>What if we have a data source (a component) and other(s) components need continuous access to that data?</em></p><p>Sharing data among objects is a recurrent problem.</p><p><strong>Solution</strong>: we need an instance to <strong><em>observe</em></strong> another. Therefore,</p><p><strong>Which are the elements?</strong></p><p>We have an element that is observing another element. Therefore, we can say that we have an <strong>observer </strong>and an <strong>observable. </strong>These are generic roles, and depending on our particular problem, we will have specific objects full-filling these roles. For instance, a Student can be an Observer and observe a Teacher, which will assume the Observable’s role. How can we be sure that these objects will fulfill their roles? We will make them to sign a contract . That means, we will make our particular classes (such as Student and Teacher) to implement an interface or to inherit from another class. An abstract class is a good idea since we do not want to create objects that are just unidentified Observers or Observables. Therefore, we need <strong>abstract classes</strong> that will define attributes and operations for Observer and Observable roles. And, we need our <strong>concrete classes</strong> commit to perform these roles –Student will be an Observer and Teacher will be an Observable. Figure 1 shows our elements and their relationships.</p><p><strong>Which are their relationships?</strong></p><p>Now, how to connect the observer and observable? Well, everything distills into calling methods. Calling a method from the observable to the observer to say <em>“Hello, I am doing something important here”</em> or <em>“Ey, I just update the value of this variable that you care about”</em>. And then, from the observer to the observable to say <em>“Tell me more, I am interested”</em>. You should be thinking that if the observable is going to notify its observers, it needs to know who is observing. That’s right.</p><p><strong>How does all this look as source code?</strong></p><p>Let’s program the pattern by tracking it from the top-down. I use <strong>Java</strong> as a programming language.</p><p><strong>Step 1</strong>. Main.java — Let us create one Student and one Teacher. And, let the teacher know that the Student will be observing. What is happening here? Well, (1) The Teacher object is using his <em>addObserver()</em> method, a method inherited from the abstract class Observable. And, (2) If we have an <em>addObserver()</em> method is because there is a data structure in that class, a data structure to store references to Observer objects. This is like a Teacher object having an array (or list) to keep a reference to all these Student objects interested in observing it. Line 6 in Figure 4 will confirm our guess.</p><p>Figure 2. Main.java</p><p><strong>Step 2</strong>. Teacher.java — Our teachers are going to be observables. Thus extends the Observable class. The good news, Java API provides an implementation of such a class. So, no need to worry about the data structure and the related methods. Our responsibilities are:</p><ol><li>Import the package <em>java.util</em> and make your data source to inherit from <strong><em>Observable</em></strong>.</li><li>In any place (method) where something significant happens, that needs to be communicated to the observers, call the methods <strong><em>setChanged()</em></strong> and <strong><em>notifyObservers()</em></strong>.</li></ol><p>Figure 3. Teacher.java –Observable</p><p>We are inheriting these methods — <strong><em>setChanged()</em></strong> and <strong><em>notifyObservers()</em></strong>; consequently, we do not need to worry about their definition. We merely call them in these places where a significant event happens, such as when a variable changes value. You can imagine the method <strong><em>notifyObservers()</em></strong> as having a loop that iterates the observer’s container and for each entity in the container, it calls the entity’s <strong><em>update()</em></strong> method. See lines 21 and 22 in Figure 4. Figure 4 shows what the implementation of the Observable class looks like in the Java API.</p><p>Figure 4. The implementation of the Observable class looks like this in the Java API</p><p><strong>Step 3</strong>. Student.java — Finally, our Students. Only one important thing to do, they should have a method <strong>update() </strong>since we have Observables calling that method. Our Student class should sign a contract to be Observer. We need an interface with that method signature, and we should make our observers to implement that interface. The Java API provide us such interface. So,</p><ol><li>Import the package <em>java.util</em> and make these classes that need access to the data source to implement <strong><em>Observer</em></strong>.</li><li>Override the <strong><em>update()</em></strong> method to provide a body. That will look like the code in Figure 5.</li></ol><p>Figure 5. Student.java — Observer</p><p>Notice how <em>notifyObservers()</em> send to <em>update()</em> a reference to the Observable that is calling the <em>update()</em>. Thus, the observer can use the reference to contact the observable. Specifically, in our example, the observer (Student) can call getters methods in the observable (Teacher) to access the updated information (the attribute <em>importantData</em>).</p><h3>Design Principles VS Design Patterns</h3><p>Design principles and design patterns are related but serve different purposes.</p><p><strong><em>Design principles</em></strong> are high-level guidelines for designing software that helps developers create code that is maintainable, extensible, and adaptable. These principles are not specific to any programming language or technology and can be applied to any software development project. Design principles provide a foundation for good software design and help developers create code that is easier to maintain and change over time.</p><p><strong><em>Design patterns</em></strong>, on the other hand, are specific solutions to recurring design problems in software development. They are practical, reusable solutions that can be applied to specific programming languages or technologies. Design patterns are based on design principles but provide specific implementations that can be used to solve specific problems. They can also help developers avoid common pitfalls in software development and ensure that their code is efficient, scalable, and easy to understand.</p><p>The relationship between design patterns and design principles is complimentary. Design principles provide high-level guidelines and best practices for designing software. Design patterns provide concrete implementations to specific design problems while adhering to the design principles</p><p>In fact, many design patterns provide solutions that adhere to multiple principles. While it is ideal for a design pattern to adhere to all the design principles, it is not always possible to achieve this. Design principles are not absolute rules that must be followed in all cases. Some design principles may be more important than others depending on the specific problem being solved, and some principles may even conflict with each other. There may be situations where adhering to a design principle is not practical or even desirable, and in such cases, a design pattern that addresses the specific problem at hand may be a better choice.</p><p>Let us see some examples:</p><h3>Single Responsibility Principle (SRP)</h3><p>The SRP states that a class should have only one responsibility or reason to change. This means that a class should only be responsible for one thing, and if that thing changes, the class should be the only one that needs to change. The goal is to keep classes focused and maintainable and reduce the risk of unintended consequences when making changes.</p><h3>Open/Closed Principle (OCP)</h3><p>The OCP states that software entities should be open for extension but closed for modification. This means that you should be able to add new functionality to a system without changing the existing code. The goal is to reduce the risk of introducing new bugs when making changes and allow for greater flexibility and adaptability in the system.</p><h3>Liskov Substitution Principle (LSP)</h3><p>The LSP states that subtypes must be substitutable for their base types. This means that if you have a variable of a certain type, you should be able to substitute any subtype of that type without affecting the behavior of the system. The goal is to ensure that code is reusable and maintainable and reduce the risk of introducing bugs when making changes.</p><h3>Interface Segregation Principle (ISP)</h3><p>The ISP states that clients should not be forced to depend on interfaces they do not use. This means that if a client only needs a subset of the functionality provided by an interface, it should only depend on that subset. The goal is to reduce coupling between components and make it easier to change or replace components without affecting the behavior of the system.</p><h3>Dependency Inversion Principle (DIP)</h3><p>The DIP states that high-level modules should not depend on low-level modules. Instead, both should depend on abstractions. This means that the details of how a system works should be hidden behind abstractions, and changes to the implementation should not affect the behavior of the system. The goal is to make systems more modular and easier to maintain.</p><h3>Why Should We Care About Design Patterns</h3><p>Design patterns help us solve problems by creating a reusable solution that we can use as a template for our software. That being said, design patterns aren’t algorithms and you can’t paste them into the code base. They give you a template of sorts, but if misused some patterns may cause additional complexity and that’s not what they were meant to do.</p><p>There’s a lot of controversy regarding design patterns — whether or not some of them are outdated or the fact that they are often being over-used which causes that additional complexity we mentioned, but the fact of the matter is that quite a few of them are very important and in order to not misuse or over-use them you will need to fully understand them.</p><p>There are 3 types of design patterns:</p><ul><li>Creational</li><li>Structural</li><li>Behavioral</li></ul><ol><li><strong><em>Creational Patterns:</em></strong> These patterns focus on object creation mechanisms, providing flexible and reusable ways to create objects. Examples include the Singleton pattern, which ensures that only one instance of a class is created, and the Factory pattern, which abstracts the object creation process by delegating it to subclasses.</li><li><strong><em>Structural Patterns: </em></strong>Structural patterns deal with object composition and relationships, helping to define how objects and classes can be combined to form larger structures. Examples include the Adapter pattern, which allows incompatible interfaces to work together, and the Decorator pattern, which dynamically adds behavior to objects without modifying their underlying structure.</li><li><strong><em>Behavioral Patterns:</em></strong> These patterns focus on communication between objects and the assignment of responsibilities. They provide solutions for effective communication and coordination among objects. Examples include the Observer pattern, where objects maintain a list of their dependents and notify them of any changes, and the Strategy pattern, which enables interchangeable algorithms by encapsulating them in separate classes.</li></ol><p>Using design patterns can bring several benefits to software development. They enhance code reusability, as patterns encapsulate proven solutions that can be applied in various scenarios. They improve code maintainability, as patterns promote modularity and separation of concerns. Design patterns also make code more understandable and easier to communicate among team members, as they provide a common language and shared understanding of software design principles.</p><p>However, it’s important to note that design patterns should be applied judiciously and in the appropriate context. Not all patterns are suitable for every situation, and their misuse can lead to unnecessary complexity. Developers should carefully analyze the problem at hand and select the appropriate design pattern to ensure that it aligns with the project’s requirements and goals.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/0*JrOxKTZd3nPRX2AX.png" /></figure><h3>The Most Important Design Patterns</h3><ol><li><strong>Singleton</strong></li></ol><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 ensures that only one instance of a class can be created. This pattern is often used for objects that need to be accessed by multiple parts of an application.</p><p>Example in PHP:</p><p>class Database {<br> private static $instance = null;<br> <br> private function __construct() {}<br> <br> public static function getInstance() {<br> if (self::$instance == null) {<br> self::$instance = new Database();<br> }<br> return self::$instance;<br> }<br>}</p><p><strong>2. Factory Method</strong></p><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><p>The Factory pattern is used to create objects without exposing the instantiation logic to the client. This pattern is often used to create objects that have complex instantiation logic.</p><p>Example in PHP:</p><p>interface Shape {<br> public function draw();<br>}</p><p>class Rectangle implements Shape {<br> public function draw() {<br> echo “Drawing a rectangle.”;<br> }<br>}</p><p>class Circle implements Shape {<br> public function draw() {<br> echo “Drawing a circle.”;<br> }<br>}</p><p>class ShapeFactory {<br> public static function createShape($type) {<br> switch($type) {<br> case ‘rectangle’:<br> return new Rectangle();<br> break;<br> case ‘circle’:<br> return new Circle();<br> break;<br> default:<br> throw new Exception(‘Invalid shape type.’);<br> }<br> }<br>}</p><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><p><strong>3. Strategy</strong></p><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><p><strong>4. Observer</strong></p><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><p>The Observer pattern is used to create a one-to-many relationship between objects, where one object is the subject and the others are observers. This pattern is often used in event-driven systems.</p><p>Example in PHP:</p><p>interface Observer {<br> public function update();<br>}</p><p>class UserObserver implements Observer {<br> public function update() {<br> echo “Updating user data.”;<br> }<br>}</p><p>class OrderObserver implements Observer {<br> public function update() {<br> echo “Updating order data.”;<br> }<br>}</p><p>interface Subject {<br> public function attach(Observer $observer);<br> public function detach(Observer $observer);<br> public function notify();<br>}</p><p>class Order implements Subject {<br> private $observers = array();<br> <br> public function attach(Observer $observer) {<br> $this-&gt;observers[] = $observer;<br> }</p><p>public function detach(Observer $observer) {<br> $key = array_search($observer, $this-&gt;observers, true);<br> if ($key !== false) {<br> unset($this-&gt;observers[$key]);<br> }<br> }<br> <br> public function notify() {<br> foreach ($this-&gt;observers as $observer) {<br> $observer-&gt;update();<br> }<br> }<br> <br> public function save() {<br> // Save order data to database<br> $this-&gt;notify();<br> }<br>}</p><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>5. Builder</strong></p><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>This pattern separates the construction of a complex object from its representation, allowing for the same construction process to create different representations. For example, a builder can be used to create different types of UI components with different properties or styles.</p><p>class ButtonBuilder {<br> constructor() {<br> this.text = ‘’;<br> this.color = ‘primary’;<br> this.size = ‘medium’;<br> }<br> <br> setText(text) {<br> this.text = text;<br> return this;<br> }<br> <br> setColor(color) {<br> this.color = color;<br> return this;<br> }<br> <br> setSize(size) {<br> this.size = size;<br> return this;<br> }<br> <br> build() {<br> return &lt;Button text={this.text} color={this.color} size={this.size} /&gt;;<br> }<br>}</p><p>const button = new ButtonBuilder()<br> .setText(‘Click me!’)<br> .setColor(‘secondary’)<br> .setSize(‘small’)<br> .build();</p><p><strong>6. Adapter</strong></p><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><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>7. State</strong></p><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>8.prototype</strong></p><p>Now, let’s take a look at the prototype pattern, which is just a fancy word for a clone. If you’ve done object-oriented programming, you should be familiar with inheritance. Where a class can be extended with a subclass.</p><p>One problem with inheritance is that it can lead to a complex hierarchy of code. The prototype pattern is an alternative way to implement inheritance, but instead of inheriting functionality for a class, it comes from an object. That’s already been created.</p><p>This creates a flat prototype chain that makes it much easier to share functionality between objects, especially in a dynamic language like javascript, which supports prototypal inheritance out of the box Imagine we have an object, named zombie this is our prototype. But now we want to create a new object based on it.</p><p>That also has a name. We can do that with object creation by passing that zombie as the prototype and then specifying additional properties, like the name for the new object. The interesting thing is that if you log this object, you’ll only see the name and not the eat brains method.</p><p><strong>9.Proxy</strong></p><p>The next structural pattern we will look at is proxy, which is just a fancy word for a substitute like in school you might have a substitute teacher to replace the real thing.</p><p>The next structural pattern we will look at is proxy, which is just a fancy word for a substitute like in school you might have a substitute teacher to replace the real thing.</p><p>In Vue you create data, but the framework itself needs a way to intercept that data and update UI whenever that data changes, the way you handle it, is by replacing the original object with a proxy.</p><p>A proxy takes the original object as the first argument then a handler as the second argument inside of which we can override methods like get and set, which allows us to run code whenever a property is accessed on the object or changed.</p><p>For example, inside the set, we might tell the framework to re-render and then use reflect to update the data on the original object. The end-user can now work with the proxy just like the original object, but it can trigger these side effects behind the scenes.</p><p>Proxies are also commonly used when you how a very large object that would be expensive to duplicate memory.</p><p><strong>10.Iterator</strong></p><p>Now we’re ready to look at some behavioral patterns, starting with the iterator. The iterator pattern allows you to traverse through a collection of objects.</p><p>Modern languages already provide abstractions for the interpreter pattern like the for a loop when you loop over an array of items you’re using the iterator pattern.</p><p>But one thing that really chaps my ass about javascript is that there is no built-in range function that I wish I could easily iterate ten times at a certain interval we can actually do that fairly easily by implementing our own iterator pattern.</p><p>In javascript, you can do that by defining an object that has the next method on it. That function needs to return an object that has a value which would be the current value in the loop and a done property so it knows when to finish its iterating.</p><p>In this case, we will keep moving on to the next step If that start value is less than the end value, but for each iteration, we will increment the start value with a step eventually the start will be greater than the end at which point we can return an object with the done property as true, and that tells javascript to stop iterating.</p><p>Now a cool technique here is that we can add a symbol iterator to this object, which allows us to use it in a regular for of loop at the end of the day with iteration, you start with a collection and then write some code that determines how to get from the beginning to the end.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*yQysP3joZoML_DSo.jpeg" /></figure><h3>Design pattern tips</h3><p><strong>Do some homework…</strong></p><p>I’ve been learning design patterns by choosing a pattern and doing some research on it (this could be every week or however often you get a chance to do some learning). There are plenty of posts on design patterns out there and a quick search will bring up lots of results.</p><ol><li>Explain what the pattern is in a way that you understand. There are a lot of technical definitions, some of which I found intuitive but many that I didn’t, so it’s worth trying to get down on paper something that makes sense to you.</li><li>Explain when/why would you use this pattern. Real-world examples can be really helpful here to cement your understanding.</li><li>Have a go! Even if you’ve read through a blog post or tutorial with code examples, I’ve found there’s real value in writing a little console app to demonstrate the pattern. Plus, you get a break from reading and can have some fun with the apps (I think I had one app that created planets and one that sold retro video games).</li></ol><p><strong>…and then explain your homework to someone else</strong></p><p>There’s no better test of your understanding than explaining it to another developer, or possibly even better, getting it down on paper (one big motivation for this blog series is exactly that).</p><p><strong>Have a list of patterns handy</strong></p><p>When faced with a problem, I’ve found it helpful to have the pattern archive I’ve written to hand — I can quickly see what each pattern does and when to use it. A good solution might not be amongst what I have so far, but it gives me a good place to start in terms of understanding what I’m trying to achieve.</p><p><strong>Take a step back</strong></p><p>I’m guilty of getting too close to the code I’m working on and not stepping back to see the wider problem. If this sounds like you, return to your initial aim regularly and check to make sure you’re on track. Is the approach you’re considering going to meet the business requirement? How does the pattern help you achieve what you want in the context of the whole application? Can it be done in a simpler way?</p><p><strong>Don’t be afraid to change plan</strong></p><p>If many of the design patterns are new to you, there are going to be times when your first choice or attempt isn’t quite right, and that’s OK. I have sometimes found that after choosing a pattern and trying it out, I’ve realised it isn’t the right solution, or learnt things about my code that could be improved. Obviously it isn’t wise to spend time trying every pattern, but trying to hold on to an ill-fitting pattern for the sake of it isn’t either.</p><p><strong>Remember, there is no right answer…</strong></p><p>Whilst the Gang of Four design patterns are widely renowned, there is still plenty of discussion about their application, and given your specific requirements and context, there is unlikely to be a right answer when it comes to choosing a pattern.</p><p><strong>…but always have an explanation for your approach</strong></p><p>On the other hand, if you can’t think of any reasons why you’ve chosen a pattern, it’s probably not a good sign. Make sure you can explain the reasoning behind your choice and what other options you considered.</p><h3>Conclusion:</h3><p>In the intricate tapestry of software development, software patterns emerge as guiding stars, illuminating the path to efficient, reliable, and scalable solutions. Their significance lies in their ability to distill the collective wisdom of experienced developers into reusable templates that address recurring challenges. From their origins in architectural concepts to their adaptation into software design by the Gang of Four, patterns have evolved into an indispensable toolset with creational, structural, and behavioral categories.</p><p>These patterns offer benefits that extend beyond mere code. They accelerate learning curves, allowing developers to build on established solutions and avoid pitfalls. Patterns foster a common language among development teams, enhancing communication and collaborative design. However, their application requires careful consideration. Blind adherence may lead to anti-patterns — misguided solutions that hinder rather than aid development.</p><p>As technology evolves, software patterns maintain their relevance. They provide stability in a rapidly changing field, adapting to novel challenges and paradigms. By encapsulating proven solutions, patterns empower developers to focus on innovation rather than reinvention. They bridge the gap between theory and practice, between problem and solution.</p><p>In conclusion, software patterns are more than abstract concepts; they are the embodiment of experience, the codification of successful strategies, and the keys to building software that stands the test of time. Just as the constellations have guided explorers through history, software patterns guide developers through the vast universe of coding possibilities, ensuring that the solutions crafted today resonate in the digital cosmos for years to come.</p><p>In the ever-evolving landscape of software development, the importance of software patterns cannot be overstated. They encapsulate the collective knowledge of experienced developers, offering a roadmap to navigate the complexities of design and implementation. By providing proven solutions to recurring problems, software patterns empower developers to create robust, maintainable, and scalable software systems. As technology continues to advance, software patterns will remain a cornerstone of effective software development, guiding developers on a path toward success in an ever-changing digital world.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1e2c14ee2eb6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[SOFTVIL TECHNOLOGIES]]></title>
            <link>https://medium.com/@pavanimadushani9/softvil-technologies-9a068667cd4a?source=rss-628d05f82adb------2</link>
            <guid isPermaLink="false">https://medium.com/p/9a068667cd4a</guid>
            <dc:creator><![CDATA[Pavani madushani]]></dc:creator>
            <pubDate>Mon, 21 Aug 2023 17:49:40 GMT</pubDate>
            <atom:updated>2023-08-21T17:49:40.579Z</atom:updated>
            <content:encoded><![CDATA[<p>Softvil Technologies is a Sri Lankan based software development outsourcing services provider that specializes in European and Asian markets.</p><h3>There services</h3><p>1.Bespoke/ Full-Cycle professional Software Development</p><p>2.Mobile Application Development</p><p>3.Software Development Services</p><p>4.Resource Augmentation</p><p>5.Software Testing</p><h3>why they special</h3><ul><li>Pre-setup consultation from there experts.</li><li>Tailor-made cost structures to suit your budget.</li><li>State-of-the-art remote workspaces.</li><li>Effective communication throughout the delivery.</li></ul><h3>They Expertise</h3><h4>UI/UX</h4><h4>Software Engineering</h4><h4>Web Design and Development</h4><h4>Augmented Reality</h4><h4>DevOps/ CloudOps</h4><h4>Software Quality Assurance</h4><h4>Business Analysis</h4><h4>Project Management</h4><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9a068667cd4a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[DBMS Keys]]></title>
            <link>https://medium.com/@pavanimadushani9/dbms-keys-6604379f0d2a?source=rss-628d05f82adb------2</link>
            <guid isPermaLink="false">https://medium.com/p/6604379f0d2a</guid>
            <dc:creator><![CDATA[Pavani madushani]]></dc:creator>
            <pubDate>Thu, 01 Sep 2022 15:14:43 GMT</pubDate>
            <atom:updated>2022-09-01T15:14:43.745Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong><em>Introduction to DBMS keys</em></strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*F_p1UhXfLmjh79Kw" /><figcaption>fig 01</figcaption></figure><p><strong>KEYS in DBMS</strong> is an attribute or set of attributes which helps you to identify a row(tuple) in a relation(table). They allow you to find the relation between two tables. Keys help you uniquely identify a row in a table by a combination of one or more columns in that table. Key is also helpful for finding unique record or row from the table. Database key is also helpful for finding unique record or row from the table.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NOzmG3EsiwXprmsAqa5sew.png" /></figure><h3>1. Primary Key</h3><p>The primary key refers to a column or a set of columns of a table that helps us identify all the records uniquely present in that table. A table can consist of just one primary key. Also, this primary key cannot consist of the same values reappearing/repeating for any of its rows. All the values of a primary key have to be different, and there should be no repetitions.</p><p>The PK (PRIMARY KEY) constraint that we put on a column/set of columns won’t allow these to have a null value or a duplicate. Any table can consist of only a single primary key constraint. A foreign key (explained below) that refers to it can never change the values present in the primary key.</p><h3>2. Super Key</h3><p>A super key refers to the set of all those keys that help us uniquely identify all the rows present in a table. It means that all of these columns present in a table that can identify the columns of that table uniquely act as the super keys.</p><p>A super key is a candidate key’s superset (candidate key has been explained below). We need to pick the primary key of any table from the super key’s set so as to make it the table’s identity attribute.</p><h3>3. Candidate Key</h3><p>The candidate keys refer to those attributes that identify rows uniquely in a table. In a table, we select the primary key from a candidate key. Thus, a candidate key has similar properties as that of the primary keys that we have explained above. In a table, there can be multiple candidate keys.</p><h3>4. Alternate Key</h3><p>As we have stated above, any table can consist of multiple choices for the primary key. But, it can only choose one. Thus, all those keys that did not become a primary key are known as alternate keys.</p><h3>5. Foreign Key</h3><p>We use a foreign key to establish relationships between two available tables. The foreign key would require every value present in a column/set of columns to match the referential table’s primary key. A foreign key helps us to maintain data as well as referential integrity.</p><h3>6. Composite Key</h3><p>The composite key refers to a set of multiple attributes that help us uniquely identify every tuple present in a table. The attributes present in a set may not be unique whenever we consider them separately. Thus, when we take them all together, it will ensure total uniqueness.</p><h3>7. Unique Key</h3><p>A unique key refers to a column/a set of columns that identify every record uniquely in a table. All the values in this key would have to be unique. Remember that a unique key is different from a primary key. It is because it is only capable of having one null value. A primary key, on the other hand, cannot have a null value.</p><h3><strong>8.Compound Key</strong></h3><p>Compound Key<strong> </strong>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.</p><h3>9.Surrogate key</h3><p>Surrogate keys is An artificial key which aims to uniquely identify each record is called a surrogate key. This kind of partial key in dbms is unique because it is created when you don’t have any natural primary key. They do not lend any meaning to the data in the table. Surrogate key in DBMS is usually an integer. A surrogate key is a value generated right before the record is inserted into a table.</p><h3>10. Artificial key</h3><p>The key created using arbitrarily assigned data are known as artificial keys. These keys are created when a primary key is large and complex and has no relationship with many other relations. The data values of the artificial keys are usually numbered in a serial order.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6604379f0d2a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Evaluation of DBMS]]></title>
            <link>https://medium.com/@pavanimadushani9/evaluation-of-dbms-af336f33eb8e?source=rss-628d05f82adb------2</link>
            <guid isPermaLink="false">https://medium.com/p/af336f33eb8e</guid>
            <dc:creator><![CDATA[Pavani madushani]]></dc:creator>
            <pubDate>Thu, 21 Jul 2022 16:09:39 GMT</pubDate>
            <atom:updated>2022-07-21T16:09:39.133Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*CC_rrSSEaeg72T9g" /><figcaption>Photo by <a href="https://unsplash.com/@casparrubin?utm_source=medium&amp;utm_medium=referral">Caspar Camille Rubin</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>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 from various systems. We perform a structured approach to evaluate the database systems.</p><h3>Evaluation Methodology</h3><p>This step involves two analyses; both these analyses should be performed to determine the most suited DBMS.</p><p>These two analyses are:</p><ol><li><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.</li><li><strong>Performance Analysis:</strong> In this phase, we analyse only those shortlisted DBMS, evaluate the systems’ efficiency, and choose one with maximum efficiency</li></ol><h3>Feature Analysis</h3><p>This analysis serves two purposes:</p><ul><li>It directly eliminates the DBMS that is not competent to fulfil all the needs of the user.</li><li>We can rank the remaining systems based on the features provided by them.</li></ul><p>This is a subjective approach as the database implementation is not necessary and can only be done with the help of reading the documentation of the database management system. This is relatively cheaper as compared to any other approach. This method does not measure the actual performance of the management system. Therefore, it cannot be decisively determined the best database management system.</p><h3>Performance Analysis</h3><p>The purpose of this analysis is:</p><ul><li>To analyse the behaviour of the database management system in the user system.</li><li>To gather the data on the performance of the DBMS and rank them accordingly.</li></ul><p>Using this method, we can decide the best DBMS that should be implemented to give the maximum result.</p><p>Techniques to analyse the Performance of DBMS</p><p>There are various methods to judge the performance of the database management system. Some of the most used methods are Analytical and Stimulation modelling and Benchmarking.</p><p><strong><em>Analytical Modelling Technique</em></strong></p><p>In this model, we use certain equations that are used to map the performance of the database management system to system parameters. This is quite an accurate method to perform performance analysis. Two models that are used under this technique are Queueing models and Cost models.</p><p><strong><em>Queueing Models</em></strong></p><p>The database system is provided with various resource systems and tasks are provided to the database management system. The system performance is evaluated based on the performance of the system while performing these assigned tasks.</p><p><strong><em>Cost Models</em></strong></p><p>This model effectively calculates the performance of physical databases. They are used to estimate the storage cost. We can determine the average response time to perform a task by the database management system.</p><p><strong><em>Simulating Modelling</em></strong></p><p>In simulation modelling, we construct a real-time model of the system to replicate the behaviour of the actual system. It performs the task and gathers the data, using this gathered data it evaluates the real-time performance of the system. It constitutes an application program, database system, operating system and hardware environment. This is more suitable for evaluating the performance of complex systems. But as the complexity of the system increases the evaluation of the performance of the system becomes more difficult.</p><p><strong><em>Benchmarking</em></strong></p><p>This technique is preferred when there is less number of databases that are to be evaluated. It requires implementing the management system in an almost similar environment so that the data acquired using this method is closest. As the environment for each database management system is created separately, this method is costly and consumes a lot of time in setting up the environment. This method is still performed because this method produces the most accurate result upon which the performance of the management system is evaluated. In this method, we need to define and implement system configuration, a database and a workload. The key component in this method is the workload that can either be specific to an application or it can be general. All the test is performed using this workload. Various systems operate on these workloads and the result and data from each implementation is used to compare and evaluate the database management system.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*JZQL6Cy8gNxHi6n6" /><figcaption>Photo by <a href="https://unsplash.com/@proggga?utm_source=medium&amp;utm_medium=referral">Mikhail Fesenko</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3><strong>The major components of DBMS are</strong></h3><h4>1. Data Manager</h4><p>The data manager is the central software component of the DBMS. It is sometimes referred to as the data base control system. One of the functions of the data manager is to convert operations in the user’s queries coming directly via the query processor or indirectly via an application program from the responsible for interfacing with the file system.</p><p>In addition, the tasks of enforcing constraints to maintain the consistency and integrity of the data, as well as its security, are also performed by the data manager. Synchronizing the simultaneous operations performed by concurrent users is under the control of the data manager. It is also entrusted with backup and recovery operations.</p><h4>2. Query Processor</h4><p>The data base user retrieves data by formulating a query in the data manipulation language provided with the data base. The query processor is used to interpret the online user’s query and convert it into an efficient series of operations in a form capable of being sent to the data manager for execution. The query processor uses the data dictionary to find the structure of the relevant portion of the data base and uses this information in modifying the query and preparing an optimal plan to access the data base.</p><p>We now focus on the common method of using the data base in an application program written in a high level language (HLL) as illustrated in Fig. 15.6. The data manipulation statements in the application program are replaced during a pre-compilation stage by a subroutine call to invoke the run time system.</p><p>The data manipulation statements are subsequently compiled separately into a sequence of optimized operations on the data base that can be performed by the data manager. Many of the same optimization functions used by the query processors are also used in the compilation of the data manipulation statements. During execution, when a subroutine call inserted in place of the data manipulation statements is encountered, control transfers to the run time system.</p><p>This system in turn transfers control to the compiled version of the original data manipulation statements. The data manipulation operations are executed by the data manager. The data manager transfers data to or from a work area indicated in the subroutine call and control returns to the application program.</p><p>For on line users, who manipulate the data base through the intermediary of a user interface (such as a form-based or menu-driven system) and a supporting application program written in a high-level language. The interaction is indirect. A user action that requires a data base operation causes the application program to request the service via its run-time system and the data manager. Batch users of the data base also interact with the data base via their application program, its run-time system, and the data manager.</p><h4>3. Data Dictionary</h4><p>Information pertaining to the structure and usage of data contained in the data base, the Meta data, is maintained in a data dictionary. The term system catalog also describes this Meta data. The data dictionary, which is a data base itself, documents the data. Each data base user can consult the data dictionary to learn what each piece of data and the various synonyms of the data fields mean.</p><p>In an integrated system (i.e., in a system where the data dictionary is part of the DBMS), the data dictionary stores information concerning the external conceptual and internal levels of the data base. It contains the source of each data field, value the frequency of its use, and an audit trail concerning updates, including the who and when of each update. Currently data dictionary systems are available as add ones to the DBMS. Standards have yet to be evolved for integrating the one for Meta data and the other for data, can be manipulated using an unified DDL/DML.</p><h4>4. Disk Manager</h4><p>The Disk manager is part of the operating system of the host computer and all physical input and output operations are performed by it. The disk manager transfers the block or page requested by the file manager so that the latter need not be concerned with the physical characteristics of the underlying storage media.</p><h4>5. File Manager</h4><p>Responsibility for the structure of the files and managing the file space rests with the file manager. It is also responsible for locating the block containing the required record, requesting this block from the disk manager and transmitting the required record to the data manager. The file manager can be implemented using an interface to the existing file sub-system provided by the operating system of the host computer or it can include a file sub-system written especially for the DBMS.</p><h4>6. Data Definition Language Compiler</h4><p>The data definitions language (DDL) computer converts the data definition statements into a set of tables. These tables contain the meta-data concerning the data base and are in a form that can be used by other components of the DBMS.</p><h4>7. Telecommunication System</h4><p>On lines users of a computer system, whether remote or local, communicate with it by sending and receiving messages over communication lines. These messages are routed via an independent software system called a telecommunication system or a communication control program. Examples of these programs are CICS, IDMS-DC, TALK MASTER, and IERCOMM.</p><p>The telecommunication system is not part of the DBMS but the DBMS works closely with the system; the subject is covered extensively in (CYPS 78). The on line user may communicate with the data base directly or indirectly via a user interface (menu-driven or form based) and an application program. Messages from the user are routed by the telecommunication system to the appropriate target and responses are sent back to the user.</p><h4>8. Data Files</h4><p>Data files contain the data portion of the data base.</p><h4>9. Access Aids</h4><p>To improve the performance of a DBMS, a set of access aids in the form of indexes are usually provided in a data base system. Commands are provided to build and destroy additional temporary indexes.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=af336f33eb8e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[File System VS Database Management System]]></title>
            <link>https://medium.com/@pavanimadushani9/file-system-vs-database-management-system-964cca351115?source=rss-628d05f82adb------2</link>
            <guid isPermaLink="false">https://medium.com/p/964cca351115</guid>
            <dc:creator><![CDATA[Pavani madushani]]></dc:creator>
            <pubDate>Fri, 08 Jul 2022 16:27:12 GMT</pubDate>
            <atom:updated>2022-07-08T16:27:12.777Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="DBMS" src="https://cdn-images-1.medium.com/max/1024/0*-YfISkOohu-qwzJq" /></figure><h3>What is Database?</h3><p>A database is a collection of related data.</p><h3>DBMS(Database Management System)?</h3><p>Database Management System is basically software that manages the collection of related data. DBMS is a application software that allows users to efficiently define, create, maintain and share databases.<br>It is used for storing data and retrieving the data effectively when it is needed. It also provides proper security measures for protecting the data from unauthorized access. In Database Management System the data can be fetched by SQL queries and relational algebra. It also provides mechanisms for data recovery and data backup. Defining a database involves specifying the data types, structures and constraints of the data to be stored in the database. <br> Creating a database involves storing the data on some storage medium that is controlled by DBMS. Sharing a database involves allowing multiple users to access the database. DBMS also serves as an interface between the database and end users or application programs. It provides control access to the data and ensures that data is consistent and correct by defining rules on them. An application program accesses the database by sending queries or requests for data to the DBMS. A query causes some data to be retrieved from database.<br> Ex-&gt;&gt; Oracle, MySQL, MS SQL server.</p><h3>Advantages of DBMS</h3><p><strong><em>Data redundancy and inconsistency</em></strong><br> Redundancy is the concept of repetition of data i.e. each data may have more than a single copy. The file system cannot control the redundancy of data as each user defines and maintains the needed files for a specific application to run. There may be a possibility that two users are maintaining the data of the same file for different applications. Hence changes made by one user do not reflect in files used by second users, which leads to inconsistency of data.<br> Whereas DBMS controls redundancy by maintaining a single repository of data that is defined once and is accessed by many users. As there is no or less redundancy, data remains consistent.</p><p><strong><em>Data sharing</em></strong><br> The file system does not allow sharing of data or sharing is too complex. <br>Whereas in DBMS, data can be shared easily due to a centralized system.</p><p><strong><em>Data concurrency</em></strong><br>Concurrent access to data means more than one user is accessing the same data at the same time. Anomalies occur when changes made by one user get lost because of changes made by another user. The file system does not provide any procedure to stop anomalies. Whereas DBMS provides a locking system to stop anomalies to occur.</p><p><strong><em>Data searching</em></strong><br>For every search operation performed on the file system, a different application program has to be written. While DBMS provides inbuilt searching operations. The user only has to write a small query to retrieve data from the database.</p><p><strong><em>Data integrity</em></strong><br>There may be cases when some constraints need to be applied to the data before inserting it into the database. The file system does not provide any procedure to check these constraints automatically. Whereas DBMS maintains data integrity by enforcing user-defined constraints on data by itself.</p><p><strong><em>Data security</em></strong><br> A file system provides a password mechanism to protect the database but how long can the password be protected? No one can guarantee that.<br> This doesn’t happen in the case of DBMS. DBMS has specialized features that help provide shielding to its data.</p><p><strong><em>System crashing</em></strong><br> In some cases, systems might have crashed due to various reasons. It is a bane in the case of file systems because once the system crashes, there will be no recovery of the data that’s been lost. A DBMS will have the recovery manager which retrieves the data making it another advantage over file systems.</p><h3>File System?</h3><p>The file system is basically a way of arranging the files in a storage medium .File Management system is a DBMS that allows access to single files or tables at a time. In a File System, data is directly stored in set of files. It contains flat files that have no relation to other files (when only one table is stored in single file, then this file is known as flat file).<br> The file system organizes the files and helps in the retrieval of files when they are required. File systems consist of different files which are grouped into directories. The directories further contain other folders and files. The file system performs basic operations like management, file naming, giving access rules, etc.<br> Ex-&gt;&gt; NTFS(New Technology File System), EXT(Extended File System).</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=964cca351115" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>