[erlang-questions] code dependency diagrams

Vlad Dumitrescu <>
Fri Feb 29 09:49:35 CET 2008


Hi,

On Thu, Feb 28, 2008 at 2:57 PM, Ulf Wiger (TN/EAB)
<> wrote:
>  > I would like to recommend an alternative to this kind of diagram, that
>  > offers much better understandability: a Dependency Structure Matrix
>  > (DSM). An example image can be found at
>  > http://erlide.sourceforge.net/untitled.png
>
>  Perhaps the way to proceed is to create a library that
>  produces the necessary metadata for later visualization?

Yes, I think so. This data is going to be needed with any visualisation method.

>  I'd like to take a swing at using xref and syntax tools
>  for extracting useful metadata about applications. The
>  question is of course: what is useful?
>
>  My first example counted modules in application A which had
>  any dependency (called any function) to application B.

I think it might be useful to know the dependencies at the function
level -- if a module has dependencies I'd like to remove, it's going
to be useful to know which functions contribute to them. If this
information is present in the metadata, the visualisation tool could
allow to try to move the affected functions somewhere else and see if
the dependency relations get closer to the desired structure.

A useful data structure could be a list of {{M, F, A}, [{call, [{Mi,
Fi, Ai, Ni}, ...]}, {include, [Fj, ...]}, {record, [Rk, ...]},
{parse_transform, [Pi,...]}, {unresolved_call, [{?}, ...]]} that tells
us that the M:F/A function calls Mi:Fi/Ai Ni times, includes the file
Fj, uses the record Rk, uses the parse transform Pi and makes a
dynamic call that can't be resolved (erlang:apply() or a M:F()
application).
Dependencies created by dynamic function application will be difficult
to get detailed information about. Maybe dialyzer could help here?

Grouping this data at module and application level is easy.

best regards,
Vlad



More information about the erlang-questions mailing list