Post on 16-Sep-2019
transcript
Quality-Driven RefactoringRebecca Tiarks
Quality-Driven Refactoring
Rebecca Tiarks
Quality-Driven RefactoringRebecca Tiarks
Overview• what is quality?• what is software-quality?• quality-driven refactoring
- modelling software-qualities- deal with trade-offs
• measuring quality with metrics• software refactoring process• transformation examples
Quality-Driven RefactoringRebecca Tiarks
What is Quality?• “The degree to which a set of inherent
characteristics fulfills requirements”[ISO 9000:2000]
• „Qualität ist die Übereinstimmung von Ist und Soll, also die Erfüllung von Erfordernissen und Erwartungen“[Wikipedia]
Quality-Driven RefactoringRebecca Tiarks
Software Quality• “quality in computer software is a controversial
field. For some, software quality is a largely aesthetic and practical issue, dealing with the question of how efficiently and elegantly a computer program performs a task and source code looks (see Programming style). For others, quality is defined as strict conformance to requirements and absence of bugs.” [Wikipedia]
Quality-Driven RefactoringRebecca Tiarks
Software Quality• Conformance to explicitly stated functional
[correctness] and non-functional requirements [performance, security, maintainability, usability, etc.]
Quality-Driven RefactoringRebecca Tiarks
Quality-Driven Refactoring• achieving one or more specific non-
functional requirements (NFR)• analyze software qualities to determine
which transformations are appropriate• evaluate effect with a specific set of
metrics
Quality-Driven RefactoringRebecca Tiarks
Modelling Software Qualities• concept of soft-goals• relationship between quality-requirements
and design decisions• achievement is judged by the sufficiency
of contributions from other soft-goals• soft-goals can be related to other
soft-goals
Quality-Driven RefactoringRebecca Tiarks
Soft-Goal Interdependency Graph(SIG)
links• AND - soft-goal is fulfilled if all linked goals are
fulfilled• OR – soft-goal is fulfilled if one of the linked
goals is fulfilledcontributionspositive “help” (+) and “make” (++)negative “hurt”(-) and “brake” (--)
Quality-Driven RefactoringRebecca Tiarks
Soft-Goal Interdependency Graph(SIG)
Source: Software Refactoring guided by multiple soft-goals
Quality-Driven RefactoringRebecca Tiarks
Trade-Offs• fulfilment of one soft-goal hurts the
fulfilment of another soft-goal• conflicting soft-goals have to be
traded off• speedup porgram without sacrifing code
complexity
Quality-Driven RefactoringRebecca Tiarks
Quality Metricscomplexity • lines of code (LOC)• Mc Cabe's complexity
(defined on control flow graph of a program):M = e - n + 2 e = edgesn = nodes
Quality-Driven RefactoringRebecca Tiarks
Quality Metricstime performance• CPU cycles in relation to input• Cache misses, in relation to the input size
Quality-Driven RefactoringRebecca Tiarks
Software Refactoring Process1. setting up the goal-reasoning model as a SIG2. quantitatively measuring software metrics to
claim which soft-goal should be applied first3. picking an effective refactoring among various
transformations that contribute the soft-goal4. applying the selected refactoring technique
which leads to iterative evaluations back in step 2.
Quality-Driven RefactoringRebecca Tiarks
Transformationsloop unrolling• instructions that are called in multiple iterations of
the loop are combined into a single iteration
Quality-Driven RefactoringRebecca Tiarks
Transformationsloop tiling• partitions a loop’s iteration space into smaller
blocks, so as to help data in a loop stays in the cache until it is reused
Quality-Driven RefactoringRebecca Tiarks
Transformationsloop interchanging• the loop interchange transformation reverses the
order of two adjacent loops in a loop nest.
Quality-Driven RefactoringRebecca Tiarks
Transformationsarray padding and interchanging• the array padding transformation sets a dimension
in an array to a new size.
Quality-Driven RefactoringRebecca Tiarks
Example• simple Fortran program for matrix
multiplication
• goal: speedup 20 times without increasing complexity more than 4 times
Source: Software Refactoring guided by multiple soft-goals
Quality-Driven RefactoringRebecca Tiarks
Conclusion• There are several approaches to enhance
quality• difficult because quality is soft-subjective• methods to analyse and transform
developed but just in prototype version
Quality-Driven RefactoringRebecca Tiarks
References[1] L. Thadvildari and K. Kontogiannis. Requirements driven Software
Re-engineering framework. In WCRE 2001, pages 71-81, 2001[2] Y. Yun et al. Software refactoring guided by multiple soft –goals.
In WCRE 2003[3] B. Du Bois and T.Mentis. Describing the impact of refactoring on
internal program quality.[4] L. Thadvildari Ph.D Thesis “Quality-Driven Object-Oriented Re-
engineering Framework”, University of Waterloo, Department of Electrical and Computer Engineering, 2003.
[5] L. Tahvildari, K.Kontogiannis, "Quality-Driven Object-Oriented Code Restructuring", In Proceedings of ICSE Workshop on Software Quality, Edinburgh, Scotland, pp. 47-52, May 2004.