Quality Assurance of Software Models within Eclipse using Java and

Quality Assurance of Software Models within
Eclipse using Java and OCL
Dr. Thorsten Arendt
Modellgetriebene Softwareentwicklung mobiler Anwendungen
Wintersemester 2014/15
17. Dezember 2014
Outline
• Why model quality assurance?
• A structured model quality assurance process
• Tailoring the process for a given modeling project
– Specification process
– Application process
• Tool support: EMF Refactor
2
MDDMA WS 2014/2015
Why model quality assurance?
Model
Metrics
Problems
Model
Smells
Model
Refactorings
Risks
3
MDDMA WS 2014/2015
Why model quality assurance?
Model
Metrics
Model
Smells
Problems
Model
Refactorings
Risks
Model
4
Quality
Assurance
Process
MDDMA WS 2014/2015
Software quality ≠ software model quality
[ISO/IEC 9126]
5
MDDMA WS 2014/2015
Software quality ≠ software model quality
Software quality
6C model quality goals
–
–
–
–
–
–
[ISO/IEC 9126]
6
Correctness
Completeness
Changeability
Comprehensibility
Confinement
Consistency
[Mohagheghi]
MDDMA WS 2014/2015
Model smells
• Adopted from the concept of code smell
• Smells are parts of the model that
– … contain symptoms of poor model quality
– … are worthy of an inspection
– … are potential candidates for improvements by refactoring
• Smells are not synonyms for problems
– ‘… smells don't always indicate a problem. ... You have to look
deeper to see if there is an underlying problem there - smells
aren't inherently bad on their own - they are often an indicator of
a problem rather than the problem themselves.’
[Fowler]
7
MDDMA WS 2014/2015
A structured model quality assurance process (1)
Specification process
Application process
Manager
8
Designer
MDDMA WS 2014/2015
Discussing important quality aspects
Specification process
Changeability
Comprehensibility
– Correctness
– Completeness
– Changeability
9
– Comprehensibility
– Confinement
– Consistency
MDDMA WS 2014/2015
Specifying relevant model smells (1)
Specification process
Changeability
Comprehensibility
• Question: Are there equally named
classes in different packages?
− Smell: Multiple definitions of
classes with equal names
10
MDDMA WS 2014/2015
Specifying relevant model refactorings (1)
Specification process
• Smell: Multiple definitions of classes with
equal names
– Refactorings: Merge Classes,
Rename Class
11
MDDMA WS 2014/2015
Specifying relevant model smells (2)
Specification process
Completeness
Confinement
• Question: Are there abstract classes
without any concrete subclasses?
− Smell: No concrete Subclass
12
MDDMA WS 2014/2015
Specifying relevant model refactorings (2)
Specification process
• Smell: No concrete subclass
– Refactoring: Insert Concrete Subclass
13
MDDMA WS 2014/2015
UML specific refactorings
Refactoring:
Change Attribute to
Association End
Refactoring:
Change Association
End to Attribute
14
MDDMA WS 2014/2015
UML class attribute
specification
Refactoring:
Change Attribute to
Association End
[OMG: UML]
15
MDDMA WS 2014/2015
A structured model quality assurance process (2)
Specification process
Application process
Manager
Designer
Modeler
16
Reviewer
MDDMA WS 2014/2015
Tool environment for model quality assurance
Model
Metrics
Model
Smells
Problems
Model
Refactorings
Risks
Model
17
Quality
Assurance
Process
MDDMA WS 2014/2015
Quality Assurance and Textual Modeling in Eclipse
18
MDDMA WS 2014/2015
Scenario: Vehicle Rental Company
• Project
– Development of a web
application for renting
vehicles using MDD
• Semantic domain
– Company with vehicles,
customers, services, ..
• Technical domain
– Web application
• Modeling purpose
– Modeling of the semantic domain as well as the information
mandatory for code generation using a (textual) DSML
• Credo
– The better the model, the better the code
19
MDDMA WS 2014/2015
Xtext Grammar for SWM
20
MDDMA WS 2014/2015
Scenario: Xtext Model Vehicle Rental Company
Is the model
complete?
21
Is the model
comprehensible,
correct, …?
MDDMA WS 2014/2015
Is the model
complete?
Metrics calculation
22
MDDMA WS 2014/2015
Is the model
complete?
Reporting and interpreting
variously
interpretable
23
MDDMA WS 2014/2015
Is the model
complete?
Smell detection
24
MDDMA WS 2014/2015
Is the model
complete?
Locating and interpreting
refactoring
as quick-fix
25
MDDMA WS 2014/2015
Is the model
complete?
Refactoring application
Model partially
completed
26
MDDMA WS 2014/2015
EMF Refactor: Architecture
Generation
module
Specification
Language
metrics, smells,
refactorings
Application
module
extension points
Eclipse Modeling Framework (EMF)
27
MDDMA WS 2014/2015
Configuration of relevant quality assurance techniques
28
MDDMA WS 2014/2015
Smell-Refactoring relations
29
MDDMA WS 2014/2015
EMF Refactor: Architecture
Generation
module
Specification
Language
metrics, smells,
refactorings
Application
module
extension points
Eclipse Modeling Framework (EMF)
30
MDDMA WS 2014/2015
Specification languages
Generation
module
Metrics
Application
module
metrics, smells,
refactorings
+
Refactorings
Eclipse Modeling Framework (EMF)
31
MDDMA WS 2014/2015
Integration of EMF Refactor tools
• Specific tools use each other
– Metric-based model smells
– Refactoring invocation from within model smell results view
– Model smell analysis during refactoring application
• Each tool can be used directly on the model within a
certain EMF-based modeling environment
– EMF instance editor
– Unified Modeling Language (UML)
• Eclipse Plugin Papyrus
• IBM Rational Software Architect
– Textual Xtext editors
32
MDDMA WS 2014/2015
Flexible specification mechanisms in EMF Refactor
• Usage of existing quality assurance techniques
– Combination of existing model metrics
– Metric-based model smells
– Composite model refactorings
• Usage of concrete specification languages
–
–
–
–
33
Java
OCL
EMF model transformation language Henshin
… further languages can be integrated by new adapters
MDDMA WS 2014/2015
Conclusion
• Quality assurance for software models is an important
project management task
• Software quality ≠ software model quality
• A structured model quality assurance process can be
adapted to project and domain specific purposes
– The application sub-process is performed during the modeling
task, e.g., in a model review
– The specification sub-process should be performed before (as
far as possible)
• Tool support in Eclipse is given by EMF Refactor
34
MDDMA WS 2014/2015
References
• ISO/IEC 9126-1:2001 – Software engineering – Product quality – Part 1: Quality
model, 2001.
• P. Mohagheghi, V. Dehlen, T. Neple: Definitions and approaches to model quality in
model-based software development - A review of literature. Information & Software
Technology, 2009.
• Martin Fowler: Code Smell. http://martinfowler.com/bliki/CodeSmell.html
• Object Management Group (OMG): Unified Modeling Language (UML),
http://www.omg.org/spec/UML/
• Thorsten Arendt and Gabriele Taentzer: A tool environment for quality assurance
based on the Eclipse Modeling Framework. Journal Automated Software
Engineering, 2013.
• Thorsten Arendt: Quality Assurance of Software Models - A Structured Quality
Assurance Process Supported by a Flexible Tool Environment in the Eclipse
Modeling Project, Dissertation, 2014.
• Eclipse: EMF Refactor, http://www.eclipse.org/emf-refactor
35
MDDMA WS 2014/2015