Chapter 9 Architectural Design - cs.appstate.edu

64
These slides are designed to accompany Software Engineering: A Practitioner’s Approach, 7/e (McGraw-Hill, 2009). Slides copyright 2009 by Roger Pressman. 1 Chapter 9 Architectural Design Slides in this presentation were taken from two sources: Software Engineering: A Practitioner’s Approach, 7/e by Roger S. Pressman Slides copyright © 1996, 2001, 2005, 2009 by Roger S. Pressman Object-Oriented Software Engineering: Using UML, Patterns, and Java, 2/e, Chapter 6 & 7 by Bernd Bruegge and Allen H. Dutoit The footer information identifies the source for each slide.

Transcript of Chapter 9 Architectural Design - cs.appstate.edu

Page 1: Chapter 9 Architectural Design - cs.appstate.edu

These slides are designed to accompany Software Engineering: A Practitioner’s Approach, 7/e (McGraw-Hill, 2009). Slides copyright 2009 by Roger Pressman. 1

Chapter 9 Architectural DesignSlides in this presentation were taken from two sources:

Software Engineering: A Practitioner’s Approach, 7/eby Roger S. Pressman

Slides copyright © 1996, 2001, 2005, 2009 by Roger S. Pressman

Object-Oriented Software Engineering: Using UML, Patterns, and Java, 2/e, Chapter 6 & 7by Bernd Bruegge and Allen H. Dutoit

The footer information identifies the source for each slide.

Page 2: Chapter 9 Architectural Design - cs.appstate.edu

These slides are designed to accompany Software Engineering: A Practitioner’s Approach, 7/e (McGraw-Hill, 2009). Slides copyright 2009 by Roger Pressman. 2

Why Architecture?

The architecture is not the operational software. Rather, it is a representation that enables a software engineer to:

(1) analyze the effectiveness of the design in meeting its stated requirements,

(2) consider architectural alternatives at a stage when making design changes is still relatively easy, and

(3) reduce the risks associated with the construction of the software.

Page 3: Chapter 9 Architectural Design - cs.appstate.edu

These slides are designed to accompany Software Engineering: A Practitioner’s Approach, 7/e (McGraw-Hill, 2009). Slides copyright 2009 by Roger Pressman. 3

Why is Architecture Important?Representations of software architecture are an enabler for communication between all parties (stakeholders) interested in the development of a computer-based system.The architecture highlights early design decisions that will have a profound impact on all software engineering work that follows and, as important, on the ultimate success of the system as an operational entity.Architecture “constitutes a relatively small, intellectually graspable mode of how the system is structured and how its components work together” [BAS03].

Page 4: Chapter 9 Architectural Design - cs.appstate.edu

These slides are designed to accompany Software Engineering: A Practitioner’s Approach, 7/e (McGraw-Hill, 2009). Slides copyright 2009 by Roger Pressman. 4

Architectural DescriptionsThe IEEE Computer Society has proposed IEEE-Std-1471-2000, Recommended Practice for Architectural Description of Software-Intensive System, [IEE00]

to establish a conceptual framework and vocabulary for use during the design of software architecture, to provide detailed guidelines for representing an architectural description, and to encourage sound architectural design practices.

The IEEE Standard defines an architectural description (AD) as a “a collection of products to document an architecture.”

The description itself is represented using multiple views, where each view is “a representation of a whole system from the perspective of a related set of [stakeholder] concerns.”

Page 5: Chapter 9 Architectural Design - cs.appstate.edu

These slides are designed to accompany Software Engineering: A Practitioner’s Approach, 7/e (McGraw-Hill, 2009). Slides copyright 2009 by Roger Pressman. 5

Architectural GenresGenre implies a specific category within the overall software domain. Within each category, you encounter a number of subcategories.

For example, within the genre of buildings, you would encounter the following general styles: houses, condos, apartment buildings, office buildings, industrial building, warehouses, and so on. Within each general style, more specific styles might apply. Each style would have a structure that can be described using a set of predictable patterns.

Page 6: Chapter 9 Architectural Design - cs.appstate.edu

