Wednesday, August 21, 2019
Evaluation of Code Smells Detection Using Meta-heuristics
Evaluation of Code Smells Detection Using Meta-heuristics Evaluation of code smells detection using Meta-heuristicsà Optimization algorithm Ragulraja.M Abstract-The development of software systems over many years leads to needless complexity and inflexibility inà design which leads to a large amount of effort for enhancements and maintenance. To take code smells detection as aà distributed optimization problem. The intention is that to aggregates different methods in parallel way to achieve aà common goal detection of code smells. To this conclusion, it utilized Parallel Evolutionary algorithms (P-EA) whereà numerous evolutionary algorithms with adaptation are executed in parallel cooperative manner, to find unanimityà between detection of code smells. An experimental results to compare the execution of our cooperative P-EA method withà random search, two genetic based approaches and two bad designs detection techniques are found to provide theà statistical measure of results witness to support the claim that cooperative P-EA is more economic and potential than theà art detection approaches based on benchmark of open source systems, whereas the results are generated in terms ofà precision and recall incurred on various code smells types. In this approach should corroborate on an extra code smellsà types with the objective of resolve the common applicability of our methodology. Keywords-Parallel Evolutionary Algorithm, Software Metrics, Code smells, Software Quality Engineering. I.INTRODUCTION Software maintenance projects are veryà costly. The total maintenance costs of Softwareà project are estimated to 40%-70% of the total cost of the lifecycle of the project consequently, reducing theà effort spent on maintenance can be seen as a naturalà way of reducing the overall costs of a softwareà project. This is one of the main reasons for the recentà interest in concepts such as refactoring and codeà smells. Hence, researchers have proposed severalà approaches to reduce defects in software .Suggestedà solutions include improvement of clarity in softwareà design, effective use of process and product metrics,à achievement of extensibility and adaptability in theà development process. The research focusing on theà study of bad software designs also called bad smellsà or code smells. To avoid these codes smellsà developers to understand the structure of source code. The large systems of existing work in badà smells or code smells detection relies on declarativeà rule specification. In these specifications, rules areà manually constructed to identify symptoms that canà be used for categorization code smells with objectà oriented metrics information. Each code smell, rulesà are defined in the form of metrics combinations. Many studies reported that manual categorizationà with declarative rule specification can be large. Theseà need a threshold value to specify the code smells. Further problem is that translation from symptoms toà rules is not obvious because there is no unanimityà symptom based description of bad smells. When unanimity occurs, the correlation of symptoms couldà be consociated with code smells types, it leads toà precise identification of code smells types. To handle these problems, we plan to extendà an approach based on use of genetic programming toà provide detection rules from the examples of codeà smells detection with metric combinations. However,à the quality of the rules depends on the behavioralà aspects of code smells, and it is not easy to confirmà that coverage also because there is still someà precariousness involves in detected code smells dueà to the difficulty to evaluate the coverage of the baseà of code smell examples. In another past work, we proposed techniqueà based on an artificial immune system metaphor toà detect code smells by deviation with well designedà systems. Thus, we believe in that an effective methodà will be to merge with detection algorithms toà discover consensus when detecting code smells. We intend to provide code smells detection as aà distributed optimization problem.The implementationà of our approach can be established by combiningà Optimization process in parallel manner to encounterà consensus involving detection of code smells. II. RELATED WORKS: There are various studies that have mainlyà based on the code smells detection in softwareà engineering using different methods. Theseà methodologies range from fully automatic detectionà to direct manual inspection. However,there is noà work that focuses on merging various detectionà algorithms to find unanimity when identifying codeà smells. In this work, the classification existingà approach for detection of code smells into variousà broad categories: symptom based approaches, manualà approaches, metric based approaches, search basedà approaches and cooperative based approaches. 2.1 Manual approaches: The software maintainers should manuallyà inspect the program to detect existing codeà anomalies. In addition, they mentioned particularà refactoringà ¢Ã¢â ¬Ã
¸s for each code smells type. Theà technique is to create a set of ââ¬Å"reading techniquesâ⬠à which help a reviewer to ââ¬Å"readâ⬠a design artifact forà calculating related information. The demerits ofà existing manual approaches is that they are finally aà human centric process which involves a great humanà effort and strong analysis and interpretation attemptà from software maintainers to find design fragmentsà that are related to code smells.Furthermore, theseà methods are time consuming, error prone and focusà on programs in their contexts. Another significantà issue is that locating code smells manually has beenà prescribed as more a human intuition than an accurateà science. 2.2 Metric based approaches: The ââ¬Å"detection strategyâ⬠mechanism forà formulating metric based rules for finding deviationsà from well design code. Detection strategies permits toà maintainer to directly find classes or methodsà subjected by a particular design smells. Theseà detection strategies for capturing about ten importantà flaws of object oriented design found in literature. Ità is accomplished by evaluating design quality of anà object oriented system via quantifying deviationsà from good design heuristics and principles byà mapping these design defects to class level metricsà such as complexity, coupling and cohesion by defining rules. Unfortunately, multi metrics neitherà encapsulate metrics in a more abstract construct,norà do they permit a negotiable combination of metrics. In common, the effectiveness of combining metric orà threshold is not clear, that is for each code smell,à rules that are declared in terms of metricà combinations need an important calibration effort toà find the fixing of threshold values for each metric. 2.3 Search based approaches: This approach is divined by contributions inà the domain of search based software engineering. SBSE uses search based approaches to resolveà optimizations problems in software engineering. Once the task is consider as a search problem, severalà search algorithms can be employed to solve thatà problem. Another approach is based on search basedà techniques, for the automatic identification ofà potential code smells in code. The detection focusedà on thenotion that more code deviates from goodà codes, the more likely it is bad. In another work,à detections rule will be produced and is described as aà combination of metrics or thresholds that betterà similar to known an examples of bad smells. Then,à the correction solutions, a combination of refactoringà operations, should reduce the number of bad smellsà detected using the detection rules. 2.4 Cooperative based approaches: Some cooperative approaches to referenceà software engineering problems have been proposedà recently, in this program and test cases co-evolve,à regulating each other with the aim of fixing theà maximum number of bugs in the programs. Theà objective is to improve the effectiveness of obtainedà test cases by evaluating their capabilities to avoidà mutants.The P-EA proposal is vary from existing coevolutionaryà approaches, this proposal based on twoà populations that are referencing the same problemà from various perspectives. Finally, the genetic basedà approaches are executed in parallel in our P-EAà framework. III. PROPOSED SCHEME In this paper, we suggested a new searchà based approach for detection of code smells. In thisà approach a parallel metaheuristic optimizationà algorithm adaptation, two genetic populations areà involves simultaneously with the target of eachà depending on the current population of other in aà parallel cooperative manner. Both populations areà generated, on the similar open source systems toà evaluate, and the solutions are punished based on theà intersection between the results of two populationsà are found. We extend our approach to various codeà smells types in order to resolve about commonà applicability ofcooperative parallel search basedà software engineering. Moreover, in this work we notà only focus on the detection of code smells but alsoà concentrate automated the correction of code smells. Furthermore, in this paper we consider theà essential need of code smells during the detectionà procedure using existing code changes, classes andà coupling complexity. Hence, the detected code smellsà will be ranked based on the severity score and also anà important score. We will measure also the use ofà more than two algorithms executed in parallelà manner as a part our work to generate results of moreà accuracy than art detection approach. The negativeà impact on the code smells can be removed byà applying more than two algorithms in cooperativeà manner ità ¢Ã¢â ¬Ã
¸s difficult to find the consensus betweenà the code smells. The research work will direct ourà approach to several software engineering problemsà such as software testing and quality assurance. IV. PROPOSED ARCHITECTURE Fig 1:system architecture 1. Metrics Evaluation 2. Evolutionary Algorithms 3. Code Smell Detection 4.1 METRICS EVALUATION 4.1.1 CK METRIC SUITE Chidember and kemerer proposed a six metricà suite used for analyzing the proposed variable. The sixà metric suite are: 1. Weighted Method Per Class(WMC): Consider a class C1 with methods M1â⬠¦.Mnà that are included in class. Let C1,C2â⬠¦Cn be the sum ofà complexity. WMC=à £ M 2. Depth Of Inheritance(DIT): The maximum length from the node to theà root of the tree. 3. Number Of Children(NOC): Number of immediate subclasses subordinatedà to a class in the class hierarchy. 4. Coupling Between Objects(CBO): It is a count of the number of other classes toà which it is coupled. 5. Response For a Class (RFC) It is the number of methods of the class plusà the number of methods called by any of thoseà methods. 4.1.2 Lack Of Cohesion of Methods (LCOM)à Measure the dissimilarity of methods in aà class via instanced variables. 4.2 EVOLUTIONARY ALGORITHMS The fundamental think of both algorithms isà to explore the search space by devising a populationà of candidate solutions, also called individuals,à germinate towards a ââ¬Å"goodâ⬠solution of a uniqueà problem. To measure the solutions, the fitnessà function in both algorithms has two components. Forà the first component of the fitness function, GPà evaluates the detection rules based on the coverage ofà code-smells examples. In GP, a solution is combinedà of terminals and functions. Hence, while applying GPà to clear particular problem, they should be carefullyà collected and fashioned to fulfil the requirements ofà the current problem. Afterwards, evaluating largeà parameters concerned to the code-smells detectionà problem, the terminal set and the function set areà recognized as follows. The terminals fit to differentà quality metrics with their threshold values (constantà values). The functions that can be used between theseà metrics ar e Union (OR) and Intersection (AND). The second algorithm run in parallel isà genetic algorithm that generates detectors from welldesignedà code examples. For GA, detectors defendà generated artificial code fragments dignified by codeà elements. Thus, detectors are mentioned as a vectorà where each dimension is a code element. We defendà these elements as sets of predicates. All predicateà type represents to a construct type of an objectorientedà system. Then, a set of best solutions areà collected from P-EA algorithms in each iteration,à Bothalgorithms interact with one other victimizingà the second component of the fitness function calledà intersection function. 4.3 CODE SMELLS DETECTION Code smells are design flaws that can beà solved by refactoringà ¢Ã¢â ¬Ã
¸s. They are considered as flagsà to the developer that some parts of the design may beà inappropriate and that it can be improved. For theà purpose of this work, we discuss a few representativeà code smells. There are a lot of code smells mentionedà in the development of this work. A thorough catalogà of code smells can be found in Fowlers refactoringà book. As this work focuses on program analysis, code smells discussed in this work include those thatà require analyses. Though this work develops only aà subset of the code smells, it provides some groundsà which can be adapted to other types of code smells. The set of best solutions from each algorithm isà stored and a new population of individuals isà generated by repetitively choosing pairs of parentà individuals from population p and employing theà crossover operator to them. We admit both the parentà and child variants in the new population pop. Then,à we apply the mutation operator, with a probabilityà score, for both parent and child to assure the solutionà diversity; this produces the population for the nextà generation. While applying change operators, noà individuals are transformed between the parallelà GA/GP. Both algorithms exit when the terminationà criterion is met, and issue the best set of rules andà detectors. At last, developers can use the best rulesà and detectors to find code-smells on new system toà evaluate. V. EXPERIMENTAL RESULTS Fig 2: The impact of the nmber of code smell example on detectionà results Fig 3: Average execution time comparison on the different system. VI. THREATS TO VALIDITY: Conclusion validity related with theà statistical relationship between the treatment andà outcome. The Wilcoxon rank sum test was used withà a 95 percent confidence level to test its importantà differences exist between the measurements forà different treatments. This test makes no suppositionà that the data is normally distributed and is suitable forà ordinal data, so we can be assured that the statisticalà relationships observed are significant. Theà comparison with other techniques not based onà heuristic search; consider the parameters obtainedà with the tools. This can be regarded as a threat thatà can be addressed in the future by developing theà impact of various parameters on the quality of resultsà of DÃâ°COR and JDeodorant. Internal validity is related with the casualà relationship between the treatment and outcome. Toà consider the internal threats to validity in theà utilization of stochastic algorithms since thisà experimental work based on 51 independentà simulation runs for each problem instance and theà obtained results are statistically analyzed by using theà Wilcoxon rank sum test with a 95 percent fairà comparison between CPU times. VII. CONCLUSION AND FUTURE WORK In this approach a parallel metaheuristicà optimization algorithm adaptation, two geneticà populations are involves simultaneously with theà target of each depending on the current population ofà other in a parallel cooperative manner. Bothà populations are generated, on the similar open sourceà systems to evaluate, and the solutions are punishedà based on the intersection between the results of twoà populations are found.Moreover, in this work we notà only focus on the detection of code smells but alsoà concentrate automated the correction of codeà smells.Furthermore, in this paper we consider theà essential need of code smells during the detectionà procedure using existing code changes, classes andà coupling complexity. Hence, the detected code smellsà will be ranked based on the severity score and also anà important score. We will measure also the use ofà more than two algorithms executed in parallelà manner as a part our work to generate result s of moreà accuracy than art detection approach. Future workà should corroborate our method with remaining codeà smell types with the objective conclude about theà common applicability of our methodology. We willà assess also the use of more than the algorithmà accomplish simultaneously as a part of our rest of ourà future work. Another future issue direction attachedà to our approach is to adapt our cooperative parallelà evolutionary approach to various softwareà engineering problems such as software testing andà the following release problem. VIII. REFERENCES 1) WaelKessentini,MarouaneKessentini,HouariSahraoà ui, Slim Bechikh:â⬠A Cooperative Parallel Search-Based Software Engineering Approach for Code-Smells Detectionâ⬠IEEE Trans. Softw. Eng.,vol. 40,à no. 9, Sep 2014. 2) N. Moha, Y. G. Gu_eh_eneuc, L. Duchien, and A.à F. Le Meur, ââ¬Å"DECOR: A method for the specificationà and detection of code and design smells,â⬠IEEEà Trans. Softw. Eng., vol. 36, no. 1, pp. 20ââ¬â36,à Jan./Feb. 2010. 3) Chidamber, S., Kemerer, C.: ââ¬Å¾A metrics suite forà object oriented designà ¢Ã¢â ¬Ã
¸,IEEE Trans. Softw. Eng.,à 1994, 20, (6), pp. 476ââ¬â493.à 4) Mark Harman and AfshinMansouri.:â⬠Search Basedà Software Engineering: Introduction to the Specialà Issue of the IEEE Transactions on Softwareà Engineeringâ⬠,â⬠IEEE Trans. Softw. Eng., vol. 36, no.à 6,Nov./Dec. 2010.à 5) F. Khomh, S. Vaucher, Y. G. Gu_eh_eneuc, and H.A. Sahraoui, ââ¬Å"A bayesian approach for the detectionà of code and design smells,â⬠in Proc. Int. Conf.à Quality Softw., 2009, 305ââ¬â314. 6) R. Marinescu, ââ¬Å"Detection strategies: Metrics-basedà rules for detecting design flaws,â⬠in Proc. 20th Int.à Conf. Softw. Maintenance, 2004, pp. 350ââ¬â359. 7) M. Kessentini, W. Kessentini, H. A. Sahraoui, M.à Boukadoum, and A. Ouni, ââ¬Å"Design defectsà detection and correction by example,â⬠in Proc. IEEEà 19th Int. Conf. Program Comprehension, 2011, pp.à 81ââ¬â90. 8) T. Burczy_nskia, W. Ku_sa, A. Dà »ugosza, and P.à Oranteka,ââ¬Å"Optimization and defect identificationà using distributed evolutionary algorithms,â⬠Eng.à Appl. Artif. Intell., vol. 4, no. 17, pp. 337ââ¬â344, 2004. 9) A. Ouni, M. Kessentini, H. A. Sahraoui, and M.à Boukadoum, ââ¬Å"Maintainability defects detection andà correction: A multiobjective approach,â⬠Autom.à Softw. Eng., vol. 20, no. 1, pp. 47ââ¬â79, 2012. 10) O. Ciupke, ââ¬Å"Automatic detection of designà problems in objectoriented reengineering,â⬠in Proc.à Int. Conf. Technol. Object-OrientedLanguage Syst.,à 1999, pp. 18ââ¬â32. 12) G. Travassos, F. Shull, M. Fredericks, and V. R.à Basili, ââ¬Å"Detecting defects in object-oriented designs:à Using reading techniques to increase softwareà quality,â⬠in Proc. Int. conf. Object-Orientedà Program.,Syst., Languages, Appl., 1999, pp. 47ââ¬â56. 13) M. Harman, S. A. Mansouri, and Y. Zhang,à ââ¬Å"Search-based software engineering: Trends,à techniques and applications,â⬠ACM Comput. Surv.,à vol. 45, no. 1, 61 pages. 14) A. Arcuri, X. Yao, ââ¬Å"A novel co-evolutionaryà approach to automatic software bug fixing,â⬠in Proc.à IEEE Congr. Evol. Comput., 2008, pp. 162ââ¬â168. 15) M. J. Munro, ââ¬Å"Product metrics for automaticà identification of ââ¬Å¾Bad Smellà ¢Ã¢â ¬Ã
¸ design problems in Javaà source-code,â⬠in Proc. IEEE 11th Int. Softw. Metricsà Symp., 2005, pp. 15ââ¬â15.à 16) W. Banzhaf, ââ¬Å"Genotype-phenotype-mapping andà neutral variation: A case study in geneticà programming,â⬠in Proc. Int. Conf. Parallel Problemà Solving from Nature, 1994, pp. 322ââ¬â332. 17) W. H. Kruskal and W. A. Wallis, ââ¬Å"Use of ranks inà one-criterion variance analysis,â⬠J. Amer. Statist.à Assoc., vol. 47, no. 260, pp. 583ââ¬â621, 1952. 18) W. J. Brown, R. C. Malveau, W. H. Brown, andà T. J. Mowbray, ââ¬Å"Anti Patterns: Refactoring Software,à Architectures, and Projects in Crisisâ⬠. Hoboken, NJ,à USA: Wiley, 1998. 19) N. Fenton and S. L. Pfleeger, ââ¬Å"Software Metrics:à A Rigorous and Practical Approachâ⬠. Int. Thomsonà Comput. Press, London, UK, 1997.à 20) Emerson Murphy-Hill, Chris Parnin, and Andrewà P. Blackâ⬠How We Refactor, and How We Knowà Itâ⬠,IEEE Trans. Softw. Eng.,vol. 38,no. 1, Jan./Feb.à 2012. 21) M. Fowler, K. Beck, J. Brant, W. Opdyke, and D.à Roberts, ââ¬Å"Refactoring: Improving the Design ofà Existing Codeâ⬠. Reading, MA,USA: Addisonà Wesley, 1999.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.