Module Architecture Control using Relation Algebrarbril/education/2II10/MAC-2005.pdf · Module...

74
Reinder J. Bril, [email protected] TU/e Informatica, System Architecture and Networking 1 Module Architecture Control using Relation Algebra Dr.ir. Reinder J. Bril [email protected] , www.win.tue.nl/~rbril 31-08-2005

Transcript of Module Architecture Control using Relation Algebrarbril/education/2II10/MAC-2005.pdf · Module...

Page 1: Module Architecture Control using Relation Algebrarbril/education/2II10/MAC-2005.pdf · Module Architecture Control using Relation Algebra Dr.ir. Reinder J. Bril r.j.bril@tue.nl,

Reinder J. Bril, [email protected]/e Informatica, System Architecture and Networking

1

Module Architecture Controlusing Relation Algebra

Dr.ir. Reinder J. [email protected], www.win.tue.nl/~rbril

31-08-2005

Page 2: Module Architecture Control using Relation Algebrarbril/education/2II10/MAC-2005.pdf · Module Architecture Control using Relation Algebra Dr.ir. Reinder J. Bril r.j.bril@tue.nl,

Reinder J. Bril, [email protected]/e Informatica, System Architecture and Networking

2

Questions

• Development artefacts of a system?• How to maintain consistency:

– between these artefacts (inter)?– between elements of an artefact (intra)?

• This lecture:– consistency between architecture and

implementation• SAN:

– consistency of designs [Lange et al 05]– generalization [Muskens et al 05].

Page 3: Module Architecture Control using Relation Algebrarbril/education/2II10/MAC-2005.pdf · Module Architecture Control using Relation Algebra Dr.ir. Reinder J. Bril r.j.bril@tue.nl,

Reinder J. Bril, [email protected]/e Informatica, System Architecture and Networking

3

Goals

• Student understands:– the need for module architecture control;– how module architecture control can be

performed;– the basics of relation algebra.

• Student can apply relation algebra on a simple example.

Page 4: Module Architecture Control using Relation Algebrarbril/education/2II10/MAC-2005.pdf · Module Architecture Control using Relation Algebra Dr.ir. Reinder J. Bril r.j.bril@tue.nl,

Reinder J. Bril, [email protected]/e Informatica, System Architecture and Networking

4

Overview

• Context and motivation– Software architecture – recap– Application domain

• Module architecture notions• Relation algebra• Verification• Conclusion• References

Page 5: Module Architecture Control using Relation Algebrarbril/education/2II10/MAC-2005.pdf · Module Architecture Control using Relation Algebra Dr.ir. Reinder J. Bril r.j.bril@tue.nl,

Reinder J. Bril, [email protected]/e Informatica, System Architecture and Networking

5

Overview

• Context and motivation– Software architecture – recap– Application domain

• Module architecture notions• Relation algebra• Verification• Conclusion• References

Page 6: Module Architecture Control using Relation Algebrarbril/education/2II10/MAC-2005.pdf · Module Architecture Control using Relation Algebra Dr.ir. Reinder J. Bril r.j.bril@tue.nl,

Reinder J. Bril, [email protected]/e Informatica, System Architecture and Networking

6

Software architecture – recap• End-User:

behavior, performance, security, reliability

• Customers:low cost, timely delivery

• Product-Management:features, short time to market, low cost, parity with products

• Development:low cost, employability

• Maintenance:modifiability

Stakeholders

Page 7: Module Architecture Control using Relation Algebrarbril/education/2II10/MAC-2005.pdf · Module Architecture Control using Relation Algebra Dr.ir. Reinder J. Bril r.j.bril@tue.nl,

Reinder J. Bril, [email protected]/e Informatica, System Architecture and Networking

7

Software architecture – recap• End-User:

behavior, performance, security, reliability

• Customers:low cost, timely delivery

• Product-Management:features, short time to market, low cost, parity with products

• Development:low cost, employability

• Maintenance:modifiability

Stakeholders

Product view

Page 8: Module Architecture Control using Relation Algebrarbril/education/2II10/MAC-2005.pdf · Module Architecture Control using Relation Algebra Dr.ir. Reinder J. Bril r.j.bril@tue.nl,

Reinder J. Bril, [email protected]/e Informatica, System Architecture and Networking

8

Software architecture – recap• End-User:

behavior, performance, security, reliability

• Customers:low cost, timely delivery

• Product-Management:features, short time to market, low cost, parity with products

• Development:low cost, employability

• Maintenance:modifiability

Stakeholders

Developm

ent view

Page 9: Module Architecture Control using Relation Algebrarbril/education/2II10/MAC-2005.pdf · Module Architecture Control using Relation Algebra Dr.ir. Reinder J. Bril r.j.bril@tue.nl,

Reinder J. Bril, [email protected]/e Informatica, System Architecture and Networking

9

Software architecture – recap

• Software architecture:

earliest artifact

means for mutual communication

enables analysis of concerns

manifests concerns as system qualities

• Software architecture is vital !

[Bass et al 1995]

Page 10: Module Architecture Control using Relation Algebrarbril/education/2II10/MAC-2005.pdf · Module Architecture Control using Relation Algebra Dr.ir. Reinder J. Bril r.j.bril@tue.nl,

