Depends could extract the following dependency types:
- Import
- Contain
- Parameter
- Call
- Return
- Throw
- Implement
- Extend
- Create
- Use
- Cast
- ImplLink
- Annotation
- Mixin
For most of relation types, the name is self-explained. ImplLink relation need more information.
- ImplLink
C/C++, Python
ImplLink could be explains as implementation link, or implicit link. In c/cpp file, if function foo calls function bar, we have relations of foo-[calls]-bar.
But, if we only analyse it based on invocation, it means foo have a call relation with bar's prototype. During runtime, the function called by foo is determined by link time.
ImplLink indicates that there is a implementation link between function foo and all of implementations of function bar.
//File A
void foo(){
bar();
}
//File B
void bar();
//File C
void bar(){
}
//File D
void bar(){
}
The relations of above code will be:
- foo - [Call] - bar (File B)
- foo - [ImplLink] - bar (File C)
- foo - [ImplLink] - bar (File D)
All lanaguages
Import is a relation between files. It indicates that File A includes or imports from File B.
###Examples
#include "LocalHeader.h"
package a;
import b.*;
import imported_a
require 'require_2'
All lanaguages
Contain is a relation between code elements(entities). It indicates that Element A contains Element B. For example, A class could contains a member, A function could contains a variable, etc.
###Examples
class A {
B *b;
C c;
};
void foo(){
B b;
}
class A {
B *b;
C c;
}
void foo(){
B b;
}
class A:
var_1 = B()
self.var_2 = B()
def foo():
global global_var
global_var = B()
class A
b = B.new
def foo
C = C.new
end
end
class A
b = B.new
def foo
C = C.new
end
end
All lanaguages
Parameter is a relation of function/method and it's parameters.
void foo(B b);
void foo(B b){}
def foo(b):
pass
def foo(b)
end
All lanaguages
Call is a relation of function/method invocation.
void foo(){
bar();
m.baz();
p->baz();
}
void foo(){
bar();
m.baz();
}
def foo(b):
bar()
m.baz()
def foo()
bar
bar()
m.baz
m.baz()
end
All lanaguages
Return is a relation of function/method and it's return type(s).
B foo(){
}
B foo(){
}
def foo():
b = B()
return b
class Class
def foo
c = Class.new
return c
end
def bar
c = Class1.new
c
end
end
C++,Java,Ruby, Python
Throw is similar as Return, it is a relation of function/method and it's throws type(s).
void foo(){
E e;
throw e;
}
void foo(){
throw new E();
}
def t1():
raise Bar()
class Class
def Class.test
raise Class1.new
end
end
C,C++, Java
Implement is a relation between a function or class implementation, and it's prototype/interface.
//A.h
void foo();
//A.c
void foo(){
}
We say that foo() of A.c implements foo of A.h
class A implements I {
}
C,C++, Java, Python, Ruby
Extends means inherit of OO lanaguage
C,C++, Java, Python, Ruby
Create is a relation of the function and objects it created
C,C++, Java
Cast is a relation of an expression and the casted types
All lanaguages
Use is a relation of an expression and the types/variables used by the expression.
Java/Python
The Annotation relation in Java, and Decorator relation of Python.
Ruby
Same as Mix-in of Ruby lanaguage.