CSE333 - University of Connecticut

Download Report

Transcript CSE333 - University of Connecticut

Software Architectures
Chapter 2: Architectural Styles
CSE333
Prof. Steven A. Demurjian, Sr.
Computer Science & Engineering Department
The University of Connecticut
191 Auditorium Road, Box U-155
Storrs, CT 06269-3155
[email protected]
http://www.engr.uconn.edu/~steve
(860) 486 - 4818
Copyright © 2000 by S. Demurjian, Storrs, CT.
SWA-1.1
Taxonomy of Architectural Styles

CSE333



Data Flow Systems
 Batch Sequential
 Pipes and Filters
Call & Return Systems

 Main/Subroutines
(C, Pascal)
 Object Oriented
 Implicit Invocation
 Hierarchical Systems

Virtual Machines
 Interpreters
 Rule Based Systems
Data Centered Systems
 DBS
 Hypertext
 Blackboards
Independent
Components
 Communicating
Processes/Event
Systems
Client/Server
 Two-Tier
 Multi-Tier
SWA-1.2
Taxonomy of Architectural Styles

Establish Framework of …
 Components
CSE333
 Building Blocks for Constructing Systems
 A Major Unit of Functionality
 Examples Include: Client, Server, Filter, Layer, DB

Connectors
 Defining the Ways that Components Interact
 What are the Protocols that Mandate the Allowable
Interactions Among Components?
 How are Protocols Enforced at Run/Design Time?
 Examples Include: Procedure Call, Event
Broadcast, DB Protocol, Pipe
SWA-1.3
Overall Framework
Consider a Question-Based Approach

CSE333 





What Is the Design Vocabulary?
 Connectors and Components
What Are Allowable Structural Patterns?
 Constraints on Combining Components &
Connectors
What Is the Underlying Conceptual Model?
 Von Newman, Parallel, Agent, Etc.
What Are Essential Invariants of a Style?
 Limits on Allowable Components &
Connectors
Common Examples of Usage
Advantages and Disadvantages of a Style
Common Specializations of a Style
SWA-1.4
Pipes and Filters
Components are Independent
Entities. No Shared State!
Components with
Input and Output
Sort
CSE333
Sort
Merge
Connectors for Flow Streams of I/O

Filters:
 Invariant: Unaware of up and Down Stream
Behavior
 Streamed Behavior: Output Could Go From
One Filter to the Next One Allowing Multiple
Filters to Run in Parallel.
SWA-1.5
Pipes and Filters

CSE333


Possible Specializations:
 Pipelines - Linear Sequence
 Bounded - Limits on Data Amounts
 Typed Pipes - Known Data Format
What is a Classic Example?
Other Examples:
 Compilers
 Sequential Processes
 Parallel Processes
SWA-1.6
Pipes and Filters
Another Example

CSE333
Text Information Retrieval Systems
 Scanning Newspapers for Key Words, Etc.
 Also, Boolean Search Expressions
User
Commands
Search
Disk
Controller
Controller
Programming
Result
Query
Resolver
Control
Term
Search
Comparator Data DB
SWA-1.7
ADTs and OO Architectures


Widespread Usage in the 1990’s
Advantages Are Well Known
CSE333
Components
op
obj
op
Connectors

op
obj
op
op
op
obj
obj
op
op
op
op
op
obj
obj
op
op
obj
obj
Disadvantages:
 Interaction Required Object Identity
 If Identity Changes, It Is Difficult to Track All
Affected Objects.
SWA-1.8
Implicit Invocation

CSE333 

Similar to OO in the Sense that Components Can
Call Services on Other Components
How Does this Work?
 Components Have List of Events they can
Raise and List of Procedures to Handle Events
 When Event is Raised, it is Broadcast
 All Components that Have Procedure to
Handle Broadcast Event will Act Upon it
 The Component That Raised the Event has no
Knowledge of Which Component(s) will
Handle Event
What are Some Examples?
SWA-1.9
Implicit Invocation

CSE333

Advantages
 No Need to Know the Targeted Components
 Single Event can Impact Multiple Components
 New Event Handlers can Easily be Added
 New Events Can then be Raised
Disadvantages
 No Control Over the Order of Processing
When an Event is Raised
 No Control Over “Who” and “How Many”
Process Events
 Very Non-Deterministic System Behavior
SWA-1.10
Layered Systems
Useful Systems
Base Utility
CSE333
Core
level



Users
Components - Virtual Machine at Each Layer
Connectors - Protocols That Specify How Layers Interact
Interaction Is Restricted to Adjacent Layers
SWA-1.11
Layered Systems

CSE333