Reinder J. Bril, [email protected]/e Informatica, System Architecture and Networking

10

Software architecture – recap

Need for (system) architecture• If a project has not achieved a system architecture, including its

rationale, the project should not proceed to full-scale system

development. Specifying the architecture as a deliverable

enables its use throughout the development and maintenance

process.

[Boehm 1995]

Page 11: Module Architecture Control using Relation Algebrarbril/education/2II10/MAC-2005.pdf · Module Architecture Control using Relation Algebra Dr.ir. Reinder J. Bril r.j.bril@tue.nl,

Reinder J. Bril, [email protected]/e Informatica, System Architecture and Networking

Software architecture – recapend users programmers

LogicalView

LogicalView

DevelopmentView

DevelopmentView

ProcessView

ProcessView

DeploymentView

DeploymentView

ScenariosScenarios

system integrators system engineers

4+1 View Model [Kruchten 95]

Page 12: Module Architecture Control using Relation Algebrarbril/education/2II10/MAC-2005.pdf · Module Architecture Control using Relation Algebra Dr.ir. Reinder J. Bril r.j.bril@tue.nl,

Reinder J. Bril, [email protected]/e Informatica, System Architecture and Networking

Software architecture – recapend users programmers

LogicalView

LogicalView

ModuleView

ModuleView

ProcessView

ProcessView

DeploymentView

DeploymentView

CodeView

CodeView

ScenariosScenarios

system integrators system engineers

4+1 View Model Revisited

Page 13: Module Architecture Control using Relation Algebrarbril/education/2II10/MAC-2005.pdf · Module Architecture Control using Relation Algebra Dr.ir. Reinder J. Bril r.j.bril@tue.nl,

Reinder J. Bril, [email protected]/e Informatica, System Architecture and Networking

Software architecture – recapend users programmers

LogicalView

LogicalView

ModuleView

ModuleView

ProcessView

ProcessView

DeploymentView

DeploymentView

CodeView

CodeView

ScenariosScenarios

system integrators system engineers

4+1 View Model Revisited

Page 14: Module Architecture Control using Relation Algebrarbril/education/2II10/MAC-2005.pdf · Module Architecture Control using Relation Algebra Dr.ir. Reinder J. Bril r.j.bril@tue.nl,

Reinder J. Bril, [email protected]/e Informatica, System Architecture and Networking

Software architecture – recapprogrammers

ModuleView

ModuleView

CodeView

CodeView

Development View

Page 15: Module Architecture Control using Relation Algebrarbril/education/2II10/MAC-2005.pdf · Module Architecture Control using Relation Algebra Dr.ir. Reinder J. Bril r.j.bril@tue.nl,

Reinder J. Bril, [email protected]/e Informatica, System Architecture and Networking

15

Software architecture – recap• A software architecture characterization:

– Components (or [architectural] entities);– Connections;– Constraints.

• Module view:– System, Subsystems, Components;– Part-of relation and uses relation;– Layering, orthogonally.

• Code view:– Directories, Files;– Directory structure, location of files, and include relation;– File name conventions and file length constraints.

Page 16: Module Architecture Control using Relation Algebrarbril/education/2II10/MAC-2005.pdf · Module Architecture Control using Relation Algebra Dr.ir. Reinder J. Bril r.j.bril@tue.nl,

Reinder J. Bril, [email protected]/e Informatica, System Architecture and Networking

16

Overview

• Context and motivation– Software architecture – recap– Application domain

• Module architecture notions• Relation algebra• Verification• Conclusion• References

Page 17: Module Architecture Control using Relation Algebrarbril/education/2II10/MAC-2005.pdf · Module Architecture Control using Relation Algebra Dr.ir. Reinder J. Bril r.j.bril@tue.nl,

Reinder J. Bril, [email protected]/e Informatica, System Architecture and Networking

17

Application domain

• Telecommunications domain• SOPHO: Philips’ family of PBXs

– 100 - 1M telephony lines– origin dating back to early 1980’s– maintenance obligations ≥ 10 years– 5 K files, 2.5 MLOC in C++– successful ⇒ asset⇒ careful to maintain this legacy

Page 18: Module Architecture Control using Relation Algebrarbril/education/2II10/MAC-2005.pdf · Module Architecture Control using Relation Algebra Dr.ir. Reinder J. Bril r.j.bril@tue.nl,

Reinder J. Bril, [email protected]/e Informatica, System Architecture and Networking

18

Application domain

• Complexity of legacy systems– hard to understand (e.g. size);– documentation out-of-date;– gap between intrinsic and experienced complexity.

• Architecture vital, but not maintained …:– recovery;– analysis;– control and verification;– (improvements).

• Need for architectural support !

Page 19: Module Architecture Control using Relation Algebrarbril/education/2II10/MAC-2005.pdf · Module Architecture Control using Relation Algebra Dr.ir. Reinder J. Bril r.j.bril@tue.nl,

Reinder J. Bril, [email protected]/e Informatica, System Architecture and Networking

19

Application domain

• Characteristics (development view):– module view

• 8 K architectural entities;• organised in an unbalanced tree, depth 5 – 12;• layered system, consisting of 8 subsystems.

