为什么术语 API 和 SDK 似乎可以互换使用?

发布于 2024-07-24 07:59:53 字数 107 浏览 5 评论 0原文

与 SDK 的定义相比,可接受的 API 定义是什么? 两者似乎可以互换使用,所以我想一些被称为 API 的库实际上是 SDK,反之亦然。 另外,这种区别有理由吗?

谢谢!

What is the accepted definition of an API compared to the definition of an SDK? Both seem to be used interchangeably, so I'd imagine that some libraries dubbed APIs are in reality SDKs, and vice versa. Also, is there a reason for this distinction?

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

我的奇迹 2024-07-31 07:59:53

API(或应用程序编程接口)定义了应用程序使用某些库或子系统时使用的一组类、函数和结构。 例如,Windows多媒体子系统和Windows套接字子系统都有自己的API。 API 不是一个具体的实体,你不能指向一个文件并说该文件本身就是一个 API。 API 只是程序使用库或子系统所需的通信协议的规范。

SDK(或软件开发套件)包含针对 1 个或多个 API 进行编程所需的工具、文档和所需文件。 某些 SDK(但并非全部)可能包含示例代码来演示如何使用 API。 SDK 的 2 个示例是 Windows Platform SDK 和 .NET Framework SDK。

这些术语互换使用的最可能原因是,有时 SDK 仅包含单个 API 的工具、文档和文件,并且 API 和 SDK 共享相同的名称。 用于开发 winamp 插件的 SDK 就是一个例子。

An API, or application programming interface, defines a set of classes, functions, and structures to be used by an application to make use of some library or subsystem. For example, both the windows multimedia subsystem, and windows sockets subsystem both have their own API. An API is not a concrete entity, you can't point at a file and say that the file itself is an API. An API is merely a specification for a communications protocol that a program needs to use to make use of a library or subsystem.

An SDK, or software development kit, contains tools, documentation, and needed files, to program against 1 or more APIs. Some SDKs, but by no means all, may contain sample code to demonstrate how an API can be used. 2 examples of an SDK are the Windows Platform SDK and the .NET Framework SDK.

The most likely reason the terms are used interchangeably is because sometimes an SDK only has the tools, documentation, and files for a single API, and both the API and SDK share the same name. An example of this would be the SDK for developing winamp plugins.

<逆流佳人身旁 2024-07-31 07:59:53

API——应用程序编程接口。 这就是您编写代码的目的。

SDK——软件开发工具包。 这些是您进行编码所需的库。 SDK 中可能包含许多不同的 api。

API - Application Programming Interface. This is what you write code to.

SDK - Software Development Kit. These are the libraries that you need so you can code. An SDK likely has many different api's contained in it.

夏夜暖风 2024-07-31 07:59:53

到目前为止,我所看到的答案都没有真正清楚、完整地描述它。

这两个术语不可互换,如果有人互换使用它们,则表明缺乏理解或精确性。

API - 应用程序编程接口。 由类库公开。 由应用程序使用。 当您构建使用该库的应用程序时,这是您的代码用于连接或调用该库的接口。 换句话说,应用程序必须遵循一组规则和约定才能使用该库。 API 包括类、它们的方法、方法的参数列表以及其他支持元素(如枚举、常量等)。 API 是一种抽象工件:您无法下载 API 或安装 API。 您可以描述一个 API,并且可以使用一个 API。 库本身就是API、交付机制的具体实现。

SDK - 软件开发套件。 这是一个具体的事情。 您可以下载 SDK、安装它、存储它。 SDK 包括:

  • 库,如您所知,公开或提供 API。
  • 头文件(如果适用)
  • 文档 - 自述文件、帮助文件、发行说明、参考文档、编程指南。 实现为 .CHM 文件、pdf 文档等
  • 工具 - 例如编译器、汇编器、链接器、分析器、调试器、优化器、测试工具等。
  • 示例代码和示例应用程序 - 展示如何使用 API
  • 也许还有其他一些不属于上述类别之一的东西

具体示例:

  • Java SDK 是一个可下载的、版本化的东西。 它提供库、工具(在 Windows 上:javac.exe、java.exe、jar.exe 等)、所有帮助文件和 API 文档以及库的源代码。
  • Java API 是您的代码调用库时必须遵循的一组规则; API 文档中描述了这些规则。

None of the answers I've seen so far really capture it clearly and completely.

The two terms are not interchangeable and if someone uses them interchangeably, it indicates a lack of understanding or preciseness.

API - Application Programming Interface. Exposed by a class library. Utilized by an application. When you build an application that uses the library, this is the interface your code uses to connect to or call into the library. In other words the set of rules and conventions applications must follow to use the library. The API includes the classes, their methods, the parameter lists for the methods, and other supporting elements (like enumerations, constants and so on). An API is an abstract artifact: You cannot download an API, or install an API. You can describe an API, and you can use one. The library itself is the concrete realization of the API, the delivery mechanism.

SDK - Software Development Kit. This is a concrete thing. You can download an SDK, install it, store it. An SDK includes:

  • libraries, which, as you know, expose or provide APIs.
  • header files (if applicable)
  • documentation - readme files, help files, release notes, reference documentation, programming guides. Realized as .CHM files, pdf documents, etc.
  • tools - such as compilers, assemblers, linkers, profilers, debuggers, optmizers, test tools, and more.
  • sample code and sample apps - showing how to use the API
  • maybe some other stuff that doesn't fit into one of the above categories

A Concrete Example:

  • the Java SDK is a downloadable, versioned thing. It delivers libraries, tools (on windows: javac.exe, java.exe, jar.exe, etc), all the help files and API doc, and source code for the libraries.
  • the API for Java is the set of rules your code must follow to invoke the libraries; these rules are described in the API documentation.
爱你是孤单的心事 2024-07-31 07:59:53

API 是一种应用程序编程接口——它是您的程序可以与之对话的东西。 SDK 通常包含一个 API 以及该 API 的文档。 API 不需要包含文档。 SDK 可能包含 API 组件,但始终包含文档。

An API is an Application Programming Interface -- its something your program can talk to. An SDK usually includes an API along with documentation for the API. An API is not required to contain documentation. An SDK may include the API Components, but will always include the documentation.

携余温的黄昏 2024-07-31 07:59:53

API 可以存在于 SDK 中,但反之则不然。 SDK 通常包含框架或环境的完整规范。 例如,Java SDK 包含 Java 语言的完整规范以及工具、外部库以及供应商决定添加的任何其他内容。 java api 只是这些规范的接口。

APIs can exist within SDKs but not vice versa. SDKs generally contain a complete specifiction of a framework or environment. For example the Java SDK contains a full specification of the Java language plus tools, external libraries and whatever else the vendor decides to throw in there. The java apis are simply the interface to those specifications.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文