Decomposing Object oriented class

38
Decomposing God Class Using Agglomerative Clustering Technique and Jaccard Distance Measure

description

Decomposing Object oriented class using agglomeration clustering. i extend this for c program

Transcript of Decomposing Object oriented class

Page 1: Decomposing Object oriented class

Decomposing God Class Using Agglomerative Clustering Technique

and Jaccard Distance Measure

Page 2: Decomposing Object oriented class

Content•Motivation –Paragraph Decomposition•Decomposing oo class•Refactoring•Literature Survey •Proposed methodology•System Architecture•Module Designs•Implementation•Performance measure•Report•Conclusion •Reference

Page 3: Decomposing Object oriented class

Motivation –Decomposition Page1 and Page 2 having same content ,tell which Page is clear to read?

Page 1Aravind was born in Namakal. Dinesh was born in erode. Aravind was finished his schooling in Namakal city. Dinesh was finished his schooling in a village named Kodumudi. Aravind was finished his under graduate in Arruni engineering college , Thiruvanamali. Dinesh was finished his MCA degree in Erode arts college , Erode. But today Aravind and Dinesh doing their ME degree in CEG, Chennai. They are staying in same room. They are friends. How it happens ? How they meet ? Why they meet? God do all things.

Page 2About Aravind

Aravind was born in Namakal. Aravind was finished his schooling in Namakal city. Aravind was finished his under graduate in Arruni engineering college, Thiruvanamali.

About Dinesh Dinesh was born in erode. Dinesh was finished his schooling in a village named Kodumudi. Dinesh was finished his MCA degree in Erode arts college , Erode.

Aravind and Dinesh But today Aravind and Dinesh doing their ME degree in CEG, Chennai. They are staying in same room. They are friends. How it happens ? How they meet ? Why they meet?

God do all things.

Page 4: Decomposing Object oriented class

Motivation - Decomposition Group the Aravind related data and group them as About Aravind

Page 2About Aravind

Aravind was born in Namakal. Aravind was finished his schooling in Namakal city. Aravind was finished his under graduate in Arruni engineering college, Thiruvanamali.

About Dinesh Dinesh was born in erode. Dinesh was finished his schooling in a village named Kodumudi. Dinesh was finished his MCA degree in Erode arts college , Erode.

Aravind and Dinesh But today Aravind and Dinesh doing their ME degree in CEG, Chennai. They are staying in same room. They are friends. How it happens ? How they meet ? Why they meet?

God do all things.

Page 1Aravind was born in Namakal. Dinesh was born in erode. Aravind was finished his schooling in Namakal city. Dinesh was finished his schooling in a village named Kodumudi. Aravind was finished his under graduate in Arruni engineering college , Thiruvanamali. Dinesh was finished his MCA degree in Erode arts college , Erode. But today Aravind and Dinesh doing their ME degree in CEG, Chennai. They are staying in same room. They are friends. How it happens ? How they meet ? Why they meet? God do all things.

Page 5: Decomposing Object oriented class

Motivation - Decomposition Group the Dinesh related data and group them as About Dinesh

Page 2About Aravind

Aravind was born in Namakal. Aravind was finished his schooling in Namakal city. Aravind was finished his under graduate in Arruni engineering college, Thiruvanamali.

About Dinesh Dinesh was born in erode. Dinesh was finished his schooling in a village named Kodumudi. Dinesh was finished his MCA degree in Erode arts college , Erode.

Aravind and Dinesh But today Aravind and Dinesh doing their ME degree in CEG, Chennai. They are staying in same room. They are friends. How it happens ? How they meet ? Why they meet?

God do all things.

Page 1Aravind was born in Namakal. Dinesh was born in erode. Aravind was finished his schooling in Namakal city. Dinesh was finished his schooling in a village named Kodumudi. Aravind was finished his under graduate in Arruni engineering college , Thiruvanamali. Dinesh was finished his MCA degree in Erode arts college , Erode. But today Aravind and Dinesh doing their ME degree in CEG, Chennai. They are staying in same room. They are friends. How it happens ? How they meet ? Why they meet? God do all things.

Page 6: Decomposing Object oriented class

Motivation - DecompositionGroup aravind and Dinesh related data in Aravind and Dinesh

Page 1Aravind was born in Namakal. Dinesh was born in erode. Aravind was finished his schooling in Namakal city. Dinesh was finished his schooling in a village named Kodumudi. Aravind was finished his under graduate in Arruni engineering college , Thiruvanamali. Dinesh was finished his MCA degree in Erode arts college , Erode. But today Aravind and Dinesh doing their ME degree in CEG, Chennai. They are staying in same room. They are friends. How it happens ? How they meet ? Why they meet? God do all things.

Page 2About Aravind

Aravind was born in Namakal. Aravind was finished his schooling in Namakal city. Aravind was finished his under graduate in Arruni engineering college, Thiruvanamali.

About Dinesh Dinesh was born in erode. Dinesh was finished his schooling in a village named Kodumudi. Dinesh was finished his MCA degree in Erode arts college , Erode.

Aravind and Dinesh But today Aravind and Dinesh doing their ME degree in CEG, Chennai. They are staying in same room. They are friends. How it happens ? How they meet ? Why they meet?

God do all things.

Page 7: Decomposing Object oriented class

• We make page 1 as clearly readable by– Grouping Aravind’s data as About Aravind.– Grouping Dinesh’s data as About Dinesh.– Grouping General data as Aravind and Dinesh

• This event is called, Decomposing a big paragraph into 3 small Clearly readable paragraph.

Motivation - Decomposition

Page1

Aravind And DineshAbout DineshAbout Aravind

Page 8: Decomposing Object oriented class

Decomposing a Class• Like Paragraph Decomposition we Decompose Big OO

Class(GOD Class) into Small and understandable OO Class– Why we want to decompose a oo class?– What is big OO class?– Why class become big?– Why we want to decompose a Big oo class?

Page 9: Decomposing Object oriented class

Public class person{Private String name ;private String job;Private String OfficeAreaCode;Private officenumberl;Public void changeJob(string newJob){ If(!newjob.equals(job))){This.job=newjob;}Name+=“,”+newjob;}Public void modifyname(String newName){ If(!newname.equals(name)){this.name=newName;}job=newName+”,”+job;}Public Dtring getTelephoneNumber(){String

phone=officeAreacode+”-”+officeNumber;Name+=“,”+phone;Job+=“,”+phone;Return phone;} }

Public class person_NewCLASS1{Private String OfficeAreaCode;Private String officenumberl;Public Dtring getTelephoneNumber(){String phone=officeAreacode+”-”+officeNumber;Name+=“,”+phone;Job+=“,”+phone;Return phone;}}Public class person_NewCLASS2

{ Private String name ; private String job; Public void changeJob(string newJob) { If(!newjob.equals(job))) { This.job=newjob; } Name+=“,”+newjob; } Public void modifyname(String newName) { If(!newname.equals(name) { this.name=newName; } job=newName+”,”+job; }

}

Class person is divided into 2

class

Page 10: Decomposing Object oriented class

Person

person_NewCLASS1 person_NewCLASS2

Page 11: Decomposing Object oriented class

Refactoring• Refactoring are widely recognized as ways to

improve the internal structure of object-oriented software while maintaining its external behavior.

• Two types of refactoring– Move method– Decomposition

• In move method we interchange Attributes and methods between class.

Page 12: Decomposing Object oriented class

Literature Survey 1• Identifying God Class 1

– Trifu and Marinescu[19]• They define God classes as “large, non-cohesive classes

that have access to many foreign data”

– Tahvildari and Kontogiannis [18]• propose two quality design heuristics and use a

diagnosis algorithm based on complexity, cohesion and coupling metrics to identify design flaws

– DuBois [12]• Gives the method to identify GOD class. And give some

line Guide lines to solve The God class. It is Manual work

Page 13: Decomposing Object oriented class

Literature Survey 2

• Identifying God Class 2 – Demeyer [10]

• suggest some conceptual criteria to identify the God classes

• The above 4 Authors gives Identification method of God class not solutions for that

Page 14: Decomposing Object oriented class

Literature Survey• Re-modularizing software modules

– Mancoridis[11]• Using Clustering technique for Re modularization

– Doval[11]• View the Partitioning problem as Optimization Problem

– Shokoufandeh• Special Clustering algorithm used for Re modulization

– Sartipi and Kontogiannis [16]• propose a semi-supervised clustering framework for

recovering the software architecture.

Page 15: Decomposing Object oriented class

Literature Survey

• Identify Extract Class opportunities– Simon[17]

• suggest a visualization techniques• Dependency set• Mapping

Page 16: Decomposing Object oriented class

Literature Survey

• Simons visualization Mapping

A1A2A3A4A5M1M2M3M4

A1A2A3A4A5M1M2M3M4

Page 17: Decomposing Object oriented class

Literature Survey

• Identify Extract Class opportunities– Joshi and Joshi [13]

• consider the problem of classes with low cohesion as a graph partitioning problem

– De Lucia[14]• structural and conceptual criteria.• weighted graph of the class methods.• MaxFlow - MinCut algorithm.

• Xcode[7] is one of the refactoring tool

Page 18: Decomposing Object oriented class

Proposed Methodology

• Identify Extract Class opportunities we use 2 Methodologies[1]– Aggolaramative Clustering– Jaccard Distance

Page 19: Decomposing Object oriented class

System Architecture

Oo code/C program Decomposed oo code

Decomposer

Cluster engine

Distant Measurer

Entity set generator

Parser

C program parserOo parser

God class Identifier

Class maker

Class generatorClass divider

Group all class

Grouping oo class

Grouping c

related class

Code re-assembler

Ranking classes

Re-assemble the class

Distend measurer Decomposer

Page 20: Decomposing Object oriented class

Module1 Design Diagram

OO ParserOO Parser

Disk OO file

Word file

Class files

Word Parser

Class Divider

Class name display interface

OO File name

Class Names

