erlang编程规范
来源:互联网 发布:js 获取style display 编辑:程序博客网 时间:2024/05/16 17:52
http://www.erlang.se/doc/programming_rules.shtml
- 3.1 Export as few functions as possible from a module
3.2 Try to reduce intermodule dependencies
3.3 Put commonly used code into libraries
3.4 Isolate "tricky" or "dirty" code into separate modules
3.5 Don't make assumptions about what the caller will do with the results of a function
3.6 Abstract out common patterns of code or behavior
3.7 Top-down
3.8 Don't optimize code
3.9 Use the principle of "least astonishment"
3.10 Try to eliminate side effects
3.11 Don't allow private data structure to "leak" out of a module
3.12 Make code as deterministic as possible
3.13 Do not program "defensively"
3.14 Isolate hardware interfaces with a device driver
3.15 Do and undo things in the same function
- 4.1 Separate error handling and normal case code
4.2 Identify the error kernel
- 5.1 Implement a process in one module
5.2 Use processes for structuring the system
5.3 Registered processes
5.4 Assign exactly one parallel process to each true concurrent activity in the system
5.5 Each process should only have one "role"
5.6 Use generic functions for servers and protocol handlers wherever possible
5.7 Tag messages
5.8 Flush unknown messages
5.9 Write tail-recursive servers
5.10 Interface functions
5.11 Time-outs
5.12 Trapping exits
- 6.1 Use records as the principle data structure
6.2 Use selectors and constructors
6.3 Use tagged return values
6.4 Use catch and throw with extreme care
6.5 Use the process dictionary with extreme care
6.6 Don't use import
6.7 Exporting functions
- 7.1 Don't write deeply nested code
7.2 Don't write very large modules
7.3 Don't write very long functions
7.4 Don't write very long lines
7.5 Variable names
7.6 Function names
7.7 Module names
7.8 Format programs in a consistent manner
- 8.1 Attribute code
8.2 Provide references in the code to the specifications
8.3 Document all the errors
8.4 Document all the principle data structures in messages
8.5 Comments
8.6 Comment each function
8.7 Data structures
8.8 File headers, copyright
8.9 File headers, revision history
8.10 File Header, description
8.11 Do not comment out old code - remove it
8.12 Use a source code control system
- erlang编程规范
- Erlang 的Socket编程
- Erlang 元编程
- Erlang编程快速入门
- Erlang编程语言
- Erlang—并发编程
- Erlang TCP编程Demo
- Erlang TCP编程:聊天室
- erlang编程注意事项
- Erlang中的并行编程
- Erlang并发编程(一)
- Erlang初步编程
- erlang 分布式编程问题
- Erlang编程语言介绍
- erlang编程基础-1
- erlang并发编程模板
- Erlang编程实战1
- Erlang编程实战2
- 依赖注入及AOP简述(七)——FQCN请求模式
- Fedora 9安装vmware tools解决方案
- 2011-2012-01学期
- 福特致胜断电后门窗无法一键升到顶的解决办法(附发动机故障灯亮原因):
- 深入浅出Powershell——拷贝GAC中dll文件
- erlang编程规范
- YONEX的羽毛球拍线
- Strlcpy和strlcat——一致的、安全的字符串拷贝和串接函数
- php open_basedir设置以及关于安全
- 如何控制Android不锁屏
- Json学习总结
- const知多少
- 修改 Cent OS yum源为中国镜像
- Android 助力云计算