开发者

Name of the practice of keeping code and related stuff (metadata,..) together?

If I try to keep code and "other related stuff" together, how is that called? Or if I fail to do this, would that be an (anti-)pattern with a name? (I need the name to refer to this practice in a document that some people will call scientific.)

An example of what I mean would be to use annotations rather than XML configuration files in Java (for example JPA, Spring) t开发者_运维百科o keep metadata close to the source code and thus reducing the risk that if code is updated it is not forgotten to update metadata.


This sounds like functional cohesion (from Wikipedia):

Functional cohesion is when parts of a module are grouped because they all contribute to a single well-defined task of the module (e.g. tokenizing a string of XML).

Other types of cohesion are:

  • Coincidental cohesion (worst)
  • Logical cohesion
  • Temporal cohesion
  • Procedural cohesion
  • Communicational cohesion
  • Sequential cohesion

For further reading, I suggest Steve McConnell's Code Complete, 2nd Edition.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