These slides are designed to accompany Software Engineering: A Practitioner’s Approach, 7/e (McGraw-Hill, 2009). Slides copyright 2009 by Roger Pressman. 6

Architectural Styles

Data-centered architecturesData flow architecturesCall and return architecturesObject-oriented architecturesLayered architectures

Each style describes a system category that encompasses: (1) a set of components (e.g., a database, computational modules) that perform a function required by a system, (2) a set of connectors that enable “communication, coordination and cooperation” among components, (3) constraints that define how components can be integrated to form the system, and (4) semantic models that enable a designer to understand the overall properties of a system by analyzing the known properties of its constituent parts.

Page 7: Chapter 9 Architectural Design - cs.appstate.edu

These slides are designed to accompany Software Engineering: A Practitioner’s Approach, 7/e (McGraw-Hill, 2009). Slides copyright 2009 by Roger Pressman. 7

Data-Centered Architecture

Page 8: Chapter 9 Architectural Design - cs.appstate.edu

These slides are designed to accompany Software Engineering: A Practitioner’s Approach, 7/e (McGraw-Hill, 2009). Slides copyright 2009 by Roger Pressman. 8

Data Flow Architecture

Page 9: Chapter 9 Architectural Design - cs.appstate.edu

These slides are designed to accompany Software Engineering: A Practitioner’s Approach, 7/e (McGraw-Hill, 2009). Slides copyright 2009 by Roger Pressman. 9

Call and Return Architecture

Page 10: Chapter 9 Architectural Design - cs.appstate.edu

These slides are designed to accompany Software Engineering: A Practitioner’s Approach, 7/e (McGraw-Hill, 2009). Slides copyright 2009 by Roger Pressman. 10

Layered Architecture

Page 11: Chapter 9 Architectural Design - cs.appstate.edu

These slides are designed to accompany Software Engineering: A Practitioner’s Approach, 7/e (McGraw-Hill, 2009). Slides copyright 2009 by Roger Pressman. 11

Architectural PatternsConcurrency—applications must handle multiple tasks in a manner that simulates parallelism

operating system process management patterntask scheduler pattern

Persistence—Data persists if it survives past the execution of the process that created it. Two patterns are common:

a database management system pattern that applies the storage and retrieval capability of a DBMS to the application architecturean application level persistence pattern that builds persistence features into the application architecture

Distribution— the manner in which systems or components within systems communicate with one another in a distributed environment

A broker acts as a ‘middle-man’ between the client component and a server component.

Page 12: Chapter 9 Architectural Design - cs.appstate.edu

These slides are designed to accompany Software Engineering: A Practitioner’s Approach, 7/e (McGraw-Hill, 2009). Slides copyright 2009 by Roger Pressman. 12

Architectural DesignThe software must be placed into context

the design should define the external entities (other systems, devices, people) that the software interacts with and the nature of the interaction

A set of architectural archetypes should be identified

An archetype is an abstraction (similar to a class) that represents one element of system behavior

The designer specifies the structure of the system by defining and refining software components that implement each archetype

Page 13: Chapter 9 Architectural Design - cs.appstate.edu

These slides are designed to accompany Software Engineering: A Practitioner’s Approach, 7/e (McGraw-Hill, 2009). Slides copyright 2009 by Roger Pressman. 13

Architectural Context

target system: Security Function

usesuses peershomeowner

Safehome Product

Internet-based system

surveillance function

sensors

control panel

sensors

uses

Page 14: Chapter 9 Architectural Design - cs.appstate.edu

These slides are designed to accompany Software Engineering: A Practitioner’s Approach, 7/e (McGraw-Hill, 2009). Slides copyright 2009 by Roger Pressman. 14

Archetypes

Page 15: Chapter 9 Architectural Design - cs.appstate.edu

These slides are designed to accompany Software Engineering: A Practitioner’s Approach, 7/e (McGraw-Hill, 2009). Slides copyright 2009 by Roger Pressman. 15

Component Structure

Page 16: Chapter 9 Architectural Design - cs.appstate.edu

