您如何提出名称空间的名称? [英] How do you come up with names for your namespaces?

查看:95
本文介绍了您如何提出名称空间的名称?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先,我通常在C#/.Net中工作.

通常,我使用一种命名方案,将常见的可重用组件放入一个名称空间,该名称空间反映了我们的组织和特定于项目的组件到与该项目关联的名称空间中.我这样做的原因之一是,有时我与部门以外但在组织内的其他人共享组件.特定于项目的名称空间通常以部门的名称或缩写开头.当我在项目之间重用代码时,通常将其迁移到基于组织的名称空间之一.

例如:

UIOWA.DirectoryServices包含用于处理Active Directory特定实现的类.

UIOWA.Calendar包含处理大学主日历的类.

LST.Inventory.Datalayer包含实现Learning Spaces Technology组清单应用程序的数据层的类.

我现在正在为一个与大学(开展慈善活动的学生团体)有模糊联系的实体着手一项项目,该实体有可能在我们的大学以外出售,因此,它没有.确实不符合我的常规命名约定,即该部门只是可能使用该项目的许多潜在客户中的第一个客户.

我的意愿是走组织命名路线,并为此应用程序创建一个组织项目"命名空间.我想听听其他人如何处理此问题以及您可能有的任何建议.

谢谢.

另请参阅有关命名空间组织的相关问题 a>.

编辑

我最终创建了org/project命名空间UIOWA.MasterEvent,并从那里派生了更多的命名空间.仍然对未来项目的其他意见感兴趣.

解决方案

在过去的五年中,我的部门三次改了名字,所以我们很高兴有人决定不使用带有组织名称的名称空间...

我们的名称空间是按项目名称组织的.可重用的内容放入Toolbox名称空间.也许有点粗糙,但到目前为止效果还不错.

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.

解决方案

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.

这篇关于您如何提出名称空间的名称?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