库和 API 之间还有区别吗? [英] Is there still a difference between a library and an API?
问题描述
每当我问人们 API 和库之间的区别时,我都会得到不同的意见.有些人给出了这种的定义,说 API 是一个规范和库是一个实现...
Whenever I ask people about the difference between an API and a library, I get different opinions. Some give this kind of definition, saying that an API is a spec and a library is an implementation...
有些人会告诉你这种类型的定义,API是一堆映射出来的函数,而库只是编译形式的分布.
Some will tell you this type of definition, that an API is a bunch of mapped out functions, and a Library is just the distribution in compiled form.
这一切让我想知道,在网络代码、框架和开源的世界里,真的有什么实际区别了吗?像 jQuery 或 cURL 这样的库可以交叉到 API 的定义中吗?
All this makes me wonder, in a world of web code, frameworks and open-source, is there really a practical difference anymore? Could a library like jQuery or cURL crossover into the definition of an API?
此外,框架是否会跨入这一类别?Rails 或 Zend 中是否有更类 API"或库式"的部分?
Also, do frameworks cross over into this category at all? Is there part of Rails or Zend that could be more "API-like," or "libraryesque"?
真的很期待一些启发性的想法:)
Really looking forward to some enlightening thoughts :)
推荐答案
我的观点是,当我谈到 API 时,它仅指暴露给程序员的部分.如果我说图书馆",那么我的意思也是在幕后"工作的一切,尽管它仍然是图书馆的一部分.
My view is that when I speak of an API, it means only the parts that are exposed to the programmer. If I speak of a 'library' then I also mean everything that is working "under the hood", though part of the library nevertheless.
这篇关于库和 API 之间还有区别吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!