473,748 Members | 6,370 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Single or multiple assemblies in big apps?

Hi everyone,

I have a question about .NET code sharing and reuse, and also about
application design best practices / guidelines.

Currently, we have many different .NET projects in source depot. Although
they are different, in some of them we share C# code by referencing source
files that are external (not part of the projects) on each project.

For instance, some of our projects have the typical “sources” file with:

SOURCES = \
..\..\some_othe r_different_unr elated_project_ A\fileA1.cs \
..\..\some_othe r_different_unr elated_project_ B\fileB1.cs \
..\..\some_othe r_different_unr elated_project_ B\fileB2.cs \
Program.cs
Class.cs

And so on.

Some people in my team think that DLLs and assemblies are evil and should be
completely avoided. Therefore, they advocate treating all projects in the
depot as one huge, monolithic project (even they are not, as they are
different projects), sharing code by referencing source files all over the
depot.

Basically, each application has one and only one assembly containing all the
application source code plus all source code that belong to other projects
too but is reused by referencing the other project(s) C# source files.

Other team members (BTW facing huge opposition) insist in packing the
shareable code into one or more assemblies, although for some people,
assemblies and DLLs are absolutely forbidden.

Can someone please tell me the pros and cons of each approach? Is it right
to be completely against packing certain substantial modules or pieces of
functionality into separated assembly/assemblies, as opposed to having one
and only one single, huge monolithic assembly containing the whole
application + other project source files?

Those in favor of having shareable code packed into separate assemblies,
instead of putting everything (all the source code of the application plus
the sources of our libraries, plus the sources of all subsystems, etc.) into
one, big monolithic assembly, point to these other URIs:

http://msdn.microsoft.com/practices/...ml/distapp.asp

http://msdn.microsoft.com/practices/...apparchch2.asp

http://weblogs.asp.net/savanness/arc.../22/10417.aspx

http://msdn.microsoft.com/library/de...esoverview.asp

So, I wonder, are there any guidelines and/or best
practices/patterns/anti-patterns in regards to C# source code sharing and
reusing among different projects? Any authoritative answers? Is it
reassonable to build big, different applications from one huge source tree,
having only one and just one assembly per application and nothing more? Or it
makes more sense to split the app into multiple assemblies, but keeping the
number of assemblies to a minimum?

Thanks and regards,

Claudio

Jul 28 '06 #1
3 2075
Claudio

I am an advocate of building assemblies, since this is after all what code
re-use is about.

For example my company has certain portions of functionality common accross
the entire suite, so we have elected to build strong named assemblies around
this commonality who are then installed into the GAC.

Also, if commonality is packaged in a single place (i.e. an assembly) and
this single place is named accordingly (eg. myCompany.myMea ningfulName), then
you don't have to go sifting through all of your source code to find that bit
of code that you know someone wrote last year.

..net makes (managed ie. written using .net) dlls much easier to manage
through the Global assembly cache, through assembly versioning, and through
private and shared assemblies.

There are many good articles on the web (including here) about version
management in .net and these articles include good explanations of how it is
handled.

I'm no expert, but the object oriented community's view on code re-use is
focused on OBJECT reuse rather than physical code file re-use.

As for building applications as one huge assembly ... well, that doesn't
make it very easy to apply bug fixes and enhancements to your product without
a complete re-compile ... I'm sure that your release manager would be
delighted to hear that by simply pre-preparing a bunch of assemblies you can
save hours (over the year) in wasted build time.

Further I'm sure your development manager would also be delighted to see how
easy splitting your monolithic application into seperate assemblies will make
it easier for developers to work on different areas of the product without
detriment to the productivity of other team members working on the same
product.

Developing areas of functionality in isolation means that when you write
your code (and your unit tests) you can be certain that by the time you hand
it over to the build engineer if there is a problem, it's is not going to be
with your code.

It's easy to write and maintain unit test for a small code project than it
is for a monolithic 160000 file project.

I hope that makes sense, and I also hope that everyone else agrees with me :o)

--
Of all words of tongue and pen, the saddest are: "It might have been"

Bill.Richards @ greyskin .co .uk
http://greyskin.co.uk
"Claudio Pacciarini" wrote:
Hi everyone,

I have a question about .NET code sharing and reuse, and also about
application design best practices / guidelines.

Currently, we have many different .NET projects in source depot. Although
they are different, in some of them we share C# code by referencing source
files that are external (not part of the projects) on each project.

