Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the advantages of loading DLLs dynamically?

Looking for the advantages of loading DLLs dynamically as opposed to letting your application load the DLLs by default.

like image 844
James Avatar asked Feb 10 '10 11:02

James


2 Answers

One advantage is for supporting a plugin architecture.

Suppose for example you want to write a service that performs different types of tasks on a scheduled basis. What those tasks are doing, isn't actually relevant to your core service which is just there to kick them off at the right time. And, it's more than likely you want to add support to do other types of tasks in the future (or another developer might want to). In that scenario, by implementing a plugin approach, it allows you to drop in more (compatible by interface) dlls which can be coded independently of the core service. So, adding in support for a new task does not require a new build/deployment of the whole service. If a particular task needs to change, just that dll needs to be redeployed and then automatically picked up.

It also requires other developers to not be concerned with the service themselves, they just need to know what interface to implement so it can be picked up.

like image 161
AdaTheDev Avatar answered Sep 19 '22 01:09

AdaTheDev


We use this architecture for our processing applications to handle differences that our different customers require. Each DLL has a similar structure and implements the same interface and entry method "Process()". We have an XML file that defines which class to load based on the customer and whether there are more methods besides process that needs to be called. Performance should not be an issue until your transaction count gets very high.

like image 29
chamiltongt Avatar answered Sep 19 '22 01:09

chamiltongt