These slides are designed to accompany Software Engineering: A Practitioner’s Approach, 7/e (McGraw-Hill, 2009). Slides copyright 2009 by Roger Pressman. 16

Refined Component Structure

Page 17: Chapter 9 Architectural Design - cs.appstate.edu

Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 16

Component Diagram

♦ Component DiagramA graph of components connected by dependency relationships.Shows the dependencies among software components

source code, linkable libraries, executables

♦ Dependencies are shown as dashed arrows from the client component to the supplier component.

The kinds of dependencies are implementation language specific.

♦ A component diagram may also be used to show dependencies on a façade:

Use dashed arrow the corresponding UML interface.

Page 18: Chapter 9 Architectural Design - cs.appstate.edu

Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 17

Component Diagram Example

UML InterfaceUML Component

Scheduler

Planner

GUI

reservations

update

Page 19: Chapter 9 Architectural Design - cs.appstate.edu

Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 18

Deployment Diagram

♦ Deployment diagrams are useful for showing a system design after the following decisions are made

Subsystem decompositionConcurrencyHardware/Software Mapping

♦ A deployment diagram is a graph of nodes connected by communication associations.

Nodes are shown as 3-D boxes.Nodes may contain component instances. Components may contain objects (indicating that the object is part of the component)

Page 20: Chapter 9 Architectural Design - cs.appstate.edu

Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 19

Deployment Diagram Example

RuntimeDependency

Compile TimeDependency

:Planner

:PC

:Scheduler

:HostMachine<<database>>

meetingsDB

Page 21: Chapter 9 Architectural Design - cs.appstate.edu

These slides are designed to accompany Software Engineering: A Practitioner’s Approach, 7/e (McGraw-Hill, 2009). Slides copyright 2009 by Roger Pressman. 17

Analyzing Architectural Design

1. Collect scenarios. 2. Elicit requirements, constraints, and environment description. 3. Describe the architectural styles/patterns that have been chosen to address the scenarios and requirements:

• module view• process view• data flow view

4. Evaluate quality attributes by considered each attribute in isolation. 5. Identify the sensitivity of quality attributes to various architectural attributes for a specific architectural style. 6. Critique candidate architectures (developed in step 3) using the sensitivity analysis conducted in step 5.

Page 22: Chapter 9 Architectural Design - cs.appstate.edu

These slides are designed to accompany Software Engineering: A Practitioner’s Approach, 7/e (McGraw-Hill, 2009). Slides copyright 2009 by Roger Pressman. 18

Architectural Complexitythe overall complexity of a proposed architecture is assessed by considering the dependencies between components within the architecture [Zha98]

Sharing dependencies represent dependence relationships among consumers who use the same resource or producers who produce for the same consumers.Flow dependencies represent dependence relationships between producers and consumers of resources.Constrained dependencies represent constraints on the relative flow of control among a set of activities.

Page 23: Chapter 9 Architectural Design - cs.appstate.edu

These slides are designed to accompany Software Engineering: A Practitioner’s Approach, 7/e (McGraw-Hill, 2009). Slides copyright 2009 by Roger Pressman. 19

ADLArchitectural description language (ADL) provides a semantics and syntax for describing a software architectureProvide the designer with the ability to:

decompose architectural componentscompose individual components into larger architectural blocks and represent interfaces (connection mechanisms) between components.

Page 24: Chapter 9 Architectural Design - cs.appstate.edu

These slides are designed to accompany Software Engineering: A Practitioner’s Approach, 7/e (McGraw-Hill, 2009). Slides copyright 2009 by Roger Pressman. 20

An Architectural Design Method

"four bedrooms, three baths,lots of glass ..."

customer requirements

architectural design

Page 25: Chapter 9 Architectural Design - cs.appstate.edu

These slides are designed to accompany Software Engineering: A Practitioner’s Approach, 7/e (McGraw-Hill, 2009). Slides copyright 2009 by Roger Pressman. 21

Deriving Program Architecture

ProgramArchitecture

Page 26: Chapter 9 Architectural Design - cs.appstate.edu

