SEG 3100: SOFTWARE DEVELOPMENT FOR LARGE-SCALE SYSTEMS (MI) Lecture C3: Architectural Design Patterns

Note: For diagrams, refer to class notes

Main Categories:

a. Subsystem and Component Patterns b. Concurrency Patterns c. Memory Patterns d. Resource Patterns e. Distribution Patterns f. Reliability Patterns

Selected Patterns for Large Scale Software Systems:

A. Subsystem and Component Patterns

a. Layered Patterns

Layers pattern helps to structure applications that can be decomposed into groups of subtasks in which each group of subtasks is at a particular level of abstraction.

o Model View Controller (Interactive Systems) The Model-View-Controller pattern (MVC) divides an interactive application into three components. The model contains the core functionality and data. Views display information to the user. Controllers handle user input. Views and controllers together comprise the user interface. A change-propagation mechanism ensures consistency between the user interface and the model. o Presentation-Abstraction-Control (Interactive Systems) Allows multiple types of GUIs to be built from a single abstraction o Five Layer Architectural Pattern List of packages - Application Layer Package a. Manage users and their profiles b. Build user workspace c. Network Control d. OS Functions e. HW Functions f. Administrative functions g. Warnings and messages

- User Interface Package a. Workspace elements: Scroll bar, windows, progress bar, etc b. Workspace presentation c. Presentation and windows d. Login/Logoff e. User Interaction

- Communication Package a. Data Link Management (Circuits and protocols) b. Name Server access c. Data transport E.g. Use of CORBA model (Broker, Proxy patterns) d. Data conversion

- Abstract OS Package a. Information Hiding b. Virtual API (use Façade pattern) c. Manage memory d. Manage Tasks and threads

- Abstract HW Package a. API for virtual devices (sensors, actuators) b. Device drivers c. Bus interfaces d. Virtual processors

Can be used in the design and virtual implementation of complex real time systems, e.g. A7 Aircraft.

b. Micro-Kernel Architecture (Adaptable Systems)

The Microkernel pattern applies to software systems that must be able to adapt to changing system requirements. It separates a minimal functional core from extended functionality and customer- specific parts. The microkernel also serves as a socket for plugging in these extensions and coordinating their collaboration.

Examples and diagrams: See class room discussions c. ROOM Pattern (RealTime Object Oriented Methodology  RRRT)

Motivation behind RRRT. Developed by Bernie Selic at Nortel.

Classes in ROOM Pattern:

- Capsule - Ports - Protocols

Main features: - Each class’s behaviour can be described by a state-chart - State charts can be nested  Harel statecharts - Capsules can regarded as nested classes with structure and behaviour. - Capsules interact with other capsules using the ports - Bidirectional Interface classes are called ports. End port, relay port, conjugate port, internal port - - Protocol classes describe the message interaction rules Binary, conjugate - Ports associated with protocols - By splitting ports from the protocols, it is possible to establish circuits whose behaviour can be dynamically changed  powerful feature -

Disadvantage: Too heavy weight. Useful in medium to large scale modeling.

B. Concurrency Patterns

a. Interrupt Pattern - Scan for interrupts - Identify interrupt - Prioritize interrupt - Save state (Registers and Variables, Program Counter) - Obtain variables for the interrupt - Identify Interrupt Service Routine - Produce result - Restore the situation that was there prior to the arrival of the interrupt (Load the old registers, variables and the PC) - Start from the point you left off.

b. Pipe and Filter

The Pipes and Filters pattern provides a structure for systems that process a stream of data. Each processing step is encapsulated in a filter component. Data is passed through pipes between adjacent filters. Recombining filters allows you to build families of related systems.

c. Blackboard Pattern The Blackboard pattern is useful for problems for which no deterministic solution strategies are known. In Blackboard several specialized subsystems assemble their knowledge to build a possibly partial or approximate solution.

C. Memory Patterns [Ref 2]

a. Memory Allocation b. Garbage Collection c. Smart Pointer

D. Resource Patterns [Ref 2]

a. Critical Section b. Priority Inheritance c. Ordered Locking

E. Distribution Patterns [Ref 2]

a. Broker Pattern: The Broker pattern can be used to structure distributed software systems with decoupled components that interact by remote service invocations. A broker component is responsible for coordinating communication, such as forwarding requests, as well as for transmitting results and exceptions.

b. Observer Pattern c. Proxy Pattern d. Remote Procedure Call

References: 1. www.rationalrose.com/models/architectural_patterns.zip 2. Real Time Design Patterns: Bruce Douglass, Addison Wesley, 2003