Namespace best practice

  • Thread starter Thread starter Ed Crowley
  • Start date Start date
E

Ed Crowley

Is it best to separate the layers within an app (for example business logic
layer) into separate .dlls or just use namespaces to logically divide the
app?
 
Is it best to separate the layers within an app (for example business
logic
layer) into separate .dlls or just use namespaces to logically divide the
app?

That's all a matter of personal preference. It is a good idea to seperate
parts of the application into DLL's, parts that are reusable and could be
used in other applications. For example, I have a DLL wich contains all of
my reusable classes and user controls, this way I can update the DLL and as
long as I don't change the interface I can *update* the application without
having to replace everything (Though I'm sure you knew that anyway).

It's a good idea to employ suitable name spaces too though of course, for
example my namespace root is my full name, and my application components
come under that.

Nick.

--
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
"No matter. Whatever the outcome, you are changed."

Fergus - September 5th 2003
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
 
Hello,

Ed Crowley said:
Is it best to separate the layers within an app (for example
business logic layer) into separate .dlls or just use namespaces
to logically divide the app?

I would place them in separate DLLs.
 
Herfried K. Wagner said:
Hello,



I would place them in separate DLLs.

Thought so. I've read advice from MS saying to put everything into one .exe
for best performance, but I may want to use my business layer for a web
front-end, so I guess DLLs are the best way to go.

Thanks.
 
Ed,
In addition to Nak's & Herfried's comments I tend to use a combination of
both.

Some of my projects have multiple assemblies per layer, where there are
logical groupings within that layer. Also I tend to have one or two
'Framework' assemblies that are somewhat layer indifferent (they apply to
all layers or multiple layers).

The problem that tends to come into play is when two layers (in two
assemblies) both need to know about the other, which is where the Separated
Interface Pattern is handy.

http://www.martinfowler.com/eaaCatalog/separatedInterface.html

Hope this helps
Jay
 
Thanks to everyone for the information!

Jay B. Harlow said:
Ed,
In addition to Nak's & Herfried's comments I tend to use a combination of
both.

Some of my projects have multiple assemblies per layer, where there are
logical groupings within that layer. Also I tend to have one or two
'Framework' assemblies that are somewhat layer indifferent (they apply to
all layers or multiple layers).

The problem that tends to come into play is when two layers (in two
assemblies) both need to know about the other, which is where the Separated
Interface Pattern is handy.

http://www.martinfowler.com/eaaCatalog/separatedInterface.html

Hope this helps
Jay
 
Back
Top