swa-1.1 cse333 software architectures chapter 2: architectural styles prof. steven a. demurjian, sr....
Post on 21-Dec-2015
224 views
TRANSCRIPT
SWA-1.1
CSE333
Software ArchitecturesSoftware ArchitecturesChapter 2: Architectural StylesChapter 2: Architectural Styles
Prof. Steven A. Demurjian, Sr.Computer Science & Engineering Department
The University of Connecticut371 Fairfield Road, Box U-255
Storrs, CT 06269-2155
[email protected]://www.engr.uconn.edu/
~steve(860) 486 - 4818
Copyright © 2000 by S. Demurjian, Storrs, CT.
SWA-1.2
CSE333
Taxonomy of Architectural StylesTaxonomy of Architectural Styles
Data Flow SystemsData Flow Systems Batch Sequential Pipes and Filters
Call & Return SystemsCall & Return Systems Main/Subroutines
(C, Pascal) Object Oriented Implicit Invocation Hierarchical Systems
Virtual MachinesVirtual Machines Interpreters Rule Based Systems
Data Centered SystemsData Centered Systems DBS Hypertext Blackboards
Independent Independent ComponentsComponents Communicating
Processes/Event Systems
Client/ServerClient/Server Two-Tier Multi-Tier
SWA-1.3
CSE333
Taxonomy of Architectural StylesTaxonomy of Architectural Styles
Establish Framework of … Establish Framework of … Components
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.4
CSE333
Overall FrameworkOverall FrameworkConsider a Question-Based ApproachConsider a Question-Based Approach
What Is the Design Vocabulary?What Is the Design Vocabulary? Connectors and Components
What Are Allowable Structural Patterns?What Are Allowable Structural Patterns? Constraints on Combining Components &
Connectors What Is the Underlying Conceptual Model?What Is the Underlying Conceptual Model?
Von Newman, Parallel, Agent, Etc. What Are Essential Invariants of a Style?What Are Essential Invariants of a Style?
Limits on Allowable Components & Connectors
Common Examples of UsageCommon Examples of Usage Advantages and Disadvantages of a StyleAdvantages and Disadvantages of a Style Common Specializations of a StyleCommon Specializations of a Style
SWA-1.5
CSE333
Pipes and FiltersPipes and Filters
Filters: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.
SortSort
SortSort
MergeMerge
Connectors for Flow Streams of I/O
Components with Input and Output
Components are IndependentEntities. No Shared State!
SWA-1.6
CSE333
Pipes and FiltersPipes and Filters
Possible Specializations:Possible Specializations: Pipelines - Linear Sequence Bounded - Limits on Data Amounts Typed Pipes - Known Data Format
What is a Classic Example?What is a Classic Example? Other Examples:Other Examples:
Compilers Sequential Processes Parallel Processes
SWA-1.7
CSE333
Pipes and FiltersPipes and FiltersAnother ExampleAnother Example
Text Information Retrieval Systems Text Information Retrieval Systems Scanning Newspapers for Key Words, Etc. Also, Boolean Search Expressions
User
SearchSearchControllerController
SearchSearchDBDB
QueryQueryResolverResolver
Term Term ComparatorComparator
DiskDiskControllerController
CommandsCommands
ProgrammingProgrammingControlControl
ResultResult
DataData
SWA-1.8
CSE333
ADTs and OO ArchitecturesADTs and OO Architectures
Widespread Usage in the 1990’sWidespread Usage in the 1990’s Advantages Are Well Known Advantages Are Well Known
Disadvantages:Disadvantages: Interaction Required Object Identity If Identity Changes, It Is Difficult to Track All
Affected Objects.
obj
obj obj
obj obj
objobj
obj
op
opopop
op
op op
op
opop op
opop
Connectors
Components
SWA-1.9
CSE333
Implicit InvocationImplicit Invocation
Similar to OO in the Sense that Components Can Similar to OO in the Sense that Components Can Call Services on Other ComponentsCall Services on Other Components
How Does this Work?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?What are Some Examples?
SWA-1.10
CSE333
Implicit InvocationImplicit Invocation
AdvantagesAdvantages 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
DisadvantagesDisadvantages 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.11
CSE333
Layered SystemsLayered Systems
Components - Virtual Machine at Each LayerComponents - Virtual Machine at Each Layer Connectors - Protocols That Specify How Layers InteractConnectors - Protocols That Specify How Layers Interact Interaction Is Restricted to Adjacent LayersInteraction Is Restricted to Adjacent Layers
Users
Corelevel
Base UtilityUseful Systems
SWA-1.12
CSE333
Layered SystemsLayered Systems
Advantages:Advantages: Increasing Levels of Abstraction Support Enhancement - New Layers Support for Reuse
Drawbacks:Drawbacks: Not Feasible for All Systems Performance Issues With Multiple Layers Defining Abstractions Is Difficult.
SWA-1.13
CSE333
ISO as Layered ArchitectureISO as Layered Architecture
ISO Open Systems Interconnect (OSI) ModelISO 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, …)
ApplicationPresentation
SessionTransportNetwork
Data LinkPhysical
ApplicationPresentation
SessionTransportNetwork
Data LinkPhysical
SWA-1.14
CSE333
Application ApplicationPresentation Presentation
Session SessionTransport TransportNetwork Network
Data LinkPhysical
Data LinkPhysical
ISO OSI ModelISO OSI Model
Physical (Hardware)/Data Link Layer Networks: Ethernet, Token Ring, Physical (Hardware)/Data Link Layer Networks: Ethernet, Token Ring, ATMATM
Network Layer Net: The InternetNetwork Layer Net: The Internet
Transport Layer Net: Tcp-based NetworkTransport Layer Net: Tcp-based Network Presentation/Session Layer Net: Http/html, RPC, PVM, MPIPresentation/Session Layer Net: Http/html, RPC, PVM, MPI
Applications, E.g., WWW, Window System, AlgorithmApplications, E.g., WWW, Window System, Algorithm
SWA-1.15
CSE333
RepositoriesRepositories
Knowledge Sources Interact With the Blackboard.Knowledge Sources Interact With the Blackboard. Blackboard Contains the Problem Solving State Data.Blackboard Contains the Problem Solving State Data. Control Is Driven by the State of the Blackboard.Control Is Driven by the State of the Blackboard. DB Systems Are a Form of Repository With a Layer DB Systems Are a Form of Repository With a Layer
Between the BB and the KSs - Supports Between the BB and the KSs - Supports Concurrent Access, Security, Integrity, Recovery
ks8
ks6
ks7
ks1
ks2
ks3
ks4 ks5
Blackboard(shared data)
SWA-1.16
CSE333
Database System as a RepositoryDatabase System as a Repository
Clients Interact With the DBMSClients Interact With the DBMS Database Contains the Problem Solving State DataDatabase Contains the Problem Solving State Data Control is Driven by the State of the DatabaseControl 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
c8
c6
c7
c1
c2
c3
c4 c5
Database(shared data)
SWA-1.17
CSE333
InterpretersInterpreters
What Are Components and Connectors?What Are Components and Connectors? Where Have Interpreters Been Used in CS&E?Where Have Interpreters Been Used in CS&E?
LISP, ML, Java, Other Languages, OS Command Line
Data(program state)
Program beinginterpreted
Simulatedinterpretation
engine
Internalinterpreter
state
Inputs
OutputsSelectedinstructionSelected
data
SWA-1.18
CSE333
Java as Interpreter Java as Interpreter
SWA-1.19
CSE333
Process Control ParadigmsProcess Control Paradigms
Also:Also: Open vs. Close Loop Systems Well Defined Control and Computational
Characters Heavily Used in Engineering Fields.
Process
ProcessController
Set point
Set point
Input variables
Input variables
Controlledvariable
Controlledvariable
s tomanipulated
variables
s tomanipulated
variables
Controller
With FeedbackWith Feedback
Without FeedbackWithout Feedback
SWA-1.20
CSE333
Process Architecture Process Architecture UML Statechart Diagram?UML Statechart Diagram?
SWA-1.21
CSE333
Breath
Waiting forResp. Signal
Resp Signal
timeout
TriggerLocalAlarm
TriggerRemoteAlarm
Heartbeat
Waiting forHeart Signal
Heart Signal
irregular beat
Alarm Reset
Process Architecture Process Architecture UML Activity Diagram?UML Activity Diagram?
SWA-1.22
CSE333
Client/ServerClient/ServerSingle and Multi-Tier ArchitecturesSingle and Multi-Tier Architectures
Widespread use in Practice for All Types of Widespread use in Practice for All Types of Distributed Systems and ApplicationsDistributed Systems and Applications
Two Kinds of ComponentsTwo 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.23
CSE333
Client/ServerClient/ServerSingle and Multi-Tier ArchitecturesSingle and Multi-Tier Architectures
Normally, Clients and Servers are Independent Normally, Clients and Servers are Independent Processes Running in ParallelProcesses Running in Parallel
Connectors Provide Means for Service Requests Connectors Provide Means for Service Requests and Answers to be Passes Among Clients/Serversand Answers to be Passes Among Clients/Servers
Connectors May be RPC, RMI, etc.Connectors May be RPC, RMI, etc. AdvantagesAdvantages
Parallelism, Independence Separation of Concerns, Abstraction Others?
DisadvantagesDisadvantages Complex Implementation Mechanisms Scalability, Correctness, Real-Time Limits Others?
SWA-1.24
CSE333
Example:Example:Software Architectural StructureSoftware Architectural Structure
Initial Data Entry Operator(Scanning & Posting)
10-100MB Network
Advanced Data Entry
Operators
DocumentServerStored
Images/CD
DatabaseServerRunningOracle
RMI Registry
Functional Server
RMI Act.Obj/Server
RMI Act.Obj/Server
Analyst Manager
SWA-1.25
CSE333
Business Process Model: Business Process Model: Scanning and Initial Data EntryScanning and Initial Data Entry
Scanner
Licensing
LicensingDivisionScanningOperator
StoredImages
BasicInformationEntered
DB
CompletedApplications
HistoricalRecords
Printer
New LicensesNew AppointmentsFOI
Letters (RequestInformation, etc.)
Licensing DivisionData Entry Operator
SupervisorReview
DB
DB DB
DB
SWA-1.26
CSE333
Two-Tier ArchitectureTwo-Tier Architecture
Small Manufacturer Previously on C++ Small Manufacturer Previously on C++ New Order Entry, Inventory, and Invoicing New Order Entry, Inventory, and Invoicing
Applications in Java Programming Language Applications in Java Programming Language Existing Customer and Order Database Existing Customer and Order Database Most of Business Logic in Stored Procedures Most of Business Logic in Stored Procedures Tool-generated GUI Forms for Java ObjectsTool-generated GUI Forms for Java Objects
SWA-1.27
CSE333
Three-Tier ArchitectureThree-Tier Architecture
Passenger Check-in for Regional Airline Passenger Check-in for Regional Airline Local Database for Seating on Today's Flights Local Database for Seating on Today's Flights Clients Invoke EJBs at Local Site Through RMI Clients Invoke EJBs at Local Site Through RMI EJBs Update Database and Queue Updates EJBs Update Database and Queue Updates JMS Queues Updates to Legacy System JMS Queues Updates to Legacy System DBC API Used to Access Local Database DBC API Used to Access Local Database
SWA-1.28
CSE333
Four-Tier ArchitectureFour-Tier Architecture
Web Access to Brokerage Accounts Web Access to Brokerage Accounts Only HTML Browser Required on Front End Only HTML Browser Required on Front End "Brokerbean" EJB Provides Business Logic "Brokerbean" EJB Provides Business Logic Login, Query, Trade Servlets Call Brokerbean Login, Query, Trade Servlets Call Brokerbean Use JNDI to Find EJBs, RMI to Invoke ThemUse JNDI to Find EJBs, RMI to Invoke Them
SWA-1.29
CSE333
Architecture ComparisonsArchitecture Comparisons
Two-tier Through JDBC API is Simplest Two-tier Through JDBC API is Simplest Multi-tier: Separate Business Logic, Protect Multi-tier: Separate Business Logic, Protect
Database Integrity, More Scaleable Database Integrity, More Scaleable JMS Queues vs. Synchronous (RMI or IDL): JMS Queues vs. Synchronous (RMI or IDL):
Availability, Response Time, Decoupling JMS Publish & Subscribe: Off-line Notification JMS Publish & Subscribe: Off-line Notification
RMI IIOP vs. JRMP vs. Java IDL: RMI IIOP vs. JRMP vs. Java IDL: Standard Cross-language Calls or Full Java
Functionality JTS: Distributed Integrity, Lockstep ActionsJTS: Distributed Integrity, Lockstep Actions
SWA-1.30
CSE333
Java Client to Legacy App via RDBSJava Client to Legacy App via RDBS
Java ClientJava Client
LegacyLegacyApplicationApplication
Relational Relational DatabaseDatabase
System(RDS)System(RDS)
Transformed Transformed Legacy DataLegacy Data
Updated DataUpdated Data
Extract and Extract and Generate DataGenerate Data
Transform andTransform andStore DataStore Data
SWA-1.31
CSE333
Java Client with Wrapper Java Client with Wrapper to Legacy Applicationto Legacy Application
LegacyLegacyApplicationApplication
NetworkNetwork
Java ClientJava Client
Java Application CodeJava Application Code
WRAPPERWRAPPER
Mapping ClassesMapping Classes
JAVA LAYERJAVA LAYER
NATIVE LAYERNATIVE LAYER
Native Functions (C++)Native Functions (C++)RPC Client Stubs (C)RPC Client Stubs (C)
Interactions Between Java ClientInteractions Between Java Clientand Legacy Appl. via C and RPCand Legacy Appl. via C and RPC
C is the Medium of Info. ExchangeC is the Medium of Info. Exchange
Java Client with C++/C WrapperJava Client with C++/C Wrapper
SWA-1.32
CSE333
One COTS and One Legacy Application One COTS and One Legacy Application to Java Clientsto Java Clients
NetworkNetwork
Java Application CodeJava Application Code
JAVA NETWORK WRAPPERJAVA NETWORK WRAPPER
Mapping ClassesMapping Classes
NATIVE LAYERNATIVE LAYER
JAVA LAYERJAVA LAYER
Native Functions that Native Functions that Map to COTS ApplMap to COTS Appl
Java ClientJava Client Java ClientJava Client
Java Application CodeJava Application Code
JAVA NETWORK WRAPPERJAVA NETWORK WRAPPER
Mapping ClassesMapping Classes
NATIVE LAYERNATIVE LAYER
JAVA LAYERJAVA LAYER
Native Functions that Native Functions that Map to Legacy ApplMap to Legacy Appl
COTS ApplicationCOTS Application Legacy ApplicationLegacy Application
Java is Medium of Info. Exchange - C/C++ Appls with Java Wrappers
SWA-1.33
CSE333
Design Patterns Design Patterns Finer Grained Software ArchitecturesFiner Grained Software Architectures
Emerged as the Recognition that in Object-Emerged as the Recognition that in Object-Oriented Systems Repetitions in Design OccurredOriented Systems Repetitions in Design Occurred
Gained Prominence in 1995 with Publication of Gained Prominence in 1995 with Publication of “Design Patterns: Elements of Reusable Object-“Design Patterns: Elements of Reusable Object-Oriented Software”, Addison-WesleyOriented 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 RequiresUsage of Patterns Requires
Consistent Format and Abstraction Common Vocabulary and Descriptions
Simple to Complex Patterns – Wide RangeSimple to Complex Patterns – Wide Range
SWA-1.34
CSE333
The Observer PatternThe Observer Pattern
Utilized to Define a One-to-Many Relationship Utilized to Define a One-to-Many Relationship Between ObjectsBetween Objects
When Object Changes State – all Dependents are When Object Changes State – all Dependents are Notified and Automatically UpdatedNotified and Automatically Updated
Loosely Coupled Objects 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.35
CSE333
The Observer PatternThe Observer Pattern
SWA-1.36
CSE333
Concluding RemarksConcluding Remarks
Architectural Styles Provide Patterns 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 StyleBy 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 Architectures Range from Large Scale to Small Scale in their ApplicabilityScale in their Applicability