These slides are designed to accompany Software Engineering: A Practitioner’s Approach, 7/e (McGraw-Hill, 2009). Slides copyright 2009 by Roger Pressman. 22

Partitioning the Architecture“horizontal” and “vertical” partitioning are required

Page 27: Chapter 9 Architectural Design - cs.appstate.edu

These slides are designed to accompany Software Engineering: A Practitioner’s Approach, 7/e (McGraw-Hill, 2009). Slides copyright 2009 by Roger Pressman. 23

Horizontal Partitioningdefine separate branches of the module hierarchy for each major functionuse control modules to coordinate communication between functions

function 1 function 3

function 2

Page 28: Chapter 9 Architectural Design - cs.appstate.edu

These slides are designed to accompany Software Engineering: A Practitioner’s Approach, 7/e (McGraw-Hill, 2009). Slides copyright 2009 by Roger Pressman. 24

Vertical Partitioning: Factoringdesign so that decision making and work are stratifieddecision making modules should reside at the top of the architecture

workers

decision-makers

Page 29: Chapter 9 Architectural Design - cs.appstate.edu

Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 26

F:SubsystemE:Subsystem G:Subsystem

D:SubsystemC:SubsystemB:Subsystem

A: Subsystem Layer 1

Layer 2

Layer 3

Subsystem Decomposition into Layers

♦ Subsystem Decomposition Heuristics:♦ No more than 7+/-2 subsystems

More subsystems increase cohesion but also complexity (more services)

♦ No more than 4+/-2 layers, use 3 layers (good)

Page 30: Chapter 9 Architectural Design - cs.appstate.edu

Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 27

Relationships between Subsystems

♦ Layer relationshipLayer A “Calls” Layer B (runtime)Layer A “Depends on” Layer B (“make” dependency, compile time)

♦ Partition relationshipThe subsystem have mutual but not deep knowledge about each otherPartition A “Calls” partition B and partition B “Calls” partition A

Page 31: Chapter 9 Architectural Design - cs.appstate.edu

Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 28

Virtual Machine

♦ Dijkstra: T.H.E. operating system (1965)A system should be developed by an ordered set of virtual machines, each built in terms of the ones below it.

VM4

VM3

VM2

VM1C1attropr

C1attropr

C1attropr

C1attropr

C1attropr

C1attropr

C1attropr

C1attropr

Problem

Existing System

Page 32: Chapter 9 Architectural Design - cs.appstate.edu

Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 29

Virtual Machine

♦ A virtual machine is an abstraction It provides a set of attributes and operations.

♦ A virtual machine is a subsystem It is connected to higher and lower level virtual machines by "provides services for" associations.

♦ Virtual machines can implement two types of software architecture

Open and closed architectures.

Page 33: Chapter 9 Architectural Design - cs.appstate.edu

Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 30

Closed Architecture (Opaque Layering)

♦ Any layer can only invoke operations from the immediate layer below

♦ Design goal: High maintainability, flexibility

VM4

VM3

VM2

VM1C1

attrop

C1attrop

C1attrop

C1attrop

C1attrop

C1attrop

C1attrop

C1attrop

C1attrop

Page 34: Chapter 9 Architectural Design - cs.appstate.edu

Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 31

Open Architecture (Transparent Layering)

♦ Any layer can invoke operations from any layers below

♦ Design goal: Runtime efficiency

VM4

VM3

VM2

VM1C1

attrop

C1attrop

C1attrop

C1attrop

C1attrop

C1attrop

C1attrop

C1attrop

C1attrop

Page 35: Chapter 9 Architectural Design - cs.appstate.edu

These slides are designed to accompany Software Engineering: A Practitioner’s Approach, 7/e (McGraw-Hill, 2009). Slides copyright 2009 by Roger Pressman. 25

Why Partitioned Architecture?

results in software that is easier to testleads to software that is easier to maintainresults in propagation of fewer side effectsresults in software that is easier to extend

Page 36: Chapter 9 Architectural Design - cs.appstate.edu

These slides are designed to accompany Software Engineering: A Practitioner’s Approach, 7/e (McGraw-Hill, 2009). Slides copyright 2009 by Roger Pressman. 26

