35
Quality Assurance of Software Models within Eclipse using Java and OCL Dr. Thorsten Arendt Modellgetriebene Softwareentwicklung mobiler Anwendungen Wintersemester 2014/15 17. Dezember 2014

Quality Assurance of Software Models within Eclipse using ...€¦ · Quality Assurance of Software Models within Eclipse using Java and OCL ... • IBM Rational Software Architect

  • Upload
    others

  • View
    3

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Quality Assurance of Software Models within Eclipse using ...€¦ · Quality Assurance of Software Models within Eclipse using Java and OCL ... • IBM Rational Software Architect

Quality Assurance of Software Models within Eclipse using Java and OCL

Dr. Thorsten Arendt

Modellgetriebene Softwareentwicklung mobiler Anwendungen Wintersemester 2014/15 17. Dezember 2014

Page 2: Quality Assurance of Software Models within Eclipse using ...€¦ · Quality Assurance of Software Models within Eclipse using Java and OCL ... • IBM Rational Software Architect

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

Page 3: Quality Assurance of Software Models within Eclipse using ...€¦ · Quality Assurance of Software Models within Eclipse using Java and OCL ... • IBM Rational Software Architect

Why model quality assurance?

Problems

Risks

Model Refactorings

Model Smells

Model Metrics

3 MDDMA WS 2014/2015

Page 4: Quality Assurance of Software Models within Eclipse using ...€¦ · Quality Assurance of Software Models within Eclipse using Java and OCL ... • IBM Rational Software Architect

Why model quality assurance?

Problems

Risks

Model Refactorings

Model Smells

Model Metrics

Model Quality Assurance Process

MDDMA WS 2014/2015 4

Page 5: Quality Assurance of Software Models within Eclipse using ...€¦ · Quality Assurance of Software Models within Eclipse using Java and OCL ... • IBM Rational Software Architect

Software quality ≠ software model quality

[ISO/IEC 9126]

MDDMA WS 2014/2015 5

Page 6: Quality Assurance of Software Models within Eclipse using ...€¦ · Quality Assurance of Software Models within Eclipse using Java and OCL ... • IBM Rational Software Architect

Software quality ≠ software model quality

[ISO/IEC 9126]

MDDMA WS 2014/2015

Software quality

[Mohagheghi]

6C model quality goals

– Correctness – Completeness – Changeability – Comprehensibility – Confinement – Consistency

6

Page 7: Quality Assurance of Software Models within Eclipse using ...€¦ · Quality Assurance of Software Models within Eclipse using Java and OCL ... • IBM Rational Software Architect

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.’

MDDMA WS 2014/2015

[Fowler]

7

Page 8: Quality Assurance of Software Models within Eclipse using ...€¦ · Quality Assurance of Software Models within Eclipse using Java and OCL ... • IBM Rational Software Architect

A structured model quality assurance process (1)

MDDMA WS 2014/2015

Specification process

Application process Manager Designer

8

Page 9: Quality Assurance of Software Models within Eclipse using ...€¦ · Quality Assurance of Software Models within Eclipse using Java and OCL ... • IBM Rational Software Architect

Discussing important quality aspects

MDDMA WS 2014/2015

– Correctness – Completeness – Changeability

Specification process

– Comprehensibility – Confinement – Consistency

Changeability Comprehensibility

9

Page 10: Quality Assurance of Software Models within Eclipse using ...€¦ · Quality Assurance of Software Models within Eclipse using Java and OCL ... • IBM Rational Software Architect

Specifying relevant model smells (1)

MDDMA WS 2014/2015

• Question: Are there equally named classes in different packages?

Specification process

Changeability Comprehensibility

− Smell: Multiple definitions of classes with equal names

10

Page 11: Quality Assurance of Software Models within Eclipse using ...€¦ · Quality Assurance of Software Models within Eclipse using Java and OCL ... • IBM Rational Software Architect

Specifying relevant model refactorings (1)

MDDMA WS 2014/2015

Specification process

• Smell: Multiple definitions of classes with equal names – Refactorings: Merge Classes,

Rename Class

11

Page 12: Quality Assurance of Software Models within Eclipse using ...€¦ · Quality Assurance of Software Models within Eclipse using Java and OCL ... • IBM Rational Software Architect

Specifying relevant model smells (2)

• Question: Are there abstract classes without any concrete subclasses?

Specification process

Completeness Confinement

− Smell: No concrete Subclass

12 MDDMA WS 2014/2015

Page 13: Quality Assurance of Software Models within Eclipse using ...€¦ · Quality Assurance of Software Models within Eclipse using Java and OCL ... • IBM Rational Software Architect

Specifying relevant model refactorings (2)

Specification process

– Refactoring: Insert Concrete Subclass • Smell: No concrete subclass

13 MDDMA WS 2014/2015

Page 14: Quality Assurance of Software Models within Eclipse using ...€¦ · Quality Assurance of Software Models within Eclipse using Java and OCL ... • IBM Rational Software Architect

UML specific refactorings

MDDMA WS 2014/2015

Refactoring: Change Attribute to Association End

Refactoring: Change Association End to Attribute

14

Page 15: Quality Assurance of Software Models within Eclipse using ...€¦ · Quality Assurance of Software Models within Eclipse using Java and OCL ... • IBM Rational Software Architect

UML class attribute specification

MDDMA WS 2014/2015

Refactoring: Change Attribute to Association End

15

[OMG: UML]

Page 16: Quality Assurance of Software Models within Eclipse using ...€¦ · Quality Assurance of Software Models within Eclipse using Java and OCL ... • IBM Rational Software Architect