– code view• 1 directory with 5 K files, and 2.5 MLOC in C++;• 35 K include statements;• File names based on “12 NCs”,

file length varies from 100 to 20 K lines.

Page 20: Module Architecture Control using Relation Algebrarbril/education/2II10/MAC-2005.pdf · Module Architecture Control using Relation Algebra Dr.ir. Reinder J. Bril r.j.bril@tue.nl,

Reinder J. Bril, [email protected]/e Informatica, System Architecture and Networking

Application domain

SAS

SD

CPS

SOPHOCPC

POM

GOS

LOS

POMCL

“Intended” module architecture(documentation + software architects)

Page 21: Module Architecture Control using Relation Algebrarbril/education/2II10/MAC-2005.pdf · Module Architecture Control using Relation Algebra Dr.ir. Reinder J. Bril r.j.bril@tue.nl,

Reinder J. Bril, [email protected]/e Informatica, System Architecture and Networking

Application domain

POMCLSAS

SD

CPC

POMCPS

GOS

SOPHO

LOS

“Derived” module architecture(extracted from the implementation)

Page 22: Module Architecture Control using Relation Algebrarbril/education/2II10/MAC-2005.pdf · Module Architecture Control using Relation Algebra Dr.ir. Reinder J. Bril r.j.bril@tue.nl,

Reinder J. Bril, [email protected]/e Informatica, System Architecture and Networking

22

Conformance

S

H

A

D

I

Causes when “intended” and “extracted” differ:1. “intended” is wrong (e.g. out-of-date): improve;

2. “extracted” is wrong: improve;

3. implementation is optimized for, e.g., speed ⇒ refinement.

Intended Extracted

S

H

AI

D

Page 23: Module Architecture Control using Relation Algebrarbril/education/2II10/MAC-2005.pdf · Module Architecture Control using Relation Algebra Dr.ir. Reinder J. Bril r.j.bril@tue.nl,

Reinder J. Bril, [email protected]/e Informatica, System Architecture and Networking

23

Application domain

• Ensure conformance to an architecture !– Keep the architecture up-to-date

• Approach using relation algebra (RPA):– Represent the “intended” architecture in RPA.– Extract the “derived” architecture from the

implementation, and represent in RPA.– Express “conformance” in RPA.– Ensure conformance by means of verification

(using RPA) and improvements (i.e. control).

Page 24: Module Architecture Control using Relation Algebrarbril/education/2II10/MAC-2005.pdf · Module Architecture Control using Relation Algebra Dr.ir. Reinder J. Bril r.j.bril@tue.nl,

Reinder J. Bril, [email protected]/e Informatica, System Architecture and Networking

24

Overview

• Context and motivation• Module architecture notions• Relation algebra• Verification• Conclusion• References

Page 25: Module Architecture Control using Relation Algebrarbril/education/2II10/MAC-2005.pdf · Module Architecture Control using Relation Algebra Dr.ir. Reinder J. Bril r.j.bril@tue.nl,

Reinder J. Bril, [email protected]/e Informatica, System Architecture and Networking

25

Overview• Context and motivation• Module architecture notions

– Module diagram– Decomposition tree– Lifting– Hiding– Lowering– Weights

• Relation algebra• Verification• Conclusion• References

Page 26: Module Architecture Control using Relation Algebrarbril/education/2II10/MAC-2005.pdf · Module Architecture Control using Relation Algebra Dr.ir. Reinder J. Bril r.j.bril@tue.nl,

Reinder J. Bril, [email protected]/e Informatica, System Architecture and Networking

26

Module architecture notions

• Module diagram• Decomposition tree• Lifting• Hiding• Lowering• Weights

Page 27: Module Architecture Control using Relation Algebrarbril/education/2II10/MAC-2005.pdf · Module Architecture Control using Relation Algebra Dr.ir. Reinder J. Bril r.j.bril@tue.nl,

Reinder J. Bril, [email protected]/e Informatica, System Architecture and Networking

27

Module diagram

B

A

S

A3A1

B2B1

A2

• Visualises a system’s architecture

• “Boxes-in-boxes” representation

• Boxes represent entities

• Arrows represent dependencies

System S is not layered

Page 28: Module Architecture Control using Relation Algebrarbril/education/2II10/MAC-2005.pdf · Module Architecture Control using Relation Algebra Dr.ir. Reinder J. Bril r.j.bril@tue.nl,

Reinder J. Bril, [email protected]/e Informatica, System Architecture and Networking

28

Decomposition tree

B

A

S

A3A1

B2B1

A2A1 A2 A3B1 B2

B A

S

System S is balanced, andthe decomposition tree has 3 levels

Page 29: Module Architecture Control using Relation Algebrarbril/education/2II10/MAC-2005.pdf · Module Architecture Control using Relation Algebra Dr.ir. Reinder J. Bril r.j.bril@tue.nl,

Reinder J. Bril, [email protected]/e Informatica, System Architecture and Networking

29

Lifting (1)

B

A

S

A3A1

B2B1

A2A1 A2 A3B1 B2

B A

S

Uses relation corresponds with a level (tree-cut)

