跳至主要内容

API与服务的差异(APIs versus Services)

最近突然对于API以及API管理相关的内容感兴趣,于是上18摸的API Management网站下载了一本《APIs For Dummies》的IBM版本做入门的学习。当看到其中的APIs versus services一节,对于API与服务差异的解释,很是清晰,也解开了自己一直以来的疑问。尤其是利用汽车来比喻API与Service的异同,真令人印象深刻。不惜做一回搬运工,把书中的内容做个归纳。

SOA的核心是服务(Service),单纯从技术的角度来看,其实API也是一种服务。但是否API就等于服务呢,这又不尽然。服务与API最大的差别,是它们设计目标的不同。API总是设计用来吸引预期的使用者,当使用者的需求发生改变API也相应改变。与此相反,对于服务的设计,全局的成本和稳定性往往更加重要。使用汽车来比喻的话,API的设计是赛车,注重于外观和使用,而服务的设计是常规的汽车,更着眼与成本和大批量的生产。
APIs and services address different concerns
APIs and services address different concerns


API的产品本质是面向特定的使用者,对于使用者来说,使用API意味着快速、方便与极短的学习曲线。至少从服务提供者的角度来看,这些设计标准是传统的服务与API的根本性差别。
  • 对服务提供者来说,重用包含于API交付的努力中;对于API的使用者,重用是关乎他们软件的交付速度,不管需要为作为软件一部分的API付出多大的代价。
  • 对于服务提供者来说,共享是关乎效率;对于API使用者,共享是是否方便(如果不方便,该API将没人使用)
  • 对于服务提供者来说,封装是更少的改变;对于API使用者,封装是更短的学习曲线(如果接口太复杂,API将没人使用)

有多少SOA项目没有因为服务提供者和服务使用者间因为服务接口由什么组成的冲突而停滞的?一方面,一个移动应用开发者希望API对于她的应用要足够简单;另一方面,后台团队希望大家使用相同的标准化的服务和数据模型。有没有一种既能满足需求,又不会产生高昂费用的强制双方接受的权宜解决方法呢?

API与服务的结合

SOA是屏蔽服务使用者与后端变化的方法。但是谁能为需求不断变化的前端多渠道应用的服务提供者提供保护呢?结合API和服务可使你沉着应对剧变的环境。服务是由服务提供商整理的应用域的基本功能,API是在这些功能(服务)以易于共享形式的重新包装,产品化。所以说API和服务是互补,而不是相互矛盾的,把API和服务结合在一起,将极大地提高企业创新的整体效益。

评论

此博客中的热门博文

Installing RHEL EPEL Repo on Centos 5.x or 6.x

习惯了用yum来安装东西,试了下这篇文章提到的做法workable,再做一次搬运工。 原文出处: http://www.rackspace.com/knowledge_center/article/installing-rhel-epel-repo-on-centos-5x-or-6x Authored by: Rackspace Support How to install RHEL EPEL repository on Centos 5.x or 6.x The following article will describe how to configure a CentOS 5.x-based or Centos 6.x-based system to use Fedora Epel repos and third party remi package repos. These package repositories are not officially supported by CentOS, but they provide much more current versions of popular applications like PHP or MYSQL. Install the extra repositories The first step requires downloading some RPM files that contain the additional YUM repository definitions. The instructions below point to the 64-bit versions that work with our Cloud Server instances. Centos 5.x wget http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm wget http://rpms.famillecollet.com/enterprise/remi-release-5.rpm sudo rpm -Uvh remi-release-5*.rpm epel...

64位OEL 6安装Oracle RCU报“libXext.so.6: cannot open shared object file: No such file or directory”的解决方法

在64位的Oracle Enterprise Linux 6上时报“ libXext.so.6: cannot open shared object file: No such file or directory ”的错误,已经装了64位x11相关的包,可见是缺少32位的包引起的。 1.libXext.so.6错误信息如下: 无法使用位置 /home/ecm/oinstall/rcuHome/rcu/log/logdir.2011-12-26_09-54/rcu.log 初始化日志记录程序 使用以下位置初始化日志记录程序: /tmp/logdir.2011-12-26_09-54/rcu.log Exception in thread "main" java.lang.UnsatisfiedLinkError: /home/ecm/oinstall/rcuHome/jdk/jre/lib/i386/xawt/libmawt.so: libXext.so.6: cannot open shared object file: No such file or directory     at java.lang.ClassLoader$NativeLibrary.load(Native Method)     at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1806)     at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1702)     at java.lang.Runtime.load0(Runtime.java:770)     at java.lang.System.load(System.java:1003)     at java.lang.ClassLoader$NativeLibrary.load(Native Method)     at java.lang.ClassLoader.loadLibrar...

How to Convert a VMware Pre-allocated Virtual Disk to a Growable Virtual Disk

受不了动辄几百G的虚机,记给自己看,只是在网络上搬运,来源在这里: http://www.virtuatopia.com/index.php/How_to_Convert_a_VMware_Pre-allocated_Virtual_Disk_to_a_Growable_Virtual_Disk 。 he vmware-vdiskmanager tool The VMware Disk Management Tool is a command line tool which is installed by default with VMware Server. The executable file is named   vmware-vdiskmanager   and is located in   \Program Files\VMware\VMware Server   on Windows hosts, and   /usr/bin   on Linux systems. The tool accepts a number of command-line arguments, a full listing of which can be obtained by running vmware-vdiskmanager with no options. vmware-vdiskmanager Virtual Disk Types The type to which a virtual disk is to be converted is specified using the -t flag, together with the target disk type. This is represented by a number as outlined in the following table: Type Identifier Description 0 Growable (single .vmdk file) 1 Growable (multiple 2GB files) 2 Pre-allocated (single file) 3 Pre...