Min Zhang School of Computer Science University of Hertfordshire

Slides:



Advertisements
Similar presentations
Chapter 4 Quality Assurance in Context
Advertisements

Tracy Hall, Brunel University David Bowes, University of Hertfordshire Andrew Kerr, University of Hertfordshire.
Nevena Ackovska/Magdalena Kostoska Faculty of Computer Science and Engineering (FCSE) UKIM, Skopje, Macedonia 11 th DAAD Workshop on “Software Engineering.
Refactoring By: Brian Smith. What is Refactoring? Definition: a change to the internal structure of software to make it easier to understand and cheaper.
Fundamentals of Software Development 1Slide 1 Gang of Four The beginnings… The original “patterns” idea was from architecture – there are repeatable patterns.
Introduction to Refactoring Excerpted from ‘What is Refactoring?’ by William C. Wake and Refactoring: Improving the Design of Existing Code by Martin Fowler.
Ralph Johnson - University of Illinois1 Patterns: What They Are, and How to Write Them Ralph Johnson University of Illinois at Urbana-Champaign
James Tam Introduction To Design Patterns You will learn about design techniques that have been successfully applied to different scenarios.
OOHDM Hypermedia Research Work Designing Web-based applications with Object Oriented Hypermedia Design Method OOHDM.
SE 450 Software Processes & Product Metrics Activity Metrics.
REFACTORING Improving the Design of Existing Code Atakan Şimşek e
ECE 355 Design Patterns Tutorial Part 2 (based on slides by Ali Razavi) Presented by Igor Ivković
The Re-engineering and Reuse of Software
Chapter 9 – Software Evolution and Maintenance
A Comparative Analysis of the Efficiency of Change Metrics and Static Code Attributes for Defect Prediction Raimund Moser, Witold Pedrycz, Giancarlo Succi.
Design Patterns Trends and Case Study John Hurst June 2005.
Cf.OBJECTIVE (ANZ) Design Patterns and Form Processing Jaime Metcher Software Architect, Centre for Innovation in Professional Learning, University of.
A Survey of Software Refactoring Tom Mens, Tom Tourwé
S T A M © 2000, KPA Ltd. Software Trouble Assessment Matrix Software Trouble Assessment Matrix *This presentation is extracted from SOFTWARE PROCESS QUALITY:
CS4723 Software Validation and Quality Assurance
Dependency Tracking in software systems Presented by: Ashgan Fararooy.
1 Copyright © 2014 Atego. Patterns INCOSE MBSE WG – Simon A. Perry - Atego.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University What Kinds of.
Advanced Programing practices
Software Engineering CS3003
Introduction to UML By: Prof. Aiman Hanna Department of Computer Science, Concordia University, Montreal, Canada.
Software Refactoring Part I: Introduction Bartosz Walter Advanced Object-Oriented Design Lecture 5.
Sadegh Aliakbary Sharif University of Technology Spring 2012.
Mining and Analysis of Control Structure Variant Clones Guo Qiao.
Programming in Java Unit 3. Learning outcome:  LO2:Be able to design Java solutions  LO3:Be able to implement Java solutions Assessment criteria: 
Reviewing Recent ICSE Proceedings For:.  Defining and Continuous Checking of Structural Program Dependencies  Automatic Inference of Structural Changes.
Y2 eProjects Session 4 – Advanced Topics. Objectives  Dynamic Models  Design Patterns (Optional)  Software testing (for S4) ACCP i7.1\Sem3_4\eProject\T4.
Samad Paydar Web Technology Lab. Ferdowsi University of Mashhad 10 th August 2011.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University Applying Clone.
Department of Computer Science, Graduate School of Information Science & Technology, Osaka University Inoue Laboratory Eunjong Choi 1 Investigating Clone.
Refactoring1 Refactoring DEPARTMENT OF COMPUTER SCIENCE AND SOFTWARE ENGINEERING CONCORDIA UNIVERSITY February 6, 2009.
Composition of UML Described Refactoring Rules Presented by Chin-Yi Tsai.
Predicting Accurate and Actionable Static Analysis Warnings: An Experimental Approach J. Ruthruff et al., University of Nebraska-Lincoln, NE U.S.A, Google.
Detecting Patterns and Antipatterns in Software using Prolog Rules Alecsandar Stoianov, Ioana Sora Department of Computers Politehnica University of Timisoara,
Refactoring1 Improving the structure of existing code.
Department of Computer Science, Graduate School of Information Science & Technology, Osaka University 1 Towards an Assessment of the Quality of Refactoring.
Teaching about Software Testing that is NOT for Defect Detection W. Morven Gentleman Dalhousie University
Software Engineering CS3003 Lecture 4 Code bad smells and refactoring.
Copyright © 2015 NTT DATA Corporation Kazuo Kobori, NTT DATA Corporation Makoto Matsushita, Osaka University Katsuro Inoue, Osaka University SANER2015.
Refactoring - 1 CS494: Intro. to Refactoring Readings: –Refactoring for everyone: How and why to use Eclipse's automated refactoring features. By David.
Experimentation in Computer Science (Part 2). Experimentation in Software Engineering --- Outline  Empirical Strategies  Measurement  Experiment Process.
Generating Software Documentation in Use Case Maps from Filtered Execution Traces Edna Braun, Daniel Amyot, Timothy Lethbridge University of Ottawa, Canada.
1 ECE 750 Topic 8 Meta-programming languages, systems, and applications Evolving Object-Oriented Designs with Refactorings – Lance Tokuda and Don Batory.
CS251 – Software Engineering Lectures 18: Intro to DP Slides by Rick Mercer, Christian Ratliff, Oscar Nierstrasz and others 1 و ابتغ فيما آتاك الله الدار.
SEG 4110 – Advanced Software Design and Reengineering Topic T Introduction to Refactoring.
What kind of and how clones are refactored? A case study of three OSS projects WRT2012 June 1, Eunjong Choi†, Norihiro Yoshida‡, Katsuro Inoue†
Refactoring1 Improving the structure of existing code.
Refactoring Agile Development Project. Lecture roadmap Refactoring Some issues to address when coding.
Pertemuan 12 Refactoring Mata kuliah: T0144 – Advanced Topics in Software Engineering Tahun: 2010.
A proposal to support the extreme programming development methodology from the quality assurance point of view Authors: Calin Jebelean –
Presented by Lu Xiao Drexel University Quantifying Architectural Debt.
Department of Computer Science, Graduate School of Information Science & Technology, Osaka University A Metric-based Approach for Reconstructing Methods.
Principles and examples
Steve Chenoweth Office Phone: (812) Cell: (937)
Do Developers Focus on Severe Code Smells?
Ruru Yue1, Na Meng2, Qianxiang Wang1 1Peking University 2Virginia Tech
Presented by Igor Ivković
Advanced Programming Behnam Hatami Fall 2017.
بازآرایی برنامه Code Refactoring
Improving the structure of existing code
Quaid-i-Azam University
Advanced Programming Behnam Hatami Fall 2017.
Advanced Programing practices
Presented by Igor Ivković
Refactoring.
Presentation transcript:

Min Zhang School of Computer Science University of Hertfordshire An Empirical Study of the Relationship Between Code Bad Smells and Software Faults Min Zhang School of Computer Science University of Hertfordshire

Introduction What is a Code Bad Smell? Problems using Code Bad Smells An overview of the empirical study Code Bad Smell detection Fault identification Result and discussion Conclusion Q/A

Code Bad Smells The 22 Code Bad Smells are bad structures in source code informally identified by Fowler et al. (1999). Fowler et al. (1999) suggest that Code Bad Smells can give “indications that there is trouble that can be solved by a refactoring”. They are widely used for detecting refactoring opportunities in software (Mens and Tourwe, 2004).

Problems in Using Code Bad Smells Fowler et al. (1999) claim that Code Bad Smells are structures which cause detrimental effects on software. However, little empirical evidence has been provided. Most existing Code Bad Smell detection tools are Metric-based. We argue about their accuracy.

An Empirical Study of the Relationship between Code Bad Smells and Faults Objective: Capture the relationship between Code Bad Smells and faults Targeted Code Bad Smells: Data Clumps, Message Chains, Middle Man, Speculative Generality, and Switch Statements Research Data: Eclipse Core Packages (Release 3.0, 3.0.1, 3.0.2, 3.1 and 3.2) Apache Common Packages (Common IO, Common Logging, Common Codec, Common DbUtils, Common DBCP, and Common Net )

Code Bad Smell Detection Pattern-based Code Bad Smell detection Define each Code Bad Smell as particular code patterns Ideas from Gamma et al.’s (1995) definition of the GoF Design Patterns Use Recoder API to analyse Java source code

An Example: The Pattern-based Definition of the Message Chains Bad Smell Fowler et al.’s definition You see message chains when a client asks one object for another object, which the client then asks for yet another object, which the client then asks for yet another another object, and so on. You may see these as a long line of getThis methods, or as a sequence of temps. (Fowler et al., 1999) Pattern-based definition An instance of the Message Chains Bad Smell is in one of the following situations: Situation 1: In order to access a data field in another class, a statement needs to call more than a threshold value of getter methods in a sequence. (E.g. int a=b.getC().getD();) This method call statement and the declarations of getter methods are in different classes. Situation 2: In order to access a data field in another class, source code use more than a threshold number of temp variable. A temp variable is that a variable only access data members (data fields/getter methods) of the other classes or other temp variables. (E.g. ClassC tmpC=b.getC(); int a=a1.getD();)

