Architectures: Design Patterns for Component-Based Systems

0 downloads 0 Views 1MB Size Report
Sep 5, 2014 - for Component-Based Systems. Short talk ... Reusable design patterns. • Systems are ... Coordination. • Data transfer. 6. A b1 r1 p1 f1 f b. C p3 f3 r3 b3. B f2 b2 ... 17. Architectures in BIP. 8. A = (c,PA,γ) b1 f1 b2 f2 free taken b12 f12 b12 f12 .... (Embedded systems, web services, enterprise integration, etc.).
Architectures: Design Patterns for Component-Based Systems Short talk @ TGC, 5th of September, 2014 Simon Bliudze
 École polytechnique fédérale de Lausanne Joint work with: Paul Attie, Eduard Baranov, Marius Bozga, Mohamad Jaber and Joseph Sifakis

Reusable design patterns •

Systems are not built from scratch



Maximal re-use of building blocks 
 (off-the-shelf components)



Maximal re-use of solutions
 (libraries, design patterns, etc.)



Express coordination constraints in declarative manner

S.Bliudze @ TGC, Rome, 5th of September, 2014

2 / 17

Applications •

Concurrency:
 (a)synchronous, time-triggered, token-ring, 
 mutual exclusion



Protocols:
 communication protocols, data access control, encryption, authentication



Robustness:
 fault detection & recovery, resource management



etc.

S.Bliudze @ TGC, Rome, 5th of September, 2014

3 / 17

Theory of architectures •

How to model?



How to specify?



How to combine?



How to implement efficiently?

Architectures enforce characteristic properties. The crucial question is whether these are preserved by composition? S.Bliudze @ TGC, Rome, 5th of September, 2014

4 / 17

How to model?

Component-based design Component design by refinement Component design by refinement Component design by refinement Component design by refinement



Three Threelayers: layers:

Three layers: Three layers: Three layers 1 Component

Component Component 1 Component behaviour • Component behaviour behaviour behaviour behaviour Coordination 2 2Coordination 2 Coordination • Coordination 2 Coordination Data transfer 3 33Data transfer Data transfer 3 Data transfer 1 1



Data transfer

A.x = max (B.y, C.z)

f f11 f1 A p A Ap11 p 1 b1 rr1 b1 b1 1 r1

p p33 p3ff33 f3 b b33 b3 C C C r r33 r3

b b22 b2

B B B

f f22 f2

SC 2011 — S. Bliudze, J. Sifakis, “Synthesizing Glue Operators...” — Z¨ urich, June 30th , 2011 — 9 / 29 th 2011 SC 2011 — S. Bliudze, J. Sifakis, “Synthesizing Glue Operators...” — Z¨ uJune rich, 30 June th , 30 SC 2011 — S. Bliudze, J. Sifakis, “Synthesizing Glue Operators...” — Z¨ urich, 2011, — 9 /—299 / 29

SC 2011 — S. Bliudze, J. Sifakis, “Synthesizing Glue Operators...” — Z¨ urich, June 30th , 2011 — 8 / 29

S.Bliudze @ TGC, Rome, 5th of September, 2014

6 / 17

Example in BIP

b1

f1

b2

sleep

f1

f2 sleep

b1 work

S.Bliudze @ TGC, Rome, 5th of September, 2014

f2

b2 work

7 / 17

Example in BIP

b1

f1

b12

sleep

f1

f12

b2 sleep

free

b1 work

S.Bliudze @ TGC, Rome, 5th of September, 2014

f12

b12 taken

f2

f2

b2 work

7 / 17

Example in BIP

b1

f1

b12

sleep

f1

f12

b2 sleep

free

b1 work

S.Bliudze @ TGC, Rome, 5th of September, 2014

f12

b12 taken

f2

f2

b2 work

7 / 17

Example in BIP

b1

f1

b12

f12

b2

f2

free

f12

b12 taken

S.Bliudze @ TGC, Rome, 5th of September, 2014

7 / 17

Example in BIP

b1

f1

b12

f12

b2

f2

free

f12

b12 taken

12

= {;, b1 b12 , b2 b12 , f1 f12 , f2 f12 }

