What are the advantages of creating dll's in the project and not putting the classes directly in it?

6

In the company where I use many DLL's and I have a lot of trouble debugging and understanding this ... In my projects (personal) I always put the classes straight in the same and I do not like them, I find it much easier so, which the advantage of using DLL? remembering that I program in ASP.NET C #.

EDIT: I have access to the source code of the DLL, however one of the problems is, the API key that I call is inside the DLL, in case that key expires I do not get a specific error, I can not debug the method that has inside the DLL because when I import the DLL I can only read the verb of the methods and the name of the attributes. I can only debug if I open the DLL project and run it in there.

    
asked by anonymous 17.04.2018 / 15:46

2 answers

6

I do not know if there are more reasons, but here are the ones I know:

  • When you have large projects, compilation time becomes a problem, so you can compile the DLLs as they are changed, or, for example, after the software is marketed, it allows you to make simple updates
  • Allows you to load and release as needed to conserve machine resources.
  • Organize and distribute project modules in a simpler way.
  • Make the code reusable
18.04.2018 / 18:55
3

The most important reason has already been spoken: Reuse code, you allow other people to use the code that is already ready, which should reduce the time to build new systems, and (should) ensure that the module is functional because you can create unit tests in a more isolated way and have adequate testing coverage.

To complement:

  • You can evolve part of the software in isolation because the other modules load the DLL, but this really only happens if you do not change the signature of the declared functions.
  • You can have more than one version of the module in different DLLs, which can be good or bad depending on how you load the DLL. If you install your DLLs in the Windows folder (or somewhere else shared by the applications that use them) you may have a severe headache (also known as DLL hell).
  • You can create your software with a plugin-based architecture (which will be developed as DLLs) so that you can evolve and incorporate new functionalities even at runtime (with due proportions of problems with code that is running, dependencies of other libraries, and different versions of DLLs).
18.04.2018 / 19:21