[erlang-questions] Learning from Open Source projects?
Richard A. O'Keefe
Fri Mar 27 03:46:45 CET 2015
On 26/03/2015, at 6:23 pm, Harit Himanshu <harit.subscriptions@REDACTED> wrote:
> • How do you read/learn open-source library?
> • What techniques do you use to make sure you understand it correctly?
Fred Hébert's free e-book "Stuff goes bad: Erlang in Anger"
at http://www.erlang-in-anger.com starts with
Chapter 1 "How to Dive into a Code Base".
Put it this way; if this book were not free, I would
be begging my department to buy me a copy even if it
was pretty expensive. It's a really practical book
by an author who knows his Erlang onions. I believe
that you are likely to find chapter 1 helpful. It
would be even more helpful if there were more of it!
I don't think there is much difference between reading
open source libraries and reading closed source ones.
I've seen the Windows Research Kernel, the sources of
Open Solaris (formerly closed), the sources of the JDK
(formerly closed), a couple of C/C++/Fortran compilers
that were open sourced having been closed, the sources
of two commercial-but-you-get-the-sources statistics
packages. I have the sources for 3 open Smalltalks and
3 commercial-but-free-for-personal-use ones. For that
matter, Quintus Prolog had some of the best customer-
level documentation I've ever seen, but the internal
documentation started good but rapidly got out of date
and wasn't maintained. I tell people that when I had
to maintain it, the core module of the Prolog compiler
had two comments. One was "This doesn't work"
commenting out a minor optimisation, and the other was
the copyright notice. (I did _not_ leave it like that!)
So you read/learn open-source code the same way you
read/learn *any* code that you have to work with.
Try some examples and see what gets executed.
(Chapter 9 "Tracing" will be useful there.) Read
just those bits. Get some ideas what neighbouring
code might do. Construct some more examples and see
what they do. It's a problem-solving activity. Make
notes of the questions you come up with, and answers
More information about the erlang-questions