Advantages:
 Increasing Levels of Abstraction
 Support Enhancement - New Layers
 Support for Reuse
Drawbacks:
 Not Feasible for All Systems
 Performance Issues With Multiple Layers
 Defining Abstractions Is Difficult.
SWA-1.12
ISO as Layered Architecture

CSE333
ISO Open Systems Interconnect (OSI) Model
 Now Widely Used as a Reference Architecture
 7-layer Model
 Provides Framework for Specific Protocols
(Such as IP, TCP, FTP, RPC, UDP, RSVP, …)
Application
Presentation
Session
Transport
Network
Data Link
Physical
Application
Presentation
Session
Transport
Network
Data Link
Physical
SWA-1.13
ISO OSI Model
Application
Presentation
Session
Transport
Network
Data Link
Physical
CSE333





Application
Presentation
Session
Transport
Network
Data Link
Physical
Physical (Hardware)/Data Link Layer Networks: Ethernet,
Token Ring, ATM
Network Layer Net: The Internet
Transport Layer Net: Tcp-based Network
Presentation/Session Layer Net: Http/html, RPC, PVM,
MPI
Applications, E.g., WWW, Window System, Algorithm
SWA-1.14
Repositories
ks8
ks1
CSE333
Blackboard
(shared data)
ks2
ks3
ks6
ks4




ks7
ks5
Knowledge Sources Interact With the Blackboard.
Blackboard Contains the Problem Solving State Data.
Control Is Driven by the State of the Blackboard.
DB Systems Are a Form of Repository With a Layer
Between the BB and the KSs - Supports
 Concurrent Access, Security, Integrity, Recovery
SWA-1.15
Database System as a Repository
c8
c1
CSE333
Database
(shared data)
c2
c3
c6
c4



c7
c5
Clients Interact With the DBMS
Database Contains the Problem Solving State Data
Control is Driven by the State of the Database
 Concurrent Access, Security, Integrity, Recovery
 Single Layer System: Clients have Direct Access
 Control of Access to Information must be
Carefully Defined within DB Security/Integrity
SWA-1.16
Interpreters
Inputs
CSE333
Outputs


Program being
interpreted
Data
(program state)
Simulated
interpretation
engine
Selected
instruction
Selected
data
Internal
interpreter
state
What Are Components and Connectors?
Where Have Interpreters Been Used in CS&E?
 LISP, ML, Java, Other Languages, OS
Command Line
SWA-1.17
Java as Interpreter
CSE333
SWA-1.18
Process Control Paradigms
Input variables
CSE333
Set
point
Ds to
manipulated
variables
Controller
Input variables
Set
point

Controller
Ds to
manipulated
variables
With Feedback
Process
Controlled
variable
Without Feedback
Process
Controlled
variable
Also:
 Open vs. Close Loop Systems
 Well Defined Control and Computational
Characters
 Heavily Used in Engineering Fields.
SWA-1.19
Process Architecture
UML Statechart Diagram?
CSE333
SWA-1.20
Process Architecture
UML Activity Diagram?
CSE333
Waiting for
Heart Signal
timeout
irregular beat
Heartbeat
Heart Signal
Waiting for
Resp. Signal
Breath
Trigger
Local
Alarm
Trigger
Remote
Alarm
Resp Signal
Alarm Reset
SWA-1.21
Client/Server
Single and Multi-Tier Architectures

CSE333 
Widespread use in Practice for All Types of
Distributed Systems and Applications
Two Kinds of Components
 Servers: Provide Services - May be Unaware of
Clients
 Web Servers (unaware?)
 Database Servers and Functional Servers (aware?)

Clients: Request Services from Servers
 Must Identify Servers
 May Need to Identify Self
 A Server Can be Client of Another Server
SWA-1.22
Client/Server
Single and Multi-Tier Architectures

CSE333 



Normally, Clients and Servers are Independent
Processes Running in Parallel
Connectors Provide Means for Service Requests
and Answers to be Passes Among Clients/Servers
Connectors May be RPC, RMI, etc.
Advantages
 Parallelism, Independence
 Separation of Concerns, Abstraction
 Others?
Disadvantages
 Complex Implementation Mechanisms
 Scalability, Correctness, Real-Time Limits
 Others?
SWA-1.23
Example:
Software Architectural Structure
Initial Data
Entry Operator
(Scanning &
Posting)
Advanced Data
Entry
Operators
Analyst
Manager
CSE333
10-100MB Network
Document
Server
Stored
Images/CD
Database
Server
Running
Oracle
RMI Registry
RMI Act.
Obj/Server
RMI Act.
Obj/Server
Functional Server
SWA-1.24
Business Process Model:
Scanning and Initial Data Entry
DB
DB
Historical Completed
Records Applications
CSE333
Licensing
DB
Supervisor
Review
Scanner
DB
Licensing
Division
Scanning
Operator
Stored
Images
Licensing Division Printer
Data Entry Operator
DB
Basic
Information
Entered
New Licenses
New Appointments
FOI
Letters (Request
Information, etc.)
SWA-1.25
Two-Tier Architecture