A structured model quality assurance process (2)

MDDMA WS 2014/2015

Specification process

Application process

Modeler Reviewer

16

Manager Designer

Page 17: Quality Assurance of Software Models within Eclipse using ...€¦ · Quality Assurance of Software Models within Eclipse using Java and OCL ... • IBM Rational Software Architect

Tool environment for model quality assurance

MDDMA WS 2014/2015

Problems

Risks

Model Refactorings

Model Smells

Model Metrics

Model Quality Assurance Process

17

Page 18: Quality Assurance of Software Models within Eclipse using ...€¦ · Quality Assurance of Software Models within Eclipse using Java and OCL ... • IBM Rational Software Architect

Quality Assurance and Textual Modeling in Eclipse

MDDMA WS 2014/2015 18

Page 19: Quality Assurance of Software Models within Eclipse using ...€¦ · Quality Assurance of Software Models within Eclipse using Java and OCL ... • IBM Rational Software Architect

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

MDDMA WS 2014/2015 19

Page 20: Quality Assurance of Software Models within Eclipse using ...€¦ · Quality Assurance of Software Models within Eclipse using Java and OCL ... • IBM Rational Software Architect

Xtext Grammar for SWM

MDDMA WS 2014/2015 20

Page 21: Quality Assurance of Software Models within Eclipse using ...€¦ · Quality Assurance of Software Models within Eclipse using Java and OCL ... • IBM Rational Software Architect

Scenario: Xtext Model Vehicle Rental Company

Is the model complete?

Is the model comprehensible,

correct, …?

MDDMA WS 2014/2015 21

Page 22: Quality Assurance of Software Models within Eclipse using ...€¦ · Quality Assurance of Software Models within Eclipse using Java and OCL ... • IBM Rational Software Architect

Metrics calculation Is the model complete?

MDDMA WS 2014/2015 22

Page 23: Quality Assurance of Software Models within Eclipse using ...€¦ · Quality Assurance of Software Models within Eclipse using Java and OCL ... • IBM Rational Software Architect

Reporting and interpreting

variously interpretable

Is the model complete?

MDDMA WS 2014/2015 23

Page 24: Quality Assurance of Software Models within Eclipse using ...€¦ · Quality Assurance of Software Models within Eclipse using Java and OCL ... • IBM Rational Software Architect

Smell detection Is the model complete?

MDDMA WS 2014/2015 24

Page 25: Quality Assurance of Software Models within Eclipse using ...€¦ · Quality Assurance of Software Models within Eclipse using Java and OCL ... • IBM Rational Software Architect

Locating and interpreting

refactoring as quick-fix

Is the model complete?

MDDMA WS 2014/2015 25

Page 26: Quality Assurance of Software Models within Eclipse using ...€¦ · Quality Assurance of Software Models within Eclipse using Java and OCL ... • IBM Rational Software Architect

Refactoring application

Model partially completed

Is the model complete?

MDDMA WS 2014/2015 26

Page 27: Quality Assurance of Software Models within Eclipse using ...€¦ · Quality Assurance of Software Models within Eclipse using Java and OCL ... • IBM Rational Software Architect

EMF Refactor: Architecture

Specification Language

Generation module

metrics, smells, refactorings

Eclipse Modeling Framework (EMF)

extension points

Generation module

MDDMA WS 2014/2015 27

Application module

Page 28: Quality Assurance of Software Models within Eclipse using ...€¦ · Quality Assurance of Software Models within Eclipse using Java and OCL ... • IBM Rational Software Architect

Configuration of relevant quality assurance techniques

MDDMA WS 2014/2015 28

Page 29: Quality Assurance of Software Models within Eclipse using ...€¦ · Quality Assurance of Software Models within Eclipse using Java and OCL ... • IBM Rational Software Architect

Smell-Refactoring relations

MDDMA WS 2014/2015 29

Page 30: Quality Assurance of Software Models within Eclipse using ...€¦ · Quality Assurance of Software Models within Eclipse using Java and OCL ... • IBM Rational Software Architect

EMF Refactor: Architecture

Specification Language

Generation module

metrics, smells, refactorings

Eclipse Modeling Framework (EMF)

extension points

Specification Language

Generation module

MDDMA WS 2014/2015 30

Application module

Page 31: Quality Assurance of Software Models within Eclipse using ...€¦ · Quality Assurance of Software Models within Eclipse using Java and OCL ... • IBM Rational Software Architect

Specification languages

Generation module

Application module

metrics, smells, refactorings

Eclipse Modeling Framework (EMF)

Metrics

Refactorings

+

MDDMA WS 2014/2015 31

Page 32: Quality Assurance of Software Models within Eclipse using ...€¦ · Quality Assurance of Software Models within Eclipse using Java and OCL ... • IBM Rational Software Architect

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

Page 33: Quality Assurance of Software Models within Eclipse using ...€¦ · Quality Assurance of Software Models within Eclipse using Java and OCL ... • IBM Rational Software Architect

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 – Java – OCL – EMF model transformation language Henshin – … further languages can be integrated by new adapters

33 MDDMA WS 2014/2015

Page 34: Quality Assurance of Software Models within Eclipse using ...€¦ · Quality Assurance of Software Models within Eclipse using Java and OCL ... • IBM Rational Software Architect

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

Page 35: Quality Assurance of Software Models within Eclipse using ...€¦ · Quality Assurance of Software Models within Eclipse using Java and OCL ... • IBM Rational Software Architect

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