During partition the evaluation criterion mainly
represents how closely the class under consideration
and the current package are related. For a class C
and a package P: Let,
and N is the set of all the classes,
RCi is the
relating degree between class
and C , then our
criteria combines three measurements below:
Refer operator represents directed relations, such as
generalization, dependency, aggregation etc. In these
factors, RCP represents the summation of relating
degrees between C and P; RCN represents the
summation of relating degrees between C and N;
refCP represents the number of the classes which
refer both class C and package P; refC represents the
number of the classes which refer both class C.
Calculation of the relating degree between two
classes are discussed in (Xin, et al.) and (Xu W., et
al., 2003). For example we can assume that:
generalization is 3, aggregation is 2 and dependency
is 1. Here we consider directed relations, that is,
only the situations that C is referred by other classes
are taken into account when considering whether C
should be added into P.
These factors represent different aspects of the
evaluation. The first one reflects the probability that
class C and package P are used together. The second
one shows to which extents C particularly serves P.
The third one describes the degree of class C as a
common function provider. The more widely a class
is used, the fewer score it can get from factor 3.
Each time when evaluating whether class C
should be added into package P, the tool calculates
the score got from these three factors and compares
it with the criterion specified to make the decision.
FDReengineer provides a default criterion according
to the level of each partition. Additionally, the user
can adjust the criterion at will, cancel the last
partition and redo it.
After this kind of partition, the legacy system is
divided into several parts. Some of them are close
organized subsystems, and the classes providing
common functions are picked out separately. The
resulting packages can be reused in the forward
phase. Some common ones can still be valuable in
other domains.
In the closure method all the classes under
consideration will be added into the package. In fact,
the closure method is a special case of the spread
method in condition of setting the criterion to 0. The
improved method has two advantages:
1) It can determine which package the class falls
into by means of specific algorithms in the case of
junction classes.
2) The classes which provide common functions
can be extracted separately.
Figure 2 shows an example of system partition.
If partition begins from class B, the resulting
package will be {B, E, F, I, J, K}. Class J and H will
repeat in several packages, since they provide
service for many classes.
Let we redo the partition by the spread method.
Suppose that the three factors are combined with the
scale of 3:1:1 and the criterion is 70 while the full
score is 100. So the full score of the three factors are
60, 20, and 20 respectively. We perform the partition
from B, so the initial package is {B}. Here are the
steps:
1) Consider the classes referred by B. The scores
of E and F are: 60+20+18.2=92.2, which is above
70, so they are added into the package. Now the
package is {B, E, F}. The score of J is:
36+12+10.9=58.9, so it should not be added here.
2) Consider I, J and K, which are referred by E.
The score of I is: 60+20+18.2=92.2, so it is added
into the package. Class J is considered again. Its
score is: 48+16+10.9=74.9, and it can be added into
current package this time. Now the package is {B, E,
F, I, J}. Class K will not be added because its score
is: 30+6.7+9.1=45.8.
3) All the classes referred by the classes in the
current package are considered, and no more classes
will be added. Therefore, this partition ends in a
package {B, E, F, I, J}.
Furthermore, class K will not fall into any
package of other classes. We will get a package only
containing K. This is what we expect, since K
provides service for many subsystems. Thus it can
be seen that this method can get a better effect.
The first partition of the legacy system produces
some subsystems, then partitions can be performed
on each subsystem using the same method. When
doing this, only the references between classes of the
subsystem will be taken into account. The right
criterion varies with the abstract level. According to
our experience, the partition at upper levels should
be loose to produce subsystems of coarse
{}
{}
,|
,))(()(|
,,
CrefersAArefC
PAPrefersACrefersAArefCP
RCiRCNRCiRCP
NiPi
=
∈∨∧=
==
∑∑
∈∈
N
refCN
RCN
RCP
refC
refCP
−
.3.2.1
Figure 2: An example of system partition
RESEARCH ON SUPPORT TOOLS FOR OBJECT-ORIENTED SOFTWARE REENGINEERING
401