Jul 5, 2012

Service versus component and SOA versus CBA?

Q. What is the difference between a component and a service?
A. Both components and services are self-contained functionality. Services enable your components to go across language boundary. For example, a component in .Net can talk to a component in Java through generalized messages in XML via Web services (i.e SOAP or RESTFul).

Components are made up of classes, interfaces, and EJBs. Components are used inside the programming boundary. The diagram below shows how you get self contained functionality and re-usability via components and services. Don't confuse yourself with some components being named like portfolio-service. This indicates it is a service layer containing the business logic. The portfolio-dao means portfolio data access object layer. The portfolio-interface contains the domain and POJO classes. These self contained components are used by both portfolio-client.ear, which is a web client and the portfolio-backend.ear, which is the service provider that exposes the business functions as web services across across the language boundaries. A .Net web client can still invoke the RESFul service. But the components in blue can only be used within Java programming boundary. The example shown below is Java based.

It is imperative to understand this difference not only when you are designing a system, but also when you are debugging your application. You need to know where to turn on the debugger for the same component used in 2 different JVM processes. That is the portfolio-client process and the portfolio-backend process. The components in blue are packaged into both deployable (i.e ear) artifacts. Similar color coded diagrams are required to communicate your design to your target audience. The color codes can indicate
  • Shared versus non-shared or reusable versus non-reusable component.
  • New versus existing component.
  • Buy (i.e. third-party ) versus build component. 

When designing a system, think as to

  • How these components are going to be packaged and deployed.
  • Dependencies between the packages and the components. Avoid cyclic dependencies.. 

Q. What is the difference between a Service Orieneted Architecture (SOA) and a Component Based Architecture (CBA) ?
A.  If you work with components, you are predominantly working with the code within the language boundary. For example, classes, interfaces, EJBs, JSF components, JavaScript widgets,  etc. If you work with services, you use some remote functionality over network under some contract. The contract will be in the form of an agreed XML message or JSON data.

Composing services into higher-level processes as in SOA is totally different than linking some components together into an application as in CBA.

A service contract is totally different from a component interface. A component can also offer its functionality over a network via RMI, IIOP, DCOM, CORBA, etc. But if you don't use an EJB as a service, then it's likely to be a component within your JEE application. A component can be exposed as a service. You can take an EJB component and expose it as a web service.

As the industry is moving from application oriented architecture to SOAwhere the applications are looked at as a set of services and components working together in fulfilling a certain business need.This is known as the SOBA (Service Oriented Business Applications). The services can be built with varying technologies like JEE, .Net, Ruby, etc. This architecture is used with the "single page web design".

Q. What is a Service Component Architecture (SCA)?
A.  The programming model that specifies how to create and implement services, how to reuse services, and how to assemble or compose services into solutions is achieved via SCA (Service Component Architecture). According to wikepedia, Service Component Architecture (SCA) is a software technology created by major software vendors including IBM and Oracle. SCA provides a model for composing applications that follow Service-Oriented Architecture principles.

SCA encourages organization of business application code based on components that implement business logic, and extend their capabilities through service-oriented interfaces to allow other components to consume functions through the service-oriented interfaces, called service references. SCA divides up the steps in building a service-oriented application into two major parts:
  • The implementation of service components  that provide services and consume other services.
  • The assembly of sets of components to build business applications, through the wiring of service references to services.

Note: If you are aspiring to be an architect, read up more on SCA (Service Component Architecture).



Blogger Nithyanantham. T said...

I applied tamil translation... and could not continue to read. I guess the google translate goes for word by word translation and this does not make much sense here.

9:05 AM, February 25, 2014  
Blogger Arulkumaran Kumaraswamipillai said...

You are right.

9:37 AM, February 25, 2014  

Post a Comment

Subscribe to Post Comments [Atom]

Links to this post:

Create a Link

<< Home