analyzing robustness of uml state machinesbiblio/downloads/talks/martes06-talk.pdf · • formulate...

23
Analyzing Robustness of UML State Machines Steffen Prochnow, Gunnar Schaefer, Ken Bell and Reinhard von Hanxleden Department of Computer Science and Applied Mathematics Real-Time Systems and Embedded Systems Group Christian-Albrecht Universit¨ at zu Kiel MARTES’06, October 2006

Upload: others

Post on 07-Mar-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Analyzing Robustness of UML State Machinesbiblio/downloads/talks/martes06-talk.pdf · • formulate profiles of robustness rules as a Statechart modeling style guide • avoid errors,

Analyzing Robustness of UML State Machines

Steffen Prochnow, Gunnar Schaefer, Ken Bell andReinhard von Hanxleden

Department of Computer Science and Applied MathematicsReal-Time Systems and Embedded Systems Group

Christian-Albrecht Universitat zu Kiel

MARTES’06, October 2006

Page 2: Analyzing Robustness of UML State Machinesbiblio/downloads/talks/martes06-talk.pdf · • formulate profiles of robustness rules as a Statechart modeling style guide • avoid errors,

Contents

Introduction

Style Checking in Statecharts

The Style Checker

Summary & Conclusion

Appendix

Steffen Prochnow, Gunnar Schaefer, Ken Bell andReinhard von Hanxleden Analyzing Robustness of UML State Machines – 2/11

Page 3: Analyzing Robustness of UML State Machinesbiblio/downloads/talks/martes06-talk.pdf · • formulate profiles of robustness rules as a Statechart modeling style guide • avoid errors,

Introduction

Motivation

• realistic Statecharts possess high complexity• size• side effects• misunderstanding

• potential errors can be subtle and hard to locate for humans

• tools provide restricted facilities to avoid modeling errors

Purpose

• formulate profiles of robustness rules as a Statechart modelingstyle guide

• avoid errors, improve readability and maintainability

• establishment of automatic Statechart analysis in a highlyconfigurable tool

Steffen Prochnow, Gunnar Schaefer, Ken Bell andReinhard von Hanxleden Analyzing Robustness of UML State Machines – 3/11

Page 4: Analyzing Robustness of UML State Machinesbiblio/downloads/talks/martes06-talk.pdf · • formulate profiles of robustness rules as a Statechart modeling style guide • avoid errors,

Introduction

Motivation

• realistic Statecharts possess high complexity• size• side effects• misunderstanding

• potential errors can be subtle and hard to locate for humans

• tools provide restricted facilities to avoid modeling errors

Purpose

• formulate profiles of robustness rules as a Statechart modelingstyle guide

• avoid errors, improve readability and maintainability

• establishment of automatic Statechart analysis in a highlyconfigurable tool

Steffen Prochnow, Gunnar Schaefer, Ken Bell andReinhard von Hanxleden Analyzing Robustness of UML State Machines – 3/11

Page 5: Analyzing Robustness of UML State Machinesbiblio/downloads/talks/martes06-talk.pdf · • formulate profiles of robustness rules as a Statechart modeling style guide • avoid errors,

Modeling Errors with Statecharts

Humans tend to digress, err, and diversify.

Steffen Prochnow, Gunnar Schaefer, Ken Bell andReinhard von Hanxleden Analyzing Robustness of UML State Machines – 4/11

Page 6: Analyzing Robustness of UML State Machinesbiblio/downloads/talks/martes06-talk.pdf · • formulate profiles of robustness rules as a Statechart modeling style guide • avoid errors,

Modeling Errors with Statecharts

Humans tend to digress, err, and diversify.

Steffen Prochnow, Gunnar Schaefer, Ken Bell andReinhard von Hanxleden Analyzing Robustness of UML State Machines – 4/11

Page 7: Analyzing Robustness of UML State Machinesbiblio/downloads/talks/martes06-talk.pdf · • formulate profiles of robustness rules as a Statechart modeling style guide • avoid errors,

Style Checking in Statecharts

Static Analysis of Statecharts

SyntacticCorrectness

Style Checkingin Statecharts

SyntacticAnalysis

SemanticRobustness

Readability Efficiency SyntacticRobustness

Error prevention:

• human code review

• dynamic testing

• Model Checking

• Style Checking

Statechart Robustness:

• syntactic and semantic style

• gather from elementcorrelation

Steffen Prochnow, Gunnar Schaefer, Ken Bell andReinhard von Hanxleden Analyzing Robustness of UML State Machines – 5/11

Page 8: Analyzing Robustness of UML State Machinesbiblio/downloads/talks/martes06-talk.pdf · • formulate profiles of robustness rules as a Statechart modeling style guide • avoid errors,

