.net 框架和架构有什么区别?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2190625/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What is the difference between framework and architecture?
提问by sikender
I would like to know the difference between framework and architecture.
for example: dotnetnukeis the framework and mvcis the architecture.
我想知道框架和架构之间的区别。
例如:dotnetnuke是框架,mvc是架构。
so if we take both of this as a example, can anyone tell me difference between them?
Want to know which one is using when and where?
Which is good in terms of user requirement satisfaction?
所以如果我们以这两个为例,谁能告诉我它们之间的区别?
想知道哪个在何时何地使用?
在用户需求满意度方面哪个好?
回答by Vasyl Boroviak
Let me illustrate the difference.
让我来说明差异。
Framework:
框架:


Architecture:
建筑学:


回答by Mark Seemann
It's common to make this distinction:
做出这种区分是很常见的:
- A Libraryis a reusable set of types/functions you can use from a wide variety of applications. The application code initiates communication with the library and invokes it.
- A Frameworkconsists of one or more libraries, but the difference is that Inversion of Controlapplies. The application registers with the framework (often by implementing one or more interfaces), and the framework calls into the application, which may call back into the framework. A framework often exists to address a particular general-purpose Domain (such as web applications, or workflows, etc.).
- Architectureconsists of the guiding principles behind a given application. It is not strongly tied to a particular framework or library.
- 一个库是一个可重用的类型集合/功能,你可以从各种各样的应用程序中使用。应用程序代码启动与库的通信并调用它。
- 一个框架由一个或多个库组成,但不同之处在于控制反转适用。应用程序向框架注册(通常通过实现一个或多个接口),框架调用应用程序,应用程序可能会回调到框架中。通常存在一个框架来解决特定的通用领域(例如 Web 应用程序或工作流等)。
- 架构由给定应用程序背后的指导原则组成。它与特定框架或库没有紧密联系。
回答by Art
Simply put -- architecture is theory, framework is implementation.
简单地说——架构是理论,框架是实现。
回答by Matthieu
Frameworks is a collection of classes and tools that help you developing great softwares ... like .net framework or Qt.
Architecture is entirely different : it refers to design pattern or how an application or a framework is organized. What are the modules that compose it and how they communicate together !
Frameworks 是一组类和工具,可帮助您开发出色的软件……例如 .net 框架或Qt。
架构完全不同:它指的是设计模式或应用程序或框架的组织方式。组成它的模块是什么以及它们如何一起通信!
回答by Ravi Gupta
Also to note the difference between design and architecture:
还要注意设计和架构之间的区别:
Design: When you talk about what to do when a user logs in ?
Ex. Usability, portability, accessibility etc.Architecture: When you talk about what to do when 5000 users logs in simultaneously ?
Ex. Scalability, reliability, availability, performance etc.
设计:当您谈到用户登录时该怎么办?
前任。可用性、便携性、可访问性等。架构:你说5000个用户同时登录怎么办?
前任。可扩展性、可靠性、可用性、性能等。
回答by Tiju John
Architecture is about style, abstract idea, flow, methodology, concept. Framework is something which implements the style, idea, concept etc..or makes it easier to implement it. example,
建筑是关于风格、抽象思想、流程、方法论、概念。框架是实现风格、想法、概念等的东西。或者使它更容易实现。例子,
Architecture: Every component should have standard pluggable interfaces and it should be possible to connect any component to any other.
架构:每个组件都应该有标准的可插拔接口,并且应该可以将任何组件连接到任何其他组件。
Framework: Then lego building blocks can be the framework.
框架:那么乐高积木可以作为框架。
Library: some readymade combinations of blocks that would work as the pillars.
图书馆:一些现成的块组合,可以作为支柱。
Application: A building structure using the pillars and other building blocks(application).
应用:使用柱子和其他积木(应用)的建筑结构。
回答by Oded
Frameworks are generally a partof your architecture. They are normally part of the infrastructure of your code. MVC is a framework, as is ASP.NET, WinForms and many many libraries (NHibernate, PostSharp and more).
框架通常是架构的一部分。它们通常是代码基础结构的一部分。MVC 是一个框架,就像 ASP.NET、WinForms 和许多库(NHibernate、PostSharp 等)一样。
Architecture refers to how your software it put together - how it is organized, how the different classes and modules in it interact.
架构是指你的软件如何组合在一起——它是如何组织的,它中的不同类和模块如何交互。
回答by Mitch Labrador
MVC is pattern as supposed to an architecture, it may be used as a technique in your architecture though. Framework as others have said is a collection of tools you use to implement your architecture. In other words framework is the tool-belt.
MVC 是一种架构模式,尽管它可以在您的架构中用作一种技术。正如其他人所说,框架是用于实现架构的工具集合。换句话说,框架就是工具带。
回答by Rorick
Framework is a part of architecture implementation. Say, our app will be organized according to MVC architecture and will use SpringMVC framework for that. Different frameworks are organized according to different architectural patterns. Someone can say, that term "framework" is itself describes architectural pattern. Its "opposite"is "library", because libraries are directly controlled by your application while frameworks use inversion of control and theycontrol execution of your code. Though, there are controversies in using term "framework".
框架是架构实现的一部分。比如说,我们的应用程序将根据 MVC 架构进行组织,并为此使用 SpringMVC 框架。不同的框架根据不同的架构模式进行组织。有人可以说,“框架”这个词本身就是对架构模式的描述。它的“对立”是“图书馆”,因为图书馆是由你的应用程序,同时框架使用控制反转,直接控制他们控制你的代码的执行。但是,使用术语“框架”存在争议。
回答by softveda
I think framework is something that is created by someone and available to you to accomplish a objective. Like MFC is a framework to write GUI application. Frameworks takes full control from you but gives you the advantage of not trying to do everything from ground up. In most cases it is better to use a well designed and tested framework, rather than write your own.
In this context architecture is how the framework has been designed and possibly the way to use the framework from you application maintaining the vision of the framework designers.
我认为框架是由某人创建并可供您完成目标的东西。就像 MFC 是一个编写 GUI 应用程序的框架。Frameworks 由您完全控制,但让您不必尝试从头开始做所有事情。在大多数情况下,最好使用经过良好设计和测试的框架,而不是编写自己的框架。
在这种情况下,架构是框架的设计方式,也可能是从您的应用程序中使用框架的方式,以维护框架设计者的愿景。
But broadly architecture is the design principle and can encompass not only software but complete systems as well. Think security, integration, reporting, infrastructure aspects etc.
但广义上的架构是设计原则,不仅可以包含软件,还可以包含完整的系统。考虑安全性、集成、报告、基础设施方面等。

