API classification of

The difference between the API and SDK

API=Application Programming Interface, 应用程序编程接口
SDK=Software Development Kit,软件开发包
二者关键的区别在于 接口和包 上
SDK一定定义了接口,但API不一定有包
比如Windows SDK里面包含了各种lib、dll

API classification of

个人理解,API大致分为两类
一类是基于源码的接口
一类是基于协议的接口

Based on source interfaces

  • Scenes
    • Interface usually in the process of adopting such an interface
    • When the interface needs across process control, and communication is a proprietary protocol, usually using such interface
    • In order to reduce the threshold of the second development, the use of such interfaces will
  • Form provided
    • Generally, such interfaces are based on C / C ++ provides, because other languages ​​also have a mechanism to call
    • Provides the interface header file, lib, dll (a or so)
  • advantage
    • It allows developers to more easily call
    • General duplex protocol is the underlying protocol, you can do better server push
  • Shortcoming
    • Maintenance costs
    • We need to consider a variety of cross-platform process
    • Upgrade compatibility issues need to be considered

Based interface protocol

  • Scenes
    • C / SB / S and other inter-process communication model
    • The server can provide external standard communication protocol
  • Form provided
    • To develop a standard communication protocol interfaces encoding protocol +
    • At present more combinations is Http + Json or Http + Xml
    • Of course there grpc used http2 + pb
  • advantage
    • More open, more compatible with the current development model of the Internet
    • More attention into the server
    • The upgrade can be better
  • Shortcoming
    • Http itself is the problem, push too much trouble
    • Secondary developers need to deal with their client logic

Other extension

  • About RESTFul and RPC
    • RESTFul often heard the API, is used for the communication protocol specification
      • Operation requires strict compliance with POST GET PUT DELETE
      • URL needs to ensure that each URL represents an object or a class of objects, can not contain verbs
    • RPC is used to invoke the specification between C / S or B / S
      • google's grpc
      • facebook的thrift

Original: Big Box  classification of API


Guess you like

Origin www.cnblogs.com/chinatrump/p/11612096.html