Design patterns vs Frameworks

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

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

12条回答
  •  囚心锁ツ
    2021-01-31 11:04

    This question has been answered a few different ways, though I think a concrete example is missing.

    Design Pattern: A set of rules put together to solve a reoccurring problem. The rules define the pattern. There is no code you can copy paste to implement this. The developer is supposed to understand the rules then implement them.

    Example:

    • Name: Test Driven Development (TDD)
    • Problem: It ensures that the unit tests written cover enough case scenarios that gives you confidence in your production code.
    • Rules: It states that you should write your tests first, then write your code after to pass those tests. This then ensures you're not writing tests to pass your code, but instead writing code to pass your tests.

    Design Patterns are split into 3 categories:

    • Creational Design Patterns:
    • Structural
    • Behavioral

    I've found this link to be helpful in explaining them.


    Framework: A framework, not to be confused with libraries, is the basic structure underlying a system that allows developers to build and deploy software applications in a standardized way.

    Example: The .Net Core framework is a tool that contains a set of libraries that enables developers using the Microsoft stack to write software applications that can be deployed in multiple different environments (Windows, Mac OS, Linux)


    Library: A reusable set of methods/classes put together in one package to provide functionality.

    Example: The System.Collections.dll library enables .Net developers to use things such as a Hashtable.


    It's worth it to also look at other answers, as sometimes it's just a buzzword and it differs from one environment to another. Look here.

    I hope this helps.

提交回复
热议问题