Describing Softw are Com ponents w ith Param etric Contracts Ralf - - PowerPoint PPT Presentation

describing softw are com ponents w ith param etric
SMART_READER_LITE
LIVE PREVIEW

Describing Softw are Com ponents w ith Param etric Contracts Ralf - - PowerPoint PPT Presentation

Universitt Karlsruhe (TH) Research University founded 1825 Describing Softw are Com ponents w ith Param etric Contracts Ralf Reussner (reussner@ipd.uka.de) Chair Software Design and Quality Institute for Program Structures and Data


slide-1
SLIDE 1

Ralf Reussner (reussner@ipd.uka.de) Chair Software Design and Quality Institute for Program Structures and Data Organization (IPD) Fakultät für Informatik, Universität Karlsruhe (TH), Karlsruhe Institute of Technology

Universität Karlsruhe (TH)

Research University • founded 1825

Describing Softw are Com ponents w ith Param etric Contracts

slide-2
SLIDE 2

Ralf Reussner, FLACOS, Oslo 2 0 0 7 1 4 / 1 0 / 2 0 0 7 2

Param etric Com ponent Properties

▪ Design-by-Contract for Software-Components ▪ Specification of the relation between provides and requires-interface(s) (and the usage profile and execution environment)

a: c b

Parametric Contract

b c a 10ms 5ms 28ms 20ms 33ms ?

Ingenieurdisziplin – Vorgehen – Komponenten – Modelle - Ausblick

slide-3
SLIDE 3

Ralf Reussner, FLACOS, Oslo 2 0 0 7 1 4 / 1 0 / 2 0 0 7 3

Overview

▪ Contracts and Parametric Contracts ▪ Protocol Adaptation with Parametric Contracts ▪ Prediction of Non-Functional Properties with Parametric Contracts

– Reliability – Performance

▪ Conclusions

slide-4
SLIDE 4

Ralf Reussner, FLACOS, Oslo 2 0 0 7 1 4 / 1 0 / 2 0 0 7 4

W hat is a com ponent?

▪ “A component is a contractually specified building unit of software which can be readily composed or deployed.”

– “readily composed or deployed”:

  • without having to understand the interna as a human
  • these are the two main things to be done with

components

– not necessarily “black-box”: Information on interna can be available to tools.

▪ “Components are for composition, much beyond is unclear…” (Clemens Szyperski)

Contracts – Protocols - Quality - Conclusions

slide-5
SLIDE 5

Ralf Reussner, FLACOS, Oslo 2 0 0 7 1 4 / 1 0 / 2 0 0 7 5

Different Abstraction of Com ponents

CT Type IID Implementation Instance Description DID Deployment Instance Description RID Runtime Instance Description

1 * 1 * Not considered within the Palladio ComponentModel 1 *

QoS (i, es, up, d) FP (es) QoS (es, up, d) FP (es) QoS (up) FP ()

i: implementation es: external services up: usage profile d: deployment «implements» «deploys»

Implementation Type Deployment Runtime

Contracts – Protocols - Quality - Conclusions

slide-6
SLIDE 6

Ralf Reussner, FLACOS, Oslo 2 0 0 7 1 4 / 1 0 / 2 0 0 7 6

Contractual Use of Methods

▪ Design-by-contract (B. Meyer, 1992)

“Supplier guarantees post-condition if pre-condition is fulfilled by client.” [Bertrand Meyer, Object Oriented Software Construction, Prentice-Hall, 1997 2nd ed.]

CustomerRecord getCustomerRecord (String ID) Post-condition Pre-condition

Contracts – Protocols - Quality - Conclusions

slide-7
SLIDE 7

Ralf Reussner, FLACOS, Oslo 2 0 0 7 1 4 / 1 0 / 2 0 0 7 7

Design-by-Contract ( Bertrand Meyer, 1 9 9 2 )

From Precondition: Handle queries only if database is attached. Satisfy postcondition: Get right customer

  • r return null.

Supplier

From postcondition: Get customer returned

  • r null

Satisfy precondition: (attached database)

Client Benefits Obligations

Contracts – Protocols - Quality - Conclusions

slide-8
SLIDE 8

Ralf Reussner, FLACOS, Oslo 2 0 0 7 1 4 / 1 0 / 2 0 0 7 8

Benefits of Contracts

▪ Developing less error-prone software through:

– Better documentation – Reduced error-handling code – Clear responsibilities – Results of run-time checking as a debugging aid

Contracts – Protocols - Quality - Conclusions

slide-9
SLIDE 9

Ralf Reussner, FLACOS, Oslo 2 0 0 7 1 4 / 1 0 / 2 0 0 7 9

Contractual Use of Com ponents

Component’ Component

Provided Interface Required Interface Contracts – Protocols - Quality - Conclusions

slide-10
SLIDE 10

Ralf Reussner, FLACOS, Oslo 2 0 0 7 1 4 / 1 0 / 2 0 0 7 1 0

Use of Com ponents

There are two different times of component usage:

  • 1. At system run-time (== component run-

time): call of component services

  • 2. At system design-time or system

configuration time: plugging in of components

Contracts – Protocols - Quality - Conclusions

slide-11
SLIDE 11

Ralf Reussner, FLACOS, Oslo 2 0 0 7 1 4 / 1 0 / 2 0 0 7 1 1