Page 30: Module Architecture Control using Relation Algebrarbril/education/2II10/MAC-2005.pdf · Module Architecture Control using Relation Algebra Dr.ir. Reinder J. Bril r.j.bril@tue.nl,

Reinder J. Bril, [email protected]/e Informatica, System Architecture and Networking

30

Lifting (1)

B

A

S

A3A1

B2B1

A2A1 A2 A3B1 B2

B A

S

Transform a relation to a higher level.

Page 31: Module Architecture Control using Relation Algebrarbril/education/2II10/MAC-2005.pdf · Module Architecture Control using Relation Algebra Dr.ir. Reinder J. Bril r.j.bril@tue.nl,

Reinder J. Bril, [email protected]/e Informatica, System Architecture and Networking

31

Lifting (1)

B

A

S

A3A1

B2B1

A2A1 A2 A3B1 B2

B A

S

Transform a relation to a higher level, i.e. replace both the source and the destination of each arrow by its enclosing entity.

Page 32: Module Architecture Control using Relation Algebrarbril/education/2II10/MAC-2005.pdf · Module Architecture Control using Relation Algebra Dr.ir. Reinder J. Bril r.j.bril@tue.nl,

Reinder J. Bril, [email protected]/e Informatica, System Architecture and Networking

32

Lifting (2)

B

A

S

A3A1

B2B1

A2

BS

A3A1

B2B1

A2

A→

Page 33: Module Architecture Control using Relation Algebrarbril/education/2II10/MAC-2005.pdf · Module Architecture Control using Relation Algebra Dr.ir. Reinder J. Bril r.j.bril@tue.nl,

Reinder J. Bril, [email protected]/e Informatica, System Architecture and Networking

33

Lifting (2)

B

A

S

A3A1

B2B1

A2

BS

A3A1

B2B1

A2

A→

Page 34: Module Architecture Control using Relation Algebrarbril/education/2II10/MAC-2005.pdf · Module Architecture Control using Relation Algebra Dr.ir. Reinder J. Bril r.j.bril@tue.nl,

Reinder J. Bril, [email protected]/e Informatica, System Architecture and Networking

34

Lifting (2)

B

A

S

A3A1

B2B1

A2

BS

A3A1

B2B1

A2

A→

Page 35: Module Architecture Control using Relation Algebrarbril/education/2II10/MAC-2005.pdf · Module Architecture Control using Relation Algebra Dr.ir. Reinder J. Bril r.j.bril@tue.nl,

Reinder J. Bril, [email protected]/e Informatica, System Architecture and Networking

35

Lifting (2)

B

A

S

A3A1

B2B1

A2

BS

A3A1

B2B1

A2

A→

Page 36: Module Architecture Control using Relation Algebrarbril/education/2II10/MAC-2005.pdf · Module Architecture Control using Relation Algebra Dr.ir. Reinder J. Bril r.j.bril@tue.nl,

Reinder J. Bril, [email protected]/e Informatica, System Architecture and Networking

36

Lifting (2)

B

A

S

A3A1

B2B1

A2

BS

A3A1

B2B1

A2

A→

Page 37: Module Architecture Control using Relation Algebrarbril/education/2II10/MAC-2005.pdf · Module Architecture Control using Relation Algebra Dr.ir. Reinder J. Bril r.j.bril@tue.nl,

Reinder J. Bril, [email protected]/e Informatica, System Architecture and Networking

37

Lifting (2)

B

A

S

A3A1

B2B1

A2

BS

A3A1

B2B1

A2

A→

Page 38: Module Architecture Control using Relation Algebrarbril/education/2II10/MAC-2005.pdf · Module Architecture Control using Relation Algebra Dr.ir. Reinder J. Bril r.j.bril@tue.nl,

Reinder J. Bril, [email protected]/e Informatica, System Architecture and Networking

38

Hiding

B

A

S

A3A1

B2B1

A2

BS

A→

Hiding the decomposition structure of both A and B

Page 39: Module Architecture Control using Relation Algebrarbril/education/2II10/MAC-2005.pdf · Module Architecture Control using Relation Algebra Dr.ir. Reinder J. Bril r.j.bril@tue.nl,

Reinder J. Bril, [email protected]/e Informatica, System Architecture and Networking

39

Lowering

B

A

S

A3A1

B2B1

A2

BS

A3A1

B2B1

A2

A←

both cases a complete graph.

Page 40: Module Architecture Control using Relation Algebrarbril/education/2II10/MAC-2005.pdf · Module Architecture Control using Relation Algebra Dr.ir. Reinder J. Bril r.j.bril@tue.nl,

Reinder J. Bril, [email protected]/e Informatica, System Architecture and Networking

40

Lowering

B

A

S

A3A1

B2B1

A2

BS

A3A1

B2B1

A2

A←

Application: architectural verification,

e.g. layering

Page 41: Module Architecture Control using Relation Algebrarbril/education/2II10/MAC-2005.pdf · Module Architecture Control using Relation Algebra Dr.ir. Reinder J. Bril r.j.bril@tue.nl,

Reinder J. Bril, [email protected]/e Informatica, System Architecture and Networking

41

Weights

B

A

S

A3A1

B2B1

A2

