Giter VIP home page Giter VIP logo

design_patterns's Introduction

Design_patterns

  • Design patterns are reusable solutions to common problems encountered during software design.
  • Characteristics of design patterns are as follows.
    • Proven Solutions: These are known approaches that have been successfully used in various projects, so time and effort can be saved.
    • Flexibility: These can be adapted and customized to fit the specific context of your project.
    • Communication Tools: These provide a common vocabulary for developers to discuss and understand design concepts. For ex, when using terms like singleton,prototype every developer understands.
  • Types of Design Patterns:
    • Creational Patterns: These patterns focus on object creation mechanisms. They are Singleton, Factory Method, Abstract Factory, Builder and Prototype.
    • Structural Patterns: These patterns deal with the composition of classes and objects, promoting a more flexible and efficient structure. Examples include,
      • Adapter: Allowing incompatible interfaces to work together
      • Facade: Providing a simplified interface to a complex system.
      • Decorator: Dynamically adding new functionality to objects.
    • Behavioral Patterns: These patterns address how objects interact and communicate, influencing the program's behavior.
      • Observer: establishing a one-to-many dependency between objects.
      • Strategy: Allowing dynamic selection of an algorithm.
      • Command: Encapsulating a request as an object.
  • By using design patterns, the following can be achieved.
    • Write cleaner, more maintainable code: Design patterns promote a well-organized and modular code structure.
    • Improve code reusability: You can leverage existing patterns across different parts of your code or even in new projects.
    • Enhance communication with other developers: Design patterns provide a common language for discussing design decisions.
    • Solve common problems efficiently: By using established and proven solutions, you can save time and effort.

Behavioral vs Structural design pattern

  • Behavioral design patterns are concerned with the interaction and communication between objects and classes.
    • They focus on how objects collaborate to fulfill responsibilities and manage relationships at runtime.
    • These patterns are primarily concerned with algorithms, responsibilities, and communication between objects.
    • Key characteristics:
      • Focus on Object Interaction: Behavioral patterns focus on defining how objects interact and communicate with each other to accomplish tasks.
      • Encapsulating Behavior: They encapsulate algorithms or behavior in objects and promote flexibility and reuse by decoupling the implementation from the client code.
      • Runtime Behavior: Behavioral patterns are concerned with the behavior of objects at runtime and how they respond to different situations or events.
      • Dynamic Relationships: They often involve dynamic relationships between objects that can change at runtime.
  • Structural design patterns are concerned with the composition of classes or objects to form larger structures or systems.
    • They focus on organizing and structuring classes to ensure that the system is scalable, maintainable, and adaptable to change.
    • These patterns are primarily concerned with class composition, relationships, and structure.
    • Key characteristics:
      • Focus on Class Composition: Structural patterns focus on how classes and objects are composed to form larger structures or systems.
      • Creating Class Relationships: They define ways to establish relationships between classes and objects to achieve specific goals, such as code reuse, flexibility, or performance optimization.
      • Static Structure: Structural patterns primarily deal with the static structure of classes and objects rather than their runtime
        behavior.
      • Code Reuse and Organization: They promote code reuse, modularity, and organization by defining common ways to structure classes and objects.

design_patterns's People

Contributors

tulasidamarla avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.