Contractual Use of Com ponents

▪ Design-by-contract (B. Meyer, 1992)

– “Supplier guarantees post-condition if pre- condition is fulfilled by client.”

▪ Contractual Use of Components

– (at system design- / configuration-time) – “Component guarantees provided services (as described in the provides-interface) if the environment offers all required services (as described in the requires-interface).”

Contracts – Protocols - Quality - Conclusions

slide-12
SLIDE 12

Ralf Reussner, FLACOS, Oslo 2 0 0 7 1 4 / 1 0 / 2 0 0 7 1 2

Contractual Use of Com ponents

▪ Pre-condition

– Required services – Information concerning required services (sequences, QoS)

▪ Post-condition

– Offered services – Information concerning offered services (sequences, QoS)

▪ Invariant

– Relation between provided and required services (as this is independent from the usage context)

Contracts – Protocols - Quality - Conclusions

slide-13
SLIDE 13

Ralf Reussner, FLACOS, Oslo 2 0 0 7 1 4 / 1 0 / 2 0 0 7 1 3

Contractual use of Com ponents

▪ Design-by-contract (B. Meyer, 1992)

“ The service supplier guarantees the post-condition, if the client guarantees the precondition of the service.”

▪ Contractual Use of Components

(at system-(re-) configuration time)

“The component offers the provided services (as specified in the provides interfaces), if the environment guarantees the required services (as specified in the requires interfaces).”

{Pre} {Post}

...

... ... {Pre} {Post} {Pre} {Post}

Contracts – Protocols - Quality - Conclusions

slide-14
SLIDE 14

Ralf Reussner, FLACOS, Oslo 2 0 0 7 1 4 / 1 0 / 2 0 0 7 1 4

Contractual Use of Com ponents

▪ Contractual use corresponds to interoperability checks: RC ⊆ PC´ ▪ Static checks of practical relevance

Component’ Component

Provided Interface Required Interface Contracts – Protocols - Quality - Conclusions

slide-15
SLIDE 15

Ralf Reussner, FLACOS, Oslo 2 0 0 7 1 4 / 1 0 / 2 0 0 7 1 5

Consequences ( 1 )

▪ Interoperability checks during design- or reconfiguration time are possible by checking the pre-condition against the post-condition of the environment

Contracts – Protocols - Quality - Conclusions

slide-16
SLIDE 16

Ralf Reussner, FLACOS, Oslo 2 0 0 7 1 4 / 1 0 / 2 0 0 7 1 6

Problem : Three external I nfluences on Quality ( Perform ance / Reliability)

Usage Model Execution Evnironment External Services Performance / Reliability?

… if (a>b) c = a; …

Contracts – Protocols - Quality - Conclusions

slide-17
SLIDE 17

Ralf Reussner, FLACOS, Oslo 2 0 0 7 1 4 / 1 0 / 2 0 0 7 1 7

Consequences ( 2 )

▪ But:

– Fixed pre- and post-condition hinder adaptation – Pre- and post-condition are hard to fix at design-time – In particular, if non-functional properties are to be specified in interfaces.

Com ponents and their contracts need to be adapted to context at deploym ent, w hich is after developm ent!

Contracts – Protocols - Quality - Conclusions

slide-18
SLIDE 18

Ralf Reussner, FLACOS, Oslo 2 0 0 7 1 4 / 1 0 / 2 0 0 7 1 8

Need for Param etric Contracts

▪ One single pair of pre- and postcondition insufficient:

– restriction of reuse – need for transparent component adaptation – QoS-properties depend on component context and are not fixed.

Contracts – Protocols - Quality - Conclusions

slide-19
SLIDE 19

Ralf Reussner, FLACOS, Oslo 2 0 0 7 1 4 / 1 0 / 2 0 0 7 1 9

Param etric Contracts for Com ponents

Parametric Contract

Contracts – Protocols - Quality - Conclusions

slide-20
SLIDE 20

Ralf Reussner, FLACOS, Oslo 2 0 0 7 1 4 / 1 0 / 2 0 0 7 2 0

Param etric Contracts

▪ Link provides- and requires interface of the same component by bijective function p: {P} → {R} ▪ Pre-condition computed out of post- condition (and vice versa) ▪ Mechanism of automatic component adaptation (besides adaptor generation)

Contracts – Protocols - Quality - Conclusions

slide-21
SLIDE 21

Ralf Reussner, FLACOS, Oslo 2 0 0 7 1 4 / 1 0 / 2 0 0 7 2 1

Param etric Contracts for Com ponents

▪ Computation of environment-dependent provides-interface ▪ Computation of use-dependent requires- interface (‘wp-calculus’) ▪ Fine-grain adaptation of large-grain components

Contracts – Protocols - Quality - Conclusions

slide-22
SLIDE 22

Ralf Reussner, FLACOS, Oslo 2 0 0 7 1 4 / 1 0 / 2 0 0 7 2 2

Com putation of Param etric Contracts

▪ Computation of context-dependent provides-interface:

  • 1. (RA= pA(PA))
  • 2. RA’:= RA ∩ PB
  • 3. PA’= pA
  • 1(RA’)