Style Checking in Statecharts

Static Analysis of Statecharts

SyntacticCorrectness

Style Checkingin Statecharts

SyntacticAnalysis

SemanticRobustness

Readability Efficiency SyntacticRobustness

Error prevention:

• human code review

• dynamic testing

• Model Checking

• Style Checking

Statechart Robustness:

• syntactic and semantic style

• gather from elementcorrelation

Steffen Prochnow, Gunnar Schaefer, Ken Bell andReinhard von Hanxleden Analyzing Robustness of UML State Machines – 5/11

Page 9: Analyzing Robustness of UML State Machinesbiblio/downloads/talks/martes06-talk.pdf · • formulate profiles of robustness rules as a Statechart modeling style guide • avoid errors,

Style Checking Tools for Statecharts

KIEL Checking

Guideline-Checker

Mint

State Analyzer

Rule Checker

Layout Style

Robustness

//

OO

Mint/Guideline-Checker:

• related toMatlab/Simulink/Stateflow

• trivial graphical and syntacticchecks

State Analyzer:

• related to Statemate

• automated theorem proving

• Problem Specific

Rule Checker:

• related to UML

• checking with Java and OCL

• interpreting OCL

Steffen Prochnow, Gunnar Schaefer, Ken Bell andReinhard von Hanxleden Analyzing Robustness of UML State Machines – 6/11

Page 10: Analyzing Robustness of UML State Machinesbiblio/downloads/talks/martes06-talk.pdf · • formulate profiles of robustness rules as a Statechart modeling style guide • avoid errors,

A Statechart Style Guide

• operational instructions for humans and configuration for automatedanalysis

• set of 41 wellformedness-, syntactic, and semantic rules

• defines a subset of the language Statechart

Connectivity

Syntactic Rules

Overlapping Transitions

Dwelling

Semantic Rules

Steffen Prochnow, Gunnar Schaefer, Ken Bell andReinhard von Hanxleden Analyzing Robustness of UML State Machines – 7/11

Page 11: Analyzing Robustness of UML State Machinesbiblio/downloads/talks/martes06-talk.pdf · • formulate profiles of robustness rules as a Statechart modeling style guide • avoid errors,

A Statechart Style Guide

• operational instructions for humans and configuration for automatedanalysis

• set of 41 wellformedness-, syntactic, and semantic rules

• defines a subset of the language Statechart

Connectivity

Syntactic Rules

Overlapping Transitions

Dwelling

Semantic Rules

Steffen Prochnow, Gunnar Schaefer, Ken Bell andReinhard von Hanxleden Analyzing Robustness of UML State Machines – 7/11

Page 12: Analyzing Robustness of UML State Machinesbiblio/downloads/talks/martes06-talk.pdf · • formulate profiles of robustness rules as a Statechart modeling style guide • avoid errors,

A Statechart Style Guide

• operational instructions for humans and configuration for automatedanalysis

• set of 41 wellformedness-, syntactic, and semantic rules

• defines a subset of the language Statechart

Connectivity

Syntactic Rules

Overlapping Transitions

Dwelling

Semantic Rules

Steffen Prochnow, Gunnar Schaefer, Ken Bell andReinhard von Hanxleden Analyzing Robustness of UML State Machines – 7/11

Page 13: Analyzing Robustness of UML State Machinesbiblio/downloads/talks/martes06-talk.pdf · • formulate profiles of robustness rules as a Statechart modeling style guide • avoid errors,

Checking: The Environment

Kiel Integrated Environment for Layout

• modeling environment to explore the visualization and intuitivecomprehend complex reactive systems

• provides a simulation based on dynamic focus-and-context

• KIEL’s generic concept of Statecharts can be adaptated to specificnotations and semantics

• imports, visualizes, and simulates Statecharts created with Esterel Studio,Stateflow, UML tools via XMI format

• Statechart synthesis from textual languages (e. g. Esterel)

• structural Statechart optimization for compactness and readability

Steffen Prochnow and Reinhard von Hanxleden.

Comfortable Modeling of Complex Reactive Systems.

In Proceedings of Design, Automation and Test in Europe (DATE’06), Munich, March 2006.

Steffen Prochnow, Claus Traulsen, and Reinhard von Hanxleden.

Synthesizing Safe State Machines from Esterel.

In Proceedings of ACM SIGPLAN/SIGBED Conference on Languages, Compilers, and Tools for EmbeddedSystems (LCTES’06), Ottawa, Canada, June 2006.

Steffen Prochnow, Gunnar Schaefer, Ken Bell andReinhard von Hanxleden Analyzing Robustness of UML State Machines – 8/11