BS

A3A1

B2B1

A2

A

Which value to be associated ?

Page 42: Module Architecture Control using Relation Algebrarbril/education/2II10/MAC-2005.pdf · Module Architecture Control using Relation Algebra Dr.ir. Reinder J. Bril r.j.bril@tue.nl,

Reinder J. Bril, [email protected]/e Informatica, System Architecture and Networking

42

Weights

B

A

S

A3A1

B2B1

A2

BS

A3A1

B2B1

A2

A

4: number of uses relations

size-oriented weight

Page 43: Module Architecture Control using Relation Algebrarbril/education/2II10/MAC-2005.pdf · Module Architecture Control using Relation Algebra Dr.ir. Reinder J. Bril r.j.bril@tue.nl,

Reinder J. Bril, [email protected]/e Informatica, System Architecture and Networking

43

Weights

B

A

S

A3A1

B2B1

A2

BS

A3A1

B2B1

A2

A

Fisheye view of the

size-oriented weight

Page 44: Module Architecture Control using Relation Algebrarbril/education/2II10/MAC-2005.pdf · Module Architecture Control using Relation Algebra Dr.ir. Reinder J. Bril r.j.bril@tue.nl,

Reinder J. Bril, [email protected]/e Informatica, System Architecture and Networking

44

Weights

B

A

S

A3A1

B2B1

A2

BS

A3A1

B2B1

A2

A

3: number of used entities (A1, A2 and A3)

fan-in-oriented weight

Page 45: Module Architecture Control using Relation Algebrarbril/education/2II10/MAC-2005.pdf · Module Architecture Control using Relation Algebra Dr.ir. Reinder J. Bril r.j.bril@tue.nl,

Reinder J. Bril, [email protected]/e Informatica, System Architecture and Networking

45

Weights

B

A

S

A3A1

B2B1

A2

BS

A3A1

B2B1

A2

A

2: number of using entities (B1 and B2)

fan-out-oriented weight

Page 46: Module Architecture Control using Relation Algebrarbril/education/2II10/MAC-2005.pdf · Module Architecture Control using Relation Algebra Dr.ir. Reinder J. Bril r.j.bril@tue.nl,

Reinder J. Bril, [email protected]/e Informatica, System Architecture and Networking

46

Weights

BS

A3A1

B2B1

A2

A

<1,1,1><2,4,3>

<1,1,1>

<2,2,1>

B

A

S

A3A1

B2B1

A2

Each weight has its merits during architectural analysis

Page 47: Module Architecture Control using Relation Algebrarbril/education/2II10/MAC-2005.pdf · Module Architecture Control using Relation Algebra Dr.ir. Reinder J. Bril r.j.bril@tue.nl,

Reinder J. Bril, [email protected]/e Informatica, System Architecture and Networking

47

Overview

• Context and motivation• Module architecture notions• Relation algebra

– Usage– Overview– Examples– Application

• Verification• Conclusion• References

Page 48: Module Architecture Control using Relation Algebrarbril/education/2II10/MAC-2005.pdf · Module Architecture Control using Relation Algebra Dr.ir. Reinder J. Bril r.j.bril@tue.nl,

Reinder J. Bril, [email protected]/e Informatica, System Architecture and Networking

48

Relation Algebra: Usage

• Visualisation and view calculations– reverse architecting purposes

• Relational calculus– software architecture analysis

• Architectural rules– software architecture verification

• Architectural metrics– software architectural quality assurance

• (formal basis of tools)

Page 49: Module Architecture Control using Relation Algebrarbril/education/2II10/MAC-2005.pdf · Module Architecture Control using Relation Algebra Dr.ir. Reinder J. Bril r.j.bril@tue.nl,

Reinder J. Bril, [email protected]/e Informatica, System Architecture and Networking

49

Relation Algebra: Overview

• Sets– ø, ∪, ∩, −, ...

• Relations: sets of pairs– ; (composition), -1, +, *, |,↑ (lifting), ↓ (lowering)

• Multi-sets: bags– ⎡⎤, ⎣⎦

• Multi-relations: bags of pairs

Page 50: Module Architecture Control using Relation Algebrarbril/education/2II10/MAC-2005.pdf · Module Architecture Control using Relation Algebra Dr.ir. Reinder J. Bril r.j.bril@tue.nl,

Reinder J. Bril, [email protected]/e Informatica, System Architecture and Networking

50

Relation Algebra: Example

B

A

S

A3A1

B2B1

A2

Set of Entities E:E = { S, A, A1, A2, A3, B, B1, B2}

Page 51: Module Architecture Control using Relation Algebrarbril/education/2II10/MAC-2005.pdf · Module Architecture Control using Relation Algebra Dr.ir. Reinder J. Bril r.j.bril@tue.nl,

Reinder J. Bril, [email protected]/e Informatica, System Architecture and Networking

51

Relation Algebra: Example

Part-of relation P:P = { <B, S>, <A, S>,

, <B1, B>, <B2, B>

, <A1, A>, <A2, A>, <A3, A>

}A1 A2 A3B1 B2

B A

S

A part-of relation:

• describes the decomposition tree;

• is both: functional and a-cyclic.