Structured Designobjective: to derive a program architecture that is partitionedapproach:

a DFD is mapped into a program architecturethe PSPEC and STD are used to indicate the content of each module

notation: structure chart

Page 37: Chapter 9 Architectural Design - cs.appstate.edu

These slides are designed to accompany Software Engineering: A Practitioner’s Approach, 7/e (McGraw-Hill, 2009). Slides copyright 2009 by Roger Pressman. 27

Flow Characteristics

Transform flow

Transactionflow

This edition of SEPA does not cover transaction mapping. For a detailed discussion see the SEPA website

Page 38: Chapter 9 Architectural Design - cs.appstate.edu

These slides are designed to accompany Software Engineering: A Practitioner’s Approach, 7/e (McGraw-Hill, 2009). Slides copyright 2009 by Roger Pressman. 28

General Mapping Approachisolate incoming and outgoing flow boundaries; for transaction flows, isolate the transaction center

working from the boundary outward, mapDFD transforms into corresponding modules

add control modules as required

refine the resultant program structureusing effective modularity concepts

Page 39: Chapter 9 Architectural Design - cs.appstate.edu

These slides are designed to accompany Software Engineering: A Practitioner’s Approach, 7/e (McGraw-Hill, 2009). Slides copyright 2009 by Roger Pressman. 29

General Mapping ApproachIsolate the transform center by specifying incoming and outgoing flow boundariesPerform "first-level factoring.”

The program architecture derived using this mapping results in a top-down distribution of control.

Factoring leads to a program structure in which top-level components perform decision-making and low-level components perform most input, computation, and output work.

Middle-level components perform some control and do moderate amounts of work.

Perform "second-level factoring."

Page 40: Chapter 9 Architectural Design - cs.appstate.edu

These slides are designed to accompany Software Engineering: A Practitioner’s Approach, 7/e (McGraw-Hill, 2009). Slides copyright 2009 by Roger Pressman. 30

Transform Mapping

Page 41: Chapter 9 Architectural Design - cs.appstate.edu

These slides are designed to accompany Software Engineering: A Practitioner’s Approach, 7/e (McGraw-Hill, 2009). Slides copyright 2009 by Roger Pressman. 31

Factoring

Page 42: Chapter 9 Architectural Design - cs.appstate.edu

These slides are designed to accompany Software Engineering: A Practitioner’s Approach, 7/e (McGraw-Hill, 2009). Slides copyright 2009 by Roger Pressman. 32

First Level Factoringmain

programcontroller

inputcontroller

processingcontroller

outputcontroller

Page 43: Chapter 9 Architectural Design - cs.appstate.edu

These slides are designed to accompany Software Engineering: A Practitioner’s Approach, 7/e (McGraw-Hill, 2009). Slides copyright 2009 by Roger Pressman. 33

Second Level Mapping

Page 44: Chapter 9 Architectural Design - cs.appstate.edu

Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 33

Software Architectural Styles

♦ Subsystem decompositionIdentification of subsystems, services, and their relationship to each other.

♦ Specification of the system decomposition is critical.♦ Patterns for software architecture

Client/ServerPeer-To-PeerRepositoryModel/View/Controller Pipes and Filters

Page 45: Chapter 9 Architectural Design - cs.appstate.edu

Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 34

Client/Server Architectural Style

♦ One or many servers provides services to instances of subsystems, called clients.

♦ Client calls on the server, which performs some service and returns the result

Client knows the interface of the server (its service)Server does not need to know the interface of the client

♦ Response in general immediately ♦ Users interact only with the client

Client

Server

service1()service2()

serviceN()…

**

requester provider

Page 46: Chapter 9 Architectural Design - cs.appstate.edu

Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 35

Client/Server Architectural Style♦ Often used in database systems:

Front-end: User application (client)Back end: Database access and manipulation (server)

♦ Functions performed by client:Customized user interfaceFront-end processing of dataInitiation of server remote procedure callsAccess to database server across the network

♦ Functions performed by the database server:Centralized data managementData integrity and database consistencyDatabase securityConcurrent operations (multiple user access)Centralized processing (for example archiving)

