Design patterns vs Frameworks

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

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

12条回答
  •  天命终不由人
    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.

提交回复
热议问题