windows API、框架和中间件有什么区别?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3934866/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 07:40:05  来源:igfitidea点击:

What is the difference between an API , framework and middleware?

windowsapiframeworksterminologymiddleware

提问by Laz

Just Randomly got this question in my head! Whats the difference between API , Framework and middleware? Essentially all of them provide abstract low level services to apps. In that case why is dot net called framework and windows API called well.. API?

只是在我脑海中随机出现了这个问题!API、框架和中间件有什么区别?基本上所有这些都为应用程序提供抽象的低级服务。在那种情况下,为什么 dot net 称为框架而 windows API 称为好.. API?

回答by hvgotcodes

An API is an Application Programmer Interface. Its just a term that refers to the methods a programmer will use to interface with the software. For example, a DAO might have a save() method. Save is part of the DAO API. At a high level, you might have an Add User to System functionality. Thats part of the system API.

API 是应用程序程序员接口。它只是一个术语,指的是程序员将用于与软件交互的方法。例如,一个 DAO 可能有一个 save() 方法。保存是 DAO API 的一部分。在较高级别,您可能具有将用户添加到系统功能。那是系统 API 的一部分。

A framework is a tool or set of tools. For example, Spring is a framework that manages your inversion of control, dependency injection, and provides nifty templates to make your life easier. You use Spring via its API.

框架是一个工具或一组工具。例如,Spring 是一个框架,可以管理您的控制反转、依赖注入,并提供漂亮的模板让您的生活更轻松。您可以通过其 API 使用 Spring。

Middleware is software that allows a bunch of isolated systems or functionalities to interact. So if you have a website, and a payment system, you use middleware to hookem up.

中间件是允许一堆孤立的系统或功能进行交互的软件。因此,如果您有一个网站和一个支付系统,则可以使用中间件进行连接。

回答by Nick

An APIis an interface to a programming library(or libraries). It doesn't impose on you a way of doing anything. E.g. OpenGL doesn't restrict what you can do with it.

一个API是一个到一个编程库接口(或文库)。它不会强加给你做任何事情的方式。例如,OpenGL 不限制你可以用它做什么。

A frameworksupplies you with part finished solution to a problem. You fill in the blanks to make what you want. This might accelerate what you are doing, but you are also limited by the limitations of the framework, e.g. design, performance, functionality. -- E.g. MFC provided a way of creating UIs. It supported dialogs well, but not forms, and things like docking were limited and contained bugs. Windows Forms is a much more capable framework (from the architect of Borland Delphi!) which is better in every way: design, flexiblitiy, tools, etc. Frameworks are great until they don't do something you want them to do and then you may lose most of the time you gained trying to work around them.

一个框架,向您提供部分完成的解决问题的办法。你填空来做你想要的。这可能会加速您正在做的事情,但您也受到框架限制的限制,例如设计、性能、功能。-- 例如,MFC 提供了一种创建 UI 的方法。它很好地支持对话框,但不支持表单,并且诸如停靠之类的东西受到限制并且包含错​​误。Windows Forms 是一个功能更强大的框架(来自 Borland Delphi 的架构师!)它在各个方面都更好:设计、灵活性、工具等。可能会失去您尝试解决这些问题所获得的大部分时间。

Middlewareis a vertical slice. If you think of software as layered (E.g. OS, hardware abstractions, utility libraries, etc), middleware incorporartes many of these layers vertically. It provides a full, or partial, solution to an area within your application. E.g. a brokered messaging system, or a rendering library/engine. Middleware supplies more than just the basic library, it also supplies associated tools like logging, debugging and performance measurement. One thing you have to be careful about when using middleware is the DRYprinciple. Because middleware is verticalsystem, it may compete or duplicate other parts of your application.

中间件是一个垂直切片。如果您将软件视为分层的(例如操作系统、硬件抽象、实用程序库等),中间件会垂直合并许多这些层。它为您的应用程序中的某个区域提供了完整或部分的解决方案。例如,代理消息传递系统或渲染库/引擎。中间件不仅提供基本库,还提供相关工具,如日志记录、调试和性能测量。使用中间件时必须注意的一件事是DRY原则。因为中间件是垂直系统,它可能会竞争或复制应用程序的其他部分。

回答by Steve Townsend

A framework implements an API. The API isolates framework clients from the implementation details of the underlying framework. Thus (broadly speaking) you can use Mono or .Net Framework to run a program based on common source code, because the API to either framework is the same.

一个框架实现了一个 API。API 将框架客户端与底层框架的实现细节隔离开来。因此(广义而言)您可以使用 Mono 或 .Net Framework 来运行基于公共源代码的程序,因为这两个框架的 API 是相同的。

Middleware is typically a framework specialized for interprocess communication.

中间件通常是专门用于进程间通信的框架。

回答by juancn

An API is a programatic interface to a system. You use it to interact with a system, but does not force any structure in your program (ideally).

API 是系统的编程接口。您使用它与系统交互,但不会强制您的程序中包含任何结构(理想情况下)。

A framework, dictates the way you write certain types of applications in order to reduce the amount of boilerplate needed. It solves some common problems for the applications of it's type.

框架规定了您编写某些类型的应用程序的方式,以减少所需的样板数量。它解决了其类型应用程序的一些常见问题。

Middleware is mostly marketing-speak. There are many definitions, but usually involve a big framework with some tooling built around it. Some commercial game engines can be thought of middleware, SOA platforms also are referred as middleware, etc.

中间件主要是营销方面的。有很多定义,但通常涉及一个带有一些围绕它构建的工具的大框架。一些商业游戏引擎可以被认为是中间件,SOA平台也被称为中间件等。

回答by Mamunar Rashid

The main difference is the purpose of functionality.

主要区别在于功能的目的。

An API is designed to solve some specific problem in a particular domain.it contains necessary data structure, classes,methods,interface etc. Such as ADO.net API provides the functionality to connecting Microsoft SQL Server.

API 旨在解决特定领域中的某些特定问题。它包含必要的数据结构、类、方法、接口等。例如 ADO.net API 提供连接 Microsoft SQL Server 的功能。

A framework designed to help developer to reusable,scalable software application.a frameworks has no specific functionality like API but its various functionality exposed by API . Such as , ADO.net is an API of .net framework for accessing data service. A framework has compiler, programs,class libraries,run-time.it can add plug-in.

旨在帮助开发人员开发可重用、可扩展的软件应用程序的框架。框架没有像 API 这样的特定功能,但它的各种功能由 API 公开。例如,ADO.net 是.net 框架的一个API,用于访问数据服务。一个框架有编译器、程序、类库、运行时。它可以添加插件。