Choosing Between DLL and Web Service for Common Functions

cdesignvb.netwcfweb services

We have a variety of basic functions (date utilities, email sending, internal math calculations, etc) that are currently in an old VB.NET project.

We're going to move towards C# and I'm wondering if we should write a new library that our applications can reference as a DLL or should we create a web service that our applications can call to do these things?

My current thought is for basic functions that return simple objects we can create a web service.

Edit: the main debate for us is that if we use a DLL that we deploy with various apps we have to then redeploy the DLL to all of them if we update it in the future. With a web service since the apps would all hit an endpoint we just update that.

Best Answer

If your entire stack is .net there is not much value to creating web services. Just reference the DLLs in the .net components that need them, it will be faster as there is no serialization or extra network hop involved.

However, for cross platform purposes, web services are the way to go. Then you can have a .net client (ASP MVC app), java client, native mobile client, etc. that all consume the functionality provided by your .net service.

This adds tremendous value when you don't know what clients will be using your functionality or if your organization has several technology stacks. However, the addition of web services does add some overhead to your architecture in regards to network and serialization of messages. Web services are more flexible/future/forward thinking so you can swap out or use multiple front ends for the same service.