For instance, some of our projects have the typical “sources” file with:

SOURCES = \
..\..\some_othe r_different_unr elated_project_ A\fileA1.cs \
..\..\some_othe r_different_unr elated_project_ B\fileB1.cs \
..\..\some_othe r_different_unr elated_project_ B\fileB2.cs \
Program.cs
Class.cs

And so on.

Some people in my team think that DLLs and assemblies are evil and should be
completely avoided. Therefore, they advocate treating all projects in the
depot as one huge, monolithic project (even they are not, as they are
different projects), sharing code by referencing source files all over the
depot.

Basically, each application has one and only one assembly containing all the
application source code plus all source code that belong to other projects
too but is reused by referencing the other project(s) C# source files.

Other team members (BTW facing huge opposition) insist in packing the
shareable code into one or more assemblies, although for some people,
assemblies and DLLs are absolutely forbidden.

Can someone please tell me the pros and cons of each approach? Is it right
to be completely against packing certain substantial modules or pieces of
functionality into separated assembly/assemblies, as opposed to having one
and only one single, huge monolithic assembly containing the whole
application + other project source files?

Those in favor of having shareable code packed into separate assemblies,
instead of putting everything (all the source code of the application plus
the sources of our libraries, plus the sources of all subsystems, etc.) into
one, big monolithic assembly, point to these other URIs:

http://msdn.microsoft.com/practices/...ml/distapp.asp

http://msdn.microsoft.com/practices/...apparchch2.asp

http://weblogs.asp.net/savanness/arc.../22/10417.aspx

http://msdn.microsoft.com/library/de...esoverview.asp

So, I wonder, are there any guidelines and/or best
practices/patterns/anti-patterns in regards to C# source code sharing and
reusing among different projects? Any authoritative answers? Is it
reassonable to build big, different applications from one huge source tree,
having only one and just one assembly per application and nothing more? Or it
makes more sense to split the app into multiple assemblies, but keeping the
number of assemblies to a minimum?

Thanks and regards,

Claudio
Jul 28 '06 #2
First off this is JUST my opinion:

1) I think the GAC is evil and should be avioded. We are moving away
from a central repository to self describing files for a reason:
Because COM sucked the life out of developers. Besides, what is the
problem with having 3 copies of a 500kb dll when your hard disk is 250
GB?

2) I have been able to cut bugs down to almost nothing by using proper
unit testing of separate assemblies - Define what your inputs and
outputs are and then code your assemblies accordingly. Ensure your
interfaces are descriptive, flexible and STABLE. When everything in the
sub assemblies (Dlls) is complete and tested, include references to
COMPILED assemblies, not projects. That way you can ensure that your
app works correctly agains myDLL.dll version 1.xx.xxxx and someone else
on the team isn't going to break that by tweaking something. Once the
dll is stable, then it can be released and re-used.

3) I have SAVED MY ASS by having business logic classes separate from
UI and DAL. Imagine this: Engineer goes to China for project and bug is
found in my code. I've already moved on in my development from the
release version so I can't fix it in the current version. I find out
the problem is in a class library that has changed signifigantly so I
get an old version from source control, hook it up to my test harness
(i.e. winform with three buttons named button 1,2,3) fix bug, test,
email a 300k file to the engineer that simply copy/replaces the file in
question. I look like a hero and it was my stupid mistake in the first
place

4) Everything that bill said.

Cheers
Dinsdale

billr wrote:
Claudio

I am an advocate of building assemblies, since this is after all what code
re-use is about.

For example my company has certain portions of functionality common accross
the entire suite, so we have elected to build strong named assemblies around
this commonality who are then installed into the GAC.

Also, if commonality is packaged in a single place (i.e. an assembly) and
this single place is named accordingly (eg. myCompany.myMea ningfulName), then
you don't have to go sifting through all of your source code to find that bit
of code that you know someone wrote last year.

.net makes (managed ie. written using .net) dlls much easier to manage
through the Global assembly cache, through assembly versioning, and through
private and shared assemblies.

There are many good articles on the web (including here) about version
management in .net and these articles include good explanations of how it is
handled.

I'm no expert, but the object oriented community's view on code re-use is
focused on OBJECT reuse rather than physical code file re-use.

As for building applications as one huge assembly ... well, that doesn't
make it very easy to apply bug fixes and enhancements to your product without
a complete re-compile ... I'm sure that your release manager would be
delighted to hear that by simply pre-preparing a bunch of assemblies you can
save hours (over the year) in wasted build time.

Further I'm sure your development manager would also be delighted to see how
easy splitting your monolithic application into seperate assemblies will make
it easier for developers to work on different areas of the product without
detriment to the productivity of other team members working on the same
product.

Developing areas of functionality in isolation means that when you write
your code (and your unit tests) you can be certain that by the time you hand
it over to the build engineer if there is a problem, it's is not going to be
with your code.

It's easy to write and maintain unit test for a small code project than it
is for a monolithic 160000 file project.

I hope that makes sense, and I also hope that everyone else agrees with me :o)

--
Of all words of tongue and pen, the saddest are: "It might have been"

Bill.Richards @ greyskin .co .uk
http://greyskin.co.uk
"Claudio Pacciarini" wrote:
Hi everyone,

I have a question about .NET code sharing and reuse, and also about
application design best practices / guidelines.

Currently, we have many different .NET projects in source depot. Although
they are different, in some of them we share C# code by referencing source
files that are external (not part of the projects) on each project.

For instance, some of our projects have the typical "sources" file with:

SOURCES = \
..\..\some_othe r_different_unr elated_project_ A\fileA1.cs \
..\..\some_othe r_different_unr elated_project_ B\fileB1.cs \
..\..\some_othe r_different_unr elated_project_ B\fileB2.cs \
Program.cs
Class.cs

And so on.

Some people in my team think that DLLs and assemblies are evil and should be
completely avoided. Therefore, they advocate treating all projects in the
depot as one huge, monolithic project (even they are not, as they are
different projects), sharing code by referencing source files all over the
depot.

Basically, each application has one and only one assembly containing all the
application source code plus all source code that belong to other projects
too but is reused by referencing the other project(s) C# source files.

Other team members (BTW facing huge opposition) insist in packing the
shareable code into one or more assemblies, although for some people,
assemblies and DLLs are absolutely forbidden.

Can someone please tell me the pros and cons of each approach? Is it right
to be completely against packing certain substantial modules or pieces of
functionality into separated assembly/assemblies, as opposed to having one
and only one single, huge monolithic assembly containing the whole
application + other project source files?

Those in favor of having shareable code packed into separate assemblies,
instead of putting everything (all the source code of the application plus
the sources of our libraries, plus the sources of all subsystems, etc.) into
one, big monolithic assembly, point to these other URIs:

http://msdn.microsoft.com/practices/...ml/distapp.asp

http://msdn.microsoft.com/practices/...apparchch2.asp

http://weblogs.asp.net/savanness/arc.../22/10417.aspx

http://msdn.microsoft.com/library/de...esoverview.asp

So, I wonder, are there any guidelines and/or best
practices/patterns/anti-patterns in regards to C# source code sharing and
reusing among different projects? Any authoritative answers? Is it
reassonable to build big, different applications from one huge source tree,
having only one and just one assembly per application and nothing more? Or it
makes more sense to split the app into multiple assemblies, but keeping the
number of assemblies to a minimum?

Thanks and regards,

Claudio
Jul 28 '06 #3
Hi Bill and Dinsdale

Thanks for your kind responses. These should help my team improve the way we
design and develop some of our applications. Thanks so much.

Claudio
--

Claudio Pacciarini

"Claudio Pacciarini" wrote:
Hi everyone,

I have a question about .NET code sharing and reuse, and also about
application design best practices / guidelines.

Currently, we have many different .NET projects in source depot. Although
they are different, in some of them we share C# code by referencing source
files that are external (not part of the projects) on each project.

For instance, some of our projects have the typical “sources” file with:

SOURCES = \
..\..\some_othe r_different_unr elated_project_ A\fileA1.cs \
..\..\some_othe r_different_unr elated_project_ B\fileB1.cs \
..\..\some_othe r_different_unr elated_project_ B\fileB2.cs \
Program.cs
Class.cs

And so on.

Some people in my team think that DLLs and assemblies are evil and should be
completely avoided. Therefore, they advocate treating all projects in the
depot as one huge, monolithic project (even they are not, as they are
different projects), sharing code by referencing source files all over the
depot.

Basically, each application has one and only one assembly containing all the
application source code plus all source code that belong to other projects
too but is reused by referencing the other project(s) C# source files.

Other team members (BTW facing huge opposition) insist in packing the
shareable code into one or more assemblies, although for some people,
assemblies and DLLs are absolutely forbidden.

Can someone please tell me the pros and cons of each approach? Is it right
to be completely against packing certain substantial modules or pieces of
functionality into separated assembly/assemblies, as opposed to having one
and only one single, huge monolithic assembly containing the whole
application + other project source files?

Those in favor of having shareable code packed into separate assemblies,
instead of putting everything (all the source code of the application plus
the sources of our libraries, plus the sources of all subsystems, etc.) into
one, big monolithic assembly, point to these other URIs:

http://msdn.microsoft.com/practices/...ml/distapp.asp

http://msdn.microsoft.com/practices/...apparchch2.asp

http://weblogs.asp.net/savanness/arc.../22/10417.aspx

http://msdn.microsoft.com/library/de...esoverview.asp

So, I wonder, are there any guidelines and/or best
practices/patterns/anti-patterns in regards to C# source code sharing and
reusing among different projects? Any authoritative answers? Is it
reassonable to build big, different applications from one huge source tree,
having only one and just one assembly per application and nothing more? Or it
makes more sense to split the app into multiple assemblies, but keeping the
number of assemblies to a minimum?

Thanks and regards,

Claudio
Jul 31 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
8411
by: AARON PECORARO | last post by:
I need to split apart my web application into multiple projects to allow it to be distributed in parts, but all of the projects need to work together (ie. they need to share session information). Does anyone have any suggestions or solutions to this problem? Thanks, Richard Bowman
6
1716
by: Tom Dacon | last post by:
If you're not putting assemblies in the GAC, but are referencing shared code with copylocal=true into the projects that use them, is there any value to signing the assemblies? In the environment I've just begun to work in, there are customer-facing web sites, internally-accessed maintenance and admin web sites, middle-tier business logic assemblies, services, and Windows Forms apps that run on the middle-tier. The policy is to sign the...
1
1439
by: loretta.stokes | last post by:
I manage our nightly builds for all of our products. Since we have added our .NET assemblies to our nightly build, it has been a learning process. I have come across a couple of situations that I am not sure how to handle without rebuilding or redeploying some of our common assemblies. First let me explain what we do: 1. Version all assemblies with 1.0.0.* 2. All assemblies are strong named 3. We use project references
5
13472
by: Edward Mitchell | last post by:
I am trying to include two class files into a web service project. The structure I have is a top level solution and project in a folder and below that, the web service project in it's own folder. In the top level folder I have two class files, classA.cs and classB.cs. In the web service project, I use Add>Existing Item... and browse to select the files in the parent directory. Unfortunately, when I hit the Open button in the file...
3
2793
by: Shikari Shambu | last post by:
Hi All, I have a situation where multiple applications are sharing some pages/ controls. So, I have a separate common project that has the common pages/ controls. My question is how do I reference these pages/ controls from my ASP.NET web projects WEbApp1 url http://localhost/app1 C:\Apps\App1
4
2327
by: Jeff | last post by:
We have multiple ASP.Net web apps in development. As a standard we are looking to go with SQL Server to hold state information. Can we have the multiple apps all point to a single State DB? Or do we need to install multiple instances of the State database on to the SQL Server (one for each Web app)? It would seem that you could run into troubles pointing several web apps at the same DB, because you would introduce the possibility (a...
1
2322
by: EricMatz | last post by:
I work for a medium-sized insurance company, developing web-based systems for our independent agents. There are four primary applications we provide - one that serves as an agent portal (ASP), and three others that serve applications specific to each line of business (one ASP, two ASP.NET). Each of these applications reside on their own server/environment, all of which are in the same AD domain. We also have multiple top-level domains...
5
2357
by: Peter Rilling | last post by:
Okay, the other day I was talking with someone about assemblies. He said something that I am not really sure about. He said that a DLL or EXE can contain more then one assembly (although the IDE only works with one). Now, I know that assemblies can be made up of more than one file, but I have never heard about it where a single file has more then one assembly. I know that files can have more than one module, but what about assemblies? ...
1
2141
by: David Herbst | last post by:
I have a solution that contains one main web project, ten sub web projects and a controls library project all in a single web application. I followed the steps in the following MS KB: How To Create an ASP.NET Application from Multiple Projects for Team Development http://support.microsoft.com/default.aspx?scid=kb;en-us;307467 e.g. http://localhost/application1 (references project sharedcontrols, module1, module2)
0
8991
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
8830
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9544
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9372
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9247
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
4606
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4874
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3313
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2783
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.