CSE333



Small Manufacturer Previously on C++
New Order Entry, Inventory, and Invoicing
Applications in Java Programming Language
Existing Customer and Order Database
Most of Business Logic in Stored Procedures
Tool-generated GUI Forms for Java Objects
SWA-1.26
Three-Tier Architecture


CSE333




Passenger Check-in for Regional Airline
Local Database for Seating on Today's Flights
Clients Invoke EJBs at Local Site Through RMI
EJBs Update Database and Queue Updates
JMS Queues Updates to Legacy System
DBC API Used to Access Local Database
SWA-1.27
Four-Tier Architecture


CSE333 


Web Access to Brokerage Accounts
Only HTML Browser Required on Front End
"Brokerbean" EJB Provides Business Logic
Login, Query, Trade Servlets Call Brokerbean
Use JNDI to Find EJBs, RMI to Invoke Them
SWA-1.28
Architecture Comparisons


CSE333



Two-tier Through JDBC API is Simplest
Multi-tier: Separate Business Logic, Protect
Database Integrity, More Scaleable
JMS Queues vs. Synchronous (RMI or IDL):
 Availability, Response Time, Decoupling
JMS Publish & Subscribe: Off-line Notification
RMI IIOP vs. JRMP vs. Java IDL:
 Standard Cross-language Calls or Full Java
Functionality
JTS: Distributed Integrity, Lockstep Actions
SWA-1.29
Java Client to Legacy App via RDBS
Transformed
Legacy Data
CSE333
Java Client
Updated Data
Relational
Database
System(RDS)
Extract and
Generate Data
Transform and
Store Data
Legacy
Application
SWA-1.30
Java Client with Wrapper
to Legacy Application
CSE333
Java Client
Java Application Code
WRAPPER
Mapping Classes
JAVA LAYER
Interactions Between Java Client
and Legacy Appl. via C and RPC
C is the Medium of Info. Exchange
Java Client with C++/C Wrapper
NATIVE LAYER
Native Functions (C++)
RPC Client Stubs (C)
Legacy
Application
Network
SWA-1.31
One COTS and One Legacy Application to
Java Clients
CSE333
COTS Application
Legacy Application
Java Application Code
Java Application Code
Native Functions that
Map to COTS Appl
NATIVE LAYER
Native Functions that
Map to Legacy Appl
NATIVE LAYER
JAVA LAYER
JAVA LAYER
Mapping Classes
JAVA NETWORK WRAPPER
Mapping Classes
JAVA NETWORK WRAPPER
Network
Java Client
Java Client
Java is Medium of Info. Exchange - C/C++ Appls with Java Wrapper
SWA-1.32
Design Patterns
Finer Grained Software Architectures

CSE333 


Emerged as the Recognition that in ObjectOriented Systems Repetitions in Design Occurred
Gained Prominence in 1995 with Publication of
“Design Patterns: Elements of Reusable ObjectOriented Software”, Addison-Wesley
 “… descriptions of communicating objects and
classes that are customized to solve a general
design problem in a particular context…”
 Akin to Complicated Generic
Usage of Patterns Requires
 Consistent Format and Abstraction
 Common Vocabulary and Descriptions
Simple to Complex Patterns – Wide Range
SWA-1.33
The Observer Pattern

CSE333 

Utilized to Define a One-to-Many Relationship
Between Objects
When Object Changes State – all Dependents are
Notified and Automatically Updated
Loosely Coupled Objects
 When one Object (Subject – an Active Object)
Changes State than Multiple Objects
(Observers – Passive Objects) Notified
 Observer Object Implements Interface to
Specify the Way that Changes are to Occur
 Two Interfaces and Two Concrete Classes
SWA-1.34
The Observer Pattern
CSE333
SWA-1.35
Concluding Remarks

CSE333


Architectural Styles Provide Patterns
 Suppose Designing a New System
 During Requirements Discovery, Behavior and
Structure of System Will Emerge
 Attempt to Match to Architectural Style
 Modify, Extend Style as Needed
By Choosing Existing Architectural Style
 Know Advantages and Disadvantages
 Ability to Focus in on Problem Areas and
Bottlenecks
 Can Adjust Architecture Accordingly
Architectures Range from Large Scale to Small
Scale in their Applicability
SWA-1.36