Page 47: Chapter 9 Architectural Design - cs.appstate.edu

Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 36

Design Goals for Client/Server Systems♦ Service Portability

Server can be installed on a variety of machines and operating systems and functions in a variety of networking environments

♦ Transparency, Location-TransparencyThe server might itself be distributed (why?), but should provide a single "logical" service to the user

♦ PerformanceClient should be customized for interactive display-intensive tasksServer should provide CPU-intensive operations

♦ ScalabilityServer should have spare capacity to handle larger number of clients

♦ FlexibilityThe system should be usable for a variety of user interfaces and end devices (eg. WAP Handy, wearable computer, desktop)

♦ ReliabilitySystem should survive node or communication link problems

Page 48: Chapter 9 Architectural Design - cs.appstate.edu

Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 37

Problems with Client/Server Architectural Styles

♦ Layered systems do not provide peer-to-peer communication

♦ Peer-to-peer communication is often needed♦ Example: Database receives queries from application but

also sends notifications to application when data have changed

Page 49: Chapter 9 Architectural Design - cs.appstate.edu

Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 38

Peer-to-Peer Architectural Style♦ Generalization of Client/Server Architecture♦ Clients can be servers and servers can be clients♦ More difficult because of possibility of deadlocks

Peer

service1()service2()

serviceN()…

requester

provider

*

*

application1:DBUser

database:DBMS

application2:DBUser

1. updateData

2. changeNotification

Page 50: Chapter 9 Architectural Design - cs.appstate.edu

Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 43

Model/View/Controller♦ Subsystems are classified into 3 different types

Model subsystem: Responsible for application domain knowledgeView subsystem: Responsible for displaying application domain objects to the userController subsystem: Responsible for sequence of interactions with the user and notifying views of changes in the model.

♦ MVC is a special case of a repository architecture:Model subsystem implements the central datastructure, the Controller subsystem explicitly dictate the control flow

Controller

Model

subscribernotifier

initiator

*

repository1

1

*

View

Page 51: Chapter 9 Architectural Design - cs.appstate.edu

Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 44

Example of a File System Based on the MVC Architectural Style

Page 52: Chapter 9 Architectural Design - cs.appstate.edu

Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 45

Sequence of Events (Collaborations)

:Controller

:InfoView

:Model

2.User types new filename

1. Views subscribe to event

3. Request name change in model

4. Notify subscribers

5. Updated views

:FolderView

Page 53: Chapter 9 Architectural Design - cs.appstate.edu

Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 46

Repository Architectural Style (Blackboard Architecture, Hearsay II Speech Recognition System)

♦ Subsystems access and modify data from a single data structure♦ Subsystems are loosely coupled (interact only through the

repository)♦ Control flow is dictated by central repository (triggers) or by

the subsystems (locks, synchronization primitives)

Subsystem

Repository

createData()setData()getData()searchData()

Page 54: Chapter 9 Architectural Design - cs.appstate.edu

Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 47

Examples of Repository Architectural Style

♦ Hearsay II speech understanding system (“Blackboard architecture”)

♦ Database Management Systems

♦ Modern Compilers

LexicalAnalyzer

SyntacticAnalyzerSemanticAnalyzer

CodeGenerator

Compiler

SyntacticEditor

ParseTree SymbolTable

Repository

SourceLevelDebugger

Optimizer

Page 55: Chapter 9 Architectural Design - cs.appstate.edu

Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 20

5. Data Management♦ Some objects in the models need to be persistent

Provide clean separation points between subsystems with well-defined interfaces.

♦ A persistent object can be realized with one of the followingData structure

If the data can be volatileFiles

Cheap, simple, permanent storageLow level (Read, Write)Applications must add code to provide suitable level of abstraction

DatabasePowerful, easy to portSupports multiple writers and readers

Page 56: Chapter 9 Architectural Design - cs.appstate.edu

Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 21

File or Database?

♦ When should you choose a file?Are the data voluminous (bit maps)?Do you have lots of raw data (core dump, event trace)?Do you need to keep the data only for a short time?Is the information density low (archival files,history logs)?