Page 21: Decomposing Object oriented class

Module2 Design Diagram

Page 22: Decomposing Object oriented class

Module3 Design Diagram

Page 23: Decomposing Object oriented class

Module4 Design Diagram

Page 24: Decomposing Object oriented class

Module5 Design Diagram

Page 25: Decomposing Object oriented class

Module6 Design Diagram

Page 26: Decomposing Object oriented class

Module7 Design Diagram

Page 27: Decomposing Object oriented class

Module8 Design Diagram

Page 28: Decomposing Object oriented class

Module9 Design Diagram

Page 29: Decomposing Object oriented class

Module10 Design Diagram

Page 30: Decomposing Object oriented class

Module11 Design Diagram

Page 31: Decomposing Object oriented class

Implementation

• Parser– Get Java file as an input– Parse file word by word– Store all the words into files

Page 32: Decomposing Object oriented class

Performance measure

• We measure the performance of module one using the following metrics– Parse word ratio

=(Number of words produced by parser)/(Total number of words in the

file)

Page 33: Decomposing Object oriented class

Report

• Complexity Analysis• Pseudo code• Project Schedule

Page 34: Decomposing Object oriented class

Conclusion

• Module 1 completed. • Module 2 Started.• Module 3 and 4 are more complex Modules in

the first Phase. In phase 2 Module 7 is complex

• Form our software we never get 100% error free code.

• We try to get 100% error free code.

Page 35: Decomposing Object oriented class

Reference1. Marios Fokaefs, Nikolaos Tsantalis, Alexander Chatzigeorgiou , Joorg Sander “Decomposing Object-Oriented Class Modules

Using an Agglomerative Clustering Technique”2009/September.2. N. Tsantalis and A. Chatzigeorgiou. Identification of Move Method Refactoring Opportunities. IEEE Transactions on Software

Engineering, 35(3):347–367, May/June 20093. Linda M. Laird M. Carol Brennan “Software measurement and Estimation A Practical Approch” wille interscience A jonson &

wiley and sons inc,.publication.4. N. Anquetil and T. Lethbridge. Experiments with Clustering as a Software Re modularization Method. In WCRE ’99:

Proceedings of the 6th Working Conference on Reverse Engineering,1999.5. Martin, J.; Muller, H.A.; , "Strategies for migration from C to Java," Software Maintenance and Re engineering, 2001. Fifth

European Conference on , vol., no., pp.200-209, 2001doi: 10.1109/.2001.9149886. A Model of Refactoring Tool Use Emerson Murphy-Hill The University of British Columbia [email protected]. Website:www.xcoder.com8. Bart Du Bois and Serge Demeyer Jan Verelst “Refactoring - Improving Coupling and Cohesion of Existing Code” 9. Class lecturer notes Dr.Baskarsn: Function points 10. S. Demeyer, S. Ducasse, and O. M. Nierstrasz. Object-Oriented Reengineering Patters. Morgan Kaufman Publishers,2002.11. D. Doval, S. Mancoridis, and B. S. Mitchell. Automatic Clustering of Software Systems Using a Genetic Algorithm.

Proceedings of the 5th International Conference on Software Tools and Engineering Practice, 30 August - 2 September1999.12. B. DuBois, S. Demeyer, and J. Verelst. Refactoring – Improving Coupling and Cohesion of Existing Code. Proceedings of the

11th Working Conference on Reverse Engineering,pages 144–151, November 8-12 2004

Page 36: Decomposing Object oriented class

Reference13. P. Joshi and R. K. Joshi. Concept Analysis for Class Cohesion.13rd European Conference on Software Maintenance and

Reengineering, pages 237–240, March 24-27 2009.14. A. D. Lucia, R. Oliveto, and L. Vorraro. Using Structural and Semantic Metrics to Improve Class Cohesion. 24th IEEE

International Conference on Software Maintenance, 2008.15. S. Mancoridis, B. S. Mitchell, C. Rorres, Y. Chen, and E. R.Gansner. Using Automatic Clustering to Produce High-Level System

Organizations of Source Code. Proceedings of the 6th International Workshop on Program Comprehension,pages 45–52, 1998.

16. K. Sartipi and K. Kontogiannis. Component Clustering Based on Maximal Association. Proceedings of the IEEE Working Conference on Reverse Engineering, October 2001.

17. F. Simon, F. Steinbruckner, and C. Lewrentz. Metrics Based Refactoring. Proceedings of the 5th European Conference on Software Maintenance and Reengineering, pages 30–38,2001.

18. L. Tahvildari and K. Kontogiannis. A Metric-Based Approach to Enhance Design Quality Through Meta-Pattern Tranformations. Proceedings of the 7th European Conference on Software Maintenance and Reengineering, pages 183–192, March 26-28 2003.

19. A. Trifu and R. Marinescu. Diagnosing Design Problems in Object Oriented Systems. Proceedings of the 12th Working Conference on Reverse Engineering, 2005.

Page 37: Decomposing Object oriented class

Queries

Page 38: Decomposing Object oriented class

Thank you