473,790 Members | 3,254 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2371
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.co m

"M Shafaat" <po***@comhem.s e> wrote in message
news:fp******** *************@n ewsc.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.Diagnos tics
Infocus.Applica tionName <-- represents an application library, one which
contains:
Infocus.Applica tionName.UI.For ms
Infocus.Applica tionName.UI.Con trols
Infocus.Applica tionName.Compon ents
Infocus.ExportA pi <-- an example 'api only' assembly. This is not
application specific, it merely contains a shared API used by one or more
applications.
Infocus.Applica tionName.Servic es <-- server-side assembly that provides
services specific to an application.
Infocus.Service s <-- 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 "UltraGridSubcl ass".

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.s e>
Newsgroups: microsoft.publi c.dotnet.langua ges.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.s e> 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.C ontrols (generated dlml is called
CodersLab.Web.C ontrols.WebLog. dll); a windows TreeView control has
CodersLab.Windo ws.Controls namespace (generated dlml is called
CodersLab.Windo ws.Controls.Tre eView.dll).

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

Business layers in an application could be called
CodersLab.Appli cationName.Busi nessServices and
CodersLab.Appli cationName.Busi nessEntities.

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.s e> wrote in message
news:fp******** *************@n ewsc.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
3052
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 a single collections type, I should be proposing a new "namespaces" module instead. Some of my reasons: (1) Namespace is feeling less and less like a collection to me. Even though it's still intended as a data-only structure, the use cases...
1
1452
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. Me.CompanyB.BusinessObjects
11
1793
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 understand that you declare your intention to use a namespace within a page through the "Inherits" attribute. I know that using "Inherits" isn't absolutely necessary, it's just recommended so the developer doesn't have to type out the entire...
5
1660
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, keeps stuff apart. If I do that, I usually name the .py file to the same as the class in it. File: Foo.py *********************** class Foo:
3
1449
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
1557
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
1305
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 folders for each month...how should i go about creating the files and folders...?
0
9666
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, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9512
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
10201
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
9023
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7531
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5424
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
5552
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3709
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2910
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.