Let's say you're looking at breaking up your applications into services. Are there any good reasons to adopt a SOA approach vs. just creating a library API that can be loaded by the applications that need it.
|
|
The difference may be subtle between both. For example in .NET world, you may have an application which would feel like monolithic to an end user and which will work on a same machine, but inside, would be separated into a bunch of WCF services. You may also have architectures where libraries are not strongly linked (addins/plugins) and are just following a protocol when talking to each other. If we avoid talking about those intermediary cases, and deal only with strongly linked API library vs. a separate REST service, then you may want to consider following points:
|
||||
|
|
|
Another advantage of services is that when you update the service, it is immediately deployed to all consumers of the service. So if you fixed a bug, or performance issue, everyone gets the benefit as soon as the updated service goes live, instead of having to distribute an update that people may choose to ignore. |
|||
|
|
|
A SOA approach allows the various services to be hosted and maintained separately. In addition to code, deploying a particular service may require a lot of special configuration (passwords, ports, certificates, etc). Consuming a REST service has a finite amount of complexity that can be clearly documented and easily understood. It's also more secure because it means you don't need to grant access to DBs or other resources to clients. |
|||
|
|
|
Library Advantages:
Service Advantages:
|
|||
|
|
|
If there is a change to an SOA service, then that SOA service will have to be redeveloped, retested and redeployed. All applications that consume that service can continue to do so. A change to a library in a DLL will mean all consumers of that library will have to be redeveloped to reference that DLL, they will all have to be retested and they will all have to be redeployed. There is also the danger this may not happen properly, and different applications will have different versions of the DLL. Sometimes this might not be a problem - perhaps every system should have the version of the library that was present at deployment time (you may have updated your logging system to have helpful new features - do you really need to update every system with it?) in this case a library is fine. But say you have a service for calculating tax rate, and the tax laws change. You don't want to have to update every system to incorporate this change, it would be better to do it in one place. In this case a service is a better option. |
|||
|
|