Page 52: Module Architecture Control using Relation Algebrarbril/education/2II10/MAC-2005.pdf · Module Architecture Control using Relation Algebra Dr.ir. Reinder J. Bril r.j.bril@tue.nl,

Reinder J. Bril, [email protected]/e Informatica, System Architecture and Networking

52

Relation Algebra: Example

Part-of relation P:P = { <B, S>, <A, S>,

, <B1, B>, <B2, B>

, <A1, A>, <A2, A>, <A3, A>

}A1 A2 A3B1 B2

B A

S

Carrier of P: car(P) = { B1, B2, B, A1, A2, A3, B, A, S } = E.

Range of P: ran(P) = { B, A, S }.

Domain of P: dom(P) = { B1, B2, B, A1, A2, A3, A }.

Page 53: Module Architecture Control using Relation Algebrarbril/education/2II10/MAC-2005.pdf · Module Architecture Control using Relation Algebra Dr.ir. Reinder J. Bril r.j.bril@tue.nl,

Reinder J. Bril, [email protected]/e Informatica, System Architecture and Networking

53

Relation Algebra: Example

A1 A2 A3B1 B2

B A

S Part-of relation P:P = { <B, S>, <A, S>,

, <B1, B>, <B2, B>

, <A1, A>, <A2, A>, <A3, A>

}

Question: How to express the leafs of the decomposition tree in relation algebra using P?

Answer: leafs(E) = car(P) – ran(P) = { B1, B2, A1, A2, A3 }.

Page 54: Module Architecture Control using Relation Algebrarbril/education/2II10/MAC-2005.pdf · Module Architecture Control using Relation Algebra Dr.ir. Reinder J. Bril r.j.bril@tue.nl,

Reinder J. Bril, [email protected]/e Informatica, System Architecture and Networking

54

Relation Algebra: Example

Part-of relation P:P = { <B, S>, <A, S>,

, <B1, B>, <B2, B>

, <A1, A>, <A2, A>, <A3, A>

}A1 A2 A3B1 B2

B A

S

Question: How to express the root of the decomposition tree in relation algebra using P?

Answer: root(E) = car(P) – dom(P) = { S }.

Page 55: Module Architecture Control using Relation Algebrarbril/education/2II10/MAC-2005.pdf · Module Architecture Control using Relation Algebra Dr.ir. Reinder J. Bril r.j.bril@tue.nl,

Reinder J. Bril, [email protected]/e Informatica, System Architecture and Networking

55

Relation Algebra: Example

B

A

S

A3A1

B2B1

A2

Uses relation U:U = { <A1, A2>, <A3, A2>,

, <B1, A1>, <B1, A2>, <B1, B2>

, <B2, A2>, <B2, A3>

, <A3, B2>

}

Question: How to express the entities that use, but are not used by, entities in relation algebra ?

Answer: use_only = car(U) – ran(U) = { B1 }.

Page 56: Module Architecture Control using Relation Algebrarbril/education/2II10/MAC-2005.pdf · Module Architecture Control using Relation Algebra Dr.ir. Reinder J. Bril r.j.bril@tue.nl,

Reinder J. Bril, [email protected]/e Informatica, System Architecture and Networking

56

Relation Algebra: Example

B

A

S

A3A1

B2B1

A2

Uses relation U:U = { <A1, A2>, <A3, A2>,

, <B1, A1>, <B1, A2>, <B1, B2>

, <B2, A2>, <B2, A3>

, <A3, B2>

}

Question: How to express the leaf entities that neither use nor are used by entities in relation algebra ?

Answer: isolated = leafs(E) – car(U) = ø.

Page 57: Module Architecture Control using Relation Algebrarbril/education/2II10/MAC-2005.pdf · Module Architecture Control using Relation Algebra Dr.ir. Reinder J. Bril r.j.bril@tue.nl,

Reinder J. Bril, [email protected]/e Informatica, System Architecture and Networking

57

Relation Algebra: Example

B

A

S

A3A1

B2B1

A2A1 A2 A3B1 B2

B A

S

Transform a relation to a higher level, i.e. replace both the source and the destination of each arrow by its enclosing entity.

Page 58: Module Architecture Control using Relation Algebrarbril/education/2II10/MAC-2005.pdf · Module Architecture Control using Relation Algebra Dr.ir. Reinder J. Bril r.j.bril@tue.nl,

Reinder J. Bril, [email protected]/e Informatica, System Architecture and Networking

58

Relation Algebra: Example

B

A

S

A3A1

B2B1

A2A1 A2 A3B1 B2

B A

S

Example: <B1, A1>

• replace source: B1 by B;

• replace destination: A1 by A.

Page 59: Module Architecture Control using Relation Algebrarbril/education/2II10/MAC-2005.pdf · Module Architecture Control using Relation Algebra Dr.ir. Reinder J. Bril r.j.bril@tue.nl,

Reinder J. Bril, [email protected]/e Informatica, System Architecture and Networking

59

Relation Algebra: Example

B

A

S

A3A1

B2B1

A2

Lifting:def.: U ↑ P ≡ P-1 ; U ; P

ex.: <B1, B> ∈ P ⇔ <B, B1> ∈ P-1;

