Component or service?

September 14, 2006

Every few days, in one forum or the other, I see the question “How to choose between a component and a service” or “shall I make this module a component or a service” or some variation of it. Is there a simple answer?

In my opinion, we should not consider web services and components as an Either Or decision. We should explore if service oriented architecture fits our needs. If we are convinced that SOA is the way to go, we could implement these services as either Components which run within the runtime of the consumer ( to save the network and xml parsing time), or we could place a web service wrapper over the component, make it centrally hosted and access that as a service.

Most architects choose a hybrid model – which is to implement everything as coarse grained component and put a web services wrapper over it, so that they could access it whichever way they wish to.

So the question is When should I distribute my “application block” as components or SDKs and when host them as web service?

When you look at the various discussion around the same ( some of the links are http://www.acmqueue.com/modules.php?name=Content&pa=showpage&pid=246,

http://www.lhotka.net/weblog/CommentView,guid,be2ee6b3-9809-4007-93e1-bc0c405a48a2.aspx

http://msdn.microsoft.com/architecture/default.aspx?pull=/library/en-us/dnbda/html/dataoutsideinside.asp

and

http://msdn.microsoft.com/architecture/default.aspx?pull=/library/en-us/dnbda/html/SOADesign.asp

)

The discussions revolve around:

– Technology independance ( whether the consumer of the application block could be implemented in a different technology to what you have used, i.e. Java instead of C#)

– Hosting vs Distributing ( Whether you keep the data centrally, with the service hosted OR you are fine with the consumers wanting to keep the data close to themselves)

– Performance ( XML processing and network overheads could hinder web service performance, however a central service used by multiple applications could benefit more from caching than distributed users and hence enhance it)

On a final note, read about REST, it might rival SOAP as the chosen way to wrap your components.

Bottomline: Design and implement as objects, create web service or rest wrappers over them.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: