473,325 Members | 2,785 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

"Global" Class Library: Best Practices?

I've got several generic "library" routines that are used by many of my
controls & applications (things like string manipulation, generic error
handling, an "about" box generator, etc.). As I transition my apps from
VB6 to VB.NET, I'm curious about the best, most efficient way to
include those in my application. Here's what I'm considering:

1. My gut reaction is to compile these routines into separate class
libraries (AIID.SplashForm.dll, for example), and reference them from
whichever apps need them.

2. I could also include the source code right into my apps, using
SourceSafe for versioning.

Option 1 seems like it would be better, since only one version of each
set of shred library code would be loaded, no matter how many of my
apps are running. However, Option 2 might offer better performance (?),
since the code is compiled together. Or maybe that's my VB6 prejudice
coming through -- is there a performance hit in VB.NET for calling into
external DLLs?

Thanks for any advice.

Jan 21 '06 #1
5 2379
As a follow up, assuming that I'm creating separate class libraries,
should I err on the side of fewer or more libraries? In other words,
let's say I've got ten different "custom" dialog box classes (an about
box, a timed message box, a localized password box, etc.). Do I compile
them all together (into "Dialogs.dll", for example), or separately
("Dialogs.About.dll", "Dialogs.Timed.dll", etc.)? Not every app will
use every one, of course. But with a strategy of dividing the DLLs into
very discrete uses, I could quickly get 30 or 40 dependencies for each
application.

I realize this is a philosophical question! Just curious if there's a
"best practice."

Jan 21 '06 #2
Lee
I also have a bunch of 1) utility functions; 2) an error-handler class;
3) specialized collection classes. The items in (1) I put into a Module
(since they would be Shared methods anyway; the other items are in
their own classes. I put the whole shebang into its own DLL. BTW, this
is very similar to what I did with these in VB6.

---
Lee Silver
Information Concepts Inc.

Jan 22 '06 #3
I suspect you will be happier in the end if you include these dll's as
projects in your solutions (assuming they are in the same language). I've
had trouble including just the dll's as when I change one of them, it
sometimes gives me trouble compiling the solutions that use them (I did fix
this though by setting the assembly version of the dll's to a set value
instead of the *.

--
Dennis in Houston
"Graham Charles" wrote:
As a follow up, assuming that I'm creating separate class libraries,
should I err on the side of fewer or more libraries? In other words,
let's say I've got ten different "custom" dialog box classes (an about
box, a timed message box, a localized password box, etc.). Do I compile
them all together (into "Dialogs.dll", for example), or separately
("Dialogs.About.dll", "Dialogs.Timed.dll", etc.)? Not every app will
use every one, of course. But with a strategy of dividing the DLLs into
very discrete uses, I could quickly get 30 or 40 dependencies for each
application.

I realize this is a philosophical question! Just curious if there's a
"best practice."

Jan 22 '06 #4
| I realize this is a philosophical question! Just curious if there's a
| "best practice."
I would go with what is "manageable".

Having too many assemblies quickly becomes hard to manage, as you are always
searching for which assembly to reference. Plus loading individual
assemblies does "cost". Having to many assemblies may also lead to hard to
resolve interdependencies & possibly circular dependencies (assembly1 needs
assembly2, assembly2 needs assembly3, assembly3 needs assembly1).

Having too few assemblies also quickly becomes hard to manage, as you may be
needing to recompile a number of your applications to make a simple change.
Plus loading a single assembly with "excessive" meta data also "costs".

Generally I would group the types into logical assemblies, so for example,
rather then having 40 dependencies, I would have 5 to 10 dependencies,
depending of course on what the various types are...

I would put all the common UI in a "Common.UI.dll". I would put all my
"framework" in a Framework.dll, common utilities, I would put in a
Common.utility.dll and so on.

Unfortunately I don't have my links handy on the matter.

--
Hope this helps
Jay [MVP - Outlook]
..NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley - http://www.tsbradley.net
"Graham Charles" <gr****@aiid.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
| As a follow up, assuming that I'm creating separate class libraries,
| should I err on the side of fewer or more libraries? In other words,
| let's say I've got ten different "custom" dialog box classes (an about
| box, a timed message box, a localized password box, etc.). Do I compile
| them all together (into "Dialogs.dll", for example), or separately
| ("Dialogs.About.dll", "Dialogs.Timed.dll", etc.)? Not every app will
| use every one, of course. But with a strategy of dividing the DLLs into
| very discrete uses, I could quickly get 30 or 40 dependencies for each
| application.
|
| I realize this is a philosophical question! Just curious if there's a
| "best practice."
|
Jan 24 '06 #5
If I am going to take a bunch of 'things' and put them into different
classes the first thing I do is create a dependency chart so I can see what
depends upon what. The last thing you want to do is end up creating a
circular reference type deal.

Doing this also help to determine what 'things' are logically used together
allot and this helps you keep the number of libraries that need to be
distributed down. Keep things that are often used together in the same
library.

"Graham Charles" <gr****@aiid.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
As a follow up, assuming that I'm creating separate class libraries,
should I err on the side of fewer or more libraries? In other words,
let's say I've got ten different "custom" dialog box classes (an about
box, a timed message box, a localized password box, etc.). Do I compile
them all together (into "Dialogs.dll", for example), or separately
("Dialogs.About.dll", "Dialogs.Timed.dll", etc.)? Not every app will
use every one, of course. But with a strategy of dividing the DLLs into
very discrete uses, I could quickly get 30 or 40 dependencies for each
application.

I realize this is a philosophical question! Just curious if there's a
"best practice."

Jan 25 '06 #6

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

Similar topics

2
by: Eddy Ilg | last post by:
Hi, I am having a problem with an application I am writing: I have 2 scripts called 'conf' and 'build'. Both define a variable named 'root' and import a module named 'helper'. In the...
5
by: j | last post by:
Anyone here feel that "global variables" is misleading for variables whose scope is file scope? "global" seems to imply global visibility, while this isn't true for variables whose scope is file...
9
by: Javaman59 | last post by:
I saw in a recent post the :: operator used to reach the global namespace, as in global::MyNamespace I hadn't seen this before, so looked it up in MSDN, which explained it nicely. My question...
4
by: BB | last post by:
Hello all, I might be missing something here, but am trying to understand the difference between using application-level variables--i.e. Application("MyVar")--and global variables--i.e. public...
3
by: Pierre | last post by:
Hello, In an aspx page (mypage.aspx) from a web projet, I would like to get the value of a variable of the projet that is declared as public in a module. The variable can be called from...
5
by: dave | last post by:
If I have a class that hold, for instance, user settings that should be accessible to the entire program logic, what is a good paradigm to use? In C++, I would have made it a global object,...
10
by: Bub.Paulson | last post by:
A month ago I finally took the plunge and began learning C# and ASP.Net, coming from a Classic ASP and VBScript background. In my classic ASP, I had my own little library of code that I stuck in...
11
by: eBob.com | last post by:
I have this nasty problem with Shared methods and what I think of as "global storage" - i.e. storage declared outside of any subroutines or functions. In the simple example below this "global"...
7
by: twang090 | last post by:
I find in other team member's project, they are referencing a type in following format " public static global::ErrorReport.Description Description = new global::ErrorReport.Description(); " I...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.