Page 14: Analyzing Robustness of UML State Machinesbiblio/downloads/talks/martes06-talk.pdf · • formulate profiles of robustness rules as a Statechart modeling style guide • avoid errors,

Checking: The Plug-In

Syntactical Checks/Wellformedness:

• adopted OCL to KOCL

• transformation into executable Java code

rule UML13CompositeStateRule1 {

declarations {

message "A composite state can have ...";}

constraint {

context ORState or Region;

"self.subnodes->select(

v| v.oclIsTypeOf(InitialState))-> size<=1";}

fails {message;}}

Java Code Snippet

Java Codefor Checking

OCL Constraint

DresdenOCL-Toolkit

KIEL DatastructureMeta-model

Semantical Checks:

• using of a theorem prover (CVC Lite)

• e. g. detecting a non-dwelling state: ((e1 ∧ c1) ∧ (e2 ∧ c2))

• implementation of JNI communication with SWIG

Steffen Prochnow, Gunnar Schaefer, Ken Bell andReinhard von Hanxleden Analyzing Robustness of UML State Machines – 9/11

Page 15: Analyzing Robustness of UML State Machinesbiblio/downloads/talks/martes06-talk.pdf · • formulate profiles of robustness rules as a Statechart modeling style guide • avoid errors,

Checking: The Plug-In

Syntactical Checks/Wellformedness:

• adopted OCL to KOCL

• transformation into executable Java code

rule UML13CompositeStateRule1 {

declarations {

message "A composite state can have ...";}

constraint {

context ORState or Region;

"self.subnodes->select(

v| v.oclIsTypeOf(InitialState))-> size<=1";}

fails {message;}}

Java Code Snippet

Java Codefor Checking

OCL Constraint

DresdenOCL-Toolkit

KIEL DatastructureMeta-model

Semantical Checks:

• using of a theorem prover (CVC Lite)

• e. g. detecting a non-dwelling state: ((e1 ∧ c1) ∧ (e2 ∧ c2))

• implementation of JNI communication with SWIG

Steffen Prochnow, Gunnar Schaefer, Ken Bell andReinhard von Hanxleden Analyzing Robustness of UML State Machines – 9/11

Page 16: Analyzing Robustness of UML State Machinesbiblio/downloads/talks/martes06-talk.pdf · • formulate profiles of robustness rules as a Statechart modeling style guide • avoid errors,

Checking: The Plug-In

Syntactical Checks/Wellformedness:

• adopted OCL to KOCL

• transformation into executable Java code

rule UML13CompositeStateRule1 {

declarations {

message "A composite state can have ...";}

constraint {

context ORState or Region;

"self.subnodes->select(

v| v.oclIsTypeOf(InitialState))-> size<=1";}

fails {message;}}

Java Code Snippet

Java Codefor Checking

OCL Constraint

DresdenOCL-Toolkit

KIEL DatastructureMeta-model

Semantical Checks:

• using of a theorem prover (CVC Lite)

• e. g. detecting a non-dwelling state: ((e1 ∧ c1) ∧ (e2 ∧ c2))

• implementation of JNI communication with SWIG

Steffen Prochnow, Gunnar Schaefer, Ken Bell andReinhard von Hanxleden Analyzing Robustness of UML State Machines – 9/11

Page 17: Analyzing Robustness of UML State Machinesbiblio/downloads/talks/martes06-talk.pdf · • formulate profiles of robustness rules as a Statechart modeling style guide • avoid errors,

Demo: Error Checking

Steffen Prochnow, Gunnar Schaefer, Ken Bell andReinhard von Hanxleden Analyzing Robustness of UML State Machines – 10/11

Page 18: Analyzing Robustness of UML State Machinesbiblio/downloads/talks/martes06-talk.pdf · • formulate profiles of robustness rules as a Statechart modeling style guide • avoid errors,

Summary & Conclusion

Contributions:

• Comprehensive Statechart Style Guide

• Syntactic and Semantic analyses

• Transformative Approach for OCL usage

Conclusion:

• OCL sufficient for most of our checks

• OCL rule specification is much faster then programming

• OCL doesn’t fit all intended Statechart analyses: theoremproving was necessary

We look for realistic models to apply our checks!

thanks!questions or comments?

Steffen Prochnow, Gunnar Schaefer, Ken Bell andReinhard von Hanxleden Analyzing Robustness of UML State Machines – 11/11

Page 19: Analyzing Robustness of UML State Machinesbiblio/downloads/talks/martes06-talk.pdf · • formulate profiles of robustness rules as a Statechart modeling style guide • avoid errors,

Summary & Conclusion

Contributions:

• Comprehensive Statechart Style Guide

