Changes between Version 4 and Version 5 of Dependency/Functions
- Timestamp:
- Apr 16, 2012, 8:04:08 AM (13 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Dependency/Functions
v4 v5 1 [[PageOutline]] 2 1 3 = Module and Function Dependencies = 2 4 … … 6 8 A '''cyclic dependency''' appears, when ''B'' is 7 9 also dependent directly (''B -> A'') or indirectly (e.g. ''B -> C -> A'') from ''A''. \\ 10 11 If one wants to have a deeper analysis and pays more 12 attention to the concerning functions, a '''function''' level query should be done. \\ In 13 our previous example, no function level cycle appears, unless ''A:foo'' calls ''B:foo'', 14 and ''B:foo'' calls ''A:foo''. \\ 15 8 16 Note that it is possible to have a cyclic dependency among the modules while having 9 17 no cyclic dependencies among the functions. \\ For example, a function call from 10 18 ''A:foo'' to ''B:foo'', and from ''B:foo2'' to ''A:foo2'' implies a cyclic dependency on the 11 19 module level. \\ 12 If one wants to have a deeper analysis and pays more13 attention to the concerning functions, a '''function''' level query should be done. \\ In14 our previous example, no function level cycle appears, unless ''A:foo'' calls ''B:foo'',15 and ''B:foo'' calls ''A:foo''. \\16 20 \\ 17 21 18 22 == Possible Analysis == 19 23 20 21 The following examinations can be done considering dependencies:\\ 22 * ''Checking'' whether there are ''cycles'', if so, ''listing'' them out 23 * ''Printing out'' the cycles, meaning the modules/functions will not be represented by their proper graph node, but with their ''names'' (instead {{{ {'$gn', module, 3} }}} there will be {{{test}}}). 24 * Checking for cycle ''from one or more nodes'' as starting points 25 * ''Drawing'' the dependency graph 26 * Drawing the dependency graph from a starting node 27 * Drawing the cyclic part of the dependency graph if one exists (you can also give a cyclic node as a starting node) \\ 28 \\ 24 There are different kind of examinations that can be run considering dependencies. \\ 25 26 First of all, the possibility of ''checking for cycles'' on RefactorErl database. This means 27 that the program is going to look for loops on the given level, and returns with the path of the cycles. \\ 28 29 If one wants to have a more visual view of the dependencies, there is the ''draw'' option. This will generate a ''.dot'' file, which latter can be converted to a desired image file format. Since in the case of a vast database, the generated picture of dependencies can be very complex and hard to figure out, there are different options how the user can narrow down the result, and get a more easier understandable view. For instance, it is possible just to receive an image of the graph which contains only the cycles, or to exclude the OTP modules from the result. \\ 30 In every dependency option there is the opportunity to run the examination from a given function/module or a list of them. 31 32 \\ 33 29 34 Dependency analysis can be done through '''two''' interfaces: \\ 30 35 31 36 1. ''ri'' (using RefactorErl through console interface) 32 2. using the ''web'' interface. \\ 33 37 2. using the ''web'' interface. (see: wiki:WebInterface/DependencyExaminations) \\ 38 39 40 == The ''ri'' == 34 41 35 42 The two interface functions are: 36 43 37 1. {{{ri:draw_dep/1}}} - for drawing 38 2. {{{ri:print_dep/1}}} - for listing, printing out to the standard output \\ 44 1. 45 {{{#!erlang 46 ri:draw_dep/1 47 }}} 48 - for drawing 49 2. 50 {{{#!erlang 51 ri:print_dep/1 52 }}} 53 - for listing, printing out to the standard output \\ 39 54 \\ 40 55 \\ … … 42 57 To call the desired query, the user should give a ''proplist'', stating the different requirements. \\ 43 58 The options and the keys for the functions are: 44 * {{{{level, Level} }}} 45 {{{Level = mod | func}}} 59 * 60 {{{#!erlang 61 {level, Level} 62 Level = mod | func 63 }}} 46 64 Stating the level of the query, module or function level. 47 * {{{{type, Type}}}} \\ 48 {{{Type = all | cycles}}} 65 * 66 {{{#!erlang 67 {type, Type} 68 Type = all | cycles 69 }}} 49 70 The investigation should be done on the whole graph/table, or just on the cycle part (if it exists). \\ 50 71 When listing out the cycles, {{{all}}} gives back the result in their graph node form, while {{{cycles}}} returns with their proper 51 72 names. 52 * {{{{gnode, Node | NodeList::lists(Node)}, }}} \\ 53 {{{Node = node() | Name,}}} \\ 54 {{{Name = Module::atom() | Function::string()}}} \\ 73 * 74 {{{#!erlang 75 {gnode, Node | lists(Node)} 76 Node = node() | Name 77 Name = Module::atom() | Function::string() 78 }}} 55 79 Specify a node or nodes (given in a list) as a starting point for the analysis. \\ 56 Module level: the name as an atom \\ 57 Function level: name as string ("Module:Function/Arity"). \\ 58 In both cases the node/nodes can be given as graph nodes as well.\\ 59 * {{{{dot, Dot::string()}}}} 80 - Module level: the name as an atom \\ 81 - Function level: name as string ("Module:Function/Arity"). \\ 82 - In both cases the node/nodes can be given as graph nodes as well.\\ 83 * 84 {{{#!erlang 85 {dot, Dot::string()} 86 }}} 60 87 The user can stipulate his own name and absolute path or the generated {{{.dot}}} file. 61 88 Unless it is a new absolute path, the {{{.dot}}} file will be placed into 62 89 the {{{./dep_files}}} directory. Only available in the case of draw_dep. 63 * {{{ {exception, NodeList::lists(Node)} }}} \\ 64 {{{Node = node() | Name,}}} \\ 65 {{{Name = Module::atom() | Function::string()}}} \\ 90 * 91 {{{#!erlang 92 {exception, NodeList::lists(Node)} 93 Node = node() | Name 94 Name = Module::atom() | Function::string() 95 }}} 66 96 The exception key gives the user the opportunity to define certain nodes (by stating their name or by giving a gnode) which 67 97 will be exluded from the analysis. 68 * {{{ {leaves, NodeList::lists(Node)} }}} \\ 69 {{{Node = node() | Name,}}} \\ 70 {{{Name = Module::atom() | Function::string()}}} \\ 98 * 99 {{{#!erlang 100 {leaves, NodeList::lists(Node)} 101 Node = node() | Name 102 Name = Module::atom() | Function::string() 103 }}} 71 104 Leaves contains those nodes which would be included in the analysis, but their children won't (so this way they become exceptions). 72 * {{{ {otp, true | false} }}} 105 * 106 {{{#!erlang 107 {otp, true | false} 108 }}} 73 109 The built-in erlang otp modules should be included in the analysis or not. The default value is false. 74 110