♦ When should you choose a database?Do the data require access at fine levels of details by multiple users?Must the data be ported across multiple platforms (heterogeneoussystems)?Do multiple application programs access the data?Does the data management require a lot of infrastructure?

Page 57: Chapter 9 Architectural Design - cs.appstate.edu

Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 22

Database Management System

♦ Contains mechanisms for describing data, managing persistent storage and for providing a backup mechanism

♦ Provides concurrent access to the stored data♦ Contains information about the data (“meta-data”), also called

data schema.

Page 58: Chapter 9 Architectural Design - cs.appstate.edu

Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 23

Issues To Consider When Selecting a Database

♦ Storage spaceDatabase require about triple the storage space of actual data

♦ Response timeMode databases are I/O or communication bound (distributed databases). Response time is also affected by CPU time, locking contention and delays from frequent screen displays

♦ Locking modesPessimistic locking: Lock before accessing object and release when object access is completeOptimistic locking: Reads and writes may freely occur (high concurrency!) When activity has been completed, database checks if contention has occurred. If yes, all work has been lost.

♦ AdministrationLarge databases require specially trained support staff to set up security policies, manage the disk space, prepare backups, monitor performance, adjust tuning.

Page 59: Chapter 9 Architectural Design - cs.appstate.edu

Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 25

Relational Databases

♦ Based on relational algebra♦ Data is presented as 2-dimensional tables. Tables have a

specific number of columns and and arbitrary numbers of rowsPrimary key: Combination of attributes that uniquely identify a row in a table. Each table should have only one primary keyForeign key: Reference to a primary key in another table

♦ SQL is the standard language defining and manipulating tables.♦ Leading commercial databases support constraints.

Referential integrity, for example, means that references to entries in other tables actually exist.

Page 60: Chapter 9 Architectural Design - cs.appstate.edu

Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 26

Data Management Questions

♦ Should the data be distributed?♦ Should the database be extensible?♦ How often is the database accessed?♦ What is the expected request (query) rate? In the worst case?♦ What is the size of typical and worst case requests?♦ Do the data need to be archived?♦ Does the system design try to hide the location of the databases

(location transparency)?♦ Is there a need for a single interface to access the data?♦ What is the query format? ♦ Should the database be relational or object-oriented?

Page 61: Chapter 9 Architectural Design - cs.appstate.edu

Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 28

Defining Access Control

♦ In multi-user systems different actors have access to differentfunctionality and data.

During analysis we model these different accesses by associatingdifferent use cases with different actors.During system design we model these different accesses by examing the object model by determining which objects are shared among actors.

Depending on the security requirements of the system, we also define how actors are authenticated to the system and how selected data in the systemshould be encrypted.

Page 62: Chapter 9 Architectural Design - cs.appstate.edu

Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 29

Access Matrix

♦ We model access on classes with an access matrix.The rows of the matrix represents the actors of the systemThe column represent classes whose access we want to control.

♦ Access Right: An entry in the access matrix. It lists the operations that can be executed on instances of the class by the actor.

Page 63: Chapter 9 Architectural Design - cs.appstate.edu

Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 30

Access Matrix Implementations

♦ Global access table: Represents explicitly every cell in the matrix as a (actor,class, operation) tuple.

Determining if an actor has access to a specific object requires looking up the corresponding tuple. If no such tuple is found, access is denied.

♦ Access control list associates a list of (actor,operation) pairs with each class to be accessed.

Every time an object is accessed, its access list is checked for the corresponding actor and operation.Example: guest list for a party.

♦ A capability associates a (class,operation) pair with an actor.A capability provides an actor to gain control access to an object of

the class described in the capability.Example: An invitation card for a party.

♦ Which is the right implementation?

Page 64: Chapter 9 Architectural Design - cs.appstate.edu

Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 31

Global Resource Questions

♦ Does the system need authentication?♦ If yes, what is the authentication scheme?

User name and password? Access control listTickets? Capability-based

♦ What is the user interface for authentication?♦ Does the system need a network-wide name server?♦ How is a service known to the rest of the system?

At runtime? At compile time?By port?By name?