Advanced Topics in model-based Software Development



Similar documents
Agile Test-based Modeling

Agile Modeling with the UML

The SPES Methodology Modeling- and Analysis Techniques

Über die Semantik von Modellierungssprachen

UML-based Test Generation and Execution

Contents. Introduction and System Engineering 1. Introduction 2. Software Process and Methodology 16. System Engineering 53

Questions? Assignment. Techniques for Gathering Requirements. Gathering and Analysing Requirements

Decomposition into Parts. Software Engineering, Lecture 4. Data and Function Cohesion. Allocation of Functions and Data. Component Interfaces

Chapter 4 Software Lifecycle and Performance Analysis

How To Test Automatically

Chapter 8 Software Testing

Enterprise Architecture: Practical Guide to Logical Architecture

Java (12 Weeks) Introduction to Java Programming Language

Model-Based Requirements Engineering with AutoRAID

Chapter 5. Regression Testing of Web-Components

A UML 2 Profile for Business Process Modelling *

The Software Development Process

Software Engineering Reference Framework

.NET and J2EE Intro to Software Engineering

Foundations of Model-Driven Software Engineering

Use Cases. Massimo Felici. Massimo Felici Use Cases c

Overview. Stakes. Context. Model-Based Development of Safety-Critical Systems

Course Syllabus For Operations Management. Management Information Systems

UNIFACE Component-based. Development Methodology UNIFACE V Revision 0 Dec 2000 UMET

TEST AUTOMATION FRAMEWORK

Six ways to accelerate Android mobile application development

Introducing Formal Methods. Software Engineering and Formal Methods

Business-Driven Software Engineering Lecture 3 Foundations of Processes

Model-based Testing: Next Generation Functional Software Testing

Compliance and Requirement Traceability for SysML v.1.0a

Formal Verification and Linear-time Model Checking

i. Node Y Represented by a block or part. SysML::Block,

1 Business Modeling. 1.1 Event-driven Process Chain (EPC) Seite 2

Design by Contract beyond class modelling

Seamless Method- and Model-based Software and Systems Engineering

Roadmap. Software Engineering. Software Engineering. Project Life Cycle. Database. Project Lifecycle

UML TUTORIALS THE USE CASE MODEL

Embedded/Real-Time Software Development with PathMATE and IBM Rational Systems Developer

Information Systems Analysis and Design CSC John Mylopoulos. Software Architectures Information Systems Analysis and Design CSC340

VDM vs. Programming Language Extensions or their Integration

1.1 The Nature of Software... Object-Oriented Software Engineering Practical Software Development using UML and Java. The Nature of Software...

Object-Oriented Systems Analysis and Design

Object Oriented Programming. Risk Management

Web Presentation Layer Architecture

SOA Testing Services. Enabling Business Agility and Digital Transformation

Benefits of Test Automation for Agile Testing

Runtime Verification - Monitor-oriented Programming - Monitor-based Runtime Reflection

Software Component Specification Using Design by Contract

Peter Mileff PhD SOFTWARE ENGINEERING. The Basics of Software Engineering. University of Miskolc Department of Information Technology

Karunya University Dept. of Information Technology

Independent Insight for Service Oriented Practice. An SOA Roadmap. John C. Butler Chief Architect. A CBDI Partner Company.

Model Driven Interoperability through Semantic Annotations using SoaML and ODM

Software Development Methodologies

Formal Software Testing. Terri Grenda, CSTE IV&V Testing Solutions, LLC

To introduce software process models To describe three generic process models and when they may be used

An Agile Formal Development Methodology

How to bridge the gap between business, IT and networks

Software Development Process Models and their Impacts on Requirements Engineering Organizational Requirements Engineering

Software Engineering. Software Development Process Models. Lecturer: Giuseppe Santucci

Software Engineering

Systems Integration: Co C mp m onent- t bas a e s d s o s ftw ft a w r a e r e ngin i eeri r n i g

Oracle Real Time Decisions

Information and Communications Technology Courses at a Glance

Chap 1. Introduction to Software Architecture

System Modeling / Class Diagra Diagr m a Week 6

Co-Presented by Mr. Bill Rinko-Gay and Dr. Constantin Stanca 9/28/2011

Java Programming (10155)

Generation and Handcoding

Division of Mathematical Sciences

Difference Between Model-Driven and Traditional Iterative Software Development

Case studies: Outline. Requirement Engineering. Case Study: Automated Banking System. UML and Case Studies ITNP090 - Object Oriented Software Design

Chapter 9 Software Evolution

Structure of Presentation. Stages in Teaching Formal Methods. Motivation (1) Motivation (2) The Scope of Formal Methods (1)

Software Testing. Definition: Testing is a process of executing a program with data, with the sole intention of finding errors in the program.

The consumer purchase journey and the marketing mix model

