Databases Reference
In-Depth Information
4.2.2 Finding Object Collaborations
Our analysis scans the method traces from one or more program executions
and extracts semantically related subsequences of manageable size to be ana-
lyzed separately. Doing so involves two challenges: First, the analysis must be
able to deal with large volumes of method traces as they result from real-world
programs. Ensuring scalability allows us to analyze a variety of traces from
different programs, and hence, helps to increase the coverage of the API by
the inferred protocols. Second, the analysis should focus on typical API usage
scenarios and discard incidental call sequences that are not representative.
We address these two challenges using an abstraction given by the pro-
grammer, namely, the grouping of related method calls into methods. A
method typically implements a small piece of functionality. Therefore, the
API methods called within a method often constitute a small and coherent
piece of API usage. We exploit this observation by considering the objects
used within a method execution and the methods called on them to form a
collaboration.
For example, the execution of method callM() depicted in Figure 4.4 in-
volves four callee objects: the list li, the iterator iter, and two instances of B,
b1 and b2. On each of them, one or more methods are called within the con-
text of callM(). We say that these objects collaborate and that the sequence
of calls on them is an object collaboration.
Definition 1. Object collaboration. The sequence of method calls within the
execution of a method and their receiver objects form an object collaboration.
Let a method call be a pair (o;s) of the receiver object o and the called method's
signature s. A collaboration is an ordered sequence
S = (o 1 ;s 1 );:::; (o n ;s n )
of calls issued within the execution of a method of outer ;s outer ). The following
objects are said to collaborate:
O = fo j 9(o;s) 2 Sg
Splitting method traces into object collaborations yields small and seman-
tically coherent sequences of method calls. Each collaboration can be analyzed
independently from other collaborations, which is crucial for keeping the anal-
ysis scalable.
While many typical API call sequences can be observed within the execu-
tion of one method, some usage scenarios may span across multiple methods.
Often, related calls happen in several methods that are called from one \root
method." To address such situations, our analysis has a parameter called nest-
ing level. With nesting level one only calls issued directly within a method are
considered to belong to a collaboration. By increasing the nesting level, the
analysis also considers indirect calls. For example, the calls to method g() in
Figure 4.4 are included in callM()'s collaboration with nesting level two. The
 
Search WWH ::




Custom Search