<?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 Sadani Samarasinghe on Medium]]></title>
        <description><![CDATA[Stories by Sadani Samarasinghe on Medium]]></description>
        <link>https://medium.com/@stanza4296?source=rss-968c76e1a164------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*vTV7HxsBshQGRafTM7toEA.jpeg</url>
            <title>Stories by Sadani Samarasinghe on Medium</title>
            <link>https://medium.com/@stanza4296?source=rss-968c76e1a164------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 10:33:23 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@stanza4296/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[Design Patterns in Software Development]]></title>
            <link>https://medium.com/@stanza4296/design-patterns-in-software-development-4b7b708f7197?source=rss-968c76e1a164------2</link>
            <guid isPermaLink="false">https://medium.com/p/4b7b708f7197</guid>
            <dc:creator><![CDATA[Sadani Samarasinghe]]></dc:creator>
            <pubDate>Wed, 30 Aug 2023 18:50:32 GMT</pubDate>
            <atom:updated>2023-09-02T16:43:08.860Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/474/1*Gwricdmn3BjuIIKAR-rtMQ.jpeg" /></figure><p>A software design pattern is a general, reusable solution to a commonly occurring problem within a specific context in software design. Think of them as time-tested blueprints for solving common programming challenges. These patterns encapsulate best practices, promoting code that is more understandable, flexible, and maintainable.</p><h3>What are design patterns?</h3><p>Design patterns are design level solutions for recurring problems that we software engineers come across often. It’s not code. It is like a description on how to tackle these problems and design a solution. Using these patterns is considered good practice, as the design of the solution is quite tried and tested, resulting in higher readability of the final code. Design patterns are quite often created for and used by OOP Languages, like Java, in which most of the examples from here on will be written.</p><p>Below, you will find a simple <strong>example</strong> of a software pattern.</p><p>class Plate<br>{<br> private $plateMake;<br> private $plateModel;<br> public function __construct($make, $model)<br> {<br> $this-&gt;plateMake = $make;<br> $this-&gt;plateModel = $model;<br> }<br> public function getMakeAndModel()<br> {<br> return $this-&gt;plateMake . ‘ ‘ . $this-&gt;plateModel;<br> }<br>}<br>class plateMaking<br>{<br> public static function create($make, $model)<br> {<br> return new Plate($make, $model);<br> }<br>}<br>$espresso = plateMaking::create(‘plate’, ‘ceremic’); // Object is created<br>print_r($ceremic-&gt;getMakeAndModel()); // Outputs “plate ceremic”</p><p>The same applies to larger contexts and processes that are frequently used to solve specific tasks in program sequences. This code example can be extended as needed, even to be used in other industries with completely different products and processes. Needless to say, it is only one building block in a more extensive piece of software. In other words, design patterns should be considered <strong>templates</strong> that have already been proven to work in practice.</p><h3><strong>Why Do Design Patterns Matter?</strong></h3><p>1. Enhanced Code Reusability: Design patterns promote modularity, making it easier to reuse solutions across different projects, saving developers valuable time and effort.</p><p>2. Improved Maintainability: Patterns encourage organized code structures, which, as projects evolve, remain easier to comprehend and maintain.</p><p>3. Scalability: By using design patterns, you can create software that can adapt to changing requirements without spiraling into complexity.</p><p>4. Effective Communication: Design patterns act as a universal language among developers, facilitating collaboration and problem-solving.</p><p>5. Embracing Best Practices: These patterns encapsulate established best practices, enabling developers to avoid common pitfalls and make informed decisions.</p><h3>What are the different types of design patterns?</h3><p>The different types of design patterns reflect the basic <strong>applications</strong> of the software patterns compiled in each case. There are about 26 Patterns currently discovered. These 26 can be classified into 3 types:</p><ol><li>Creational:</li></ol><p>Creational design patterns are a category of design patterns that deal with the process of object creation in software development. They provide various ways to instantiate objects while promoting flexibility and reusability.</p><p><strong>Creational patterns</strong> are used to create objects which can simplify process design for specific instances. This works regardless of how the individual objects are created and represented in the software.</p><p>Over time, <strong>additional types of design patterns</strong> have been introduced that do not fit into any of the three categories described above. This includes patterns for <strong>object-relational mapping </strong>to store objects and their relationships in a relational database.</p><ul><li><strong>Builder pattern: </strong>This creational pattern separates the development of a (complex) object from its representation.</li></ul><p>example:</p><p># Product class<br>class Person:<br> def __init__(self, name, age, address):<br> self.name = name<br> self.age = age<br> self.address = address</p><p>def __str__(self):<br> return f”Name: {self.name}, Age: {self.age}, Address: {self.address}”</p><p># Builder interface<br>class PersonBuilder:<br> def set_name(self, name):<br> pass</p><p>def set_age(self, age):<br> pass</p><p>def set_address(self, address):<br> pass</p><p>def build(self):<br> pass</p><p># ConcreteBuilder class<br>class SimplePersonBuilder(PersonBuilder):<br> def __init__(self):<br> self.person = Person(“”, 0, “”)</p><p>def set_name(self, name):<br> self.person.name = name</p><p>def set_age(self, age):<br> self.person.age = age</p><p>def set_address(self, address):<br> self.person.address = address</p><p>def build(self):<br> return self.person</p><p># Client code<br>if __name__ == “__main__”:<br> builder = SimplePersonBuilder()</p><p>builder.set_name(“John”)<br> builder.set_age(30)<br> builder.set_address(“123 Main St”)</p><p>person = builder.build()</p><p>print(person)</p><p>In this simple example:</p><ol><li>Person is the class representing the product we want to build, which is a Person with a name, age, and address.</li><li>PersonBuilder is the interface that defines the construction steps for building a Person.</li><li>SimplePersonBuilder is a concrete builder that implements the PersonBuilder interface to specify how to build a Person.</li><li>In the client code, you create a SimplePersonBuilder, set the attributes of the person (name, age, and address), and then use the builder to construct the Person object.</li></ol><ul><li><strong>Factory pattern:</strong> This creational pattern creates an object by calling a method instead of a constructor.</li></ul><p>example:</p><p># Product classes<br>class Dog:<br> def __init__(self, name):<br> self.name = name</p><p>def speak(self):<br> return “Woof!”</p><p>class Cat:<br> def __init__(self, name):<br> self.name = name</p><p>def speak(self):<br> return “Meow!”</p><p># Factory class<br>class AnimalFactory:<br> def create_animal(self, animal_type, name):<br> if animal_type == “Dog”:<br> return Dog(name)<br> elif animal_type == “Cat”:<br> return Cat(name)<br> else:<br> raise ValueError(“Invalid animal type”)</p><p># Client code<br>if __name__ == “__main__”:<br> factory = AnimalFactory()</p><p>dog = factory.create_animal(“Dog”, “Buddy”)<br> cat = factory.create_animal(“Cat”, “Whiskers”)</p><p>print(f”{dog.name} says: {dog.speak()}”)<br> print(f”{cat.name} says: {cat.speak()}”)</p><p>In this example:</p><ol><li>We have two product classes, Dog and Cat, which represent different types of animals.</li><li>The AnimalFactory class is the factory responsible for creating instances of Dog and Cat based on the provided animal_type and name.</li><li>In the client code, we create an instance of the AnimalFactory, and then we use it to create Dog and Cat objects with specific names. Finally, we call the speak() method on each animal to demonstrate their behavior.</li></ol><ul><li><strong>Singleton pattern:</strong> The Singleton pattern ensures that a class has only one instance and provides a global point of access to that instance.</li></ul><p>The Singleton Design Pattern is a Creational pattern, whose objective is to create only one instance of a class and to provide only one global access point to that object. One commonly used example of such a class in Java is Calendar, where you cannot make an instance of that class. It also uses its own getInstance() method to get the object to be used.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/276/1*NequqyQ4G17gaE4HSx93mg.png" /><figcaption>Singleton Class Diagram</figcaption></figure><ol><li>A private static variable, holding the only instance of the class.</li><li>A private constructor, so it cannot be instantiated anywhere else.</li><li>A public static method, to return the single instance of the class.</li></ol><p>class Singleton:<br> _instance = None<br> <br> def __new__(cls):<br> if cls._instance is None:<br> cls._instance = super(Singleton, cls).__new__(cls)<br> return cls._instance</p><p># Usage<br>obj1 = Singleton()<br>obj2 = Singleton()</p><p>print(obj1 is obj2) # Output: True (Both objects are the same instance)</p><p>In this example, no matter how many times you create instances of the Singleton class, they all refer to the same instance.</p><p>2. Structural:</p><p>These patterns are designed with regard to a class’s structure and composition. The main goal of most of these patterns is to increase the functionality of the class(es) involved, without changing much of its composition.</p><ul><li><strong>Composite pattern:</strong> This structural pattern is specially designed to handle dynamic structures, such as for file organization or data compression.</li></ul><p>example:</p><p># Component interface<br>class FileSystemComponent:<br> def show_info(self):<br> pass</p><p># Leaf class<br>class File(FileSystemComponent):<br> def __init__(self, name):<br> self.name = name</p><p>def show_info(self):<br> print(f”File: {self.name}”)</p><p># Composite class<br>class Folder(FileSystemComponent):<br> def __init__(self, name):<br> self.name = name<br> self.children = []</p><p>def add(self, component):<br> self.children.append(component)</p><p>def remove(self, component):<br> self.children.remove(component)</p><p>def show_info(self):<br> print(f”Folder: {self.name}”)<br> for child in self.children:<br> child.show_info()</p><p># Client code<br>if __name__ == “__main__”:<br> file1 = File(“document.txt”)<br> file2 = File(“image.jpg”)</p><p>folder1 = Folder(“My Documents”)<br> folder1.add(file1)<br> folder1.add(file2)</p><p>file3 = File(“music.mp3”)</p><p>root_folder = Folder(“Root”)<br> root_folder.add(folder1)<br> root_folder.add(file3)</p><p>root_folder.show_info()</p><p>In this example:</p><ol><li>FileSystemComponent is the component interface that defines the common methods for both leaf and composite objects.</li><li>File is a leaf class representing individual files.</li><li>Folder is a composite class representing folders that can contain files and other folders. It can have child components and manage them.</li><li>In the client code, we create files (file1, file2, file3) and folders (folder1, root_folder). We add files to folder1, and we add both folder1 and file3 to the root_folder.</li><li>When we call the show_info() method on the root_folder, it recursively displays information about its contents, including nested folders and files.</li></ol><ul><li><strong>Decorator pattern:</strong> The Decorator pattern allows you to add behavior to individual objects, either statically or dynamically, without affecting the behavior of other objects from the same class.</li></ul><p>Example:</p><p>Suppose you have a coffee shop and want to offer various coffee options with optional extras (decorators) like milk, sugar, and whipped cream.</p><p># Component interface<br>class Coffee:<br> def cost(self):<br> pass</p><p># Concrete Component<br>class SimpleCoffee(Coffee):<br> def cost(self):<br> return 5 # Base price for simple coffee</p><p># Decorators<br>class MilkDecorator(Coffee):<br> def __init__(self, coffee):<br> self._coffee = coffee</p><p>def cost(self):<br> return self._coffee.cost() + 2 # Add the cost of milk</p><p>class SugarDecorator(Coffee):<br> def __init__(self, coffee):<br> self._coffee = coffee</p><p>def cost(self):<br> return self._coffee.cost() + 1 # Add the cost of sugar</p><p># Usage<br>coffee = SimpleCoffee()<br>print(f”Cost of Simple Coffee: ${coffee.cost()}”) # Output: Cost of Simple Coffee: $5</p><p>coffee_with_milk_and_sugar = MilkDecorator(SugarDecorator(coffee))<br>print(f”Cost of Coffee with Milk and Sugar: ${coffee_with_milk_and_sugar.cost()}”)<br># Output: Cost of Coffee with Milk and Sugar: $8</p><p>In this example, you can dynamically add decorators to the coffee object to customize its behavior, such as adding milk or sugar.</p><ul><li><strong>Facade pattern:</strong> This pattern provides an interface for other systems or sub-systems.</li></ul><p>example:</p><p># Complex subsystem classes<br>class Amplifier:<br> def on(self):<br> return “Amplifier is on”</p><p>def off(self):<br> return “Amplifier is off”</p><p>class DVDPlayer:<br> def play(self):<br> return “DVD player is playing”</p><p>def stop(self):<br> return “DVD player is stopped”</p><p>class Projector:<br> def on(self):<br> return “Projector is on”</p><p>def off(self):<br> return “Projector is off”</p><p># Facade class<br>class HomeTheaterFacade:<br> def __init__(self, amplifier, dvd_player, projector):<br> self.amplifier = amplifier<br> self.dvd_player = dvd_player<br> self.projector = projector</p><p>def watch_movie(self):<br> result = []<br> result.append(self.amplifier.on())<br> result.append(self.dvd_player.play())<br> result.append(self.projector.on())<br> return “\n”.join(result)</p><p>def end_movie(self):<br> result = []<br> result.append(self.dvd_player.stop())<br> result.append(self.projector.off())<br> result.append(self.amplifier.off())<br> return “\n”.join(result)</p><p># Client code<br>if __name__ == “__main__”:<br> amplifier = Amplifier()<br> dvd_player = DVDPlayer()<br> projector = Projector()</p><p>home_theater = HomeTheaterFacade(amplifier, dvd_player, projector)</p><p># Start watching a movie<br> print(“=== Start Watching Movie ===”)<br> print(home_theater.watch_movie())</p><p># End the movie and turn off components<br> print(“\n=== End Movie ===”)<br> print(home_theater.end_movie())</p><p>In this example:</p><ol><li>Amplifier, DVDPlayer, and Projector are complex subsystem classes representing different components of a home theater system.</li><li>HomeTheaterFacade is a simplified interface to control the home theater components. It provides methods watch_movie() to start watching a movie and end_movie() to end the movie and turn off the components.</li><li>In the client code, you create instances of the subsystem classes and the HomeTheaterFacade. You then use the facade to start and end a movie. The client code doesn&#39;t need to interact directly with the complex subsystems but relies on the simplified facade interface.</li></ol><p>3. Behavioral:</p><p>Behavioral design patterns focus on defining how objects interact and communicate with one another to accomplish specific tasks. They emphasize the delegation of responsibilities between objects to achieve flexibility and maintainability.</p><p>These patterns are designed depending on how one class communicates with others. <strong>Behavioral patterns</strong> are used to model the software’s behavior. These patterns simplify complex processes for controlling and monitoring. For this, you can choose between algorithms and object responsibilities.</p><ul><li><strong>Observer pattern:</strong> The Observer pattern defines a one-to-many dependency between objects so that when one object changes state, all its dependents (observers) are notified and updated automatically.</li></ul><p>Example:</p><p>from abc import ABC, abstractmethod</p><p># Subject (Observable)<br>class WeatherStation(ABC):<br> <a href="http://twitter.com/abstractmethod">@abstractmethod</a><br> def register_observer(self, observer):<br> pass</p><p><a href="http://twitter.com/abstractmethod">@abstractmethod</a><br> def remove_observer(self, observer):<br> pass</p><p><a href="http://twitter.com/abstractmethod">@abstractmethod</a><br> def notify_observers(self):<br> pass</p><p># Concrete Subject<br>class WeatherData(WeatherStation):<br> def __init__(self):<br> self.observers = []<br> self.temperature = None</p><p>def register_observer(self, observer):<br> self.observers.append(observer)</p><p>def remove_observer(self, observer):<br> self.observers.remove(observer)</p><p>def notify_observers(self):<br> for observer in self.observers:<br> observer.update(self.temperature)</p><p>def set_temperature(self, temperature):<br> self.temperature = temperature<br> self.notify_observers()</p><p># Observer<br>class Display(ABC):<br> <a href="http://twitter.com/abstractmethod">@abstractmethod</a><br> def update(self, temperature):<br> pass</p><p># Concrete Observers<br>class TemperatureDisplay(Display):<br> def update(self, temperature):<br> print(f”Temperature Display: {temperature}°C”)</p><p>class MobileAppDisplay(Display):<br> def update(self, temperature):<br> print(f”Mobile App Display: {temperature}°C”)</p><p># Usage<br>weather_data = WeatherData()<br>temp_display = TemperatureDisplay()<br>app_display = MobileAppDisplay()</p><p>weather_data.register_observer(temp_display)<br>weather_data.register_observer(app_display)</p><p>weather_data.set_temperature(25)<br># Output:<br># Temperature Display: 25°C<br># Mobile App Display: 25°C</p><ul><li><strong>Strategy pattern:</strong> This pattern defines a family of interchangeable algorithms.</li></ul><p># Strategy interface<br>class PaymentStrategy:<br> def pay(self, amount):<br> pass</p><p># Concrete strategy classes<br>class CreditCardPayment(PaymentStrategy):<br> def __init__(self, card_number, name):<br> self.card_number = card_number<br> self.name = name</p><p>def pay(self, amount):<br> print(f”Paid ${amount} with credit card {self.card_number} (Name: {self.name})”)</p><p>class PayPalPayment(PaymentStrategy):<br> def __init__(self, email):<br> self.email = email</p><p>def pay(self, amount):<br> print(f”Paid ${amount} with PayPal (Email: {self.email})”)</p><p># Context class<br>class ShoppingCart:<br> def __init__(self):<br> self.items = []</p><p>def add_item(self, item):<br> self.items.append(item)</p><p>def calculate_total(self):<br> return sum(item.price for item in self.items)</p><p>def checkout(self, payment_strategy):<br> total_amount = self.calculate_total()<br> payment_strategy.pay(total_amount)</p><p># Client code<br>if __name__ == “__main__”:<br> cart = ShoppingCart()</p><p>item1 = {“name”: “Item 1”, “price”: 10}<br> item2 = {“name”: “Item 2”, “price”: 20}<br> item3 = {“name”: “Item 3”, “price”: 30}</p><p>cart.add_item(item1)<br> cart.add_item(item2)<br> cart.add_item(item3)</p><p># Payment with credit card<br> credit_card_payment = CreditCardPayment(“1234–5678–9876–5432”, “John Doe”)<br> cart.checkout(credit_card_payment)</p><p># Payment with PayPal<br> paypal_payment = PayPalPayment(“<a href="/service/mailto:john@example.com">john@example.com</a>”)<br> cart.checkout(paypal_payment)</p><p>In this example:</p><ol><li>PaymentStrategy is the strategy interface that defines the pay method, which will be implemented by concrete strategy classes.</li><li>CreditCardPayment and PayPalPayment are concrete strategy classes that implement the payment logic using different payment methods.</li><li>ShoppingCart is the context class that maintains a list of items and calculates the total amount. It also has a checkout method that takes a PaymentStrategy as a parameter and delegates the payment to the selected strategy.</li><li>In the client code, we create a shopping cart, add items to it, and then perform two different payment operations using the Strategy pattern. We can easily switch between payment methods (strategies) without changing the context (shopping cart) code.</li></ol><ul><li><strong>Visitor pattern:</strong> This pattern isolates executable operations so that new operations can be performed without changing the relevant classes.</li></ul><p>example:</p><p># Element interface<br>class DocumentElement:<br> def accept(self, visitor):<br> pass</p><p># Concrete Element classes<br>class TextElement(DocumentElement):<br> def accept(self, visitor):<br> visitor.visit_text(self)</p><p>class ImageElement(DocumentElement):<br> def accept(self, visitor):<br> visitor.visit_image(self)</p><p># Visitor interface<br>class DocumentVisitor:<br> def visit_text(self, text_element):<br> pass</p><p>def visit_image(self, image_element):<br> pass</p><p># Concrete Visitor class<br>class HTMLExporter(DocumentVisitor):<br> def visit_text(self, text_element):<br> print(f”Exporting text as HTML: {text_element.content}”)</p><p>def visit_image(self, image_element):<br> print(f”Exporting image as HTML: &lt;img src=’{image_element.url}’ alt=’{image_element.alt}’&gt;”)</p><p># Document structure<br>class Document:<br> def __init__(self):<br> self.elements = []</p><p>def add_element(self, element):<br> self.elements.append(element)</p><p>def export(self, exporter):<br> for element in self.elements:<br> element.accept(exporter)</p><p># Client code<br>if __name__ == “__main__”:<br> document = Document()<br> document.add_element(TextElement(“This is a text element.”))<br> document.add_element(ImageElement(“image.jpg”, “An example image.”))</p><p>html_exporter = HTMLExporter()<br> document.export(html_exporter)</p><p>In this example:</p><ol><li>DocumentElement is the interface that defines the accept method for elements.</li><li>TextElement and ImageElement are concrete element classes representing text and image elements. They implement the accept method to allow visitors to visit them.</li><li>DocumentVisitor is the interface that defines the visit_text and visit_image methods for visitors.</li><li>HTMLExporter is a concrete visitor class that implements the visit_text and visit_image methods to export elements as HTML.</li><li>Document is the structure that holds a list of document elements. It provides an export method that accepts a visitor and dispatches the visit calls to its elements.</li><li>In the client code, we create a Document, add text and image elements to it, and then use an HTMLExporter visitor to export the document as HTML.</li></ol><h3>Implementing Design Patterns</h3><p>Implementing a design pattern involves adapting it to the specific requirements of your project. Here’s a simplified process to follow:</p><ol><li>Identify the Problem: Clearly define the problem you’re addressing in your project.</li><li>Choose the Appropriate Pattern: Select a design pattern that aligns with the specific issue you’re facing.</li><li>Implementation: Integrate the selected pattern into your codebase, adhering to its principles and guidelines.</li><li>Testing and Refinement: Rigorously test your implementation to ensure it meets expectations. Refine the code as needed for optimal performance.</li></ol><h3>Pros of Using Design Patterns:</h3><ol><li>Reusability: Design patterns encapsulate proven solutions to common problems. Reusing these patterns saves development time and effort and promotes consistency across projects.</li><li>Maintainability: Patterns promote a structured and organized codebase. This makes it easier to understand, modify, and maintain the code over time.</li><li>Scalability: Design patterns often result in more flexible and extensible code. This makes it easier to accommodate changing requirements and add new features without major code overhauls.</li><li>Communication: Patterns provide a common vocabulary and framework for developers. This enhances collaboration and communication within development teams, as team members can easily discuss and understand the design decisions.</li><li>Best Practices: Patterns embody best practices and design principles. They guide developers toward making informed design decisions, reducing the likelihood of making common design mistakes.</li><li>Performance: Some patterns, when implemented correctly, can improve the performance of your software by optimizing resource usage and reducing redundancy.</li></ol><h3>Cons of Using Design Patterns:</h3><ol><li>Overhead: Applying design patterns can sometimes introduce unnecessary complexity to simple problems. Not all problems require patterns, and using them when not needed can result in code bloat.</li><li>Learning Curve: Design patterns can be challenging for less experienced developers to grasp. It takes time and experience to understand when and how to apply them effectively.</li><li>Rigidity: In some cases, adhering too strictly to a pattern can make the codebase rigid and less adaptable to unexpected changes.</li><li>Over-Engineering: Developers might be tempted to apply multiple patterns in a single project, leading to over-engineering. This can make the code unnecessarily complex and harder to maintain.</li><li>Performance Impact: Poorly implemented design patterns can negatively impact performance. For example, using a Singleton pattern excessively can lead to bottlenecks in multithreaded applications.</li><li>Misapplication: Applying the wrong design pattern to a problem can lead to convoluted and confusing code. It’s essential to choose the right pattern for the specific problem at hand.</li></ol><h3><strong>how to Choosing the right design pattern</strong></h3><p>Choosing the right design pattern for a particular problem or project involves careful consideration of several factors. Here’s a step-by-step guide to help you select the most appropriate design pattern:</p><p>1. Understand the Problem:<br>Start by thoroughly understanding the problem you need to solve. Analyze the requirements, constraints, and objectives of the project. Identify any recurring issues or challenges in the problem domain.</p><p>2. Identify Common Patterns:<br>Examine the problem and look for recurring themes or common issues. Consider whether there are any well-known design patterns that address these problems. Patterns often emerge from common software design challenges.</p><p>3. Consider the Nature of the Problem:<br>Determine whether the problem is primarily related to object creation, object composition, or object interaction. This will help you categorize the problem into creational, structural, or behavioral design pattern categories.</p><p>4. Evaluate SOLID Principles:<br> Consider how the SOLID principles (Single Responsibility, Open-Closed, Liskov Substitution, Interface Segregation, Dependency Inversion) apply to the problem. Design patterns often align with these principles, so choosing patterns that reinforce SOLID principles can lead to better software design.</p><p>5. Assess the Trade-Offs:<br>Each design pattern comes with its own advantages and trade-offs. Consider factors such as complexity, performance, flexibility, and maintainability. Choose a pattern that strikes the right balance based on your project’s requirements.</p><p>6. Review Existing Patterns:<br> Familiarize yourself with a variety of design patterns. Read about their intent, structure, and typical use cases. This knowledge will enable you to recognize which pattern(s) might be suitable for your problem.</p><p>7. Discuss with Teammates:<br>Collaborate with your development team or colleagues. Gather input and insights from others who may have experience with design patterns or expertise in the problem domain. Different perspectives can lead to better decisions.</p><p>8. Analyze Constraints:<br>Consider any project-specific constraints, such as technology stack, platform compatibility, or organizational guidelines. Some design patterns may be more suitable for certain environments than others.</p><p>9. Prototype and Experiment:<br>If you’re uncertain about which pattern to choose, consider creating prototypes or conducting small experiments. Implement different patterns and assess their feasibility, readability, and maintainability in your specific context.</p><p>10. Be Open to Adaptation:<br>Keep in mind that design patterns are not rigid templates; they can be adapted and combined to suit your needs. Don’t feel restricted by a single pattern. Sometimes a hybrid approach or a variation of a pattern may be the best solution.</p><p>11. Document Your Decision:<br>Once you’ve chosen a design pattern, document your decision and rationale. This documentation will be valuable for your team and future developers who work on the project.</p><p>12. Review and Refactor:<br>Periodically review your choice of design pattern as the project evolves. If you find that the chosen pattern no longer aligns with project requirements or if new requirements emerge, be prepared to refactor and adapt the design.</p><p>Continuously learn from your experiences with design patterns. Over time, you’ll develop a better intuition for when and how to apply them effectively.</p><p>Choosing the right design pattern is not always straightforward, and it often requires a combination of analysis, experience, and creativity. The goal is to select a pattern that simplifies your solution, enhances maintainability, and aligns with the specific needs of your project.</p><h3>Conclusion</h3><p>Software design patterns are powerful tools that can elevate your programming skills and transform your software development projects. They offer structured solutions to common problems, enhance code quality, and foster collaboration among development teams. As you embark on your coding journey, explore the world of design patterns and harness their transformative potential to build software that stands the test of time.</p><ol><li>Creational Patterns:</li></ol><p>These patterns deal with object creation mechanisms, trying to create objects in a manner suitable for the situation. They help make a system independent of how its objects are created, composed, and represented. Examples include:</p><ul><li>Singleton Pattern: Ensures a class has only one instance and provides a global point of access to that instance.</li><li>Factory Method Pattern: Defines an interface for creating an object but lets subclasses alter the type of objects that will be created.</li><li>Abstract Factory Pattern: Provides an interface for creating families of related or dependent objects without specifying their concrete classes.</li></ul><p>2. Structural Patterns:</p><p>These patterns focus on the composition of classes or objects to form larger structures. They help in defining relationships between objects, making it easier to add new functionalities to a system without altering its structure. Examples include:</p><ul><li>Adapter Pattern: Allows the interface of an existing class to be used as another interface.</li><li>Decorator Pattern: Attaches additional responsibilities to an object dynamically.</li><li>Composite Pattern: Composes objects into tree structures to represent part-whole hierarchies.</li></ul><p>3. Behavioral Patterns:</p><p>These patterns deal with the communication between objects, responsibilities, and the algorithms used to solve specific problems. They describe how objects interact and encapsulate behavioral patterns in an object. Examples include:</p><ul><li>Observer Pattern: Defines a one-to-many dependency between objects, so that when one object changes state, all its dependents are notified and updated automatically.</li><li>Strategy Pattern: Defines a family of algorithms, encapsulates each one, and makes them interchangeable. Strategy lets the algorithm vary independently from clients that use it.</li><li>Command Pattern: Encapsulates a request as an object, thereby allowing for parameterization of clients with queues, requests, and operations.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4b7b708f7197" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Amazon [AWS].]]></title>
            <link>https://medium.com/@stanza4296/amazon-aws-f9c00867119e?source=rss-968c76e1a164------2</link>
            <guid isPermaLink="false">https://medium.com/p/f9c00867119e</guid>
            <dc:creator><![CDATA[Sadani Samarasinghe]]></dc:creator>
            <pubDate>Sat, 17 Sep 2022 18:21:01 GMT</pubDate>
            <atom:updated>2022-09-17T18:21:01.213Z</atom:updated>
            <content:encoded><![CDATA[<p>AWS stands for Amazon Web Services, it needs no formal introduction, given its immense popularity. The leading cloud provider in the marketplace is <a href="https://www.simplilearn.com/introduction-to-amazon-web-services-aws-article">Amazon Web Services</a>. It provides over 170 AWS services to the developers so they can access them from anywhere at the time of need.</p><p>AWS has customers in over 190 countries worldwide, including 5000 ed-tech institutions and 2000 government organizations. Many companies like ESPN, Adobe, Twitter, Netflix, Facebook, BBC, etc., use AWS services.</p><p>For example, Adobe creates and updates software without depending upon the IT teams. It uses its services by offering multi-terabyte operating environments for its clients. By deploying its services with Amazon services, Adobe integrated and operated its software in a simple manner.</p><p>Now, before getting started with what is AWS, let us first give you a brief description of what cloud computing is.</p><h3><strong>What is Cloud Computing?</strong></h3><p><a href="https://www.simplilearn.com/tutorials/cloud-computing-tutorial/what-is-cloud-computing">Cloud computing</a> is the delivery of online services (such as servers, databases, software) to users. With the help of cloud computing, storing data on local machines is not required. It helps you access data from a remote server. Moreover, it is also used to store and access data from anywhere across the world.</p><h3>What is AWS?</h3><p>Amazon web service is an online platform that provides scalable and cost-effective cloud computing solutions.</p><p>AWS is a broadly adopted cloud platform that offers several on-demand operations like compute power, database storage, content delivery, etc., to help corporates scale and grow.</p><p>How Does it Work?</p><p>That was all about what is AWS. Next, let’s have a look at the history.</p><h3><strong>History of AWS</strong></h3><p>· In the year 2002 — AWS services were launched</p><p>· In the year 2006- AWS cloud products were launched</p><p>· In the year 2012 — AWS had its first customer event</p><p>· In the year 2015- AWS achieved $4.6 billion</p><p>· In the year 2016- Surpassed the $10 billion revenue target</p><p>· In the year 2016- AWS snowball and AWS snowmobile were launched</p><p>· In the year 2019- Released approximately 100 cloud services</p><h3>How Does AWS Work?</h3><p>AWS usually works in several different configurations depending on the user’s requirements. However, the user must be able to see the type of configuration used and the particular server map with respect to the AWS service.</p><h3><strong>Advantages of AWS</strong></h3><p>1. AWS provides a user-friendly programming model, architecture, database as well as operating system that has been already known to employers.</p><p>2. AWS is a very cost-effective service. There is no such thing as long-term commitments for anything you would like to purchase.</p><p>3. It offers billing and management for the centralized sector, hybrid computing, and fast installation or removal of your application in any location with few clicks.</p><p>4. There is no need to pay extra money on running data servers by AWS.</p><p>5. AWS offers a total ownership cost at very reasonable rates in comparison to other private cloud servers.</p><h3><strong>Disadvantages of AWS</strong></h3><p>1. AWS has supportive paid packages for intensive or immediate response. Thus, users might need to pay extra money for that.</p><p>2. There might be some cloud computing problems in AWS especially when you move to a cloud Server such as backup protection, downtime, and some limited control.</p><p>3. From region to region, AWS sets some default limitations on resources such as volumes, images, or snapshots.</p><p>4. If there is a sudden change in your hardware system, the application on the cloud might not offer great performance.</p><p>Migration</p><p>Migration services use 3 different sub-services, DMS, SMS, and snowball to transfer the data physically from Datacenter to AWS.</p><p>1. DMS also known as Database Migration Service is used to migrate one database to another.</p><p>2. SMS is a Server Migration Service that helps to migrate on-site servers to AWS within a short period of time.</p><p>3. Snowball is used to migrate data inside in terabytes to data outside within the AWS environment.</p><h3>Applications of AWS</h3><p>The most common applications of AWS are storage and backup, websites, gaming, mobile, web, and social media applications. Some of the most crucial applications in detail are as follows:</p><h3>1. Storage and Backup</h3><p>One of the reasons why many businesses use AWS is because it offers multiple types of storage to choose from and is easily accessible as well. It can be used for storage and file indexing as well as to run critical business applications.</p><h3>2. Websites</h3><p>Businesses can host their websites on the AWS cloud, similar to other web applications.</p><h3>3. Gaming</h3><p>There is a lot of computing power needed to run gaming applications. AWS makes it easier to provide the best online gaming experience to gamers across the world.</p><h3>4. Mobile, Web and Social Applications</h3><p>A feature that separates AWS from other cloud services is its capability to launch and scale mobile, e-commerce, and <a href="https://www.simplilearn.com/what-is-saas-article">SaaS applications</a>. API-driven code on AWS can enable companies to build uncompromisingly scalable applications without requiring any OS and other systems.</p><h3>5. Big Data Management and Analytics (Application)</h3><p>· Amazon Elastic Map Reduced to process large amounts of data via the Hadoop framework.</p><p>· Amazon Kinesis to analyze and process the streaming data.</p><p>· AWS Glue to handle, extract, transform and load jobs.</p><p>· Amazon Elasticsearch Service to enable a team to perform log analysis, and tool monitoring with the help of the open source tool, Elastic-search.</p><p>· Amazon Athena to query data.</p><p>· Amazon Quick Sight to visualize data.</p><h3>6. Artificial Intelligence</h3><p>· Amazon Lex to offer voice and text chatbot technology.</p><p>· Amazon Polly to translate text-to-speech translation such as Alexa Voice Services and echo devices.</p><p>· Amazon Rekognition to analyze the image and face.</p><h3>7. Messages and Notifications</h3><p>· Amazon Simple Notification Service (SNS) for effective business or core communication.</p><p>· Amazon Simple Email Service (SES) to receive or send emails for IT professionals and marketers.</p><p>· Amazon Simple Queue Service (SQS) to enable businesses to subscribe or publish messages to end users.</p><h3>8. Augmented Reality and Virtual Reality</h3><p>· Amazon Sumerian service enables users to make the use of AR and VR development tools to offer 3D web applications, E-commerce &amp; sales applications, Marketing, Online education, Manufacturing, Training simulations, and Gaming.</p><h3>9. Game Development</h3><p>· AWS game development tools are used by large game development companies that offer developer back-end services, analytics, and various developer tools.</p><p>· AWS allows developers to host game data as well as store the data to analyze the gamer’s performance and develop the game accordingly.</p><h3>10. Internet of Things</h3><p>· AWS IoT service offers a back-end platform to manage IoT devices as well as data ingestion to database services and AWS storage.</p><p>· AWS IoT Button offers limited IoT functionality to hardware.</p><p>· AWS Greengrass offers AWS computing for IoT device installation.</p><h3>AWS Pricing Model</h3><p>AWS pricing model is very cost-effective which makes it most reliable. For instance, if a user wants to use a cloud server for an hour, AWS asks the user to pay only for an hour. There is no such long-term commitment as five years or 10 years and pay accordingly. Besides, there is an AWS free tier service to increase the potential customers’ affordability by offering free services with AWS servers up to 58 products that help users gain some experience with the AWS platform.</p><h3>Companies Using AWS</h3><p>Whether it’s technology giants, startups, government, food manufacturers or retail organizations, there are so many companies across the world using AWS to develop, deploy and host applications. According to Amazon, the number of active AWS users exceeds 1,000,000. Here is a list of companies using AWS:</p><p>· Netflix</p><p>· Intuit</p><p>· Coinbase</p><p>· Finra</p><p>· Johnson &amp; Johnson</p><p>· Capital One</p><p>· Adobe</p><p>· Airbnb</p><p>· AOL</p><p>· Hitachi</p><h3>AWS Services</h3><p>Amazon has many services for cloud applications. Let us list down a few key services of the AWS ecosystem and a brief description of how developers use them in their business.</p><p>Amazon has a list of services:</p><p>· Compute service</p><p>· Storage</p><p>· Database</p><p>· Networking and delivery of content</p><p>· Security tools</p><p>· Developer tools</p><p>· Management tools</p><h3>Compute Service</h3><p>These services help developers build, deploy, and scale an application in the cloud platform.</p><h3>AWS EC2</h3><p>· It is a web service that allows developers to rent virtual machines and automatically scales the compute capacity when required.</p><p>· It offers various instance types to developers so that they can choose required resources such as CPU, memory, storage, and networking capacity based on their application requirements.</p><h3>AWS Lambda</h3><p>· <a href="https://www.simplilearn.com/aws-lambda-function-article">AWS Lambda</a> is a serverless compute service. It is also responsible for executing code for applications.</p><p>· It helps you execute a program without the hassle of managing servers.</p><h3>Storage</h3><p>AWS provides web data storage service for archiving data. Also, its primary advantage is disaster data recovery with high durability.</p><h3>Amazon S3</h3><p>· It is an open cloud-based storage service that is utilized for online data backup.</p><p>· Amazon S3 provides storage through a web services interface and is designed for developers where web-scale computing can be easier for them. to know more.</p><h3>Amazon EBS</h3><p>· It provides a high availability storage volume for persistent data. It is mainly used by <a href="https://www.simplilearn.com/tutorials/aws-tutorial/aws-ec2">Amazon EC2</a> instances.</p><p>· EBS volumes are used explicitly for primary storage such as file storage, databases storage, and block-level storage.</p><p>As one of the top three cloud providers available, there are plenty of career opportunities related to GCP. Simple learn’s <a href="https://www.simplilearn.com/google-cloud-architect-certification-training-course?source=GhPreviewCoursepages">Google cloud certification</a> provides you with the foundation you will need to start or enhance your current career working with this comprehensive cloud platform. Get started today!</p><h3>Database</h3><p>AWS database domain service offers cost-efficient, highly secure, and scalable database instances in the cloud.</p><h3>DynamoDB</h3><p>· It is a flexible <a href="https://www.simplilearn.com/rise-of-nosql-and-why-it-should-matter-to-you-article">NoSQL database</a> service that offers fast and reliable performance with no scalability issues.</p><p>· It is a multi-region and durable database with instant built-in security, backup and restores features.</p><h3>RDS</h3><p>· It is a managed distributed relational database cloud service that helps developers to operate and scale a database in a simple manner.</p><p>· We launched it to simplify the setup, operation, and scaling process for developers while accessing a relational database.</p><h3>Networking and Delivery of Content</h3><p>It offers a highly secure cloud platform and connects your physical network to your private VN with a high transfer speed.</p><h3>VPC</h3><p>· It helps a developer to deploy AWS resources, such as Amazon EC2 instances into a <a href="https://www.simplilearn.com/tutorials/aws-tutorial/aws-vpc">private virtual cloud.</a></p><p>· It gives you control over the complete cloud network environment, including the section of your <a href="https://www.simplilearn.com/tutorials/cyber-security-tutorial/what-is-an-ip-address">IP address</a> range, subnets, route table configuration, and network gateways.</p><p>· With this, developers can both IPv4 and IPv6 at a time for your resources in a highly secure environment.</p><h3>Developer Tools</h3><p>It helps a user build, deploy, and run an application source code automatically. It also updates the server and instance on the workload.</p><h3>Code Star</h3><p>It is a service designed to manage application development in a single place. Here, developers can quickly develop, build and deploy applications on AWS</p><h3>Code Build</h3><p>· This removes the hassle of managing physical servers and helps developers build and test code with continuous scaling.</p><p>· In simple words, it compiles your code, executes unit tests, and gives output artifacts that are ready to deploy.</p><h3>Security, Identity &amp; Compliance</h3><p>It helps in monitoring a safe environment for your AWS resources by providing limited access to specific users.</p><h3>IAM</h3><p>· Identity Access Management is a framework that helps in maintaining access to AWS services in a secure way.</p><p>· The service gives you Shared access to your AWS account and Secure access to AWS services that run on the AWS EC2 application.</p><h3>KMS</h3><p>· It enables users to create and manage the encryption keys that are used for encrypting data.</p><p>· The service includes a key generation method where digital sign within your applications becomes easier.</p><h3>Management Tools</h3><p>Using this service, an individual can optimize costs, minimize risks, and automate all the resources running efficiently on the AWS infrastructure.</p><h3>Cloud Watch</h3><p>· It is a monitoring tool for AWS resources and customer applications running on the AWS platform.</p><p>· The service helps you gather and access all your operational data in the form of logs from a single interface.</p><h3>Cloud Formation</h3><p>· <a href="https://www.simplilearn.com/tutorials/aws-tutorial/aws-cloudformation">This service</a> helps you in monitoring all your AWS resources in one place so that you can spend minimum time managing those resources and maximum time developing applications.</p><p>· It allows developers to manage their cloud infrastructure either in a text file or a template.</p><p>With this, we have come to the end of what is AWS article.</p><h3>Conclusion</h3><p>In this introductory tutorial “what is AWS”, we discussed what cloud computing is, what is AWS and its history, and we also went through all the AWS services in detail.</p><p>Whether you’re an experienced <a href="https://www.simplilearn.com/tutorials/aws-tutorial/how-to-become-aws-solution-architect">AWS Architect</a> or you’re aspiring to break into this exciting industry, enrolling in our Cloud Architect Training program will help individuals with all levels of experience master AWS Cloud Architect techniques and strategies.</p><p>Do you have any questions for us in the article “What is AWS”? Please feel free to leave them in the comments section of this article; our experts will get back to you as soon as possible.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f9c00867119e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Keys in DBMS]]></title>
            <link>https://medium.com/@stanza4296/keys-in-dbms-b956a00db8cd?source=rss-968c76e1a164------2</link>
            <guid isPermaLink="false">https://medium.com/p/b956a00db8cd</guid>
            <dc:creator><![CDATA[Sadani Samarasinghe]]></dc:creator>
            <pubDate>Fri, 02 Sep 2022 16:57:36 GMT</pubDate>
            <atom:updated>2022-09-02T16:57:36.304Z</atom:updated>
            <content:encoded><![CDATA[<p>What are keys in DBMS</p><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 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 the 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><p>Why we need keys in DBMS?</p><ul><li>Keys help you to identify any row of data in a table. In a real-world application, a table could contain thousands of records. Moreover, the records could be duplicated. Keys in RDBMS ensure that you can uniquely identify a table record despite these challenges.</li><li>Allows you to establish a relationship between and identify the relation between tables</li><li>Help you to enforce identity and integrity in the relationship.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sZ1ufJv4NDN_xVFGbbCapg.png" /></figure><p>Types of keys in DBMS</p><p>1. Super Key</p><p>2. Primary Key</p><p>3. Candidate Key</p><p>4. Alternate Key</p><p>5. Foreign Key</p><p>6. Compound Key</p><p>7. Composite Key</p><p>8. Surrogate Key</p><h3>1.Super key</h3><p>Super Key is the superset of primary key. The super key contains a set of attributes, including the primary key, which can uniquely identify any data row in the table.</p><p>example of super key:</p><p>Employee(EmpSSN,EmpNum,Empname<strong>,</strong>age)</p><p>EmpSSN and EmpNum name are superkeys.</p><h3>2.Primary key</h3><p>Primary key in DBMS is a column or group of columns in a table that uniquely identify every row in that table. The Primary Key can’t be a duplicate meaning the same value can’t appear more than once in the table. A table cannot have more than one primary key.</p><p>Primary key should be ,</p><ul><li>Two rows can’t have the same primary key value.</li><li>It must for every row to 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><p>example of primary key :</p><p>STUDENTS(stu_id,name,age)</p><p>stu_id is a primary key in the STUDENTS table.</p><h3>3. Candidate Key</h3><p>Candidate Key is a set of attributes that uniquely identify tuples in a table. Candidate Key is a super key with no repeated attributes.</p><p>Candidate Key should be ,</p><ul><li>It must contain unique values</li><li>Candidate key in SQL may have multiple attributes</li><li>Must not contain null values</li><li>It should contain minimum fields to ensure uniqueness</li><li>Uniquely identify each record in a table.</li></ul><h4>Students(StudID,Roll No,First Name,LastName,Email)</h4><p>Candidate key Example:</p><p>In the given table Stud ID, Roll No, and email are candidate keys which help us to uniquely identify the student record in the table.</p><h3>4. Alternate Key</h3><p>Alternate Key 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.</p><h4><strong>Students(StudID,Roll No,First Name,LastName,Email)</strong></h4><p>In this table, StudID, Roll No, Email are qualified to become a primary key. But since StudID is the primary key, Roll No, Email becomes the alternative key.</p><h3>5. Foreign Key</h3><p>Foreign Key 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. It acts as a cross-reference between two tables as it references the primary key of another table.</p><p>Example of Foreign key:</p><p>STUDENTS(stu_id,name,age) /COURCE(course_id,name,stu_id)</p><p>stu_id in course table is a foregin key.</p><h3>6. Compound Key</h3><p>Compound Key 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 database is to uniquely identify each record in the table.</p><p><strong>Product(OrderNo,PorductID,Product_Name,Quantity)</strong></p><p>In this example, OrderNo and ProductID can’t be a primary key as it does not uniquely identify a record. However, a compound key of Order ID and Product ID could be used as it uniquely identified each record.</p><h3>7. Composite Key</h3><p>Composite Key is a combination of two or more columns that uniquely identify rows in a table. The combination of columns guarantees uniqueness, though individually uniqueness is not guaranteed. Hence, they are combined to uniquely identify records in a table. The difference between compound and the composite key is that any part of the compound key can be a foreign key, but the composite key may or maybe not a part of the foreign key.</p><h4>Students(StudID,Roll No,First Name,LastName,Email)</h4><h4>First Name,LastName is composite key.</h4><h3>8. Surrogate Key</h3><p>Surrogate Key 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><p>Surrogate keys in SQL are allowed when</p><ul><li>No property has the parameter of the primary key.</li><li>In the table when the primary key is too big or complicated.</li></ul><h3><strong>Difference between primary key and foreign key.</strong></h3><p>A primary key is used to assure the value in the particular column is unique. The foreign key provides the link between the two tables.</p><p>Table allows only one primary key but Tables can allow more than one foreign key.</p><p>The primary key doesn’t allow null values but Foreign key accepts multiple null values.</p><p>primary key can identify the record uniquely in the database table but a foreign key is a field in the table that is the primary key in another table.</p><p>In the primary key, the value cannot be removed from the parent table but foreign key, the value can be deleted from the child table.</p><p>primary key, restriction can be completely defined on the temporary tables but foreign key, restriction cannot be defined on the global or local temporary tables.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b956a00db8cd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Evaluation Of Database Management System]]></title>
            <link>https://medium.com/@stanza4296/evaluation-of-database-management-system-cbbe8d062124?source=rss-968c76e1a164------2</link>
            <guid isPermaLink="false">https://medium.com/p/cbbe8d062124</guid>
            <dc:creator><![CDATA[Sadani Samarasinghe]]></dc:creator>
            <pubDate>Wed, 20 Jul 2022 16:45:08 GMT</pubDate>
            <atom:updated>2022-07-20T17:00:28.749Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CfXd9U7GWdVpbciEZlpDhA.jpeg" /></figure><p>We are using various database management systems. We used each type of DBMS systems for varied purposes to solve our problem. To choose the most suitable DBMS, we need to evaluate from various systems.</p><p>We perform a structured approach to evaluate the database systems.</p><p>First of all, we need to know about What is the database management system, what are the example of DBMS, what are the applications of DBMS and what are the Features of DBMS.</p><p>Then we can learn to evaluation of DBMS.</p><p><strong>What is the database management system (DBMS)?</strong></p><p>DBMS is a collection of programs that enables user to create and maintain a database.</p><p>DBMS is software system that allows the access to the data contained in a database.</p><p>E.g.: MySQL, PostgreSQL, Microsoft Access, SQL Server, FileMaker, Oracle,<br>RDBMS, dBase, Clipper, and FoxPro.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9ekclKFEhiP9M84-fAhs9g.jpeg" /></figure><h4>What are the applications of DBMS?</h4><p>Banking</p><p>Finance</p><p>Online shopping</p><p>Telecommuncation</p><p>Social media sites</p><p>Credit card transaction</p><p>Manufacturing</p><p>Education sector</p><p>Library management system</p><p>Human Resource Management</p><p><strong>What are the Features of DBMS?</strong></p><p>Accept data input &amp; store</p><p>Multi-user access</p><p>Security</p><p>Query languages (Searching, sorting)</p><h4><strong>Components of Evaluation of DBMS</strong></h4><p><strong>The major components of DBMS.</strong></p><p>1. Data Manager</p><p>2. Disk Manager</p><p>3. Data Dictionary</p><p>4. Query Processor</p><p>5. File Manager</p><p>6. Data Definitions Language Compiler</p><p>7. Telecommunication System</p><p>8. Data Files</p><p>9. Access Aids.</p><h4><strong>Evaluation Methodology</strong></h4><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><p>1. Feature analysis:</p><p>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>This analysis serves two purposes: -</p><p>It directly eliminates the DBMS that is not competent to fulfil all the needs of the user.</p><p>We can rank the remaining systems based on the features provided by them.</p><p>2. Performance Analysis:</p><p>In this phase, we analyze only those shortlisted DBMS, evaluate the systems’ efficiency, and choose one with maximum efficiency.</p><p>This analysis serves two purposes: -</p><p>To analyze the behavior of the database management system in the user system.</p><p>To gather the data on the performance of the DBMS and rank them accordingly.</p><p><strong>Techniques to Analyze the Performance of DBMS:</strong></p><p>There are various methods to judge the performance of the database management system.</p><p>Some of the most used Analytical and Stimulation modelling and Benchmarking methods.</p><p>Now, discuss these methods individually.</p><ol><li>Analytical Modelling Technique: -</li></ol><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.</p><p>Two models that are used under this technique are Queueing models and Cost models.</p><p>2. Queueing Models: -</p><p>The database system is provided with various resource systems and tasks are provided to the database management system.</p><p>The system performance is evaluated based on the performance of the system while performing these assigned tasks.</p><p>3. Cost Models: -</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>4.Simulating Modelling: -</p><p>In simulation modelling, we construct a real-time model of the system to replicate the behavior 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.</p><p>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>5.Benchmarking: -</p><p>This technique is preferred when there is a smaller 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.</p><p>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.</p><p>This method is still performed because this method produces the most accurate result upon which the performance of the management system is evaluated.</p><p>In this method, we need to define and implement system configuration, a database and a workload.</p><p>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.</p><p>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><p>Thank you!!!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cbbe8d062124" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[· What is file system?]]></title>
            <link>https://medium.com/@stanza4296/what-is-file-system-c2ea7783963e?source=rss-968c76e1a164------2</link>
            <guid isPermaLink="false">https://medium.com/p/c2ea7783963e</guid>
            <dc:creator><![CDATA[Sadani Samarasinghe]]></dc:creator>
            <pubDate>Fri, 08 Jul 2022 16:19:54 GMT</pubDate>
            <atom:updated>2022-07-08T16:19:54.058Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/472/1*zWCPaQBrhBdpVkbx6qXozA.jpeg" /><figcaption><strong>File System Vs Database Management System (DBMS)</strong></figcaption></figure><blockquote><strong><em>File System</em></strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vHcqKMNiN3f-OeZrvHX4ww.jpeg" /></figure><h3>· What is file system?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/239/1*GC2arWnJ5xNv8O0GQSw7SQ.jpeg" /></figure><p>A file system is a technique of arranging the files in a storage medium like a hard disk, pen drive, DVD, etc.</p><p>It helps you to organizes the data and allows easy retrieval of files when they are required.</p><p>It mostly consists of different types of files like mp3, mp4, txt, doc, etc. That are grouped into directories.</p><h3>· What are the advantages of file system?</h3><p>Here are pros/benefits of file system:</p><p>1. Enforcement of development and maintenance standards.</p><p>2. Helps you to reduce redundancy.</p><p>3. Avoid inconsistency across file maintenance to get the integrity of data independence.</p><p>4. The design of file processing is simply than designing database.</p><p>5. It is more efficient and cost less than a DBMS in certain situations.</p><p>6. Firm theoretical foundation (for the relational model).</p><h3>· What are the disadvantages of file system?</h3><p>Here are cons/drawback of file system:</p><p>1. Each application has its data file so, the same data may have to be recorded and stored many times.</p><p>2. Data dependance in the file processing system are data-dependent, but the problem is incompatible with file format.</p><p>3. Limited data sharing.</p><p>4. The problem with security.</p><p>5. Time-consuming.</p><p>6. It allows you to maintain the record of the big firm having a large number of items.</p><p>7. Required lots of labor work to do.</p><h3>· What are the application of file system?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/200/1*Rznc3DUmlbHMMOSyd8YJcg.jpeg" /></figure><p>Here, are important application of the file system:</p><p>i. Language-specific run-time libraries.</p><p>ii. API programs using it to make requests of the file system.</p><p>iii. It is used for data transfer and positioning.</p><p>iv. Helps you to update the metadata</p><p>v. Managing directories.</p><blockquote><strong><em>Database Management System (DBMS)</em></strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/472/1*2aT25ZvBri9rjXJ-b_CGQw.jpeg" /></figure><h3>· What is Database Management System (DBMS)?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/591/1*QEUvmM7J9bzwxPjUkaqMVA.png" /></figure><p>A database is a collection of related data.</p><p>Database Management System (DBMS) is a collection of programs that enables user to create and maintain a database.</p><p>Example of DBMS software: MySQL, Oracle, Microsoft Access, SQL Server, Clipper, File Maker, RDBMS, dBASE, Foxpro</p><p><em>DBMS=DB Software +Database</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/590/1*OI9CRgMlkIM6tLw_VuQd4w.png" /></figure><h3>· What are the advantages of Database Management System?</h3><p>Here are pros/benefits of DBMS:</p><p>1. DBMS offers a variety of techniques to stores &amp; retrieve data.</p><p>2. Uniform administration procedures for data.</p><p>3. Application programmers never exposed to details of data representation and storage.</p><p>4. A DBMS uses various powerful functions to store and retrieve data efficiently.</p><p>5. Offers Data Integrity and Security.</p><p>6. The DBMS implies integrity constraints to get a high level of protection against prohibited access to data.</p><p>7. Reduced Application Development Time.</p><p>8. Consume lesser space.</p><p>9. Reduction of redundancy.</p><p>10. Data independence.</p><h3>· What are the disadvantages of Database Management System?</h3><p>Here are cons/drawback of the DBMS:</p><p>1. Cost of Hardware and Software of a DBMS is quite high, which increase the budget of your organization.</p><p>2. Most database management systems are often complex systems, so the training for users to uses the DBMS is required.</p><p>3. The use of same program at a time by many users sometimes lead to the loss of some data.</p><p>4. DBMS can’t perform sophisticated calculations.</p><p>5. Data-sets begins to grow large as it provides a more predictable query response time.</p><p>6. It required a processor with the high speed of data processing.</p><p>7. The database can fail because or power failure or the whole system stops.</p><p>8. The cost of DBMS is depended on the environment, function, or recurrent annual maintenance cost.</p><h3>· What are the Application of Database Management System?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*qvlwg_q_NMcBceDsgwSdNw.jpeg" /></figure><p>Here, are important application of the DBMS:</p><p>i. Admission System Examination System Library System.</p><p>ii. Payroll &amp; Personal Management System.</p><p>iii. Accounting System Hotel Reservation System Airline Reservation System.</p><p>iv. It is used in the Banking System for Customer information, account activities, Payments, deposits, loans etc.</p><p>v. Use for Airlines for reservations and schedules.</p><p>vi. DBMS also used by universities to keep call records, monthly bills, maintaining balances, etc.</p><p>vii. Finance for storing information about stocks, sales, and purchases of financial instruments like stocks and bonds.</p><blockquote><strong>Difference between File System Vs. DBMS</strong></blockquote><p>Here, are the difference between File System and DBMS</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/906/1*YSO_SUI1EniI3Agm49DOzA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/947/1*p7UO8T_OY3wd-wetdA4Fuw.jpeg" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c2ea7783963e" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>