12

3.2 尽量减少跨模块的依赖关系

FILED IN Erlang-rules No Comments

3.2 Try to reduce intermodule dependencies

inter module :跨模块
dependencies: 依赖关系

3.2 尽量减少跨模块的依赖关系

A module which calls functions in many different modules will be more difficult to maintain than a module which only calls functions in a few different modules.

maintain : 维护 /维持

如果一个模块大量的调用其他外部模块的功能函数,那么它将比那些只调用了少量外部模块功能函数的要难以维护得多。

This is because each time we make a change to a module interface, we have to check all places in the code where this module is called. Reducing the interdependencies between modules simplifies the problem of maintaining these modules.

interdependency:相互依赖性

这是因为每次当我们修改某个模块的接口函数时,我们不得不检查所有调用到这些接口函数的代码。减少模块间的依赖关系,是简化这些模块的维护的一个简单办法。

We can simplify the system structure by reducing the number of different modules which are called from a given module.

我们可以通过减少某个给定的模块调用其他模块的模块数量,来简化我们系统的设计。

Note also that it is desirable that the inter-module calling dependencies form a tree and not a cyclic graph.

desirable:合适的/令人满意的

应当注意的是,假如模块间的调用关系形成一个树状结构,这是允许的,但不要是环形结构。

Erlang模块调用规则

Erlang模块调用规则

, ,

10

3.1尽可能地减少模块函数的导出

FILED IN Erlang-rules No Comments

3 SW Engineering Principles
3.软件设计原则

SW:软件
Engineering :开发/设计
Principles:原则/法则

3.1 Export as few functions as possible from a module
3.1尽可能地减少模块函数的导出

Modules are the basic code structuring entity in Erlang. A module can contain a large number of functions but only functions which are included in the export list of the module can be called from outside the module.

structuring:组织
entity: 单个/单元

模块,是Erlang组织程序结构的最基本单元。一个模块可以包含大量的函数但是只有那些放在导出列表里的函数,可以在模块外部被其他模块调用。
猛击…还有更多…

, ,

09

2.语言结构及术语 (Structure and Erlang Terminology)

FILED IN Erlang-rules No Comments

2 Structure and Erlang Terminology
语言结构及术语

Structure:组织/结构 在这里应该是代码结构风格的意思
terminology:术语

Erlang systems are divided into modules. Modules are composed of functions and attributes. Functions are either only visible inside a module or they are exported i.e. they can also be called by other functions in other modules. Attributes begin with “-” and are placed in the beginning of a module.

be divided into:被(划)分为
be composed of: 由…组成
be either only or: 要么是….要么是…(不是x就是y)

Erlang 系统 被划分成各种各样的 模块(module)。这些模块由一些 函数属性 组成。 函数 要么是导出的,要么仅是 模块 内部可见的,好比类里面的私有方法(当然Erlang没有类的概念)。导出(-export([]))的函数不仅在模块内部可见,而且在其他模块也可以被调用到,使用 模块名:函数名(参数…) 的方式。属性以 - 横杠开始,并被放置在模块的 头部 (实践证明,这不是必须的,但却是推荐的)



猛击…还有更多…

, ,

08

1.Purpose 目的

FILED IN Erlang-rules No Comments

这个分类下面的所有文章,我计划全部转载自下面的网址

http://www.erlang.se/doc/programming_rules.shtml,并通过google、有道、金山等软件进行翻译然后整理贴出,因为菜,所以要自不量力的去翻译仿佛不可能完成的任务。

This paper lists some aspects which should be taken into consideration when specifying and programming software systems using Erlang. It does not attempt to give a complete description of general specification and design activities which are independent of the use of Erlang.
aspects:问题
be taken into consideration:被考虑到
are independent of :不依赖于…
这篇文章列出了 一些应在使用Erlang作为开发语言,设计并编码一款软件系统时该被考虑到的问题。这篇文章并不试图给出一份不依赖于Erlang这门语言的、完整的通用的(编码)规范文档和设计活动

,

TOP