Service/Component/Plug-in
the term "service-oriented" has existed for some time, it has been used in different contexts and for different purposes. One constant through its existence has been that it represents a distinct approach for separating concerns.
说得很有道理,Service-Oriented中的Service在不同的上下文中有着不同的含义. 在Component Based Development中经常把严格划分的接口称为Service.
最早接触到Service和Component的争论来自于Avalon, Apache下已经关闭的一个开源项目,致力于构建Java Server Application开发的平台,其Phonix和Avalon Framework作为Java领域Component和Container的先行者,就是因为对于Component和Service的使用之争导致了框架接口的变化,最终导致小社区的瓦解.
最近看到Martin Flower的经典文章Inversion of Control Containers and the Dependency Injection pattern,他是这样做得区分: A service is similar to a component in that it's used by foreign applications. The main difference is that I expect a component to be used locally (think jar file, assembly, dll, or a source import). A service will be used remotely through some remote interface, either synchronous or asynchronous (eg web service, messaging system, RPC, or socket.)
最近得益于上次presentation的收获,对于Component和Service和Eclipse Plug-in的共同和差别有了自己的体会: 从描述软件粒度单元的角度,他们才具有可比性,也就是有Component Based/Service-oriented/Plug-in Based的热门词汇, Component和Plug-in是属于物理上Local的软件单元,Component要遵循Component Framework 运行在Container中的,而Plug-in是一种具有运行时多态性的Component,这种多态的实现机理埋藏在Plug-in规范中. Service是更高Level的粒度,也就是说Service可以利用Component和Plug-in来实现,具体体现SOA中. 所以建议OSGi中能用其他词语来表达Bundle的运行时行为,省得搞得很多人迷惑.