Upload
derrick-mcdaniel
View
215
Download
0
Tags:
Embed Size (px)
Citation preview
© 2008 IBM Corporation
Behavioral Models for Software Development
Andrei Kirshin, Dolev Dotan, Alan Hartman
January 2008
2
Haifa Research Lab – Model Driven Engineering Technologies Group
© 2008 IBM Corporation
Abstract
MDD raising the level of abstraction, increasing the automation
Models and model transformations increased productivity, quality, effective way of adapting to changes in requirements
This talk focuses on models which describe the behavior of the system, and the tools for executing at the model level
Platform independent action language
3
Haifa Research Lab – Model Driven Engineering Technologies Group
© 2008 IBM Corporation
Outline
Introduction– Motivation
– UML Behavioral Modeling
– Action Language
UML Model Debugger– Debugging capabilities
– Debugging perspective
– Diagram animation
Testing– Model testing
– Model-based testing (test generation)
4
Haifa Research Lab – Model Driven Engineering Technologies Group
© 2008 IBM Corporation
Outline – Introduction
Introduction– Motivation
– UML Behavioral Modeling
– Action Language
UML Model Debugger– Debugging capabilities
– Debugging perspective
– Diagram animation
Testing– Model testing
– Model-based testing (test generation)
5
Haifa Research Lab – Model Driven Engineering Technologies Group
© 2008 IBM Corporation
Introduction – VisionTime
Developers
Variety & versatility of users: business analysts, architects, developers, testers
Tools
Many highly qualified developers
Abstraction
Registers,low level commands
Structures, operations, statements, expressions, classes, interfaces, packages
Components, services,features, behaviors,actions, patterns
3GL level debugging,3GL testing tools,
Assembler,Assembly debugger
CompilerRE
OO
DM
DD
PD
Few experts
PD – Procedural Development, RE – Reverse Engineering, MD – Model Discovery
Model level debugging Model level testingSupport for ALStatic model analysis
MDCode
Generation
6
Haifa Research Lab – Model Driven Engineering Technologies Group
© 2008 IBM Corporation
Behavioral Modeling Toolset
Traditional SoftwareDevelopment
Model DrivenDevelopment
CodeDebugger
ModelDebugger
CompilerModel
Transformation
IDEModeling
Tool
7
Haifa Research Lab – Model Driven Engineering Technologies Group
© 2008 IBM Corporation
MDD and Model Debugger
Identify defects at a much higher level of abstraction, earlier in the development cycle
Model Debugger
Transformation Execution
RuntimeExecutable ModelExecutable
Specification(e.g. code)
8
Haifa Research Lab – Model Driven Engineering Technologies Group
© 2008 IBM Corporation
Modeling with UML Structure
– Class (Class diagram)
– Component (Composite structure diagram) Behavior
– State machine (state machine diagram)
– Activity (activity diagram)
– Interaction (sequence/communication diagram)
– Action language (snippets of code in model)
9
Haifa Research Lab – Model Driven Engineering Technologies Group
© 2008 IBM Corporation
State Machines
Features include: Behaviors for: transition effects, state
entry, do, exit Composite states Nested state machines Concurrency (orthogonal states) Transition guards Conditionals (choice, junction)
Integration with the Object Oriented Model: Effect/entry/do/exit behaviors… Guards…
– …can access class attributes, call class operations, etc. Triggers:
– Operation calls
– Attribute changes
10
Haifa Research Lab – Model Driven Engineering Technologies Group
© 2008 IBM Corporation
Activity Diagrams – “Sophisticated Flowcharts”
Features include: Control flow Data flow Conditionals (choice node,
guards) Concurrency (fork & join) Nested behavior calls Data stores
Integration with the Object Oriented Model: (“Opaque”) actions – code snippets… Guard expressions…
– …can access class attributes, call class operations, etc.
Actions for:– Calling operations
– Reading and modifying attributes
– Sending signals
– and more…
11
Haifa Research Lab – Model Driven Engineering Technologies Group
© 2008 IBM Corporation
UML Behavioral Modeling
Structure: protocol, classes (capsules), ports and connectors
Behaviors (state machines, activities, interactions)– Stand-alone– Specify the implementation of operations– Specify the lifecycle of objects (capsules)– Specify state entry/do/exit behavior and transition effect
Code snippets (target language or platform independent)– Specify the implementation of operations– Specify state entry/do/exit behavior and transition effect– Activity actions– Guards (activity edge, state machine transition)
Flexible Very complex (almost as complex as code)
12
Haifa Research Lab – Model Driven Engineering Technologies Group
© 2008 IBM Corporation
Action Language
Snippets of Code in the Model
Target language (Java, C++, C#) or its subset Error prone, bound to specific target platform and compiler
Already known language Platform independent
New language to learn
Makes the model retargetable, less error prone
13
Haifa Research Lab – Model Driven Engineering Technologies Group
© 2008 IBM Corporation
Outline – UML Model Debugger
Introduction– Motivation
– UML Behavioral Modeling
– Action Language
UML Model Debugger– Debugging capabilities
– Debugging perspective
– Diagram animation
Testing– Model testing
– Model-based testing (test generation)
14
Haifa Research Lab – Model Driven Engineering Technologies Group
© 2008 IBM Corporation
Interactive Debugging
Traditional debugging– Running a main function
– Hitting a breakpoint
– Stepping
– Observing values
Interactive debugging (model “exerciser”)– Creating instances
– Invoking operations and behaviors, send signals
– Hitting a breakpoint
– Stepping
– Observing values
15
Haifa Research Lab – Model Driven Engineering Technologies Group
© 2008 IBM Corporation
Model Debugging Perspective
Debug Variables
Console
Diagram Animation
Signals
Event Pools
Instances
Breakpoints
I/O
Snippet
16
Haifa Research Lab – Model Driven Engineering Technologies Group
© 2008 IBM Corporation
Instances View
Dynamic debugging– Object creation and
destruction
– Method invocation
Create New Instance
Destroy Instance
Instance
Attribute
Double-click to Invoke
Operation
17
Haifa Research Lab – Model Driven Engineering Technologies Group
© 2008 IBM Corporation
Debug View
Control and display granularity – model elements– State, Transition, Action, Edge, etc.
Supports concurrency in behaviors – stack trace is a tree
Execution Stack
Step(into, over, out)
Stop Pause Resume
Send Signal Broadcast
Signal
18
Haifa Research Lab – Model Driven Engineering Technologies Group
© 2008 IBM Corporation
Variables View
Similar to Eclipse debugging framework view
Self Object
Behavior attributes, local variables and parameters
19
Haifa Research Lab – Model Driven Engineering Technologies Group
© 2008 IBM Corporation
Breakpoints View
Similar to Eclipse debugging framework view Breakpoints
– Statemachine: State, Transition, Entry, Do, Exit, Effect
– Activity: Action
“Do” Behavior
State
Transition
20
Haifa Research Lab – Model Driven Engineering Technologies Group
© 2008 IBM Corporation
Event Pools View
Shows pending events in event the pools of active objects
Pending Events
21
Haifa Research Lab – Model Driven Engineering Technologies Group
© 2008 IBM Corporation
Signals and I/O Views
Send and Broadcast Signal
Buttons
Double-click to send signal Signals
History
22
Haifa Research Lab – Model Driven Engineering Technologies Group
© 2008 IBM Corporation
Diagram Animation – State Machine
Current State
Execution Pending
Running Transition
Breakpoint
23
Haifa Research Lab – Model Driven Engineering Technologies Group
© 2008 IBM Corporation
Diagram Animation – Activity
Token Provider
Offer Path
Execution Pending
24
Haifa Research Lab – Model Driven Engineering Technologies Group
© 2008 IBM Corporation
Outline – Testing
Introduction– Motivation
– UML Behavioral Modeling
– Action Language
UML Model Debugger– Debugging capabilities
– Debugging perspective
– Diagram animation
Testing– Model testing
– Model-based testing (test generation)
25
Haifa Research Lab – Model Driven Engineering Technologies Group
© 2008 IBM Corporation
Debugging – Model Interpretation
Simulation / Emulation (for debugging and understanding) Recording of execution traces (assisted test generation)
Model Debugger
Test Generator
Test Execution Environment
UML Model Application
Test / Trace
Code Generation
26
Haifa Research Lab – Model Driven Engineering Technologies Group
© 2008 IBM Corporation
Debugging – Generated Code
Execution monitoring and control Execution trace animation Trace analysis results visualization
Model Debugger
Test Generator
Test Execution Environment
UML Model Application
Test / Trace
Code Generation
27
Haifa Research Lab – Model Driven Engineering Technologies Group
© 2008 IBM Corporation
Automatic Test Generation
Test is a sequence of stimuli and observations Model is used as the oracle to predict the expected results A bunch of tests is generated automatically according to provided criteria
Model Debugger
Test Generator
Test Execution Environment
UML Model Application
Test / Trace
Code Generation
28
Haifa Research Lab – Model Driven Engineering Technologies Group
© 2008 IBM Corporation
Test Editing
Manual test creation using model-level terms Editing of tests generated using the Test Generator or Model Debugger
traces
Model Debugger
Test Generator
Test Execution Environment
UML Model Application
Test / Trace
Code Generation
29
Haifa Research Lab – Model Driven Engineering Technologies Group
© 2008 IBM Corporation
Model Testing
Execution of tests on the model Used for model regression testing and test-first modeling approach
Model Debugger
Test Generator
Test Execution Environment
UML Model Application
Test / Trace
Code Generation
30
Haifa Research Lab – Model Driven Engineering Technologies Group
© 2008 IBM Corporation
Model Driven Testing of Applications
Execution of tests on the application Transformation to concrete test execution environment
Model Debugger
Test Generator
Test Execution Environment
UML Model Application
Test / Trace
Code Generation
31
Haifa Research Lab – Model Driven Engineering Technologies Group
© 2008 IBM Corporation
Testing Summary
Test creation– Manual (test editor)
– Assisted (execution trace recording)
– Automatic test generation
Model Testing– Execution of tests on the model
– Used for model regression testing and test-first modeling approach
Model-Based Testing of Systems– Transformation to concrete test execution environment
– Execution of tests on the application
32
Haifa Research Lab – Model Driven Engineering Technologies Group
© 2008 IBM Corporation
Summary
MDD is a practical option for improving SW production and capitalizing on existing SW assets through:
– Abstraction
– Automation
– Legacy modernization
UML Behavioral Modeling Action Language UML Model Debugger Model testing Model-based testing of applications
33
Haifa Research Lab – Model Driven Engineering Technologies Group
© 2008 IBM Corporation
References
IBM Haifa Research Lab – Model Driven Engineering Technologies group
http://www.research.ibm.com/haifa/dept/services/mdet.html Model Debugger
http://www.research.ibm.com/haifa/projects/software/ple/mex/index.html Model Grokking
http://www.research.ibm.com/haifa/projects/software/ple/grokking/index.html UML
http://www.uml.org/
Contacts:Andrei Kirshin, Dolev Dotan, Alan Hartman
{kirshin,dotan,hartman}@il.ibm.com