What's the difference between design patterns and architectural patterns?

前端 未结 5 954
遥遥无期
遥遥无期 2020-11-29 14:28

When we read about design patterns on the internet we note that there are 3 categories:

  • Creational
  • Structural
  • Behavioral
5条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-11-29 15:20

    Design Patterns differ from Architectural Patterns in their scope, they are more localized, they have less impact on the code base, they impact a specific section of the code base, for example:

    How to instantiate an object when we only know what type needs to be instantiated at run time (maybe a Factory Class?)
    How to make an object behave differently according to its state (maybe a state machine, or a Strategy Pattern?)
    

    Architectural Patterns have an extensive impact on the code base, most often impacting the whole application either horizontally (ie. how to structure the code inside a layer) or vertically (ie. how a request is processed from the outer layers into the inner layers and back). Examples of Architectural Patterns: Model-View-Controller, Model-View-ViewModel

提交回复
热议问题