php coding standard(5)

请教!给群组发Email求助这个简单的方法很少被使用。因为有些程序员们觉得如果他向其他人求助,会显得自己水平低,这多傻啊!做新
的有趣的工作,不要一遍又一遍的做别人已经做过的东西。

如果你需要某些事项的源代码,如果已经有某人做过的话,就向群组发email求助。结果会很惊喜哦!

在许多大的群组中,个人往往不知道其他人在干什么。你甚至可以发现某人在找一些东西做,并且自愿为你写代
码,如果人们在一起工作,外面就总有一个金矿。 告诉!当你在做事的时候,把它告诉所有人 如果你做了什么可重用的东西的话,让其他人知道。别害羞,也不要为了保护自豪感而把你的工作成果藏起来。
一旦养成共享工作成果的习惯,每个人都会获得更多。 Don't be Afraid of Small Libraries 对于代码重用,一个常见的问题就是人们不从他们做过的代码中做库。一个可重用的类可能正隐蔽在一个程序目
录并且决不会有被分享的激动,因为程序员不会把类分拆出来加入库中。

这样的其中一个原因就是人们不喜欢做一个小库,对小库有一些不正确感觉。把这样的感觉克服掉吧,电脑才不
关心你有多少个库呢。

如果你有一些代码可以重用,而且不能放入一个已经存在的库中,那么就做一个新的库吧。如果人们真的考虑重
用的话,库不会在很长的一段时间里保持那么小的。

If you are afraid of having to update makefiles when libraries are recomposed or added then don't include libraries in your makefiles, include the idea of services. Base level makefiles define services that are each composed of a set of libraries. Higher level makefiles specify the services they want. When the libraries for a service change only the lower level makefiles will have to change.

Keep a Repository Most companies have no idea what code they have. And most programmers still don't communicate what they have done or ask for what currently exists. The solution is to keep a repository of what's available.

In an ideal world a programmer could go to a web page, browse or search a list of packaged libraries, taking what they need. If you can set up such a system where programmers voluntarily maintain such a system, great. If you have a librarian in charge of detecting reusability, even better.

Another approach is to automatically generate a repository from the source code. This is done by using common class, method, library, and subsystem headers that can double as man pages and repository entries.

评价注释 注释应该是讲述一个故事Consider your comments a story describing the system. Expect your comments to be extracted by a robot and formed into a man page. Class comments are one part of the story, method signature comments are another part of the story, method arguments another part, and method implementation yet another part. All these parts should weave together and inform someone else at another point of time just exactly what you did and why. Document Decisions Comments should document decisions. At every point where you had a choice of what to do place a comment describing which choice you made and why. Archeologists will find this the most useful information. 使用标头说明

利用类似ccdoc的文档抽取系统。在这一文档的其他部分描述的是怎么利用ccdoc记录一个类和方法。
这些标头说明可以以这样的一个方式来提取并分析和加以组织,它们不像一般的标头一样是无用的。
因此花时间去填上他吧。

注释布局

工程的每部分都有特定的注释布局。

Make Gotchas Explicit Explicitly comment variables changed out of the normal control flow or other code likely to break during maintenance. Embedded keywords are used to point out issues and potential problems. Consider a robot will parse your comments looking for keywords, stripping them out, and making a report so people can make a special effort where needed.

Gotcha Keywords :TODO: topic
Means there's more to do here, don't forget. :BUG: [bugid] topic
means there's a Known bug here, explain it and optionally give a bug ID. :KLUDGE:
When you've done something ugly say so and explain how you would do it differently next time if you had more time. :TRICKY:
Tells somebody that the following code is very tricky so don't go changing it without thinking. :WARNING:
Beware of something. :PHARSER:
Sometimes you need to work around a pharser problem. Document it. The problem may go away eventually. :ATTRIBUTE: value
The general form of an attribute embedded in a comment. You can make up your own attributes and they'll be extracted.

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/b9a3222ea7d2c3391fe0d2fa546484b8.html