S.Bliudze @ TGC, Rome, 5th of September, 2014

7 / 17

Architectures in BIP A = (C, PA , ) Set of coordinating behaviours

Interaction model Interface (ports)

The interface includes all ports
 of the coordinator components [ PC ✓ PA C2C

S.Bliudze @ TGC, Rome, 5th of September, 2014

b1

f1

b12

f12

b2

f2

free

f12

b12 taken

8 / 17

How to combine?

Constraints intuition

S.Bliudze @ TGC, Rome, 5th of September, 2014

10 / 17

Constraints intuition

Bad 1

S.Bliudze @ TGC, Rome, 5th of September, 2014

10 / 17

Constraints intuition

Bad 1

S.Bliudze @ TGC, Rome, 5th of September, 2014

10 / 17

Constraints intuition

Bad 1 Bad 2

S.Bliudze @ TGC, Rome, 5th of September, 2014

10 / 17

Constraints intuition

Bad 1 Bad 2

S.Bliudze @ TGC, Rome, 5th of September, 2014

10 / 17

Constraints intuition

Good

Bad 1 Bad 2

S.Bliudze @ TGC, Rome, 5th of September, 2014

10 / 17

Limits of white magic

S.Bliudze @ TGC, Rome, 5th of September, 2014

11 / 17

Limits of white magic

1 d Ba

S.Bliudze @ TGC, Rome, 5th of September, 2014

11 / 17

Limits of white magic

1 d Ba

S.Bliudze @ TGC, Rome, 5th of September, 2014

11 / 17

Limits of white magic

1 d Ba

S.Bliudze @ TGC, Rome, 5th of September, 2014

Bad

2

11 / 17

Limits of white magic

1 d Ba

S.Bliudze @ TGC, Rome, 5th of September, 2014

Bad

2

11 / 17

Limits of white magic

1 d Ba

S.Bliudze @ TGC, Rome, 5th of September, 2014

Bad

2

11 / 17

How to implement efficiently?

a a

c

b

c b

d

d

Architecture-based External: component behaviour is not modified

S.Bliudze @ TGC, Rome, 5th of September, 2014

13 / 17

Task 1:!

Task 2:!

while (true) {
 free(S1); take(S2); do-a; free(S1); take(S2); do-b; }

while (true) { take(S1); free(S2); do-c; take(S1); free(S2); do-d; }

Architecture-agnostic Internal: the coordination primitives mix-up with the functional behaviour of the components S.Bliudze @ TGC, Rome, 5th of September, 2014

14 / 17

Two sides of the same design



Architecture-based



Architecture-agnostic



External



Internal



Declarative



Imperative



Highly abstract



Detailed



Relies on an execution engine



Relies on low-level primitives



Easy to understand, analyse and manipulate



Efficient

S.Bliudze @ TGC, Rome, 5th of September, 2014

15 / 17

Two sides of the same design



Architecture-based



Architecture-agnostic



External



Internal



Declarative



Imperative



Highly abstract



Relies on an execution engine



Relies on low-level primitives



Easy to understand, analyse and manipulate



Efficient

Detailed Internalisation

S.Bliudze @ TGC, Rome, 5th of September, 2014



15 / 17

Conclusion •

Architectures solve coordination problems by enforcing characteristic properties.



First steps toward the study of a rigorous concept of architecture and its effective use for achieving correctness by construction in a system design flow. •

A notion of architecture in BIP



Safety-preserving architecture composition operator •



[SEFM 2014] A General Framework for Architecture Composability

Architecture internalisation using Top/Bottom component model •

[CBSE 2014] Architecture internalisation in BIP

S.Bliudze @ TGC, Rome, 5th of September, 2014

16 / 17

Future work •



Modelling •

Study and classification of real-life architectures in various domains
 (Embedded systems, web services, enterprise integration, etc.)



Versatility of the model



Dynamic architectures

Specification •



Development of a simple powerful language for specifying architectures and their characteristic properties

Efficiency & distribution •

Optimisation of internalised architectures



Implementation based on message-passing mechanisms (e.g. AKKA)

S.Bliudze @ TGC, Rome, 5th of September, 2014

17 / 17

Thank you for your attention