Analysis of software architecture quality metrics

Similar documents
CHAPTER 4 OBJECT ORIENTED COMPLEXITY METRICS MODEL

Technical Metrics for OO Systems

Risk-based Object Oriented Testing

DETERMINE COHESION AND COUPLING FOR CLASS DIAGRAM THROUGH SLICING TECHNIQUES

An approach to quantifying the run-time behaviour of Java GUI applications

Execution Trace Streaming based Real Time Collection of Dynamic Metrics using PaaS

Effectiveness of software metrics for object-oriented system

Obfuscating Transformations. What is Obfuscator? Obfuscation Library. Obfuscation vs. Deobfuscation. Summary

By: Eng. Mohammed T. Abo Alroos

2IS55 Software Evolution. Software metrics (3) Alexander Serebrenik

Empirical Evaluation and Critical Review of Complexity Metrics for Software Components

ARiSA First Contact Analysis

Visualization of Object Oriented Modeling from the Perspective of Set theory

Kostis Kapelonis Athens Greece, March 2010

CHAPTER 4 HEURISTICS BASED ON OBJECT ORIENTED METRICS

Empirical Analysis of the Reusability of Object-Oriented Program Code in Open-Source Software

J2EE Development Best Practices: Improving Code Quality

How do we measure product and project progress?? Why is software incomparable to traditional quality of manufactured goods?

Taxonomy Dimensions of Complexity Metrics

Static Metrics. Feature Brief

Measuring Complexity

Quantify the project. Better Estimates. Resolve Software crises

Improving the quality of software cohesion metrics through dynamic analysis

Object Oriented Metrics. Impact on Software Quality

Analysis of Cohesion and Coupling Metrics for Object Oriented System

Software Testing 2. OOD and Testability. White box vs Black box Testing. Software Testing 2 Semester 1, 2006

Introduction to software metics

Avancier Methods. Very basic design patterns. It is illegal to copy, share or show this document

Marking Guidelines for MVK Projects. MVK11. Version 6.2 (PPD, URD, ADD, revised URD+ADD, and software demo)

ISSN: [Gupta* et al., 6(5): May, 2017] Impact Factor: 4.116

Introduction to System Design

Toward a definition of run-time object-oriented metrics

Moonzoo Kim CS Division of EECS Dept.

Class Break Point Determination Using CK Metrics Thresholds

Principles of Object-Oriented Design

Application of Object Oriented Metrics to Java and C Sharp: Comparative Study

A New Measure of Code Complexity during Software Evolution: A Case Study

Effect of Principle Component Analysis and Support Vector Machine in Software Fault Prediction

XOTcl an Object-Oriented Scripting Language. First European Tcl/Tk User Meeting, 15/16th June 2000

A Metric-based Approach for Reconstructing Methods in Object-Oriented Systems

Run-Time Cohesion Metrics: An Empirical Investigation

Marking Guidelines for MVK Projects. MVK12. Version 6.2 (PPD, URD, RURD, ADD and software demo)

2IS55 Software Evolution. Software metrics (2) Alexander Serebrenik

Object-Oriented and Classical Software Engineering DESIGN 11/12/2017. CET/CSC490 Software Engineering Design CHAPTER 14. Stephen R. Schach.

Quality-oriented Move Method Refactoring

Improving the Applicability of Object-Oriented Class Cohesion Metrics

Quality Metrics Tool for Object Oriented Programming

An Object Oriented Runtime Complexity Metric based on Iterative Decision Points

Towards the re-usability of software metric definitions at the meta level

Measuring the quality of UML Designs

Investigation of Metrics for Object-Oriented Design Logical Stability

Agenda. Introduce new members 5 minutes. CISQ status 5 minutes. AEFP work 45 minutes. Assignments and adjourn 5 minutes

Enhancing Object Oriented Coupling Metrics w.r.t. Connectivity Patterns

(Milano Lugano Evaluation Method) A systematic approach to usability evaluation. Part I LAB HCI prof. Garzotto - HOC-POLITECNICO DI MILANO a.a.

International Journal of Software and Web Sciences (IJSWS)

Software complexity Methodologies Comparisons. Paper Reference Number: 6 Name of the Presenter: masoud rafighi

Analysis of operations and parameters involved in interface for CBSE

An Object-Oriented Metrics Suite for Ada 95

BUILDING MICROSERVICES ON AZURE. ~ Vaibhav

A Hierarchical Model for Object- Oriented Design Quality Assessment

CHAPTER 4 QUANTIFICATION AND EVALUATION OF INTERFACE COMPLEXITY IN COTS BASED SYSTEMS

SNS College of Technology, Coimbatore, India

Domain Knowledge Driven Program Analysis

SANER 17. Klagenfurt, Austria

Design. Eric McCreath

OO Package Design Principles

SELECTED TOPICS in APPLIED COMPUTER SCIENCE

Visualizing Software Metrics for increased Refactoring

Supporting Operating System Kernel Data Disambiguation using Points-to Analysis

Enhancing Reusability with Reusable Code Patterns based on Reverse Engineering

Modularity Guidelines for design in any programming language

What are Metrics?! Functions, that assign a precise numerical value to. Detecting Design Problems using Metrics

1 Introduction. Abstract

An Empirical Verification of Software Artifacts Using Software Metrics

Just-In-Time Compilation

Rediscovering. Modularity. Stuttgart JUG November 20 th 2012

Application of a Fuzzy Inference System to Measure Maintainability of Object-Oriented Software

CSE 70 Final Exam Fall 2009

A Systematic Review of Bad Smells Metrics. Luiz Paulo Coelho Ferreira

M-Track: A Metric Tool Framework for Monitoring the Evolution of OO Systems

Relating Software Coupling Attribute and Security Vulnerability Attribute

Lecture 3. Parnas Information Hiding

Software Metrics and Problem Detection

Refactoring Practice: How it is and How it Should be Supported

A Study of Software Metrics

A Design Recovery View - JFace vs. SWT. Abstract

On the Impact of Aspect-Oriented Programming on Object-Oriented Metrics

A Novel Class, Object and Inheritance based Coupling Measure (COICM) to Find Better OOP Paradigm using JAVA

A Heuristic-based Approach to Identify Concepts in Execution Traces

Method-Level Phase Behavior in Java Workloads

A Complete and Comprehensive Metrics Suite for Object-Oriented Design Quality Assessment

Maintainability and Agile development. Author: Mika Mäntylä

Describing the architecture: Creating and Using Architectural Description Languages (ADLs): What are the attributes and R-forms?

COMPARATIVE ANALYSIS OF COHESION METRICS FOR COMPONENT BASED SOFTWARE SYSTEM

Design Quality Assessment in Practice

Two Dimensional Visualization of Software Metrics

Obfuscation Studio Executive

Modularity!! Guidelines for design! in any programming language!

A Novel Class, Object and Inheritance based Coupling Measure (COICM) to Find Better OOP Paradigm using JAVA

Influence of Design Patterns Application on Quality of IT Solutions

Transcription:

Analysis of software architecture quality metrics Hongyu Chen hongyu.chen@rwthaachen.de 23.04.2014 Motivation Goals elated work Approaches Evaluation Conclusion

Motivation Motivation A good software architecture can make software development successful There exist many metrics for measuring the quality of the static view of the software architecture, while neglecting the behavior view Measuring the quality of the behavior view of the software architecture is important because the behavior is the one actually supporting the execution Whether the results measured in behavior view are different with those measured in static view 2

Motivation Software architecture evaluation tool Sonargraph Architect is a tool which applies some metrics to measure the quality of the architecture 3

Motivation Behavior is not always considered in current approaches Behavior view analysis VS. Static analysis Aspect Inheritance Dependencies Interface Implementation Execution Frequency Execution Time Behavior View (runtime) Static view (code) 4

Motivation Considering the behavior view to measure the quality of architecture, we can Know more details about the architecture at runtime Method execution frequency Time consumed Know the difference of the results achieved from static view and behavior view Combine the two measurement ways to make the evaluation more accurate 5

Goal Thesis goals Find or adapt existing metrics which support the measurement of software architecture behavior quality If there are no such metrics, metric proposals should be made and evaluated Tasks Investigate existing software architecture metrics Draw a conclusion about the existence of such metrics Choose, adjust or develop relevant metrics to measure the quality of software architecture behavior 6

elated work Metrics categories Static metrics Dynamic metrics Each category includes sub-categories Coupling metrics Cohesion metrics Complexity metrics 7

elated work Static metrics Chidamber & Kemere metrics suit (C&K metrics [1]) Measure static view Adapted by many other metrics Component metrics Most of these metrics focus on coupling measurement in the static view [2],[3] obert C.Martin s metrics suit [4] can be adapted to measure component design 8

elated work Dynamic metrics [5] Mostly Adapted from static metrics Analyse data during runtime Not consider the execution frequency and time consumed Dynamic cohesion metrics focus mainly on class cohesion 9

Issues Problems with the existing metrics Important questions are still not solved Are the components well designed (coupling, cohesion, )?(Q1) What classes or components should be redesigned?(q2) What violations should I address first? (Q3) 10

Approach Component metrics Three metrics proposals Presented in the following slides, including metrics threshold Execution Hot spot metrics Two metrics proposals Not changed since the intermediate presentation Violation metrics Two metrics proposals 11

Approach-Component metrics Component metrics Aims to solve the question 1 Are the components well designed (coupling, cohesion, )? (Q1) Coupling & Cohesion Coupling and cohesion are normally interdependent Two important indicators for architecture design They affect the software architecture flexibility, maintainability and so on. There are some metrics for measuring component coupling & cohesion, but few metrics for measuring these at runtime. 12

Approach-Component metrics Existing coupling and cohesion metrics Component metrics VS. Class metrics Metric Entity Component Class Coupling The number of relations between the target component and other components The number of relations between the target class and other classes Cohesion Based on the classes relationships in the target component Based on the instance variables used by the methods in the target class Find a way to measure the quality of a component by combining coupling and cohesion metrics 13

Approach-Component metrics Component design analysis Strong coupling Low cohesion What is the difference? Loose coupling High cohesion 14

Approach-Component metrics Important factors for component design Classes dependencies/relationships in this component (component cohesion) Classes dependencies/relationships among components (component coupling) Execution frequency (measured in behavior view) Types of cohesion Structural cohesion Behavioral cohesion 15

Approach-Component metrics New component metrics (Focus on cohesion) Simple Component Cohesion Metric (SCCM) (Structural cohesion) SCCM Q /( Q P ) Formula: Q P -> number of class pairs having direct relations -> number of class pairs having no direct relations Hybrid Component Cohesion Metric (HCM) HCM Q' /( Q' O' ) Formular: Q' O' -> total number of direct relationships -> total number of component couplings (Behavioral cohesion) Call-Weighted hybrid component cohesion metric (CW-HCM) (Behavioral cohesion) Formula: CW HCM = Q'' /( Q'' O'' ) Q'' -> total number of direct relationship execution frequency O'' -> total number of coupling execution frequency 16

Approach-Component metrics Example (For component A) P {( Class1, Class4),( Class2, Class3),( Class3, Class4)}, P 3 Q {( Class1, Class3),( Class1, Class2),( Class2, Class4)}, Q 3 Q' 2 1 1 4 Q'' 50 4 5 15 74 O' 2 1 3 O'' 100 20 20 140 (getules(), getlayer(), Priority(), ArchitectureuleSet()) (getcallercallee(), getcallee(), getcaller()) 17