Professional Organization Checklist for the Computer Science Curriculum Updates. Association of Computing Machinery Computing Curricula 2008

Approach of Unit testing with the help of JUnit

CS4507 Advanced Software Engineering

Software Engineering/Courses Description Introduction to Software Engineering Credit Hours: 3 Prerequisite: (Computer Programming 2).

OVERVIEW OF THE PROJECT...

Applying 4+1 View Architecture with UML 2. White Paper

Becoming a Business Analyst

MDA and Analysis of Web Applications

Generating Enterprise Applications from Models

Real Time Embedded Software Development Using Agile Technology An Experience Report

SOFTWARE ENGINEERING PROGRAM

Challenges and Opportunities for formal specifications in Service Oriented Architectures

Engineering Process Software Qualities Software Architectural Design

Transcription:

Advanced Topics in model-based Software Development Prof. Dr. Bernhard Rumpe Technische Universität Braunschweig http://www.sse-tubs.de/

Seite 1 Trends in software development Size and complexity of systems continually increase: Isolated solutions company-wide integration E-Commerce Systems-Of-Systems World-Wide Cyber-Infrastructure New technologies: EJB, XML,.Net,... Diversification of application domains: Embedded systems, business systems, telecommunication, mobility, ad-hoc changing infrastructures Growing methodological experience how to deal with challenges Agile Methods, e.g, address unstable requirements, time-to-market pressure, lean and effective development for small projects Improved analytical techniques Portfolio of software development processes / techniques etc.

Seite 2 Very short overview of Extreme Programming Best Practices. Abandons many software development elements Activities (among others) Coding Incremental Coding standards Runs of all tests Refactoring Testing Tests developed together with the code Functional tests Customers develop business logic tests

Seite 3 Idealized View on Model Driven Architecture Requirement use cases and scenarios: sequence diagram describes users viewpoint application classes define data structures (PIM) T T T T T T T T state machines describe states and behavior class diagram Nr. 2 ( PSM ): adaptation, extension, technical design + behavior for technical classes code generation + integration with manually written code system complete and running system

Seite 4 Problems of Model Driven Architecture Requirement No reuse Tool chain too long No efficient tools Tracing problems Evolution is awkward T T T T T T T T Lot of information missing, e.g. - Design rationale - Non-functional reqs. Agile development is not possible SE-Models are not integrated with other Models (spatial, biological,...) system

Seite 5 Core elements of an agile modelling method Incremental modelling Modelling tests Automatic analysis: Types, dataflow, control flow,... Code generation for system and tests from compact models Small increments Intensive simulation with customer participation for feedback Refactoring for incremental extension and optimisation Common ownership of models... This approach uses elements of agile methods based on the UML notation

Seite 6 Model-based programming Two kinds of models are used for the system and the executable tests object deployment diagram class diagrams statecharts C++, Java OCL diagrams : : : sequence diagrams consistency analyser parameterized code generator test code generator smells & errors system tests siehe: B. Rumpe: Agile Modellierung mit UML, Springer Verlag 2004

Seite 7 How the approach supports agile development Core characteristics of agility: Efficiency of the developers Reactivity: flexibility to deal with changes Customer focus Rely on individuals Simplicity Quality is an emerging property Improvement through use of UML: + increased through advanced notation & tools + incremental, small cycles + model-based refactoring + even more rapid feedback + less tedious work? skilled people are necessary + refactoring increases extensibility + automated tests + better review-able designs + common ownership & pairwise development of models

Seite 8 Agile Model-Based Testing

Seite 9 Typical infrastructure of an automated test Principle: use relatively complete object diagram (OD) for test data partial OD and OCL as oracle sequence diagram (SD) or Java as test driver test data test driver expected result and/or OCL-contract as test oracle o1 o3 o2 o4 OD objects under test SD or Java o5 o1 o3 o2 o4 + OD OCL

Seite 10 Sequence diagram: test driver and interaction description linear structure of an exemplaric system run + OCL for property description copper912: Auction «trigger» handlebid(bid) validatebid(bid) bidpol: BiddingPolicy timepol: TimingPolicy SD test driver return OK newcurrentclosingtime(copper912, bid) return t OCL constraints describe properties during the test run t.time == bid.time + extensiontime

Seite 11 Test pattern Systems need to be testable Example: Side effects like file protocol must be captured Protocol void setlogfile (String filename) void writetolog (String text) method with side effects logs its text in a file ProtocolDummy String loglastline = int logcount = 0 void writetolog (String text) redefined method stores arguments in attribute: no side effects and results can be checked Test pattern describe typical processes & structures for test definition

Seite 12 Test pattern for standard problems side effects (DB, GUI) capsule with adapter & dummies static attributes capsule with singleton object object creation factory frameworks separation of application and framework through adapter time simulation through controllable clock concurrency simulation through explicit scheduling distribution simulation in one process space