<B1, A1> ∈ U;

<A1, A> ∈ P;

For U ↑ P, P must be a part-of relation

Page 60: Module Architecture Control using Relation Algebrarbril/education/2II10/MAC-2005.pdf · Module Architecture Control using Relation Algebra Dr.ir. Reinder J. Bril r.j.bril@tue.nl,

Reinder J. Bril, [email protected]/e Informatica, System Architecture and Networking

60

Relation Algebra: Example

B

A

S

A3A1

B2B1

A2

Lifting:def.: U ↑ P ≡ P-1 ; U ; P

ex.: <B1, B> ∈ P ⇔ <B, B1> ∈ P-1;

<B1, A1> ∈ U;

<A1, A> ∈ P;

<B, A1> ∈ P-1 ; U

Page 61: Module Architecture Control using Relation Algebrarbril/education/2II10/MAC-2005.pdf · Module Architecture Control using Relation Algebra Dr.ir. Reinder J. Bril r.j.bril@tue.nl,

Reinder J. Bril, [email protected]/e Informatica, System Architecture and Networking

61

Relation Algebra: Example

B

A

S

A3A1

B2B1

A2

Lifting:def.: U ↑ P ≡ P-1 ; U ; P

ex.: <B1, B> ∈ P ⇔ <B, B1> ∈ P-1;

<B1, A1> ∈ U;

<A1, A> ∈ P;

<B, A> ∈ P-1 ; U ; P

Page 62: Module Architecture Control using Relation Algebrarbril/education/2II10/MAC-2005.pdf · Module Architecture Control using Relation Algebra Dr.ir. Reinder J. Bril r.j.bril@tue.nl,

Reinder J. Bril, [email protected]/e Informatica, System Architecture and Networking

62

Relation Algebra: Example

B

A

S

A3A1

B2B1

A2

BS

A→

Hiding the decomposition structure of both A and B

Page 63: Module Architecture Control using Relation Algebrarbril/education/2II10/MAC-2005.pdf · Module Architecture Control using Relation Algebra Dr.ir. Reinder J. Bril r.j.bril@tue.nl,

Reinder J. Bril, [email protected]/e Informatica, System Architecture and Networking

63

Relation Algebra: Example

B

A

S

A3A1

B2B1

A2

BS

A→

Question: How to express the set of entities E’ after hiding in relation algebra using P?

Answer: E’ = ran(P) = { S, A, B }.

Page 64: Module Architecture Control using Relation Algebrarbril/education/2II10/MAC-2005.pdf · Module Architecture Control using Relation Algebra Dr.ir. Reinder J. Bril r.j.bril@tue.nl,

Reinder J. Bril, [email protected]/e Informatica, System Architecture and Networking

64

Relation Algebra: Example

B

A

S

A3A1

B2B1

A2

BS

A→

Question: How to express the part-of relation P’ after hiding in relation algebra ?

Answer: P’ = P |car E’ = { S, A, B }.

Page 65: Module Architecture Control using Relation Algebrarbril/education/2II10/MAC-2005.pdf · Module Architecture Control using Relation Algebra Dr.ir. Reinder J. Bril r.j.bril@tue.nl,

Reinder J. Bril, [email protected]/e Informatica, System Architecture and Networking

65

Relation Algebra: Example

B

A

S

A3A1

B2B1

A2

Lowering:def.: U ↓ P ≡ P ; U ; P-1

For U ↓ P, P must be a part-of relation

Page 66: Module Architecture Control using Relation Algebrarbril/education/2II10/MAC-2005.pdf · Module Architecture Control using Relation Algebra Dr.ir. Reinder J. Bril r.j.bril@tue.nl,

Reinder J. Bril, [email protected]/e Informatica, System Architecture and Networking

66

Relation Algebra: Example

B

A

S

A3A1

B2B1

A2

Lowering:def.: U ↓ P ≡ P ; U ; P-1

ex.: {<A, B>} ↓ P = {<A1, B1>, <A1, B2>

,<A2, B1>, <A2, B2>

,<A3, B1>, <A3, B2>

}

{<A, B>} ↓ P ∩ U = {<A3, B2>}

Layering rule:

{<A, B>} ↓ P ∩ U = ø

Page 67: Module Architecture Control using Relation Algebrarbril/education/2II10/MAC-2005.pdf · Module Architecture Control using Relation Algebra Dr.ir. Reinder J. Bril r.j.bril@tue.nl,

Reinder J. Bril, [email protected]/e Informatica, System Architecture and Networking

67

Relation Algebra: Example

B

A

S

A3A1

B2B1

A2

Size-oriented lifting:def.: UM ↑ P ≡ ⎡P-1⎤ ; UM ; ⎡P⎤

where UM = ⎡U⎤

ex.: <B, A> 4 times in UM ↑ P

Page 68: Module Architecture Control using Relation Algebrarbril/education/2II10/MAC-2005.pdf · Module Architecture Control using Relation Algebra Dr.ir. Reinder J. Bril r.j.bril@tue.nl,

Reinder J. Bril, [email protected]/e Informatica, System Architecture and Networking

68

Relation Algebra: Example

B

A

S

A3A1

B2B1

A2

