Presentation is loading. Please wait.

Presentation is loading. Please wait.

Placement of Entities in Object-oriented Systems by means of a Single-objective Genetic Algorithm Margaritis Basdavanos Alexander Chatzigeorgiou University.

Similar presentations


Presentation on theme: "Placement of Entities in Object-oriented Systems by means of a Single-objective Genetic Algorithm Margaritis Basdavanos Alexander Chatzigeorgiou University."— Presentation transcript:

1 Placement of Entities in Object-oriented Systems by means of a Single-objective Genetic Algorithm Margaritis Basdavanos Alexander Chatzigeorgiou University of Macedonia Thessaloniki, Greece 5 th International Conference on Software Engineering Advances (ICSEA’2010)

2 Design System The decomposition into modules The design (in any technical field) consists in:

3 Design The design (in any technical field) consists in: The decomposition into modules System The definition of the relationships among them

4 Design The design (in any technical field) consists in: The decomposition into modules System The definition of the relationships among them Functionality A Fields: X, Y Functionality B Fields: Y, Z The assignment of responsibilities and state information

5 “Old” problem The distribution of responsibilities and state information among system modules is an “old” problem in SE How to achieve an optimal design?

6 “Old” problem – Why is it important? Coupling Cohesion

7 Why is coupling and cohesion important? Empirical studies have shown that they affect a large number of –ilities in OO design comprehensibility maintainability testability reusability Attributes in Quality Models €

8 Software Ageing well-designed code Design quality decays

9 Problem Given a system S : (methods, attributes, classes) Find an optimal assignment that minimizes coupling and maximizes cohesion Search problem in the space of alternative arrangements

10 Optimal Placement Placing 4 entities into 2 classes For x classes and n entities the search space consists of x n possible allocations !!

11 Crash Course on Genetic Algorithms GAs are heuristics that can generate useful solutions to optimization and search problems Inspired by evolution and natural selection (Darwin's theory)

12 Crash Course on GAs – Brief Overview Select initial population of individuals Evaluate the fitness of each individual in that population Breed new individuals through crossover and mutation operations

13 Crash Course on Gas - Terminology Potential Solutions are usually encoded as binary or integer strings called chromosomes chromosome Elements of chromosomes are called genes genes The values that a gene can take are called alleles 12123 alleles The positions of genes in the chromosome are called loci 0 1 2 3 4 5 6 7 8 9 loci

14 Our fitness function: Entity Placement Constituents of an OO system: methods and attributes Methods can access attributes and methods of the class that they belong to directly and also attributes and methods of other classes through references. Attributes can be accessed directly from methods of the class that they belong to and also from methods of other classes that have reference to that class. For each entity it is possible to define a set of entities that it accesses (if it is a method) or a set of entities that it is accessed from (if it is an attribute). Entity Set of a Class: contains all of its members

15 Entity Placement It is reasonable to assume that the similarity between an entity and a class is high when the number of common entities is large Jaccard Distance

16 Example of Distance Calculation 16 f1 S m = {Source.field, Target.f1, Target.m2}S Target = {Target.f1, Target.m2, Target.m1} field S m  S Target = {Target.f1, Target.m2} S m  S Target = {Source.field, Target.f1, Target.m2, Target.m1} distance(S m, S Target ) = 1 – 2/4 = 0.5

17 Global Measure of Entity Placement cohesion coupling

18 Simplified Case Studies Entity SetsClass Sets S x = {m 2 } => S 0 = {3} S A = { x, m 1 } => S 0 = {0,1} S m1 = {y} => S 1 = {2} S B = { y, m 2 } => S 1 = {2,3} S y = {m 1 } => S 2 = {1} S m2 = {x} => S 3 = {0}

19 Simplified Case Studies Chromosome of the initial model System Entity Placement = 2 Number of possible arrangements: 2 4 = 16 Decoded Form Encoded Form

20 Optimal Placement Placing 4 entities into 2 classes

21 Simplified Case Studies GA population size 2*m = 2*4 = 8 Crossover Rate:50%, Mutation Rate: 12,5% Selection rate: 80% –Chromosome of the optimal solution Resulting Entity Placement value = 0 –Average execution time: 14 ms (Pentium IV 3,2GHz) –Average number of generations : 3

22 Simplified Case Studies Optimal Class Diagram Evolution of the fitness function

23 Simplified Case Studies - #2

24 Chromosome for OrderManagement Κωδικοποιημένη κατανομή οντοτήτων στις κλάσεις του συστήματος Entity Placement OrderManagement = 0,7141 Number of possible arrangements: 6 38

25 Simplified Case Studies - #2 GA population [1,2*38] = 46 –Configuration: p c = 50% p m = 2,63% p s = 60% Final Entity Placement value = 0,6878 –Average execution time: 15,7 s (Pentium IV 3,2GHz) –Number of generations : 86

26 Simplified Case Studies - #2 Evolution of Entity Placement

27 Eclipse Plugin Project to be analyzed Analysis by clicking here Results of the GA

28 Eclipse Plugin

29 Conclusions Optimal solutions can be reached within reasonable time (much faster than Multi-Objective GAs) Feasible distribution of entities among classes avoiding the generation of “God” classes Entity Placement captures efficiently coupling and cohesion

30 Future Work Handling of user constraints Proper handling of inheritance Empirical Studies on large systems

31 Thank you for your attention !! 5 th International Conference on Software Engineering Advances (ICSEA’2010)


Download ppt "Placement of Entities in Object-oriented Systems by means of a Single-objective Genetic Algorithm Margaritis Basdavanos Alexander Chatzigeorgiou University."

Similar presentations


Ads by Google