Seite 13 Testing of embedded software through simulation

Seite 14 Simulation for autonomic driving Caroline, an autonomously driving car in the DARPA Urban Challenge 2007 Testing the intelligence The context is: a street map pedestrians other cars driving... Use of SE-models (e.g. state machines) and other kinds of models (e.g. maps) to feed the simulation engine Simulation as technology to early capture problems and validate (as well understand) requirements.

Seite 15 Simulation Runs virtual journeys in complex traffic situations automatic regression tests ID = 22 v = 4m/s loc = (23.4; -12.2) Schematic drawing showing Caroline approaching an intersection.

Seite 16 Simulation Runs virtual journeys in complex traffic situations automatic regression tests, various scenarios

Seite 17 Model-based simulation for SE Test-Infrastructure needs simulation of its context: context can be: geographical, sociological, etc. Simulation helps to understand complexity deployment diagram class diagrams statecharts Further DSLs C++, Java OCL object diagrams Further : : DSLs : sequence diagrams system tests

Seite 18 Model-Based Evolution / Refactoring

Seite 19 Software Evolution Software evolution is the key problem in software development. Oscar Nierstrasz Requirements change Platforms and system contexts evolve Bugs needs to be fixed Time and space optimisations are desired Existing software needs to be evolved Code as well as models need to be adapted to keep them consistent

Seite 20 Refactoring as a special form of transformation Refactoring is a technique to improve internal structure / architecture of a system, while preserving observable behaviour Refactoring rules: series of systematically applicable, goal directed steps Powerful through simplicity of piecewise application and flexibility of combination of systematic steps Roots: Opdyke/Johnson 1992 had 23 refactorings on C++ Fowler 1999 has 72 refactoring rules for Java

Seite 21 Refactoring example 1 Person CD Person CD Bidder Guest Refactoring checkpasswd() long ident checkpasswd() checkpasswd() long ident Bidder Guest Pull Up Attribute ident into superclass: structural generalization Factor Method checkpasswd() and adapt it Preservation of observable behaviour? depends on viewpoint: class, component, system

Seite 22 Principle of refactoring Refactoring is orthogonal to adding functionality An idealised diagram: functionality 100% target: 100% of the functionality, acceptable design programming refactoring 100% quality of design

Seite 23 Example: moving an attribute Attribute att shall be moved from class A to B A att B CD // code a.att Code a.exp is the navigation path from A to B {frozen} A /connection 1 1 att B CD context A a inv: OCL a.connection == a.exp; context A a1, A a2 inv: a1!= a2 implies a1.connection!= a2.connection A att B CD // Code a.exp.att Code

Seite 24 Refactoring example: changing data structures A series of steps to apply: 1. Identify old data structure: here: long to be replaced by Money Auction long currentbidincent 2. Add new datastructure + queries + compile Auction long currentbidincent Money bestbid 3. Identify invariants to relate both context Auction inv M: currentbidincent == bestbid.valueincent() 4. Add code for new data structure & invariants wherever old data structure is changed + compile & run tests currentbidincent =... bestbid.setvalue... assert M 5. Modify places where old data structure was used + compile & run tests =... currentbidincent... =... bestbid.valueincent()... 6. Simplify + compile & run tests 7. Remove old data structure + compile & run tests Auction Money bestbid

Seite 25 Test as observation for refactoring Both structure and behaviour are observed by tests test = driver and observer setup & call observe creation observe interaction check property compare with expected result snapshots of the test run time axis

Seite 26 Validation of refactorings using tests Observation remains invariant under refactoring test: driver and observer Observation Refactoring Test result Ok. test: driver and observer Observation

Seite 27 Evolution as strategic refactoring Evolution in the small supports evolution in the large Evolution in the small: Transformation rules = small, manageable and systematic steps General goals of transformations: reasoning, deriving implementation oriented artefacts, building abstractions e.g. for reengineering, evolutionary improvement Transformation calculi can serve as technical basis for an evolutionary approach to software development

Seite 28 Examples for Transformational Development Mathematical calculi for reasoning State machine transformations for error completion, determinism, Stepwise refinement of programs (Bauer, Partsch) for software development Hoare calculus for reasoning over programs Refactoring (Opdyke, Fowler) for evolution.

Seite 29 Streams & Behaviors Communication histories over channels are modeled by streams: streams s = <1,2,a,3,b,b,...> Channel valuations assign streams to channel names: C = C M ℵ An I/O behavior relates input and output channel valuations: β : I P( O ) Composition of behaviors can be modeled graphically:

Seite 30 Kinds of Transformations Behavioral Refinement: A behavior β is a refinement of a behavior β Structural Refinement (Decomposition) x : β (x) β(x) Evolution of architecture (Refactoring)

