Are DLLs redundant in .NET?
-
PIEBALDconsult wrote:
I don't see a big benefit.
You'd be separating the "testing" code from the code being tested. Better yet, put it in your own class, as opposed to the
Program
class, and get the benefits of inheritance. I can see how one would create an application that executes SQL from the command prompt, and references this as if it is a library to get the appropriate databaseclasses. Then again, you don't want to be referencing a WinApp application from a Webapplication and have it load the complete Forms-environment and all its dependencies.Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]
Eddy Vluggen wrote:
referencing a WinApp application from a Webapplication and have it load the complete Forms-environment and all its dependencies
I don't think we're talking about doing anything like that. Just a regular library, but with the ability to self-identify at the console.
-
Whilst prototyping a console app the other day, it stuck me that the dynamically linked library seemed somewhat redundant in .NET and that was nothing I could do with one that could not be achieved by creating an executable. I can add a reference and reuse publically declared types whilst with both. But an executable has some obvious benefits, yet I've always created DLLs because I've been told 'it's best practice' or just followed other's examples. Can anyone think of a technical reason why you'd choose to build a library over an executable? Is a DLL an artefact simply for some legacy backwards compatibility that I'm unaware of? Thoughts?
Well, in .Net it is called an assembly, but for your question it has the same function as a DLL or static library in Win32. An executable is usually a front end that the user executes and it can show a graphical user interface (GUI), a command line console interface or a web interface. An assembly is loaded into memory at run time and used by the executing application. What you want to achieve with a library/assembly is to compile code that is used over and over again into reusable modules. Look at all the references you add to your exe, they all contain code other people have written and you can reuse. Another way to reuse is to have compile the source code of the reusable classes into your exe, but that means that you need to have all source code available at all times. It means that every compilation might give you a slightly different functionality if you share code and someone make some changes in a class. If you use a specific version of an assembly you are pretty sure that you get what you wanted (assuming versions are used) This was a short explanation that could be much longer, and as an end note I boil it down to this: 1. No DLL's or assemblies are not obsolete. 2. Reuseability is the biggest advantage as I see it.