5

In a not-so-small program, when you have not-so-few entities, in order to maintain code readability, common terms, and otherwise improve mutual understanding between team members, one have to define and maintain program vocabulary.

How do you (or your company) deal with this task, what discipline do you have, what arrangements do you introduce?

4

5 回答 5

3

Most projects of reasonable size should have a programming/coding standards document that dictates common conventions and naming guidelines that should be followed.

Another way to help with this is through code reviews. Obviously some coordination among reviewers is required (the document helps with that, too). Code reviews help keep the greener devs and senior devs alike on track and act as an avenue to enforce the coding standards.

于 2008-09-21T21:08:34.040 回答
1

@Ilya Ryzhenkov,

恐怕大多数公司都没有这样的做法 :) 我曾在一家拥有数百万 LOC 代码库的不那么小的公司工作,他们根本没有任何文档(除了通用编码指南)

在我的一个项目中,我们维护了应用程序领域中常用术语的词库,并在代码审查期间使用它。我不时分析 .NET XML 文档差异,以决定应将哪些实体\术语添加到同义词库中。强制遵守词库的唯一方法是编码指南。

Wiki 方法被证明是不适用的,因为没有人关心定期更新它:)

我想知道您在 JetBrains 使用什么方法?我在 Reflector 中检查了 ReSharper 的代码,对实体的数量和名称感到惊讶 :)

于 2008-09-21T22:43:24.047 回答
0

Divide your packages/modules into logical groups and use descriptive and concise names. Avoid generic names except if they are really counters etc. Create conventions for groups of functions or functionality and stick to them.

于 2008-09-21T21:10:11.977 回答
0

Domain Driven Design is interesting here, since it encourages programmers to embrace the domain vocabulary. On top of that, there is some design conventions, which allow you to refer parts of your application using well known terms, like services, repositories, factories, etc.

Combining domain vocabulary and using technical conventions above it could be a good solution.

于 2008-09-21T21:11:12.427 回答
0

My team keeps this kind of information (conventions/vocabulary etc.) on a wiki. This makes it easy to keep up to date and share.

于 2008-09-21T21:11:44.077 回答