02.04.2013 Views

CONTENTS

CONTENTS

CONTENTS

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

TRANSFORMING PROCEDURAL INTO OBJECT-ORIENTED SOFTWARE SYSTEMS 187<br />

We have chosen the distance between two entities as expressed in Equation (1)<br />

because it emphasizes the idea of cohesion. As illustrated in [4], “Cohesion refers to<br />

the degree to which module components belong together”. Our distance, as defined in<br />

Equation (1), highlights the concept of cohesion. It is very likely that entities with<br />

low distances have to be placed in the same application class, and distant entities<br />

have to belong to different aplication classes.<br />

kOOS algorithm is a k-medois like algorithm that uses a heuristic for choosing<br />

the initial medoids.<br />

The entity chosen as the first medoid is the most “distant” entity from the set of<br />

all entities (the entity that maximizes the sum of distances from all other entities).<br />

At each step we select from the remaining entities the most distant entity relative<br />

to the already chosen medoids. If the selected entity is close enough to the already<br />

chosen medoids, then the process is stoped, otherwise the selected entity is added to<br />

the medoids list and we try to choose a new medoid from the remaining entities.<br />

We consider an entity close to a set of medoids if the distances between the entity<br />

and any of the medoids are less than a given threshold. We have chosen the value<br />

1 for the threshold because distances greater than 1 are obtained only for unrelated<br />

entities (Equation (1)).<br />

The idea of the above described heuristic is to choose medoids that will act as<br />

seeds for the clusters that will represent application classes in the resulted objectoriented<br />

system.<br />

After selecting the initial medoids, kOOS behaves like the classical k-medoids<br />

algorithm.<br />

The main idea of the kOOS algorithm that we apply in order to group entities<br />

from a software system is the following:<br />

(i) The initial number p of clusters and the initial medoids are determined by<br />

the heuristic described above.<br />

(ii) The clusters are recalculated, i.e., each object is assigned to the closest<br />

medoid. Empty clusters will be eliminated from the partition.<br />

(iii) Recalculate the medoid i of each cluster k based on the following idea: if h is<br />

an object from k such that <br />

(d(j, h) − d(j, i)) is negative, then h becomes<br />

j∈k<br />

the new medoid of cluster k.<br />

(iv) Steps (ii)-(iii) are repeatedly performed until there is no change in the partition<br />

K.<br />

Each cluster from the resulted partition will represent an application class from<br />

the equivalent object-oriented version of the software system S.<br />

We have successfully evaluated our approach on a simple code example written<br />

in Borland Pascal.<br />

3. Conclusions and further work<br />

We have presented in this paper a partitional clustering algorithm (kOOS) that<br />

can be used for assisting software developers in transforming procedural software

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!