general modeling principles: building blocks of analysis patterns pa116 – l2 (c) zdenko...

44
General Modeling Principles: Building Blocks of Analysis Patterns PA116 – L2 (c) Zdenko Staníček, Sept 2010

Upload: ethan-lawrence

Post on 14-Dec-2015

212 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: General Modeling Principles: Building Blocks of Analysis Patterns PA116 – L2 (c) Zdenko Staníček, Sept 2010

General Modeling Principles:

Building Blocks of Analysis Patterns

PA116 – L2

(c) Zdenko Staníček, Sept 2010

Page 2: General Modeling Principles: Building Blocks of Analysis Patterns PA116 – L2 (c) Zdenko Staníček, Sept 2010

2

Content

• Data Polymorphism

• Special Constructs (Analytic patterns)

• Analytic Pattern Accountability

According to:Lubor Sesera: presentations

papers (“google it, please”)books (Application Architectures

of SW Systems – in Slovak)

Page 3: General Modeling Principles: Building Blocks of Analysis Patterns PA116 – L2 (c) Zdenko Staníček, Sept 2010

3

Data Polymorphism - topics

• What is data polymorphism?

• What are reasons for using data polymorphism?

• Solving data polymorphism by using “glasses”

• Solving data polymorphism by using attribute as isolated entity (see Special Constructs or Building Blocks in DM)

Page 4: General Modeling Principles: Building Blocks of Analysis Patterns PA116 – L2 (c) Zdenko Staníček, Sept 2010

4

What is data polymorphism?

• Type of data processed by a program is not known in compilation time, but only in the time of program running.

• Function represented by program is computed in the same way for different types of its arguments

• Typical example is function “Sum”

• … along with this the data processing lies in – permanent storage in DB, – searching, actualizing, ...

Page 5: General Modeling Principles: Building Blocks of Analysis Patterns PA116 – L2 (c) Zdenko Staníček, Sept 2010

5

Reasons for utilization of data polymorphism

• Example: Component “Technical Equipment Register and Maintenance” in Power distribution plant– What Item is worth to be filed as self-reliant entity– Would we like to see “Transformer” and “Electrical

Distributor”, (“insulator”) or only– “Device”

• Complexity of application when data polymorphism is not used

• Dependence of application on current state of users’ thinking about their business needs

• Sliding on the Identity-axe (what has to be distinguished and what hasn’t)

Page 6: General Modeling Principles: Building Blocks of Analysis Patterns PA116 – L2 (c) Zdenko Staníček, Sept 2010

6

Supertype--Subtype, Identity of types

Device

Transformer

Electricaldistributor

Pillar

Lightning arrester

Bulk power substation

Switchboard

Cable

Approx. 180 – 220

Page 7: General Modeling Principles: Building Blocks of Analysis Patterns PA116 – L2 (c) Zdenko Staníček, Sept 2010

7

Connections between Subtypes

Device

Transformer

Electricaldistributor

Pillar

Lightningarrester

Bulk power substation

Switchboard

Cable

Cca 180 – 220

Page 8: General Modeling Principles: Building Blocks of Analysis Patterns PA116 – L2 (c) Zdenko Staníček, Sept 2010

8

Connections between Supertypes

Device

Cca 180 – 220 Transformer

Electricaldistributor

Pillar

Lightningarrester

Bulk power substation

Switchboard

Cable

Page 9: General Modeling Principles: Building Blocks of Analysis Patterns PA116 – L2 (c) Zdenko Staníček, Sept 2010

9

Solving Data Polymorphism using “glasses”

• Non-interpreted storage place in Device records

• Each Device instance is of exactly one type from Device Type

• Within the run-time the current “type” of the “non-interpreted storage” of a given Device instance is interpreted according to assigned “device type”

Page 10: General Modeling Principles: Building Blocks of Analysis Patterns PA116 – L2 (c) Zdenko Staníček, Sept 2010

10

Using glases

Device

Device Type Glasses

1,1

0,M

1,1 0,M