• Syntactic and Semantic analyses

• Transformative Approach for OCL usage

Conclusion:

• OCL sufficient for most of our checks

• OCL rule specification is much faster then programming

• OCL doesn’t fit all intended Statechart analyses: theoremproving was necessary

We look for realistic models to apply our checks!

thanks!questions or comments?

Steffen Prochnow, Gunnar Schaefer, Ken Bell andReinhard von Hanxleden Analyzing Robustness of UML State Machines – 11/11

Page 20: Analyzing Robustness of UML State Machinesbiblio/downloads/talks/martes06-talk.pdf · • formulate profiles of robustness rules as a Statechart modeling style guide • avoid errors,

Summary & Conclusion

Contributions:

• Comprehensive Statechart Style Guide

• Syntactic and Semantic analyses

• Transformative Approach for OCL usage

Conclusion:

• OCL sufficient for most of our checks

• OCL rule specification is much faster then programming

• OCL doesn’t fit all intended Statechart analyses: theoremproving was necessary

We look for realistic models to apply our checks!

thanks!questions or comments?Steffen Prochnow, Gunnar Schaefer, Ken Bell andReinhard von Hanxleden Analyzing Robustness of UML State Machines – 11/11

Page 21: Analyzing Robustness of UML State Machinesbiblio/downloads/talks/martes06-talk.pdf · • formulate profiles of robustness rules as a Statechart modeling style guide • avoid errors,

Appendix: SWIG Workflow

wrapped CVCLlibraray, JNI enabled

CVCL .h files SWIG interfacedefinition file

manualannotation

Java wrapper classesfor CVCL

communicationthrough JNI

SWIG C++ wapper forCVCL library

SWIG

gcc

CVCLC++ library

KIEL CheckingPlug-In

uses

(a) The SWIG Workflow

Java Wrapper Classes

Java Native Interface (JNI)

C++ Wrapper Classes

CVCL C++ library

(b) Composition of WrapperLayers

Figure: Interfacing of KIEL and the CVC Lite Library via JNI and SWIG.

Steffen Prochnow, Gunnar Schaefer, Ken Bell andReinhard von Hanxleden Analyzing Robustness of UML State Machines – 11/11

Page 22: Analyzing Robustness of UML State Machinesbiblio/downloads/talks/martes06-talk.pdf · • formulate profiles of robustness rules as a Statechart modeling style guide • avoid errors,

Appendix: Further Rules

Connectivity

DefaultTransition

Syntactic Rules

Overlapping Transitions

Dwelling

Read/Write Race Condition

Semantic Rules

Steffen Prochnow, Gunnar Schaefer, Ken Bell andReinhard von Hanxleden Analyzing Robustness of UML State Machines – 11/11

Page 23: Analyzing Robustness of UML State Machinesbiblio/downloads/talks/martes06-talk.pdf · • formulate profiles of robustness rules as a Statechart modeling style guide • avoid errors,

Appendix: Bibliography

Miltiadis Moutos, Albrecht Korn, and Carsten Fisel.

Guideline-Checker.Studienarbeit, University of Applied Sciences in Esslingen, June 2000.

Christian Scheidler.

Systems Engineering for Time Triggered Architectures.SETTA Consortium, 2002.Deliverable D7.3 – Final Document.

Martin Mutz and Michaela Huhn.

Automated statechart analysis for user-defined design rules.Technical report, Technische Universitat Braunschweig, 2003.

David M. Beazley.

SWIG: An easy to use tool for integrating scripting languages with C and C++.In Proceedings of the Fourth Annual USENIX Tcl/Tk Workshop, pages 129–139, 1996.

Clark W. Barrett and Sergey Berezin.

CVC Lite: A new implementation of the Cooperating Validity Checker Category B.In Rajeev Alur and Doron A. Peled, editors, Proceedings of Computer Aided Verification: 16th International Conference, CAV2004, Boston, volume 3114 of Lecture Notes in Computer Science, pages 515–518. Springer, 2004.

Steffen Prochnow and Reinhard von Hanxleden.

Comfortable Modeling of Complex Reactive Systems.In Proceedings of Design, Automation and Test in Europe (DATE’06), Munich, March 2006.

Steffen Prochnow, Claus Traulsen, and Reinhard von Hanxleden.

Synthesizing Safe State Machines from Esterel.In Proceedings of ACM SIGPLAN/SIGBED Conference on Languages, Compilers, and Tools for Embedded Systems(LCTES’06), Ottawa, Canada, June 2006.

Steffen Prochnow, Gunnar Schaefer, Ken Bell andReinhard von Hanxleden Analyzing Robustness of UML State Machines – 11/11