Approach-Component metrics Threshold Simple Component Cohesion Metric (SCCM) Consider the threshold of McCabe Cyclomatic Complexity CC=e-n+2p Assume a component with N classes, we have Q e CC Q N 2 Q P C N, N=n, and P=1. And 2 2 ( means any two C N classes have a relation), so we 2 SCCM Q / C N have. After simplification 18

Approach-Component metrics Threshold Simple Component Cohesion Metric (SCCM) Consider that the smallest number of relations in a component is N-1. The bottom threshold is 2 ( 1) / N 2 / N C N Threshold tables 19

Approach-Component metrics Threshold Hybrid Component Cohesion Metric (HCM) Assume that Q' O' is the acceptable case, we get HCM=0.5. Assume that Q' 2 O' is the good situation, HCM=0.66. Call Weighted-Hybrid Component Cohesion Metric (CW-HCM) Assume that Q'' O'' is the acceptable case, we get CW-HCM=0.5. Assume that Q'' 2 O'' is the good situation, CW-HCM=0.66. 20

Approach-Component metrics Threshold integration SCCM and HCM Combine structural cohesion and behavioral cohesion SCCM-HCM SCCM HCM Good Good Good Good Good Good Final result Good Final result SCCM-HCM CW-HCM Excellent Good Good Good Good Good Good Good Very 21

Approach-Execution Hot Spot Execution Hot Spot metrics Aims to solve the question 2 What classes or components should be redesigned?(q2) Definition of Execution Hot Spot A method which was invoked frequently and/or is very time consuming is a method Hot spot A class whose methods were invoked frequently and/or lead to big delays in a component or between components is a Class Hot Spot 22

Approach-Execution Hot Spot Execution Hot Spot metrics Method Hot Spot Dependency Hot Spot between two components (D-Hot Spot) Method Hot Spot in a component (M-Hot Spot) Class Hot Spot Class Hot Spot in a component Class Hot Spot between two components Difference with Profilers Hot Spot Jprofiler s Hot Spots are CPU Hot Spots and Memory Hot Spots. They focus on performance. Execution Hot Spots can be used to find the methods or classes which increase the inter-component coupling. 23

Evaluation Communication Integrity Checker (CIC) A Java application A tool for checking communication violations at runtime JHotDraw 7 A famous drawing framework which has been previously used to evaluate new metrics (see APSEC 2013). It has a highly modular decomposition -> High structural cohesion Measuring JHotDraw 7 aims to validate whether the threshold of component cohesion metrics are suitable or not. 24

Evaluation Tools Kieker Communication Integrity Checker (CIC) Self-developed program for filtering and analyzing data Evaluation work flow 25

Evaluation-CIC Communication Integrity Check Data Collected by running CIC to check itself. Occasionally too many intercomponent method calls -> high coupling! Package SCCM HCM CW-HCM Final results Component metrics results SCCM values are not bad. marshalling 0.67 Good Network 0.50 statistics 0.67 Good 0.161 0.286 0.333 0.29 0.44 0.40 Very bad HCM and CW-HCM values are bad rules 0.43 0.250 0.16 Very bad architecture 0.29 0.367 0.55 Final results are bad or very bad. monitoring 0.36 0.279 0.54 validation 0.24 0.426 0.15 Very bad 26

Evaluation-CIC Communication Integrity Checker Analysis by Sonargraph-Architect obert C.Martin s Metric --- Instability (I) validation --- 0.75 marshalling ---0.69 That means these two packages are very unstable. (Depend much on other packages) Dependency metric 55 outgoing dependencies from validation to rules (vs. 19 methods calls and 1828 execution frequency observed by us) 12 outgoing dependencies from marshalling to monitoring (vs. 12 methods calls and 608 execution frequency observed by us) That means that (validation; rules) and (marshalling; monitoring) are highly coupled. 27

