Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you come up with names for your namespaces?

I'll preface this by saying that I usually work in C#/.Net.

Normally, I use a naming scheme that puts common, reusable components into a namespace that reflects our organization and project-specific components into a namespace tied to the project. One of the reasons I do this is that I sometimes share my components with others outside my department, but within the organization. Project-specific namespaces are typically prefaced with the name or abbreviation of the department. When I reuse code between projects, I typically migrate it into one of the organization-based namespaces.

For example:

UIOWA.DirectoryServices contains classes that deal with the specific implementation of our Active Directory.

UIOWA.Calendar contains classes that deal with the University's master calendar.

LST.Inventory.Datalayer holds the classes implementing the data layer of the Learning Spaces Technology group inventory application.

I'm embarking on a project now for an entity that has a fuzzier connection to the Unviersity (a student group that runs a charity event) that has the potential to be sold outside of our University and, thus, it doesn't really fit into my normal naming conventions, i.e., the department is only the first customer of potentially many that might use the project.

My inclination is to go the organization naming route and create an "organizational project" name space for this application. I'd like to hear how others handle this and any advice you might have.

Thanks.

See also this related question about namespace organization.

EDIT

I ended up creating the org/project namespace UIOWA.MasterEvent and deriving further namespaces from there. Still interested in other opinions for future projects.

like image 791
tvanfosson Avatar asked Oct 27 '08 14:10

tvanfosson


People also ask

What are the naming conventions and how are namespaces established?

The convention for creating a namespace identifier is to always use lowercase letters. The source files inside of a namespace must conform to a standard directory naming and structure.

How many types of namespaces are there?

There four types of namespaces in C#.


2 Answers

My department got his name changed thrice in the last five years, so we're all glad that someone decided against using namespaces with organisational names...

Our namespaces are organised by project names. Reusable stuff is put into the Toolbox namespace. Perhaps a bit crude, but it works quite well so far.

like image 148
Treb Avatar answered Sep 22 '22 00:09

Treb


I'm a .NET developer, and I always use the organisational project namespace (com.bolidian.projectspace) because it guarantees uniqueness.

like image 22
Stewart Johnson Avatar answered Sep 21 '22 00:09

Stewart Johnson