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

Namespace convention help please

Hi everyone, just hoping to get some opinions from those who have been
using/creating namespaces for a while.

Currently I have our namespace as follows:

CompanyName.Location.Client.Class

So for class DMRequest I may do something like this:

ABC.Base.DMRequestBase -base class
ABC.AUS.JDHardware.DMRequest : which is meant to inherit from
ABC.Base.DMRequestBase.
ABC.USA.FDShoes.DMRequest : which is also meant to inherit from
ABC.Base.DMRequestBase.

Now I've read somewhere that one should use distinct names for
different classes (in this case DMRequest will inherit from
DMRequestBase but the implementation for each case may be different).
So that being the case should I use the following naming convention:

ABC.Base.DMRequestBase
ABC.AUS.JDHardware.AUSJDH_DMRequest
ABC.USA.FDShoes.USFDS_DMRequest

I know that the naming looks a little odd (I wouldn't necessarily use
that convention) but it is more just to make the point of the
difference between the two.

So ultimately I think my question is: Do I use the same class name and
have the namespace describe the implementation, or should I use new and
different class names given that they are in fact, different classes.

Thanks,
Frank.

PS: Follow up question: If I define classes at the base level (or at
the root of my namespace - i.e. ABC.ClassName) would it be more proper
to use the ABC.ClassName at a 'deeper' level in my namespace, i.e.
ABC.AUS.JDHardware, or should I create a new class in that level of the
namespace which effectively just inherits ABC.ClassName and may be
called ABC.AUS.JDHardware.ClassName. I hope this make some sense.

Jul 7 '06 #1
1 3177
Personally, I wouldn't use your location in the namespace. I think it
is a piece of information that isn't really needed for the context.

Additionally, I don't know why you can't have two classes with the same
name. Look at the Control class. It exists in the following namespaces:

System.Windows.Forms
System.Web.UI
System.Windows.Controls (in Windows Presentation Foundation)

Finally, I would change your namespace definitions to conform to the
public naming conventions. Acroynms are not capitalized, and Pascal casing
is used, like so:

Abc.Base.DmRequestBase
Abc.JdHardware.DmRequest
....

An example in the framework is the HttpWebRequest class. Even though
HTTP is an acronym, it is Pascal-cased.

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

<mr********@hotmail.comwrote in message
news:11**********************@p79g2000cwp.googlegr oups.com...
Hi everyone, just hoping to get some opinions from those who have been
using/creating namespaces for a while.

Currently I have our namespace as follows:

CompanyName.Location.Client.Class

So for class DMRequest I may do something like this:

ABC.Base.DMRequestBase -base class
ABC.AUS.JDHardware.DMRequest : which is meant to inherit from
ABC.Base.DMRequestBase.
ABC.USA.FDShoes.DMRequest : which is also meant to inherit from
ABC.Base.DMRequestBase.

Now I've read somewhere that one should use distinct names for
different classes (in this case DMRequest will inherit from
DMRequestBase but the implementation for each case may be different).
So that being the case should I use the following naming convention:

ABC.Base.DMRequestBase
ABC.AUS.JDHardware.AUSJDH_DMRequest
ABC.USA.FDShoes.USFDS_DMRequest

I know that the naming looks a little odd (I wouldn't necessarily use
that convention) but it is more just to make the point of the
difference between the two.

So ultimately I think my question is: Do I use the same class name and
have the namespace describe the implementation, or should I use new and
different class names given that they are in fact, different classes.

Thanks,
Frank.

PS: Follow up question: If I define classes at the base level (or at
the root of my namespace - i.e. ABC.ClassName) would it be more proper
to use the ABC.ClassName at a 'deeper' level in my namespace, i.e.
ABC.AUS.JDHardware, or should I create a new class in that level of the
namespace which effectively just inherits ABC.ClassName and may be
called ABC.AUS.JDHardware.ClassName. I hope this make some sense.

Jul 7 '06 #2

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

Similar topics

1
by: Roberto Modica | last post by:
Hi all, I am trying to create a namespace hierachy but i think i am doing something wrong. I have an DAL vb file with the namespace: CompanyName.newsletter.DAL and i compile that using...
1
by: News.microsoft.com | last post by:
Any one Who have coding convention? Please share me. Thanks in advance.
6
by: SpOiLeR | last post by:
Why doesn't following code compile? Problem line is commented in code. ---------------------- Cut here------------------------------- #include <iostream> #include <list> #include <string> ...
6
by: vivekian | last post by:
Hi, I am not sure if this is a relevant topic here, anyways, When using the std namespace is it a good practice to .. put this right at the beginning using namespace std ;
11
by: Bruno de Oliveira Schneider | last post by:
Hello all, I'm rewriting a C++ framework, so that old prefixed names are replaced by namespaces. Please consider the following class: === boundingbox.h === namespace VART { class...
1
by: vsgdp | last post by:
I just want to clarify: Say I have a helper class that is only used in one translation file (e.g., a predicate class). I don't want the name of this class to conflict with other class names in...
3
by: Wayne Shu | last post by:
When I read the chapter of the namespace of the book C++ Primer(3e). It explain the using directive as follow: "A using directive makes the namespace member names visible as if they were declared...
2
by: dirk | last post by:
Why doesn't the standard allow to overload operator new/delete in my namespace, e.g. namespace Foo { void* operator new( std::size_t sz ); void operator delete( void* address ); } On the...
80
by: tech | last post by:
Hi, i have the following problem In file1.h namespace A { class Bar { void foo();
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
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...
1
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...
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
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.