Click here to Skip to main content
15,867,488 members
Articles / All Topics

Is the DLL Obsolete?

Rate me:
Please Sign up or sign in to vote.
4.30/5 (6 votes)
8 Oct 2014CPOL3 min read 15.9K   2   23
Is the DLL obsolete?

Whilst hacking together a prototype console application and then reusing it within a WinForms app, it struck me that the dynamically linked library as far as the (.NET developer is concerned), seems somewhat obsolete.

There appears nothing that can be done with an assembly in the form of a DLL that can’t be done with an EXE. In fact, the only reason I seem to create libraries in this way is because ‘someone once told me to’ plus the test runner I use seemed to require it.

If we look at the Java and C++ worlds, things seem to be slightly different. By default, Java does not appear to differentiate between library and executable code in its default distribution or package format: the JAR. A JAR file can be executed by the JVM so long as it implements the correct interface just like a Windows EXE.

In the C++ world, things seem even looser, as how you compile and package your code seems to be platform dependent (.exe, dll, lib, tlb, ocx, etc.) and the unit of re-use is even finer-grained.

So, let's look at some of the ways in which re-use is achieved:

Code relating to deployable components and that relating to common components are separated by folder, workspace or even a separate repository within the source control system. At compile time, code re-use is achieved by directly compiling that common source code as you compile your deployable. Artefacts can either be a single executable or library or any number of these combined.

There may be slight variants of the above, but essentially they will either be using pre or post compile time sharing. With post compile seemingly preferred in most instances I have encountered. Note, there is nothing about either strategy that forces us to choose one binary output over another. But I do see many open source projects where it is feasible to build your own library by simply picking the class files you need at build time and more than one client that uses source control sharing and still builds DLL components.

  1. A single solution file (or sometimes workspace) to build a single, versionable deployable component, where a ‘deployable’ component can be a single long running service or user tool, e.g., client side GUI or website. A versionable component means that any change to that component’s code increments the version (and so is usually derived from the source control’s particular revisioning method). Such a component may depend on one or common components that it shares with other deployables.

    The notion of a common component is code that is to be re-used. Generally, this is moved to a common area within source control. It is built separately from the deployable component and therefore has its own solution file and suite of automated tests. Importantly, it has its own separate version number from any other component. Once compiled, we can share them with deployable components using source control (i.e., checking them in somewhere) or using a package manager such as nuget or maven.

  2. The build system defines the deployable component and source control is used to share code.

    SO after a little bit of thought, I did ask the question:

    But most answers assumed I didn’t understand there was a thing called an assembly and so missed the point. One person did mention ilmerge and after further questioning, admitted that his opinion only really boiled down to load and start up times. Not one mentioned compatibility, which suggests that most .NET developers do not take that into consideration and aren’t designing for it.

Perhaps there are some underlying reasons why it’s conventional (or idiomatic) to build a DLL. Or perhaps most of us are following a cargo-cult!

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Technical Lead Alpha Integralis Limited
United Kingdom United Kingdom
CatchExAs aka Nick Wilton runs Alpha Integralis, a software development consultancy to companies in the City of London.

Main interests include exploring Algo-Trading, Quant Development and Physics using C# and Java.

www.nickwilton.info/Blog

Comments and Discussions

 
GeneralA reasonable discussion Pin
Gary R. Wheeler1-Nov-14 1:37
Gary R. Wheeler1-Nov-14 1:37 
SuggestionMaybe we should share our .sln's Pin
jediYL31-Oct-14 18:40
professionaljediYL31-Oct-14 18:40 
GeneralRe: Maybe we should share our .sln's Pin
CatchExAs5-Nov-14 1:34
professionalCatchExAs5-Nov-14 1:34 
Answer[My vote of 1] My vote 0.5 Pin
Sing Abend15-Oct-14 7:44
professionalSing Abend15-Oct-14 7:44 
GeneralRe: [My vote of 1] My vote 0.5 Pin
CatchExAs16-Oct-14 1:11
professionalCatchExAs16-Oct-14 1:11 
Questionmy vote of 1 Pin
Alex_19-Oct-14 18:35
Alex_19-Oct-14 18:35 
AnswerRe: my vote of 1 Pin
CatchExAs9-Oct-14 20:11
professionalCatchExAs9-Oct-14 20:11 
GeneralRe: my vote of 1 Pin
Alex_110-Oct-14 12:59
Alex_110-Oct-14 12:59 
GeneralRe: my vote of 1 Pin
CatchExAs13-Oct-14 1:44
professionalCatchExAs13-Oct-14 1:44 
GeneralMy vote of 1 Pin
Donny Redmond9-Oct-14 11:44
Donny Redmond9-Oct-14 11:44 
GeneralRe: My vote of 1 Pin
CatchExAs9-Oct-14 20:04
professionalCatchExAs9-Oct-14 20:04 
GeneralRe: My vote of 1 Pin
Donny Redmond10-Oct-14 2:48
Donny Redmond10-Oct-14 2:48 
GeneralRe: My vote of 1 Pin
CatchExAs10-Oct-14 7:30
professionalCatchExAs10-Oct-14 7:30 
GeneralRe: My vote of 1 Pin
Donny Redmond10-Oct-14 11:25
Donny Redmond10-Oct-14 11:25 
GeneralRe: My vote of 1 Pin
CatchExAs13-Oct-14 1:40
professionalCatchExAs13-Oct-14 1:40 
GeneralRe: My vote of 1 Pin
codefabricator10-Oct-14 3:00
codefabricator10-Oct-14 3:00 
GeneralRe: My vote of 1 Pin
CatchExAs10-Oct-14 7:36
professionalCatchExAs10-Oct-14 7:36 
GeneralRe: My vote of 1 Pin
codefabricator10-Oct-14 8:46
codefabricator10-Oct-14 8:46 
GeneralRe: My vote of 1 Pin
CatchExAs13-Oct-14 2:07
professionalCatchExAs13-Oct-14 2:07 
QuestionI rarely use dlls for production code Pin
Member 25550069-Oct-14 8:07
Member 25550069-Oct-14 8:07 
AnswerRe: I rarely use dlls for production code Pin
CatchExAs9-Oct-14 9:22
professionalCatchExAs9-Oct-14 9:22 
Is that what really happens on windows? I had been led to believe (or maybe I just assumed) that a process's memory space was guaranteed to be separate from any other and so a library would be loaded into the space of any process that used it.
Maybe I misunderstand what you mean by family of programs, but apart from that I completely agree with you.
QuestionDLL Pin
Member 107541999-Oct-14 7:50
Member 107541999-Oct-14 7:50 
AnswerRe: DLL Pin
CatchExAs9-Oct-14 9:30
professionalCatchExAs9-Oct-14 9:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.