software specification and architecture...

24
Software Specification and Architecture 2IW80 Julien Schmaltz (slides from A. Serebrenik) Lecture 06: Structural specification: beyond class diagrams

Upload: truongtuyen

Post on 05-Mar-2019

213 views

Category:

Documents


0 download

TRANSCRIPT

Software Specification and Architecture 2IW80Julien Schmaltz (slides from A. Serebrenik)

Lecture 06: Structural specification: beyond class diagrams

/ SET / W&I2

Reminder - This week

» Homework 3 – Today 17:15 – Thursday 23:59 – PDF only !!

» Group assignment 2: Specification – Thursday, March 10, 23:59 – Start working on it !!

09/02/15

3

UML Tools

» Non-commercial tool » Umbrella UML: https://umbrello.kde.org » yEd Graph Editor (help —> example graphs —> UML)

» Commercial tools » IBM Rational Rhapsody » Enterprise Architect

» TU/e has licenses for IBM Rhapsody » AT students have it already » IBM Rhapsody runs on Windows + Linux » We are working on getting the tool to other students. » Check the non-commercial tools for now.

4

On multiplicity and associations

» We will basically keep three possibilities (see next slides)

» All other possibilities mentioned in the course » you know they exist » you may use them in your group assignment » you won’t be ask about them at the examination

» The three possibilities » you will surely be asked about them at the examination

5

Possibility 1: Bi-directional arrow

Wheelm n

Car

Car has a reference to Wheel. Wheel has a reference to Car. Every instance of Wheel can be associated with n instance(s) of Car. Every instance of Car can be associated with m instance(s) of Wheel. An instance of Wheel may exist without an instance of Car. An instance of Car may exist without an instance of Wheel.

6

Possibility 2: Uni-directional arrow

Wheelm n

Car

Car has a reference to Wheel. An instance of Wheel has **NO** reference to instances of Car. Every instance of Wheel can be associated with n instance(s) of Car. Every instance of Car can be associated with m instance(s) of Wheel. An instance of Wheel may exist without an instance of Car. An instance of Car may exist without an instance of Wheel.

7

Possibility 3: Composition

Wheelm

Car

Car has a reference to Wheel. An instance of Wheel has **NO** reference to instances of Car. Every instance of Wheel can be associated with 1 instance(s) of Car. Every instance of Car can be associated with m instance(s) of Wheel. An instance of Wheel may **NOT** exist without an instance of Car. An instance of Car may exist without an instance of Wheel.

/ SET / W&I8

24/02/15

Before we start

– A patient must be assigned to only one doctor, and a doctor has one or more patients.

Patientx y Doctor

Determine x and y

/ SET / W&I9

24/02/15

Before we start

– A patient must be assigned to only one doctor, and a doctor can have one or more patients.

Patient1..* 1 Doctor

10

Multiplicity of composition

Wheelm

Car1

By definition of a composition, instances of Wheel are associated with at most 1 instance of Car. So, n is by definition always 1.

/ SET / W&I11

24/02/15

Before we start

» Match the pairs

1 Association A2 Aggregation B3 Composition C4 Implementation D5 Generalization E6 Dependency F

/ SET / W&I12

24/02/15

Before we start

» Match the pairs

1 Association A2 Aggregation B3 Composition C4 Implementation D5 Generalization E6 Dependency F

1E 2C 3F 4A 5D 6B

13

This week sources

Slides by

David Meredith, Aalborg University, DK

Marie-Elise Kontro, Tampere University, FI

Site by

Kirill Fakhroutdinov GE Healthcare, USA

/ SET / W&I14

Recall

Structural diagram is a diagram that identifies modules, activities, or other entities in a system or computer program and shows how larger or more general entities break down into smaller, more specific entities.

IEEE Standard Glossary of Software Engineering Terminology 610.12 1990

24/02/15

15

UML diagram types

Classes: Chapter 11.4 of the UML standard.

/ SET / W&I16

UML structure diagrams

24/02/15

Class diagram

Composite structure diagram

Packages diagram

Component diagram

Object diagram

Deployment diagramTODAY

/ SET / W&I17

Component diagrams

» Component: a modular unit with well-defined interfaces that is replaceable within its environment (UML Superstructure Specification, v.2.0, Chapter 8)

– fosters reuse – stresses interfaces

» Graphical representation: special kind of class

24/02/15

<<component>>

Account Account Account

UML 1 UML 2

/ SET / W&I18

Component diagrams

» Component: a modular unit with well-defined interfaces that is replaceable within its environment (UML Superstructure Specification, v.2.0, Chapter 8)

– fosters reuse – stresses interfaces

» Two views: black-box and white-box – Black-box view: interfaces provided and required only

24/02/15

/ SET / W&I19

Component diagrams

» Component: a modular unit with well-defined interfaces that is replaceable within its environment (UML Superstructure Specification, v.2.0, Chapter 8)

– fosters reuse – stresses interfaces

» Two views: black-box and white-box – Black-box view: interfaces provided and required only – White-box view: structure of interfaces and/or internal

structure

24/02/15

provided interface

required interface

/ SET / W&I20

Which notation indicates that I is provided by Account?

24/02/15

Account

Account

Account

Account

<<interface>> I

<<interface>> I

a) b)

c) d)

/ SET / W&I21

Which notation indicates that I is provided by Account?

24/02/15

Account

Account

Account

Account

<<interface>> I

<<interface>> I

a) b)

c) d)provided interface

provided interface

/ SET / W&I22

Nested components

» Components can be contained in other components » Interfaces can then be delegated through ports

24/02/15

/ SET / W&I23

Summary: UML component diagrams

24/02/15http://www.uml-diagrams.org/component-diagrams.html

24

UML diagram types

Classes: Chapter 11.4 of the UML standard.