Design patterns vs Frameworks

后端 未结 12 1641
清歌不尽
清歌不尽 2021-01-31 10:52

Can someone illustrate what really is the difference between the two?

相关标签:
12条回答
  • 2021-01-31 11:06

    Pattern support reuse of software architecture and design - Pattern capture the static and dynamic structures and collaboration of successful solution to problem that arise when building application in particular domain

    Framework supports reuse of detail design and code - A framework is an integrated set of a component that collaborate to provide a reusable architecture for a family of related application

    Together, design patterns and frameworks helps to improve software quality and reduce development time.

    0 讨论(0)
  • 2021-01-31 11:07
    |------------------------|
    |          (------)      |
    |          (ClassA)      |
    |          (------)      |
    | (-----------)          |
    | ((Singleton))          |
    | (-----------)          |
    |         (---------)    |     
    |         ((Factory))    |
    |         (---------)    |
    |                        |
    |                        |
    |------------------------|
    
    Legend:
      |---|  Framework
      (---)  Class
      ()     Design Pattern
    

    A framework is a set of related classes to perform a certain task. Those classes may or may not implement a certain design pattern.

    0 讨论(0)
  • 2021-01-31 11:08

    Pattern: Set of guild-lines, architecturing the application.

    Framework: To follow particular pattern, set of pre-build classes and libraries to create architecture pattern.

    0 讨论(0)
  • 2021-01-31 11:11

    From Object -Oriented Software Development Using Java by Xiaoping Jia:

    Although both design patterns and frameworks are mechanisms used to capyure reusable designs, they are quite different. On the one hand, design patterns are schematic descriptions of reusable designs that are not concrete programs and that are language independent. On the other hand, frameworks are compilable programs written in a specific programming language and often contain abstract classes and interfaces. Design patterns are the architectural building blocks of frameworks. They help make frameworks extendable and reusable. Frameworks usually contain implementations of many cooperating design patterns.

    0 讨论(0)
  • 2021-01-31 11:16

    Even though they are two very different things, one can argue they both solve a software architecture problem

    • a design pattern solves many software architecture issues (about creation, behavior, concurrency, ...) with different pre-defined design. (design being an implementation of an architecture topic)

    • a framework is based on the Hollywood Principle ("Don't call us, we call you"), where you implement some high level requirements as specified, and leave the framework do the rest of the work, calling your implementations.

    A key difference is the scope cohesion:

    • design pattern have a tight scope:

      • class design patterns (involves classes)
      • business design patterns (involves business workflows)
      • application design patterns (involves applications)
    • framework has a large scope:
      For instance, .NET is a framework composed of:

      • a language (C#)
      • a runtime environment (CLR)
      • a collection of libraries
        Just develop what you need and let the .Net framework call your classes.
    0 讨论(0)
  • 2021-01-31 11:18

    A design pattern is a concept, or a receipt for how to get a specific problem done.

    A Framework is code ready for use, usually packaged in a way that makes creating an application much easier.

    It does not make sense to explain the differences because they are two totally different things.

    0 讨论(0)
提交回复
热议问题