设计模式和建筑模式有什么区别? [英] What's the difference between design patterns and architectural patterns?

查看:605
本文介绍了设计模式和建筑模式有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我们阅读互联网上的设计模式时,我们注意到有3个类别:

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


  • 创作

  • 结构

  • 行为

但是当我们创建一个软件的架构,然后我们考虑MVP,MVC或MVVM。

But when we create the architecture of a software, then we think about MVP, MVC or MVVM.

例如,在创作模式中,我发现了单例模式 ,但我也在我的MPV中使用单身人士。

For example, among creational patterns I found the singleton pattern, but I have also used singleton in my MPV.

所以我的问题是:产品的所有结构都是设计模式吗?

So my question is: Is a design pattern a over all structure of a product?


  • 如果是,那么单例可以是一个设计模式吗?因为我可以在我的应用程序中的任何地方使用它。基本上,它只限于在内存中一次创建一个实例,但是这个概念不是定义软件的设计方式吗?

  • If yes, then how singleton can be a design pattern? Because I can use it anywhere in my application. Basically, it is restricted only to create one instance at a time in memory, but doesn't this concept define how software is designed?

如果没有,那么MVP,MVC和MVVM在哪三种模式中?软件的设计和架构有什么区别?

If not, then where are MVP, MVC and MVVM in the three categories of patterns? And what is the difference between design and architecture of software?

推荐答案

需要一个详细的解释,但我会尽量简化我所知道的差异。

It requires a detailed explanation but I will try to sketch the differences to best of my knowledge.

模式是在程序中找到的蒸馏通用性。它允许我们使用简单的部分来解构大型复杂的结构和构建。它为一类问题提供了一般的解决方案。

Patterns are distilled commonality that you find in programs. It allows us to deconstruct a large complex structure and build using simple parts. It provides a general solution for a class of problems.

大型复杂软件经历了不同层次的一系列解构。在很大程度上,建筑模式是工具。在较小的层面上,设计模式是工具,在实现层面上,编程范例是工具。

A large complex software goes through a series of deconstruction at different levels. At large level, architectural patterns are the tools. At smaller level, design patterns are the tools and at implementation level, programming paradigms are the tools.

模式可能发生在非常不同的层次。请参阅分形。快速排序,合并排序都是用于组织一系列元素的算法模式。

A pattern can occur at very different levels. See Fractals. Quick sort, Merge sort are all algorithmic patterns for organizing a group of elements in a order.

对于最简单的视图:

 Programming paradigms   Specific to programming language
 ......................
 Design patterns         Solves reoccurring problems in software construction
 ......................
 Architectural patterns  Fundamental structural organization for software systems
 ......................

成语是范式特定的语言编程技术,可以填写低级细节。

Idioms are paradigm-specific and language-specific programming techniques that fill in low-level details.

设计模式通常与代码级共同点相关联。它提供了各种改进和构建较小子系统的方案。它通常受编程语言的影响。由于语言范式,某些模式变得无关紧要。
设计模式是中等规模的手段,可以体现实体及其关系的一些结构和行为。

Design patterns are usually associated with code level commonalities. It provides various schemes for refining and building smaller subsystems. It is usually influenced by programming language. Some patterns pale into insignificance due to language paradigms. Design patterns are medium-scale tactics that flesh out some of the structure and behavior of entities and their relationships.

虽然架构模式被看作是比设计模式更高层次的共性。
建筑模式是涉及大型组件,系统的全局属性和机制的高级策略。

While architectural patterns are seen as commonality at higher level than design patterns. Architectural patterns are high-level strategies that concerns large-scale components, the global properties and mechanisms of a system.

如何获取模式?
通过:

How are patterns obtained? Through :


  1. 重复使用

  2. 分类

  3. ,最后抽象来提炼出共同点。

如果您遵循上面提到的想法。您将看到Singleton是一种设计模式,而MVC是处理分离问题的架构模式之一。

If you have followed the thoughts laid above. You will see that Singleton is a "design pattern" while MVC is one of the "architectural" pattern to deal with separation of concerns.

尝试阅读:


  1. http: /en.wikipedia.org/wiki/Architectural_pattern_(computer_science)

  2. http://en.wikipedia.org/wiki/Design_pattern

  3. http://en.wikipedia.org/wiki/Anti-pattern

  1. http://en.wikipedia.org/wiki/Architectural_pattern_(computer_science)
  2. http://en.wikipedia.org/wiki/Design_pattern
  3. http://en.wikipedia.org/wiki/Anti-pattern

这篇关于设计模式和建筑模式有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