▪ Computation of context-dependent requires-interface: 1.PB’:= RA ∩ PB 2.RB’= pB(PB’)

RA PB RB PA A pA B

pB Contracts – Protocols - Quality - Conclusions

slide-23
SLIDE 23

Ralf Reussner, FLACOS, Oslo 2 0 0 7 1 4 / 1 0 / 2 0 0 7 2 3

Param etric Contracts

▪ Lifting the Design-by-Contract Principle to Software Components ▪ Linking the provided and required services

  • f the same component

a: c b

Parametric Contract

b c a 10ms 5ms 28ms 20ms 33ms ?

Contracts – Protocols - Quality - Conclusions

slide-24
SLIDE 24

Ralf Reussner, FLACOS, Oslo 2 0 0 7 1 4 / 1 0 / 2 0 0 7 2 4

Hierarchie of I nterface Models

Signature-Lists Protocols Quality of Service ...

Contracts – Protocols - Quality - Conclusions

slide-25
SLIDE 25

Ralf Reussner, FLACOS, Oslo 2 0 0 7 1 4 / 1 0 / 2 0 0 7 2 5

P R Component

Param etric Contracts for Signature-list based I nterfaces Service Effect Specification: List of required services for each provided service

provides-interface { void foo (); int bar (); … } void foo () requires externalMethod1 externalMethod2 … { … } Provides-Interface Service-Effect-Specifications Contracts – Protocols - Quality - Conclusions

slide-26
SLIDE 26

Ralf Reussner, FLACOS, Oslo 2 0 0 7 1 4 / 1 0 / 2 0 0 7 2 6

Param etric Contracts for Signature-list based I nterfaces

Provides-Interface Requires-Interface + Service-Effect-Specification = = Service-Effect-Specification +

A method n is then and only then required, if there exists (at least) one method m with n ∈ se(m). A method n is then and only then provided, if all its required methods se(n) are available.

Contracts – Protocols - Quality - Conclusions

slide-27
SLIDE 27

Ralf Reussner, FLACOS, Oslo 2 0 0 7 1 4 / 1 0 / 2 0 0 7 2 7

Param etric Contracts for Protocol-m odeling I nterfaces Service Effect Specification: List of required call sequences

  • f services for

each provided service

provides-interface { void foo (); int bar (); … } Provides-Interface Service-Effect-Specifications

external- Method1

foo bar

external- Method2 external- Method3

P R Component

Contracts – Protocols - Quality - Conclusions

slide-28
SLIDE 28

Ralf Reussner, FLACOS, Oslo 2 0 0 7 1 4 / 1 0 / 2 0 0 7 2 8

Protocol-Adaptation w ith Param etric Contracts

foo bar foo_start external_method3 external_method1 return return bar_ start external_method3

Provides protocol Requires protocol

return external_method2

Contracts – Protocols - Quality - Conclusions

slide-29
SLIDE 29

Ralf Reussner, FLACOS, Oslo 2 0 0 7 1 4 / 1 0 / 2 0 0 7 2 9

Param etric Contracts for Protocol-m odelling I nterfaces

Provides-Interface Requires-Interface + Service-Effect-Specification = = Service-Effect-Specification +

A call sequence s is then and only then required, if there exists (at least) one method m with s ∈ se(m). A method n is then and only then provided, if all its required call sequences se(n) are available.

Contracts – Protocols - Quality - Conclusions

slide-30
SLIDE 30

Ralf Reussner, FLACOS, Oslo 2 0 0 7 1 4 / 1 0 / 2 0 0 7 3 0 1 4 .1 0 .2 0 0 7 3 0

Service Effect Specification

<<BasicComponent>> Component1 <<VariableUsage>> Z.BYTESIZE = 2000 <<Interface>> interface1 service1(X : Integer, Y : Collection) : Collection <<provides>>

Contracts – Protocols - Quality - Conclusions

slide-31
SLIDE 31

Ralf Reussner, FLACOS, Oslo 2 0 0 7 1 4 / 1 0 / 2 0 0 7 3 1 1 4 .1 0 .2 0 0 7 3 1

<<BasicComponent>> Component1 <<VariableUsage>> Z.BYTESIZE = 2000 <<Interface>> interface1 service1(X : Integer, Y : Collection) : Collection <<provides>>

Service Effect Specification