Seite 31 Semantics of Transformations Blackbox behavior Transformation rules: Add or remove components Add or remove channels Refine component behavior Fold and unfold subsystems Refinement relation =, Blackbox behavior

Seite 32 Example: Communication System In Stub Data RDB Key Req Data (Consisting of key and value) is accepted via In and transmitted to the Remote Data Base (RDB) Upon sending a key, the requested value is sent Problem: Transmission from Stub to RDB shall be encrypted Solution: We evolve the part of the system, we are currently focusing on

Seite 33 Example: Communication System In Stub Data RDB Key Req Step 0: Decide what observed behavior will be that is not changed. Here, we group the observed channels into a component

Seite 34 Example: Communication System In Stub Data RDB Key Req ENC DEC Step 1: Add encryption and decryption components No connection to the rest of the system: Nothing bad can happen

Seite 35 Example: Communication System In Stub Data RDB Key ENC CData DEC Data Req Step 2: Define signature and behavior of new components (may be we reuse of the shelf components?) Still no connection to the rest of the system: Nothing bad can happen

Seite 36 Example: Communication System In Stub Data RDB Key ENC CData DEC Data Req Step 3: connect Input and output channels RDB now has an additional input channel, but doesn t use it yet Still nothing bad can happen

Seite 37 Example: Communication System In Stub Data RDB Key ENC CData DEC Data Req Step 4: establish invariant between channels: CData = encrypt* (Data) Data = Data (modulo time) RDB now can use Data instead of Data

Seite 38 Example: Communication System In Stub RDB Key ENC CData DEC Data Req Step 5: Remove unused channel Data

Seite 39 Example: Communication System In Stub RDB Key ENC CData DEC Data Req Step 6: Fold new parts into subcomponents

Seite 40 Conclusion: Constructive use of Models + Evolution deployment diagram class diagrams statecharts C++, Java object diagrams : : sequence diagrams OCL : consistency analyser parameterized code generator test code generator smells & errors system tests siehe: B. Rumpe: Agile Modellierung mit UML, Springer Verlag 2004

Seite 41 Conclusion Further diversification of SE techniques / tools / methods leads to a portfolio of SE techniques Intelligent use of models allows to improve development Methodical knowledge allows more efficient processes correctness by construction automated tests over documentation and reviews evolutionary development (refactoring) over big-upfront-design phase Model engineering

Seite 42 Attachment

Seite 43 State machines A state machine is a tupel A=(S,M,δ,I) consisting of: set of states S, set of input and output messages M, state transition relation δ: (S M) 2 (S M*) and set I S M * of initial states and outputs Nondeterminism = underspecification Partiality = total underspecification (chaos)

Seite 44 State machines A state machine is a tupel A=(S,M,δ,I) consisting of: set of states S, set of input and output messages M, state transition relation δ: (S M) 2 (S M*) and set I S M * of initial states and outputs Nondeterminism = underspecification Partiality = total underspecification (chaos)

Seite 45 Semantics of a state machine One transition contains one input message and a sequence of output messages Semantics is a relationship between input and output streams M : (S,M,δ,I) 2 (M* M*) Behavioral refinement between automata: A 1 A 2 iff M[A 1 ] M[A 2 ] Refinement rules can be used to constrain (detail) behavior description inherit state machines implementation of an interface

Seite 46 Example transformation rule Remove a transition: if there is an alternative A A foo foo foo B C B C If preconditions are present, the remaining transition must overlap the removed transition. This must be proven.

Seite 47 Example transformation rule 2 Split a state A A foo foo foo B B1 B2 Multiplies transitions useful to remove unwanted transitions

Seite 48 Example: Statemachine for class Figure /draw deselect/ NotSel select/render Sel 1. Intro. state Sel(ected) 2. Intro. state NotSel(ected) 3. Define init states 4. Constrain method select in state NotSel /draw&render deselect/error deselect/unrender 5. deselect in state Sel 6. introduce error state 7. error completion using underspecification Error deselect/ select/

Seite 49 Example: Statemachine for class Figure /draw deselect/ NotSel select/render Sel 1. Intro. state Sel(ected) 2. Intro. state NotSel(ected) 3. Define init states 4. Constrain method select in state NotSel /draw&render deselect/error deselect/unrender Error deselect/ select/ 5. deselect in state Sel 6. introduce error state 7. error completion using underspecification 8. specialize deselect: remove transition 9. remove error state 10. specialize initial states

Seite 50 Example: Statemachine for class Figure deselect/ NotSel select/render Sel 1. Intro. state Sel(ected) 2. Intro. state NotSel(ected) 3. Define init states 4. Constrain method select in state NotSel /draw&render deselect/unrender Each step is a refinement of the observable behavior of that class 5. deselect in state Sel 6. introduce error state 7. error completion using underspecification 8. specialize deselect: remove transition 9. remove error state 10. specialize initial states