Evaluation-CIC Communication Integrity Checker Analysis by using Execution Hot Spot metrics validation->rules (D-Hot Spots) marshalling->monitoring (D-Hot Spots) Caller Callee Method # Percentage in caller and callee Caller Callee Method # Percentage in caller and callee validation rules getcaller() 576 22%, 29% validation rules getcallee() 576 22%, 29% validation rules getoperator() 304 11.5%, 15.3% marshalling monitoring gettarget() 65 9.2%, 3.2% marshalling monitoring getend() 65 9.2%, 3.2% 4 validation rules getpriority() 204 7.7%, 10.3% marshalling monitoring gettype() 46 6.5%, 2.3% 7 marshalling monitoring getvalidatio nstate() 46 6.5%, 2.3% 28

Evaluation-CIC Optimization Create façade classes in the rules and monitoring packages 1. A simple façade class containing all problematic methods 2. Based on 1, optimize the methods in the façade class by aggregating methods which were called at the same time Combine the packages as a new component Conclusion rules and validation marshalling and monitoring Designing façade classes in a component can improve this component s cohesion. Merging different small but related components into a new component is a good way to indentify a cohesive component. Situation Package Final result Original Façade 1 Façade 2 Merging rules validation marshalling monitoring rules validation marshalling monitoring rules validation marshalling monitoring rules+validation marshalling+monito ring Very bad Very bad Very bad Very bad Good Good Good 29

Evaluation-JHotDraw 7 JHotDraw 7 Collect data based on a simple scenario un the Draw application Draw the graph Closed the application 30

Evaluation-JHotDraw 7 JHotDraw 7 Data esults does not mean low cohesion, it means high cohesion but complex. Package SCCM HCM CW-HCM Final result app 0.151 0.63 0.63 So maybe the threshold for SCCM is not very accurate. If I improve the upper threshold, the final result would become better. draw gui 0.038 0.177 Good 0.72 Good 0.59 0.81 Good 0.57 Good Excellent 31

Evaluation-JHotDraw 7 esults of JProfiler Green -> initialization ed -> after drawing Analysis After drawing, most of the new instances belong to component draw -> behavioral cohesion 32

Evaluation Summary Component cohesion metrics are useful to evaluate the quality of software architecture behavior Structural cohesion Behavioral cohesion Execution Hot Spots help to find the design problems which reduce the component cohesion. Method Hot Spot Class Hot Spot 33

Conclusion Conclusion Component cohesion metrics Give three indacators to evaluate the quality of component design Compared results with those of static analyzers and profiling tools Execution Hot Spot metrics Identify the optimizion points to help improve the design Violation metrics Give a way to identify the violation ranking both in static and behavior view 34

Further work Improve the thresholds of component cohesion metrics Based on industry experience and experts opinions Machine Learning Better filtering for CIC (e.g., JProfiler) Illustrate the results using graphs (e.g., Sonargraph-Architect) Integrate the violation metrics with CIC Calculate the violation metrics results directly within CIC 35

Thanks 36

eference [1] Chidamber, Shyam.; Kemerer, Chris F. (1991): Towards a metrics suite for object oriented [2] Cho, Eun Sook; Kim, Min Sun; Kim, Soo Dong (2001): Component metrics to measure component quality. In : Software Engineering Conference, 2001. APSEC 2001. Eighth Asia-Pacific. IEEE, pp. 419 426. [3] Kharb, Latika; Singh, ajender (2008): Complexity metrics for component-oriented software systems. In ACM SIGSOFT Software Engineering Notes 33 (2), p. 4. [4] Martin, obert (1994): OO design quality metrics. In An analysis of dependencies. [5] Mitchell, Aine; Power, James (2005): An empirical study of run-time coupling and cohesion software metrics. In presented Doctoral Thesis, Department of Computer Science National University of Ireland, Maynooth Co. Kildare, Ireland. [6] Saraiva, Juliana; Soares, Sérgio; Castor, Fernando (2010): Assessing the impact of aosd on layered software architectures. In : Software Architecture: Springer, pp. 344 351. 37