Stuff Goes Bad:Erlang In Anger

Part I:Writing Applications

Chapter 1 How to Dive into a Code Base


"Read the source" is one of the most annoying things to be told, but dealing with Erlang programmers, you’ll have to do it often. Either the documentation for a library will be incomplete, outdated, or just not there.
In other cases, Erlang programmers are a bit similar to Lispers in that they will tend to write libraries that will solve their problems and not really test or try them in other circumstances, leaving it to you to extend or fix issues that arise in new contexts.
It’s thus pretty much guaranteed you’ll have to go dive in some code base you know nothing about, either because you inherited it at work, or because you need to fix it or understand it to be able to move forward with your own system. This is in fact true of most languages whenever the project you work on is not one you designed yourself.

 “阅读源码” 是最讨人厌的忠告之一,但是对于编写Erlang来说,你不得不经常阅读源码,要么代码文档不全,过时了,或完全不存在。
 因此,你不得不深入源码才能确保代码的可靠性,不论你是接管上一位的工作,还是需要修复一个问题,或理解它并把他移植到你自己的系统中。 工作的项目不是自己设计时,“阅读源码”无疑是最有效的方法。

There are three main types of Erlang code bases you’ll encounter in the wild: raw Erlang code bases, OTP applications, and OTP releases. In this chapter, we’ll look at each of these and try to provide helpful tips on navigating them.

 一般你会遇到三种类型的Erlang代码:未加工过的(Raw)Erlang代码库,OTP Applications 和OTP releases. 接下来,我们逐一地分析它们,并提供一些有用的建议以便更好地驾驭它们。