Fan-out-oriented lifting:UM ↑> P ≡ ⎡P-1⎤ ; ⎡⎣UM⎦ ; P⎤

<B, A> 2 times in UM ↑> P

Fan-in-oriented lifting:UM ↑< P ≡ ⎡P-1 ; ⎣UM⎦⎤ ; ⎡P⎤

<B, A> 3 times in UM ↑< P

Page 69: Module Architecture Control using Relation Algebrarbril/education/2II10/MAC-2005.pdf · Module Architecture Control using Relation Algebra Dr.ir. Reinder J. Bril r.j.bril@tue.nl,

Reinder J. Bril, [email protected]/e Informatica, System Architecture and Networking

69

Relation Algebra: Application• Analytical techniques:

– lifting,– checking of rules,– impact analysis,– finding unused and unavailable components,– identification of top and bottom layers,– study of alternative component groupings,– improvement of presentation by suppressing elements,– improvement of locality,– checking of linearity,– analysis of cycles,– improvement of presentation by transitive reduction.

[Feijs et al 98]

Page 70: Module Architecture Control using Relation Algebrarbril/education/2II10/MAC-2005.pdf · Module Architecture Control using Relation Algebra Dr.ir. Reinder J. Bril r.j.bril@tue.nl,

Reinder J. Bril, [email protected]/e Informatica, System Architecture and Networking

70

VerificationS’

C

B

A

System S’ consists of 3 levels, and is layered.

Question: How to express layering rule LR for S’ in relation algebra?

Answer: Layering rule LR for S’:

LR(S’): {<A, B>, <A, C>, <B, C>} ↓ P ∩ U = ø

Page 71: Module Architecture Control using Relation Algebrarbril/education/2II10/MAC-2005.pdf · Module Architecture Control using Relation Algebra Dr.ir. Reinder J. Bril r.j.bril@tue.nl,

Reinder J. Bril, [email protected]/e Informatica, System Architecture and Networking

71

VerificationS’

C

B

A

System S’ consists of 3 levels, andis strictly layered.

Question: How to express strictly layering rule SLR for S’ in relation algebra?

Answer: Strictly layering rule SLR for S’:

SLR(S’): {<A, B>, <A, C>, <B, C>, <C, A>} ↓ P ∩ U = ø

Page 72: Module Architecture Control using Relation Algebrarbril/education/2II10/MAC-2005.pdf · Module Architecture Control using Relation Algebra Dr.ir. Reinder J. Bril r.j.bril@tue.nl,

Reinder J. Bril, [email protected]/e Informatica, System Architecture and Networking

72

VerificationS’

C

B

A

S’

C

B

A

S’

C

B

A

Cx

Ay

Intended Derived

Question: How to express the exception to the strictly layering rule SLR(S’) for S’ in relation algebra?

Answer: Delete specific uses relation between modules !

{<A, B>, <A, C>, <B, C>, <C, A>} ↓ P ∩ U – {<Cx, Ay>} = ø

Page 73: Module Architecture Control using Relation Algebrarbril/education/2II10/MAC-2005.pdf · Module Architecture Control using Relation Algebra Dr.ir. Reinder J. Bril r.j.bril@tue.nl,

Reinder J. Bril, [email protected]/e Informatica, System Architecture and Networking

73

Conclusion

Goals revisted• Student understands:

– the need for module architecture control;• diversion of intended and derived architecture over time

– how module architecture control can be performed;

• describe the architecture in terms of rules, check compliance of the derived architecture, and adapt

– the basics of relation algebra.• Student can apply relation algebra on a

simple example.

Page 74: Module Architecture Control using Relation Algebrarbril/education/2II10/MAC-2005.pdf · Module Architecture Control using Relation Algebra Dr.ir. Reinder J. Bril r.j.bril@tue.nl,

Reinder J. Bril, [email protected]/e Informatica, System Architecture and Networking

74

References• [Bass et al 98] L. Bass, P. Clemens, and R. Kazman, Software

Architecture in Practice, Addison-Wesley, 1998.• [Boehm 1995] Engineering context (for software architecture), invited

talk, 1st Int. Workshop on Architecture for Software Systems, Seattle, Washington, April 1995.

• [Bril et al 2000] R.J. Bril, L.M.G. Feijs, A. Glas, R.L. Krikhaar, an M.R.M. Winter, Maintaining a legacy: towards support at the architectural level, Journal of Software Maintenance, 12(3): 143 – 170, May/June 2000.

• [Feijs et al 98] L. Feijs, R. Krikhaar, and R. van Ommering, A relational approach to support software architecture analysis, Software – Practice and Experience, 28(4): 371 – 400, April 1998.

• [Kruchten 95] P. Kruchten, The 4 + 1 View Model of Architecture, IEEE Software, 12(6): 42 – 50, November 1995.

• [Lange et al 05] C. Lange and M. Chaudron, Experimentally investigating effects of defects in UML models, TU/e, CS-Report 05-07, 2005.

• [Muskens et al 05] J. Muskens, R.J. Bril, and M.R.V. Chaudron, Generalizing Consistency Checking between Software Views, To appear in: Proc. 5th Working Conference on Software Architecture (WICSA), November 2005.