340 likes | 427 Views
Behavioral Models for Software Development. Andrei Kirshin, Dolev Dotan, Alan Hartman January 2008. Abstract. MDD r ai sing the level of abstraction , i ncrea sing the automation
E N D
Behavioral Models for Software Development Andrei Kirshin, Dolev Dotan, Alan Hartman January 2008
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
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)
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)
Introduction – Vision Time Tools Developers Abstraction • Variety & versatility of users: business analysts, architects, developers, testers • Components, services, • features, behaviors, • actions, patterns • Model level debugging • Model level testing • Support for AL • Static model analysis MDD Code Generation MD • Many highly qualified developers • Structures, operations, statements, • expressions, classes, interfaces, packages • 3GL level debugging, • 3GL testing tools, OOD Compiler RE • Few experts • Registers, • low level commands • Assembler, • Assembly debugger PD • PD – Procedural Development, RE – Reverse Engineering, MD – Model Discovery
ModelingTool IDE CodeDebugger ModelDebugger ModelTransformation Compiler Behavioral Modeling Toolset Traditional Software Development Model DrivenDevelopment
Model Debugger MDD and Model Debugger • Identify defects at a much higher level of abstraction, earlier in the development cycle ExecutableSpecification (e.g. code) Runtime Executable Model Execution Transformation
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)
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 State Machines
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…
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)
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
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)
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
Model Debugging Perspective Debug Variables Breakpoints Event Pools Instances Diagram Animation Console Signals Snippet I/O
Instances View Create New Instance Destroy Instance • Dynamic debugging • Object creation and destruction • Method invocation Instance Attribute Double-click to Invoke Operation
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
Variables View • Similar to Eclipse debugging framework view Self Object Behavior attributes, local variables and parameters
Breakpoints View • Similar to Eclipse debugging framework view • Breakpoints • Statemachine: State, Transition, Entry, Do, Exit, Effect • Activity: Action “Do” Behavior State Transition
Event Pools View • Shows pending events in event the pools of active objects Pending Events
Signals and I/O Views Send and Broadcast Signal Buttons Double-click to send signal Signals History
Diagram Animation – State Machine Running Transition Execution Pending Current State Breakpoint
Diagram Animation – Activity Execution Pending Offer Path Token Provider
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)
Debugging – Model Interpretation UML Model Application • Simulation / Emulation (for debugging and understanding) • Recording of execution traces (assisted test generation) Code Generation Model Debugger Test Execution Environment Test Generator Test / Trace
Debugging – Generated Code UML Model Application • Execution monitoring and control • Execution trace animation • Trace analysis results visualization Code Generation Model Debugger Test Execution Environment Test Generator Test / Trace
Automatic Test Generation UML Model Application • 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 Code Generation Model Debugger Test Execution Environment Test Generator Test / Trace
Test Editing UML Model Application • Manual test creation using model-level terms • Editing of tests generated using the Test Generator or Model Debugger traces Code Generation Model Debugger Test Execution Environment Test Generator Test / Trace
Model Testing UML Model Application • Execution of tests on the model • Used for model regression testing and test-first modeling approach Code Generation Model Debugger Test Execution Environment Test Generator Test / Trace
Model Driven Testing of Applications UML Model Application • Execution of tests on the application • Transformation to concrete test execution environment Code Generation Model Debugger Test Execution Environment Test Generator Test / Trace
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
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
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