+ All Categories
Home > Documents > Ch4: Software Architecture and Design

Ch4: Software Architecture and Design

Date post: 21-Jan-2016
Category:
Upload: hedya
View: 28 times
Download: 2 times
Share this document with a friend
Description:
Ch4: Software Architecture and Design. Modules: Interface vs. Implementation (contd..). Interface design considerations:. Module: Interface vs. Implementation (contd..). Symbol table. GET(Varname) returns (int,POS). Retrieve value. PUT(Varname,value) returns POS. Store new value. - PowerPoint PPT Presentation
Popular Tags:
33
Ch4: Software Architecture and Design
Transcript
Page 1: Ch4: Software Architecture and Design

Ch4: Software Architecture and Design

Page 2: Ch4: Software Architecture and Design

2

Modules: Interface vs. Implementation (contd..)

Interface design considerations:

Page 3: Ch4: Software Architecture and Design

3

Module: Interface vs. Implementation (contd..)

Symbol tableGET(Varname) returns (int,POS)

PUT(Varname,value) returns POS

CREATE(Varname,size)

Retrieve value

Store new value

New entry creationsize = #of entriesit represents

Page 4: Ch4: Software Architecture and Design

4

Module: Interface vs. Implementation (contd..)

Module symbol table hides:

Page 5: Ch4: Software Architecture and Design

5

Modules: Interface vs. implementation (contd..)

Support for prototyping:

Page 6: Ch4: Software Architecture and Design

6

Modules: Interface vs. Implementation (contd..)

Separation of interface and implementation supports information hiding:

Page 7: Ch4: Software Architecture and Design

7

Modules: Interface vs. Implementation (contd..)

Secrets that may be hidden in the module: How the algorithm works (quicksort, bubble sort, etc.) Data formats (Binary, ASCII, etc.) Data structure (linked list, array etc.) User interfaces (AWT) Texts (language specific grammars, spellings, etc.) Details of interfacing with input/output devices

Page 8: Ch4: Software Architecture and Design

8

Modules: Interface vs. Implementation (contd..)

openFile()closeFile()readFile()

File I/O module

Unix O/S AIX O/SWindows O/S

Page 9: Ch4: Software Architecture and Design

9

Advantages of modular designs

Page 10: Ch4: Software Architecture and Design

10

Properties of modular designs

Cohesion:

Coupling:

Page 11: Ch4: Software Architecture and Design

11

Top-down design strategy

General Specific

Page 12: Ch4: Software Architecture and Design

12

Bottom-up design strategy

Pieces Compose

Page 13: Ch4: Software Architecture and Design

13

Top-down vs. bottom-up design strategy

Which choice is better?

How should documentation be structured?

Page 14: Ch4: Software Architecture and Design

14

IS_COMPONENT_OF revisited

M1

M M

M MM M M

2 4

5 67 8 9

M3

M MM M M5 67 8 9

M2 M3 M4

M1

(IS_COMPONENT_OF) (COMPRISES)

What design strategy do the relations IS_COMPONENT_OF & COMPRISESdepict?

Page 15: Ch4: Software Architecture and Design

15

Design notation

Why do we need a design notation?

What are the different types of design notation?

Page 16: Ch4: Software Architecture and Design

16

Textual Design Notation (TDN)

Textual design notation loosely based on Ada Interface description

Module may export:

Comments are used to describe

Page 17: Ch4: Software Architecture and Design

17

TDN (contd..)

module X uses Y, Z exports var A : integer;

type B : array (1. .10) of real; procedure C ( D: in out B; E: in integer; F: in real); Here is an optional natural-language description of what A, B, and C actually are, along with possible constraints or properties that clients need to know; for example, we might specify that objects of type B sent to procedure C should be initialized by the client and should never contain all zeroes.

implementation If needed, here are general comments about the rationale of the modularization, hints on the implementation, etc. is composed of R, T

end X

Page 18: Ch4: Software Architecture and Design

18

TDN (contd..)

Uses

Implementation

An entity E exported by module M is denoted by M.E

Page 19: Ch4: Software Architecture and Design

19

TDN (contd..)

R

T

Y

X

X

•Export section:

•Consistency and completeness analysis:

Page 20: Ch4: Software Architecture and Design

20

Graphical design notation (GDN)

Graphical notation:

Y

Z Module

Module

X

A

B

R T Module Module

Module

C

B

Page 21: Ch4: Software Architecture and Design

21

Categories of modules

Advantages of categorization into modules:

Categories of modules:

Page 22: Ch4: Software Architecture and Design

22

Categories of modules: Standard categories

Functional modules:

Libraries:

Common pools of data:

Page 23: Ch4: Software Architecture and Design

23

Categories of modules (contd..)

Abstract objects

Abstract data types

Page 24: Ch4: Software Architecture and Design

24

Abstract objects

What is an abstract object:

Difference between an abstract object and a library module:

Page 25: Ch4: Software Architecture and Design

25

Abstract objects

Example of an abstract object: stack

Page 26: Ch4: Software Architecture and Design

26

Abstract objects (contd..)

PublicInterface

User

PUSHPOPTOPEMPTY

Private Implementation

DesignerHead: Int;ST: Array[100] of Int;

Push(X Int)…End;

Int Pop()…End;

TOP

5

1015

20

PUSH

5

20 15 10 5

20 15 10 5

ST

Page 27: Ch4: Software Architecture and Design

27

Motivating ADTs

All built in types are ADTs

Use of ADTs:

Page 28: Ch4: Software Architecture and Design

28

Motivating ADTs (contd..)

Applications may require multiple abstract objects of one “type”.

Abstract data types (ADTs) introduced to address these issues.

Page 29: Ch4: Software Architecture and Design

29

ADT definition

Page 30: Ch4: Software Architecture and Design

30

ADT examples

Set:

Multiset:

Sequence:

Graph:

Page 31: Ch4: Software Architecture and Design

31

Abstract data types: Stack example

Stack ADT

module STACK_HANDLER exports

type STACK = ?; This is an abstract data-type module; the data structure is a secret hidden in the implementation part. procedure PUSH (S: in out STACK ; VAL: in integer); procedure POP (S: in out STACK ; VAL: out integer); function EMPTY (S: in STACK) : BOOLEAN; . . .

end STACK_HANDLER

indicates that details of thedata structure are hidden to clients

Page 32: Ch4: Software Architecture and Design

32

Abstract objects vs. ADTs

OK

OK

TH

IS

GO

I

S

O

D

Module objectSingle instanceHas state

Multiple instancesADT has no state Stack S1, S2, S3;

STACK ofchars

STACK

Page 33: Ch4: Software Architecture and Design

33

Abstract data types: Summary

Proposed by B. Liskov (MIT) in 1975

Abstract data type:

ADTs and OO


Recommended