Fault Identification Zimmerman et al.’s (2007) fault identification approach: Locate “bug”, “fix(ed)” and “update(d)” token in CVS comment messages. If a version entry in CVS contains one or more above tokens and those tokens are followed by numbers, this version entry is seen as a bug fixing update. Those numbers are treated as bug ID. Confirm the bug ID using Bugzilla database.

Existence of Code Bad Smells Speculative Generality Results and Discussion: Binary Coding of the Existence of Code Bad Smells (1) Existence of Code Bad Smells Coding Data Clumps Message Chains Middle Men Speculative Generality Switch Statements 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

Existence of Code Bad Smells Speculative Generality Result and Discussion: Binary Coding of the Existence of Code Bad Smells (2) Existence of Code Bad Smells Coding Data Clumps Message Chains Middle Men Speculative Generality Switch Statements 1 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31

Result and Discussion: One-way Analysis of Variance Eclipse Data (1) .

Result and Discussion: One-way Analysis of Variance Eclipse Data (2) The five profiles which indicate the existence of each of the five Code Bad Smells contain significantly lower mean number of faults than profile zero. All profiles which have higher mean number of faults than profile zero contain the Message Chains and the Switch Statement Bad Smells.

Result and Discussion: the Message Chains and Switch Statements

Result and Discussion: the Message Chains and Switch Statements All source code samples associated with more than 10 faults contain the Message Chains Bad Smell. The Switch Statements Bad Smell does not show a clear relationship with high number of faults.

Result and Discussion: One-way Analysis of Variance Apache Data (1)

Result and Discussion: One-way Analysis of Variance Apache Data (2) The five profiles which indicate the existence of each of the five Code Bad Smells contain lower mean number of faults than profile zero. All the Message Chains Bad Smell contained profiles do not show higher mean number of faults than the profile zero.

A Detailed Investigation of Message Chains Objective: To test whether the Message Chains Bad Smell is directly associated with faults. To test whether the Message Chains Bad Smell is directly associated with particular types of faults. Method: Manually investigate 20 source code samples from the Eclipse project

An Detail Investigation of Message Chains: Direct Association with Faults Association Type Detail of Change Number of Instances Message Chains Touched During Fix Message Chains Increased 4 Message Chains Reduced 5 Message Chains Not Touched During Fix 45 Total 54

A Detailed Investigation of Message Chains: Fault Classification Classification Schema: An adopted version of Seaman et al.’s (2008) fault classification schema Results: Type of Fault Number of Instances Algorithm / Method 4 Checking 1 External Interface 2 Internal Interface Non-functional Defects Other .

A Detailed Investigation of Message Chains: Result Message Chains Bad Smell is not likely to be directly associated with faults, but it indicates a complicated software context. Message Chains Bad Smell is likely to be associated with Algorithm/Method faults.

Conclusion Source code containing only one of the five Code Bad Smells is not likely to be fault prone. The Message Chains Bad Smell could cause a high number of faults and is likely to be associated with Algorithm/Method faults, so it deserves further attention. The Message Chains Bad Smell may not be directly associated with faults but it may indicate a complicated software context.

Q/A

References FOWLER, M., BECK, K., BRANT, J., OPDYKE, W. & ROBERTS, D. (1999) Refactoring: Improving the Design of Existing Code, Addison Wesley. GAMMA, E., HELM, R., JOHNSON, R. & VLISSIDES, J. (1995) Design patterns : elements of reusable object-oriented software, Reading, Mass., Addison-Wesley. MENS, T. & TOURWE, T. (2004) A survey of software refactoring. Software Engineering, IEEE Transactions on, 30, 126-139. SEAMAN, C. B., SHULL, F., REGARDIE, M., ELBERT, D., FELDMANN, R. L., GUO, Y. & GODFREY, S. (2008) Defect categorization: making use of a decade of widely varying historical data. Proceedings of the Second ACM-IEEE international symposium on Empirical software engineering and measurement. Kaiserslautern, Germany, ACM. ZIMMERMANN, T., PREMRAJ, R. & ZELLER, A. (2007) Predicting Defects for Eclipse. IN PREMRAJ, R. (Ed.) Predictor Models in Software Engineering, 2007. PROMISE'07: ICSE Workshops 2007. International Workshop on.