DEVICE

xxxxx *xxx * xxxxxxxxxxxx *xx * xxxxxxxxx * x *

Page 11: General Modeling Principles: Building Blocks of Analysis Patterns PA116 – L2 (c) Zdenko Staníček, Sept 2010

11

Solving Data Polymorphism using “glasses” -- discussion

• Used in several real-life examples (case study “Building Data Model”, IS “White Butterfly”, …)

• Discussion:– What are the advantages?– What kind of problems this solution brings?– Is it easy to maintain?– Computational complexity?– What about the fact that SW company has its product

at 100 (at 1000, ...) customers?

Page 12: General Modeling Principles: Building Blocks of Analysis Patterns PA116 – L2 (c) Zdenko Staníček, Sept 2010

12

Solving Data Polymorphism by using attribute as isolated entity

• Who will find out how to do it?

• It is one of the basic analytic patterns

Page 13: General Modeling Principles: Building Blocks of Analysis Patterns PA116 – L2 (c) Zdenko Staníček, Sept 2010

13

Using attribute as isolated entity

Device

Device Type Attribute

1,1

0,M

1,1 0,M

Valuep

p

(1,M)

(Value) of given (#Attribute) for given (#Device) / 0,1:0,M

Page 14: General Modeling Principles: Building Blocks of Analysis Patterns PA116 – L2 (c) Zdenko Staníček, Sept 2010

14

Attribute as isolated entity

• Discussion:– What are advantages?– What kind of problems this solution brings?– Is it easy to maintain?– Computational complexity?– Comparison with Glases

Page 15: General Modeling Principles: Building Blocks of Analysis Patterns PA116 – L2 (c) Zdenko Staníček, Sept 2010

15

Special Constructions (Analytical patterns)

• Are there any other general solutions except the Data Polymorphism?

• Lubor Šešera: paper at DATASEM• ... and the book Data Modeling in Examples• … and now: Application Architectures of SW

Systems• M. Fowler: Analysis Patterns: Reusable Object

Models.

Page 16: General Modeling Principles: Building Blocks of Analysis Patterns PA116 – L2 (c) Zdenko Staníček, Sept 2010

16

Reasons for usage

• Example: Component “Technical Equipment Register and Maintenance”

• Complexity of application when special constructs are not used

• Dependence of application on current state of users’ thinking about their business needs

• Higher solidity of the construction when proven prefabricated elements are used

Page 17: General Modeling Principles: Building Blocks of Analysis Patterns PA116 – L2 (c) Zdenko Staníček, Sept 2010

17

Conceptual modeling using patterns - principles

• Principles of normalization

• Principles of abstraction

• Principles of flexibility

• See Šešera: Data Modeling in ExamplesFollowing examples and figures are used from authors speach (with author's kind permition) L. Šešera: General Data Modeling Principles: Building Blocks of Analysis Patterns. DATASEM 1999, which preceded cited book

Page 18: General Modeling Principles: Building Blocks of Analysis Patterns PA116 – L2 (c) Zdenko Staníček, Sept 2010

18

Principles of normalization

• Uniqueness of occurrence of data item– from not normalized entity towards to

construction of normalized entities

• Multiplicity– reduce a multiplicity of objects in relation only

to:• zero• one• infinity

Page 19: General Modeling Principles: Building Blocks of Analysis Patterns PA116 – L2 (c) Zdenko Staníček, Sept 2010

19

Every fact only in one place

Person

namesurnamevillagestreetnumber

*

{or}

{or}

1*

1

*

0..1

*

0..1

Person

Number

Street

Village

namesurname

Page 20: General Modeling Principles: Building Blocks of Analysis Patterns PA116 – L2 (c) Zdenko Staníček, Sept 2010

20

Actual cardinalities transform to general ones

10..50Person

Address-housenumber

1*Person

Address-housenumber

Page 21: General Modeling Principles: Building Blocks of Analysis Patterns PA116 – L2 (c) Zdenko Staníček, Sept 2010

21

Principles of abstraction

• Abstraction in itself– Generalization– Constructing types– Substitution

• Aggregation

• Categorization

Page 22: General Modeling Principles: Building Blocks of Analysis Patterns PA116 – L2 (c) Zdenko Staníček, Sept 2010

22

Generalizationrelation of inheritance, some inherited

characteristics could be overridden in subtype

Man Woman

Person

Locality

NumberVillage Street

Page 23: General Modeling Principles: Building Blocks of Analysis Patterns PA116 – L2 (c) Zdenko Staníček, Sept 2010

23

Constructing typestype as a standalone entity

Gender

Person

*

1

Man Woman

Person

Page 24: General Modeling Principles: Building Blocks of Analysis Patterns PA116 – L2 (c) Zdenko Staníček, Sept 2010

24

Constructing types (2)type as a standalone entity

Type ofLocality

Locality

*

1

Gender

Person

*

1

According to this pattern: … we create the followingconstruction:

Page 25: General Modeling Principles: Building Blocks of Analysis Patterns PA116 – L2 (c) Zdenko Staníček, Sept 2010

25

Substitutionspecial entity is set instead of general entity -

opposite of generalization

Person

name

surname

Woman

namesurname

Page 26: General Modeling Principles: Building Blocks of Analysis Patterns PA116 – L2 (c) Zdenko Staníček, Sept 2010

26

Aggregationgrouping parts into wholes; it supports constructing

more levels of abstraction

Family

Person

1..*

1

Village

Street

1

*

Page 27: General Modeling Principles: Building Blocks of Analysis Patterns PA116 – L2 (c) Zdenko Staníček, Sept 2010

27

Categorizationgrouping instances into sets; it does not subscribe

attributes to grouped instances (contrary to constructing types)

Nationality

Person

*

1

Size ofVillage

Village

*

1

Page 28: General Modeling Principles: Building Blocks of Analysis Patterns PA116 – L2 (c) Zdenko Staníček, Sept 2010

28

Abstraction (Generalization) vs. Aggregation

Person

Man Woman Head Body

1

1

1

1

Page 29: General Modeling Principles: Building Blocks of Analysis Patterns PA116 – L2 (c) Zdenko Staníček, Sept 2010

29

Abstraction (Generalization) vs Categorization

Locality

Village

Size ofVillage

*

1

Page 30: General Modeling Principles: Building Blocks of Analysis Patterns PA116 – L2 (c) Zdenko Staníček, Sept 2010

30

Principles of Flexibility

• Recursion– direct– indirect

• Abstraction of relationship

• Abstraction of attributes

Page 31: General Modeling Principles: Building Blocks of Analysis Patterns PA116 – L2 (c) Zdenko Staníček, Sept 2010

31

Direct recursionsemantic relationship and special relationship

(aggregation)

parentchild

Person

1

*

Locality

1

*

Page 32: General Modeling Principles: Building Blocks of Analysis Patterns PA116 – L2 (c) Zdenko Staníček, Sept 2010

32

Indirect recursion (1)

Person

Parent Childless

child

*

1

Page 33: General Modeling Principles: Building Blocks of Analysis Patterns PA116 – L2 (c) Zdenko Staníček, Sept 2010

33

Indirect recursion (2)

Locality

ComposedLocality

Number Personadress

1

*

*1

Page 34: General Modeling Principles: Building Blocks of Analysis Patterns PA116 – L2 (c) Zdenko Staníček, Sept 2010

34

Abstraction of relationships

marriage WomanMan

date maiden namenamesurname

1 * * 1

Person Familyrelationship

Type offamily

relationship

*1

*1

*

1

Page 35: General Modeling Principles: Building Blocks of Analysis Patterns PA116 – L2 (c) Zdenko Staníček, Sept 2010

35

Abstraction of attributes (1)

Device

Device Type Attribute

1,1

0,M

1,1 0,M

Valuep

p

(1,M)

(Value) of given (#Attribute) for given (#Device) / 0,1:0,M

Page 36: General Modeling Principles: Building Blocks of Analysis Patterns PA116 – L2 (c) Zdenko Staníček, Sept 2010

36

Abstraction of attributes (2)not only by using types, but using aggregations

Gender

Patient

Attributeof patient

Value

1

*

1 *

1 *

1

*

Page 37: General Modeling Principles: Building Blocks of Analysis Patterns PA116 – L2 (c) Zdenko Staníček, Sept 2010

37

Pattern Accountabilityas an example of complex patterns

• taken from L. Šesera's lecture at DATASEM 1999• by M. Fowler

• Organizational structure of big organization• Problem of changing the model when the organization

structure changes• Problem of more existing hierarchies at the same time• Abstractions: OrgUnit → Participant;

OrgRelationship→ (any) Accountability• Separation of general knowledge from operational level;

implementation of general scope of accountability and allowing multiple inheritance

Page 38: General Modeling Principles: Building Blocks of Analysis Patterns PA116 – L2 (c) Zdenko Staníček, Sept 2010

38

Organizational structure of big organization

Regional Centre

Subsidiary

Headquarters

Store

1

*

1

*

1

*

Page 39: General Modeling Principles: Building Blocks of Analysis Patterns PA116 – L2 (c) Zdenko Staníček, Sept 2010

39

Solving Problem of changing the model when changing the org. structure

SubsidiaryHeadquarters StoreRegionalCentre

Org Unit

Rule:

no superordinate

Rule:superordinate is

Headquarters

Rule:superordinate is

RegionalCentre

Rule:superordinate is

Subsidiary

superordinate

subordinate

0..1

*

Page 40: General Modeling Principles: Building Blocks of Analysis Patterns PA116 – L2 (c) Zdenko Staníček, Sept 2010

40

Solving Problem of more existing hierarchies at the same time

Type

Organizationrelationship

Time interval SubsidiaryHeadquarters StoreRegionalCentre

Org

Unit

superordinate

subordinate *

1

* 1

* 1

1

*

Organizationrelationship

Page 41: General Modeling Principles: Building Blocks of Analysis Patterns PA116 – L2 (c) Zdenko Staníček, Sept 2010

41

Abstraction: OrgUnit → ParticipantOrgRelationship→ (any) Accountability

Type ofAccountability

Time interval

ParticipantAccountability

to whom

Person Post Organization

who

1

*

*

1

* 1

* 1

Page 42: General Modeling Principles: Building Blocks of Analysis Patterns PA116 – L2 (c) Zdenko Staníček, Sept 2010

42

Generalization up to analytic pattern Accountability

• Separate general knowledge of the world from operational level on which we keep track of particular states-of-the-world

• Implement general scope of accountability• Allow multiple inheritance (we inherit from

mother and also from father; subtype can have more supertypes)

• Subtypes of relational entity Scope and explanation what is the scope for (subtype entities of the Scope)

Page 43: General Modeling Principles: Building Blocks of Analysis Patterns PA116 – L2 (c) Zdenko Staníček, Sept 2010

43

Analytic pattern Accountabilityby Lubor Šešera, DATASEM'99

Region ofsales

Product typeResource type QuantityType ofhealth

care

1..*

Person Post Organization

Operational level

Knowledge level

supertype

subtype

to whom 1+

ParticipantAccountability

type typeswho 1+

Scope{abstract}

Place

Scope ofhealthcare

Scope ofresources

to whom

Type ofAccountability

Period

who

Type ofParticipant

type

* 10..1

*

1

*

1

*

1*1

*

*

1

*

*1

* *

* *

* 1

* 1

1

*

*

*

Page 44: General Modeling Principles: Building Blocks of Analysis Patterns PA116 – L2 (c) Zdenko Staníček, Sept 2010

44

Discussion

• Fear of special constructs

• Quo vadis SW development?

• Will we implement solutions after domain and situation analysis in the future? Or will we teach a Service System what to do?

• What customers want today?

• What will they want tomorrow?

• … and what they really need?