public void handle(ExternalCallAction call) { Signature serviceToBeCalled = call.getCalledService_ExternalService(); Interface requiredInterface = (Interface) serviceToBeCalled .eContainer(); EList<VariableUsage> parametricParameterUsages = call.getParameterUsage_ExternalCallAction(); AssemblyConnector foundAssemblyConnector = findAssemblyConnector(requiredInterface); if (foundAssemblyConnector == null) { logger.info("Found System External Call"); String timeSpecification = getTimeSpecification(serviceToBeCalled); createInternalAction(timeSpecification, call); } else { logger.info("Found Assembly Connector"); SeffVisitor nextVisitor = visitNextSeff(serviceToBeCalled, parametricParameterUsages, foundAssemblyConnector); storeOutputParametersToUsageContext(call, nextVisitor); } } private void createInternalAction(String timeSpecification, ExternalCallAction call) { ParametricResourceDemand demand = seffFactory.createParametricResourceDemand(); demand.setSpecification(timeSpecification); demand.setUnit(""); demand.setRequiredResource_ParametricResourceDemand(getProcessingResourceType()); InternalAction action = seffFactory.createInternalAction(); action.getResourceDemand_Action().add(demand); // Add new internal action into control flow after external action action.setSuccessor_AbstractAction(call.getSuccessor_AbstractAction()); action.setPredecessor_AbstractAction(call); ResourceDemandingBehaviour rdb = (ResourceDemandingBehaviour)call.eContainer(); rdb.getSteps_Behaviour().add(action); }

Contracts – Protocols - Quality - Conclusions

slide-32
SLIDE 32

Ralf Reussner, FLACOS, Oslo 2 0 0 7 1 4 / 1 0 / 2 0 0 7 3 2 1 4 .1 0 .2 0 0 7 3 2

Service Effect Specification

<<BasicComponent>> Component1 <<VariableUsage>> Z.BYTESIZE = 2000 <<Interface>> interface1 service1(X : Integer, Y : Collection) : Collection <<provides>>

<<InternalAction>> <<GuardedBranchTransition>> specification = „X.VALUE<0" <<GuardedBranchTransition>> specification = „X.VALUE>=0" <<ParametricResourceDemand>> specification = „Z.BYTESIZE * 10" <<ProcessingResource>> name = „CPU“ <<InternalAction>> <<ParametricResourceDemand>> specification = „Z.BYTESIZE * 2" <<ProcessingResource>> name = „CPU“ <<BranchAction>>

Contracts – Protocols - Quality - Conclusions

slide-33
SLIDE 33

Ralf Reussner, FLACOS, Oslo 2 0 0 7 1 4 / 1 0 / 2 0 0 7 3 3 1 4 .1 0 .2 0 0 7 3 3

Service Effect Specification

<<InternalAction>> <<GuardedBranchTransition>> specification = „X.VALUE<0" <<GuardedBranchTransition>> specification = „X.VALUE>=0" <<ParametricResourceDemand>> specification = „Z.BYTESIZE * 10" <<ProcessingResource>> name = „CPU“ <<InternalAction>> <<ParametricResourceDemand>> specification = „Z.BYTESIZE * 2" <<ProcessingResource>> name = „CPU“ <<CollectionIteratorAction>> <<ExternalCallAction>> <<VariableUsage>> extCallPar.VALUE = Y.INNER.VALUE <<BranchAction>> <<Parameter>> parameterName = „Y“

<<BasicComponent>> Component1 <<VariableUsage>> Z.BYTESIZE = 2000 <<Interface>> interface1 service1(X : Integer, Y : Collection) : Collection <<provides>>

Contracts – Protocols - Quality - Conclusions

slide-34
SLIDE 34

Ralf Reussner, FLACOS, Oslo 2 0 0 7 1 4 / 1 0 / 2 0 0 7 3 4 1 4 .1 0 .2 0 0 7 3 4

Service Effect Specification

<<InternalAction>> <<GuardedBranchTransition>> specification = „X.VALUE<0" <<GuardedBranchTransition>> specification = „X.VALUE>=0" <<ParametricResourceDemand>> specification = „Z.BYTESIZE * 10" <<ProcessingResource>> name = „CPU“ <<InternalAction>> <<ParametricResourceDemand>> specification = „Z.BYTESIZE * 2" <<ProcessingResource>> name = „CPU“ <<CollectionIteratorAction>> <<ExternalCallAction>> <<VariableUsage>> extCallPar.VALUE = Y.INNER.VALUE <<SetVariableAction>> <<VariableUsage>> service1.RETURN.NUMBER_OF_ELEMENTS = Y.NUMBER_OF_ELEMENTS / 3 <<BranchAction>> <<Parameter>> parameterName = „Y“

<<BasicComponent>> Component1 <<VariableUsage>> Z.BYTESIZE = 2000 <<Interface>> interface1 service1(X : Integer, Y : Collection) : Collection <<provides>>

Contracts – Protocols - Quality - Conclusions

slide-35
SLIDE 35

Ralf Reussner, FLACOS, Oslo 2 0 0 7 1 4 / 1 0 / 2 0 0 7 3 5 1 4 .1 0 .2 0 0 7 3 5

Service Effect Specification

<<InternalAction>> <<GuardedBranchTransition>> specification = „X.VALUE<0" <<GuardedBranchTransition>> specification = „X.VALUE>=0" <<ParametricResourceDemand>> specification = „Z.BYTESIZE * 10" <<ProcessingResource>> name = „CPU“ <<InternalAction>> <<ParametricResourceDemand>> specification = „Z.BYTESIZE * 2" <<ProcessingResource>> name = „CPU“ <<CollectionIteratorAction>> <<ExternalCallAction>> <<VariableUsage>> extCallPar.VALUE = Y.INNER.VALUE <<SetVariableAction>> <<VariableUsage>> service1.RETURN.NUMBER_OF_ELEMENTS = Y.NUMBER_OF_ELEMENTS / 3 <<BranchAction>> <<Parameter>> parameterName = „Y“

<<Interface>> interface1 service1(X : Integer, Y : Collection) : Collection

<<UsageContext>> P(X.VALUE = -5) = 0.8

Contracts – Protocols - Quality - Conclusions

slide-36
SLIDE 36

Ralf Reussner, FLACOS, Oslo 2 0 0 7 1 4 / 1 0 / 2 0 0 7 3 6 1 4 .1 0 .2 0 0 7 3 6

Service Effect Specification

<<InternalAction>> <<GuardedBranchTransition>> specification = 0.8 <<GuardedBranchTransition>> specification = „X.VALUE>=0" <<ParametricResourceDemand>> specification = „Z.BYTESIZE * 10" <<ProcessingResource>> name = „CPU“ <<InternalAction>> <<ParametricResourceDemand>> specification = „Z.BYTESIZE * 2" <<ProcessingResource>> name = „CPU“ <<CollectionIteratorAction>> <<ExternalCallAction>> <<VariableUsage>> extCallPar.VALUE = Y.INNER.VALUE <<SetVariableAction>> <<VariableUsage>> service1.RETURN.NUMBER_OF_ELEMENTS = Y.NUMBER_OF_ELEMENTS / 3 <<BranchAction>> <<Parameter>> parameterName = „Y“

<<Interface>> interface1 service1(X : Integer, Y : Collection) : Collection

<<UsageContext>> P(X.VALUE = -5) = 0.8

Contracts – Protocols - Quality - Conclusions

slide-37
SLIDE 37

Ralf Reussner, FLACOS, Oslo 2 0 0 7 1 4 / 1 0 / 2 0 0 7 3 7 1 4 .1 0 .2 0 0 7 3 7

Service Effect Specification

<<InternalAction>> <<GuardedBranchTransition>> specification = 0.8 <<GuardedBranchTransition>> specification = „X.VALUE>=0" <<ParametricResourceDemand>> specification = „Z.BYTESIZE * 10" <<ProcessingResource>> name = „CPU“ <<InternalAction>> <<ParametricResourceDemand>> specification = „Z.BYTESIZE * 2" <<ProcessingResource>> name = „CPU“ <<CollectionIteratorAction>> <<ExternalCallAction>> <<VariableUsage>> extCallPar.VALUE = Y.INNER.VALUE <<SetVariableAction>> <<VariableUsage>> service1.RETURN.NUMBER_OF_ELEMENTS = Y.NUMBER_OF_ELEMENTS / 3 <<BranchAction>> <<Parameter>> parameterName = „Y“

<<Interface>> interface1 service1(X : Integer, Y : Collection) : Collection

<<UsageContext>> P(X.VALUE = -5) = 0.8 P(X.VALUE = 7) = 0.2

Contracts – Protocols - Quality - Conclusions

slide-38
SLIDE 38

Ralf Reussner, FLACOS, Oslo 2 0 0 7 1 4 / 1 0 / 2 0 0 7 3 8 1 4 .1 0 .2 0 0 7 3 8

Service Effect Specification

<<InternalAction>> <<GuardedBranchTransition>> specification = 0.8 <<GuardedBranchTransition>> specification = 0.2 <<ParametricResourceDemand>> specification = „Z.BYTESIZE * 10" <<ProcessingResource>> name = „CPU“ <<InternalAction>> <<ParametricResourceDemand>> specification = „Z.BYTESIZE * 2" <<ProcessingResource>> name = „CPU“ <<CollectionIteratorAction>> <<ExternalCallAction>> <<VariableUsage>> extCallPar.VALUE = Y.INNER.VALUE <<SetVariableAction>> <<VariableUsage>> service1.RETURN.NUMBER_OF_ELEMENTS = Y.NUMBER_OF_ELEMENTS / 3 <<BranchAction>> <<Parameter>> parameterName = „Y“

Contracts – Protocols - Quality - Conclusions

slide-39
SLIDE 39

Ralf Reussner, FLACOS, Oslo 2 0 0 7 1 4 / 1 0 / 2 0 0 7 3 9 1 4 .1 0 .2 0 0 7 3 9

Service Effect Specification

<<InternalAction>> <<GuardedBranchTransition>> specification = 0.8 <<GuardedBranchTransition>> specification = 0.2 <<ParametricResourceDemand>> specification = „Z.BYTESIZE * 10" <<ProcessingResource>> name = „CPU“ <<InternalAction>> <<ParametricResourceDemand>> specification = „Z.BYTESIZE * 2" <<ProcessingResource>> name = „CPU“ <<CollectionIteratorAction>> <<ExternalCallAction>> <<VariableUsage>> extCallPar.VALUE = Y.INNER.VALUE <<SetVariableAction>> <<VariableUsage>> service1.RETURN.NUMBER_OF_ELEMENTS = Y.NUMBER_OF_ELEMENTS / 3 <<BranchAction>> <<Parameter>> parameterName = „Y“

Contracts – Protocols - Quality - Conclusions

slide-40
SLIDE 40

Ralf Reussner, FLACOS, Oslo 2 0 0 7 1 4 / 1 0 / 2 0 0 7 4 0 1 4 .1 0 .2 0 0 7 4 0

Service Effect Specification

<<InternalAction>> <<GuardedBranchTransition>> specification = 0.8 <<GuardedBranchTransition>> specification = 0.2 <<ParametricResourceDemand>> specification = 20000 <<ProcessingResource>> name = „CPU“ <<InternalAction>> <<ParametricResourceDemand>> specification = „Z.BYTESIZE * 2" <<ProcessingResource>> name = „CPU“ <<CollectionIteratorAction>> <<ExternalCallAction>> <<VariableUsage>> extCallPar.VALUE = Y.INNER.VALUE <<SetVariableAction>> <<VariableUsage>> service1.RETURN.NUMBER_OF_ELEMENTS = Y.NUMBER_OF_ELEMENTS / 3 <<BranchAction>> <<Parameter>> parameterName = „Y“

<<Interface>> interface1 service1(X : Integer, Y : Collection) : Collection

<<UsageContext>> P(X.VALUE = -5) = 0.8 P(X.VALUE = 7) = 0.2 P(Z.BYTESIZE = 2000) = 1.0

Contracts – Protocols - Quality - Conclusions

slide-41
SLIDE 41

Ralf Reussner, FLACOS, Oslo 2 0 0 7 1 4 / 1 0 / 2 0 0 7 4 1 1 4 .1 0 .2 0 0 7 4 1

Service Effect Specification

<<InternalAction>> <<GuardedBranchTransition>> specification = 0.8 <<GuardedBranchTransition>> specification = 0.2 <<ParametricResourceDemand>> specification = 20000 <<ProcessingResource>> name = „CPU“ <<InternalAction>> <<ParametricResourceDemand>> specification = 4000 <<ProcessingResource>> name = „CPU“ <<CollectionIteratorAction>> <<ExternalCallAction>> <<VariableUsage>> extCallPar.VALUE = Y.INNER.VALUE <<SetVariableAction>> <<VariableUsage>> service1.RETURN.NUMBER_OF_ELEMENTS = Y.NUMBER_OF_ELEMENTS / 3 <<BranchAction>> <<Parameter>> parameterName = „Y“

Contracts – Protocols - Quality - Conclusions

slide-42
SLIDE 42

Ralf Reussner, FLACOS, Oslo 2 0 0 7 1 4 / 1 0 / 2 0 0 7 4 2 1 4 .1 0 .2 0 0 7 4 2

Service Effect Specification

<<InternalAction>> <<GuardedBranchTransition>> specification = 0.8 <<GuardedBranchTransition>> specification = 0.2 <<ParametricResourceDemand>> specification = 20000 <<ProcessingResource>> name = „CPU“ <<InternalAction>> <<ParametricResourceDemand>> specification = 4000 <<ProcessingResource>> name = „CPU“ <<CollectionIteratorAction>> <<ExternalCallAction>> <<VariableUsage>> extCallPar.VALUE = Y.INNER.VALUE <<SetVariableAction>> <<VariableUsage>> service1.RETURN.NUMBER_OF_ELEMENTS = Y.NUMBER_OF_ELEMENTS / 3 <<BranchAction>> <<Parameter>> parameterName = „Y“

Contracts – Protocols - Quality - Conclusions

slide-43
SLIDE 43

Ralf Reussner, FLACOS, Oslo 2 0 0 7 1 4 / 1 0 / 2 0 0 7 4 3 1 4 .1 0 .2 0 0 7 4 3

Service Effect Specification

<<InternalAction>> <<GuardedBranchTransition>> specification = 0.8 <<GuardedBranchTransition>> specification = 0.2 <<ParametricResourceDemand>> specification = 20000 <<ProcessingResource>> name = „CPU“ <<InternalAction>> <<ParametricResourceDemand>> specification = 4000 <<ProcessingResource>> name = „CPU“ <<CollectionIteratorAction>> <<ExternalCallAction>> <<VariableUsage>> extCallPar.VALUE = „foo“ <<SetVariableAction>> <<VariableUsage>> service1.RETURN.NUMBER_OF_ELEMENTS = Y.NUMBER_OF_ELEMENTS / 3 <<BranchAction>> <<Parameter>> parameterName = „Y“

<<Interface>> interface1 service1(X : Integer, Y : Collection) : Collection

<<UsageContext>> P(X.VALUE = -5) = 0.8 P(X.VALUE = 7) = 0.2 P(Y.INNER.VALUE = „foo“) = 1.0 P(Z.BYTESIZE = 2000) = 1.0

Contracts – Protocols - Quality - Conclusions

slide-44
SLIDE 44

Ralf Reussner, FLACOS, Oslo 2 0 0 7 1 4 / 1 0 / 2 0 0 7 4 4 1 4 .1 0 .2 0 0 7 4 4

Service Effect Specification

<<InternalAction>> <<GuardedBranchTransition>> specification = 0.8 <<GuardedBranchTransition>> specification = 0.2 <<ParametricResourceDemand>> specification = 20000 <<ProcessingResource>> name = „CPU“ <<InternalAction>> <<ParametricResourceDemand>> specification = 4000 <<ProcessingResource>> name = „CPU“ <<CollectionIteratorAction>> <<ExternalCallAction>> <<VariableUsage>> extCallPar.VALUE = „foo“ <<SetVariableAction>> <<VariableUsage>> service1.RETURN.NUMBER_OF_ELEMENTS = Y.NUMBER_OF_ELEMENTS / 3 <<BranchAction>> <<Parameter>> parameterName = „Y“

Contracts – Protocols - Quality - Conclusions

slide-45
SLIDE 45

Ralf Reussner, FLACOS, Oslo 2 0 0 7 1 4 / 1 0 / 2 0 0 7 4 5 1 4 .1 0 .2 0 0 7 4 5

Service Effect Specification

<<InternalAction>> <<GuardedBranchTransition>> specification = 0.8 <<GuardedBranchTransition>> specification = 0.2 <<ParametricResourceDemand>> specification = 20000 <<ProcessingResource>> name = „CPU“ <<InternalAction>> <<ParametricResourceDemand>> specification = 4000 <<ProcessingResource>> name = „CPU“ <<CollectionIteratorAction>> <<ExternalCallAction>> <<VariableUsage>> extCallPar.VALUE = „foo“ <<SetVariableAction>> <<VariableUsage>> service1.RETURN.NUMBER_OF_ELEMENTS = INT_PMF[(10; 0.1)(20;0.9)] <<BranchAction>> <<Parameter>> parameterName = „Y“

<<Interface>> interface1 service1(X : Integer, Y : Collection) : Collection

<<UsageContext>> P(X.VALUE = -5) = 0.8 P(X.VALUE = 7) = 0.2 P(Y.NoE = 30) = 0.1 P(Y.NoE = 60) = 0.9 P(Y.INNER.VALUE = „foo“) = 1.0 P(Z.BYTESIZE = 2000) = 1.0

Contracts – Protocols - Quality - Conclusions

slide-46
SLIDE 46

Ralf Reussner, FLACOS, Oslo 2 0 0 7 1 4 / 1 0 / 2 0 0 7 4 6 1 4 .1 0 .2 0 0 7 4 6

Service Effect Specification

<<InternalAction>> <<GuardedBranchTransition>> specification = 0.8 <<GuardedBranchTransition>> specification = 0.2 <<ParametricResourceDemand>> specification = 20000 <<ProcessingResource>> name = „CPU“ <<InternalAction>> <<ParametricResourceDemand>> specification = 4000 <<ProcessingResource>> name = „CPU“ <<CollectionIteratorAction>> <<ExternalCallAction>> <<VariableUsage>> extCallPar.VALUE = „foo“ <<SetVariableAction>> <<VariableUsage>> service1.RETURN.NUMBER_OF_ELEMENTS = INT_PMF[(10; 0.1)(20;0.9)] <<BranchAction>> <<Parameter>> parameterName = „Y“

<<Interface>> interface1 service1(X : Integer, Y : Collection) : Collection

<<UsageContext>> P(X.VALUE = -5) = 0.8 P(X.VALUE = 7) = 0.2 P(Y.NoE = 30) = 0.1 P(Y.NoE = 60) = 0.9 P(Y.INNER.VALUE = „foo“) = 1.0 P(Z.BYTESIZE = 2000) = 1.0 <<UsageContext>> P(X.VALUE = -2) = 0.3 P(X.VALUE = 9) = 0.7 P(Y.NoE = 15) = 0.2 P(Y.NoE = 18) = 0.8 P(Y.INNER.VALUE = „bar“) = 1.0 P(Z.BYTESIZE = 300) = 1.0

Contracts – Protocols - Quality - Conclusions

slide-47
SLIDE 47

Ralf Reussner, FLACOS, Oslo 2 0 0 7 1 4 / 1 0 / 2 0 0 7 4 7 1 4 .1 0 .2 0 0 7 4 7

Service Effect Specification

<<InternalAction>> <<GuardedBranchTransition>> specification = 0.3 <<GuardedBranchTransition>> specification = 0.7 <<ParametricResourceDemand>> specification = 3000 <<ProcessingResource>> name = „CPU“ <<InternalAction>> <<ParametricResourceDemand>> specification = 600 <<ProcessingResource>> name = „CPU“ <<CollectionIteratorAction>> <<ExternalCallAction>> <<VariableUsage>> extCallPar.VALUE = „bar“ <<SetVariableAction>> <<VariableUsage>> service1.RETURN.NUMBER_OF_ELEMENTS = INT_PMF[(5; 0.2)(6;0.8)] <<BranchAction>> <<Parameter>> parameterName = „Y“

<<Interface>> interface1 service1(X : Integer, Y : Collection) : Collection

<<UsageContext>> P(X.VALUE = -5) = 0.8 P(X.VALUE = 7) = 0.2 P(Y.NoE = 30) = 0.1 P(Y.NoE = 60) = 0.9 P(Y.INNER.VALUE = „foo“) = 1.0 P(Z.BYTESIZE = 2000) = 1.0 <<UsageContext>> P(X.VALUE = -2) = 0.3 P(X.VALUE = 9) = 0.7 P(Y.NoE = 15) = 0.2 P(Y.NoE = 18) = 0.8 P(Y.INNER.VALUE = „bar“) = 1.0 P(Z.BYTESIZE = 300) = 1.0

Contracts – Protocols - Quality - Conclusions

slide-48
SLIDE 48

Ralf Reussner, FLACOS, Oslo 2 0 0 7 1 4 / 1 0 / 2 0 0 7 4 8 1 4 .1 0 .2 0 0 7 4 8

Palladio Com ponent Model

Contracts – Protocols - Quality - Conclusions

slide-49
SLIDE 49

Ralf Reussner, FLACOS, Oslo 2 0 0 7 1 4 / 1 0 / 2 0 0 7 4 9 1 4 .1 0 .2 0 0 7 4 9

Stochastic Regular Expression

Symbol Sequence Alternative Probability π, 1-π Loop Iterations (l)

Contracts – Protocols - Quality - Conclusions

slide-50
SLIDE 50

Ralf Reussner, FLACOS, Oslo 2 0 0 7 1 4 / 1 0 / 2 0 0 7 5 0 1 4 .1 0 .2 0 0 7 5 0

Transform ation

Contracts – Protocols - Quality - Conclusions

slide-51
SLIDE 51

Ralf Reussner, FLACOS, Oslo 2 0 0 7 1 4 / 1 0 / 2 0 0 7 5 1 1 4 .1 0 .2 0 0 7 5 1

Palladio Com ponent Model

Contracts – Protocols - Quality - Conclusions

slide-52
SLIDE 52

Ralf Reussner, FLACOS, Oslo 2 0 0 7 1 4 / 1 0 / 2 0 0 7 5 2 1 4 .1 0 .2 0 0 7 5 2

Model Solution

Contracts – Protocols - Quality - Conclusions

slide-53
SLIDE 53

Ralf Reussner, FLACOS, Oslo 2 0 0 7 1 4 / 1 0 / 2 0 0 7 5 3 1 4 .1 0 .2 0 0 7 5 3

Model Solution

[Trivedi1982/Firus2005] Contracts – Protocols - Quality - Conclusions

slide-54
SLIDE 54

Ralf Reussner, FLACOS, Oslo 2 0 0 7 1 4 / 1 0 / 2 0 0 7 5 4 1 4 .1 0 .2 0 0 7 5 4

Model Solution

[Trivedi1982/Firus2005] Contracts – Protocols - Quality - Conclusions

slide-55
SLIDE 55

Ralf Reussner, FLACOS, Oslo 2 0 0 7 1 4 / 1 0 / 2 0 0 7 5 5 1 4 .1 0 .2 0 0 7 5 5

Model Solution

[Koziolek2006a] Contracts – Protocols - Quality - Conclusions

slide-56
SLIDE 56

Ralf Reussner, FLACOS, Oslo 2 0 0 7 1 4 / 1 0 / 2 0 0 7 5 6 1 4 .1 0 .2 0 0 7 5 6

MediaStore - Architecture

Contracts – Protocols - Quality - Conclusions

slide-57
SLIDE 57

Ralf Reussner, FLACOS, Oslo 2 0 0 7 1 4 / 1 0 / 2 0 0 7 5 7 1 4 .1 0 .2 0 0 7 5 7

Dow nload - Use Case

Contracts – Protocols - Quality - Conclusions

slide-58
SLIDE 58

Ralf Reussner, FLACOS, Oslo 2 0 0 7 1 4 / 1 0 / 2 0 0 7 5 8 1 4 .1 0 .2 0 0 7 5 8

Case Study: Usage Profiles

Contracts – Protocols - Quality - Conclusions

slide-59
SLIDE 59

Ralf Reussner, FLACOS, Oslo 2 0 0 7 1 4 / 1 0 / 2 0 0 7 5 9 1 4 .1 0 .2 0 0 7 5 9

Results

Contracts – Protocols - Quality - Conclusions

slide-60
SLIDE 60

Ralf Reussner, FLACOS, Oslo 2 0 0 7 1 4 / 1 0 / 2 0 0 7 6 0 1 4 .1 0 .2 0 0 7 6 0

Results

Contracts – Protocols - Quality - Conclusions

slide-61
SLIDE 61

Ralf Reussner, FLACOS, Oslo 2 0 0 7 1 4 / 1 0 / 2 0 0 7 6 1

Model-based Prediction of Quality

Software Design Model Annotated Software Design Model Analysis Modell Analysis Results

UML, ADL, … UML Performance Profile, QML, … Queueing models Stochastic Petri-Nets, Stochastic Process Algebra, … Response time Throughput, Utilisation, … Estimation Measurement Transformation (MDD) Analyse / Simulation Results

Automated by Tools Executable Software

Transformation (MDD)

Contracts – Protocols - Quality - Conclusions

slide-62
SLIDE 62

Ralf Reussner, FLACOS, Oslo 2 0 0 7 1 4 / 1 0 / 2 0 0 7 6 2

Scientific Approach

Software Modell of Software (mit Annotationen) Measured Quality Predicted Quality Comparison Abstraction

Prediction Measurement

Interpretation Acceptance / rejection

  • f abstract model

Improvement / Extension

Engineering? – Components – Contracts – Protocols - Quality - Conclusions

slide-63
SLIDE 63

Ralf Reussner, FLACOS, Oslo 2 0 0 7 1 4 / 1 0 / 2 0 0 7 6 3

Sum m ary

▪ Contractual Use of Components

– Requires-interfaces as pre-conditions – Provides-interfaces as post-conditions – Enabling (static) interoperability checks

▪ Parametric Contracts

– Compute pre-condition in dependency of post- condition and vice versa – Prediction of properties in non-cyclic architectures by propagating interface information – Formal models of parametric contracts for predicting quality properties are created in a process oriented toward natural sciences.

Contracts – Protocols - Quality - Conclusions