473,388 Members | 1,340 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,388 software developers and data experts.

How to organise namespaces

Hi,
I want to develop a number of generic components which I intend to use in
different applications. Is it a good idea to put all these generic
components in one and the same namespace, e.g. named GenApplCtrls, without
any regard to whether or not the components have any functionality in
common?
Which principles should be considered when deciding which classes to belong
to a namespace?
Regards
M Shafaat

Nov 17 '05 #1
5 2351
You are going to find that this is usually a matter of preference. For
me, I like the namespace to be pretty specific about what is in them.

For example, in your setup, you might have some common components for
data access, and some which are actual user controls. In this case, I would
recommend breaking them out into two separate namespaces, with a common
root.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"M Shafaat" <po***@comhem.se> wrote in message
news:fp*********************@newsc.telia.net...
Hi,
I want to develop a number of generic components which I intend to use in
different applications. Is it a good idea to put all these generic
components in one and the same namespace, e.g. named GenApplCtrls, without
any regard to whether or not the components have any functionality in
common?
Which principles should be considered when deciding which classes to
belong to a namespace?
Regards
M Shafaat

Nov 17 '05 #2
some namespaces where I work:

Infocus.Shared <-- 'common' components, utility classes etc. This class does
not reference any other of our libs.
Infocus.Diagnostics
Infocus.ApplicationName <-- represents an application library, one which
contains:
Infocus.ApplicationName.UI.Forms
Infocus.ApplicationName.UI.Controls
Infocus.ApplicationName.Components
Infocus.ExportApi <-- an example 'api only' assembly. This is not
application specific, it merely contains a shared API used by one or more
applications.
Infocus.ApplicationName.Services <-- server-side assembly that provides
services specific to an application.
Infocus.Services <-- more generalized server-side assembly that provides
services specific to no application.
Infocus.Forms <-- Similar to System.Windows.Forms, it contains Components,
Controls submnamespaces and the root contains basic Form subclasses.

We do not create namespaces specific to content, for example, if we subclass
a grid component we don't go and create an assembly or new namespace, it
would automatically find itself in a more general namespace such as
"Infocus.Forms.Controls" with an obvious name like "UltraGridSubclass".

Also, I've found it helpful to make use of default root namespaces
cross-assembly. For example, consider I wrote my own browser, i might have
these three assemblies:

Infocus.Browser.dll
Infocus.Browser.Shared.dll
Infocus.Browser.Services.dll

Infocus.Browser would be a common namespace, this means that in all 3 dll's
ALL components by default are located at Infocus.Browser.*

Shared and Services libraries both have a subnamespace defined as
Infocus.Browser.Services, the shared lib contains interface definitions,
whereas the service lib contains the implementation code that runs at the
server.

Hope that helps,
SEWilson

----- Original Message -----
From: "M Shafaat" <po***@comhem.se>
Newsgroups: microsoft.public.dotnet.languages.csharp
Sent: Friday, April 01, 2005 11:36 AM
Subject: How to organise namespaces

Hi,
I want to develop a number of generic components which I intend to use in
different applications. Is it a good idea to put all these generic
components in one and the same namespace, e.g. named GenApplCtrls, without
any regard to whether or not the components have any functionality in
common?
Which principles should be considered when deciding which classes to belong to a namespace?
Regards
M Shafaat

Nov 17 '05 #3
Thank you all for the great replys

Best regards,
M Shafaat
Nov 17 '05 #4
On Fri, 01 Apr 2005 19:36:43 GMT, "M Shafaat" <po***@comhem.se> wrote:
Hi,
I want to develop a number of generic components which I intend to use in
different applications. Is it a good idea to put all these generic
components in one and the same namespace, e.g. named GenApplCtrls, without
any regard to whether or not the components have any functionality in
common?
Which principles should be considered when deciding which classes to belong
to a namespace?
Regards
M Shafaat


I mostly do it like this: a WebLog web control has the namespace
CodersLab.Web.Controls (generated dlml is called
CodersLab.Web.Controls.WebLog.dll); a windows TreeView control has
CodersLab.Windows.Controls namespace (generated dlml is called
CodersLab.Windows.Controls.TreeView.dll).

For general stuff without UI it's something like CordersLab.Utilities.

Business layers in an application could be called
CodersLab.ApplicationName.BusinessServices and
CodersLab.ApplicationName.BusinessEntities.

I try to create seperate dll's for each control I make. This way, if
someone want to use one of my controls, he just has to reference a
small dll; I think this is in contradiction to what Shaun wrote.

I guess that it's all about taste :)

--
Ludwig Stuyck
http://www.coders-lab.net
Nov 17 '05 #5
"M Shafaat" <po***@comhem.se> wrote in message
news:fp*********************@newsc.telia.net...
Which principles should be considered when deciding which classes to
belong to a namespace?


I have a dozen or so "generic" classes all of which have the namespace
"shared", for no other reason that they are shared in Visual SourceSafe.
These include: a SQL Server DAL, mail, encryption, validation, event log
handling, registry handling etc. When I start a new project, I just share
what I need into it from VSS.

Above that, namespaces will depend on the individual project, but I try to
make them relate to the specific business entities as far as possible. E.g.
for a "vanilla" sales system, I might have namespaces like Customers,
Products, Sales etc
Nov 17 '05 #6

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

Similar topics

18
by: Steven Bethard | last post by:
In the "empty classes as c structs?" thread, we've been talking in some detail about my proposed "generic objects" PEP. Based on a number of suggestions, I'm thinking more and more that instead of...
1
by: dhnriverside | last post by:
Hi peeps I want to create some namespaces and dlls to encapsulate some common functionality. Here's what I want. Me Me.CompanyA Me.CompanyA.BusinessObjects Me.CompanyB....
11
by: Random | last post by:
I'm confused about the proper use and usefulness of namespaces. I beleive I understand the purpose is so the developer can put classes within namespaces to essentially organize your code. And I...
5
by: Alex | last post by:
Hi, this is my first mail to the list so please correct me if Ive done anything wrong. What Im trying to figure out is a good way to organise my code. One class per .py file is a system I like,...
3
by: jyck91 | last post by:
I want to get some ideas to organise a composition analyzer?? eg. frequencies of letters Thx for your suggestion
5
by: jyck91 | last post by:
Can anyone give me some ideas to organise a composition analyzer in C? It analyses an english composition. What functions should it include? eg. frequency of letter/ words thanks for help
2
daniel aristidou
by: daniel aristidou | last post by:
Hey... I've got a program...that organises customers... I want to create text files of each day........containing the IDs of customers seen........ However i want to organise the Text files in...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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,...
0
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...

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.