Architectures and Architectural Styles
An Introduction
|
Prof. David Bernstein
James Madison University
|
|
Computer Science Department |
bernstdh@jmu.edu |
|
Architectures and Architectural Styles/Idioms
- Architecture:
- An abstract model of a system
- Architectural Style/Idiom:
- Some architectures have similar entities, attributes and
relationships which allow them to be grouped into a
a style or idiom (i.e., when we
abstract even further we see commonalities)
- A Common Mistake:
- Using the term "architecture" when one really
means "architectural style"
Architectural Design
- Purpose:
- Specify the major components of the system, their
responsibilities, and their properties
- Specify each component's interface
- Specify the relationships and interactions between
components (sometimes called connectors)
The Formalization of Architectural Styles
- Define a Vocabulary:
- Components (e.g., modules, processes, tools, databases)
- Connectors (e.g., calls, events, queries)
- Specify Constraints:
- How components and connectors can/can't be combined
(e.g., topological constraints)
The Study of Architectural Styles/Idioms
- Researchers "Discover" Styles By:
- Studying a large number of products
- Looking for commonalities
- Abstracting (i.e., ignoring some details)
- Researchers Present Styles By:
- Identifying the commonalities that define the style
- Enumerating the style's advantages and disadvantages
- Software Engineers Study Styles To:
- Make it easier to understand/discuss the architectures of
existing systems
- Help in the design of architectures for new systems
Layered Architectures
- Commonalities:
- Entities are grouped based on the services that
they provide
- Each layer hides all of the
layers above and below
- Visualizations:
Layered Architectures (cont.)
- Advantages:
- Improved cohesion which allows for multiple physical
deployment options (e.g., presentation and application
logic on one machine; storage on another)
- Decreased coupling which promotes re-use
- Specialized expertise (by level)
- Disadvantages:
- Communicating through multiple layers can be inefficient
- Often results in "cheating"
Layered Example
- The Classic Three Tiers:
- Presentation (Front End)
- Application Logic
- Storage (Back End)
- Visualization:
Client-Server Architectures
- Commonalities:
- Each entity has exactly one role, service provider or service
consumer
- Service providers wait for and then respond to requests
- Service consumers initiate requests
- The Alternative:
- The entities are peers (i.e., all play the same roles)
Client-Server Architectures (cont.)
- Advantages:
- Same as for layered architectures
- Centralized control
- Disadvantages:
- "Single" point of failure
- Difficult to scale (especially to balance loads)
Client-Server Example
- The WWW:
- Identify the client(s)
- Identify the server(s)
- X-Windows:
- Identify the client(s)
- Identify the server(s)
Pipe and Filter Architectures
- Commonalities:
- Treat inputs/outputs as streams (i.e., infinite
sequences of bytes)
- Group entities into filters (i.e., those that process
streams) and pipes (i.e., those that connect
sources and sinks)
- A Visualization:
Pipe and Filter Architectures (cont.)
- Advantages:
- Simple
- Easy to extend and/or modify
- Disadvantages:
- Forces lowest-common-denominator data transmission
- Queue overflows
- Unidirectional data flow
- Not good for interactive systems
Pipe and Filter Examples
- The Problem:
-
Read a file and print all of the lines that contain
a particular string. The output should be sorted alphabetically.
- The Solution (in Unix):
cat in.txt | grep "CS346" | sort > out.txt
- A Diagram:
Pipe and Filter Examples (cont.)
- The Problem:
-
Read a file that contains Java source code and produce
the associated byte code.
- A Diagram of the Java Compiler:
Pipe and Filter Examples (cont.)
- The Problem:
-
Read a file that contains invoices and payments and prints
receipts and reminders.
- A Diagram:
Event Driven Architectures
- Commonalities:
- Entities are grouped into event generators/producers
and event receivers/handlers
- Generators and receivers communicate through
an intermediary (called an event queue)
- Visualization:
- Terminology:
- Event generators post/announce events
- The event queue invokes/fires to event
handlers/receivers
Event Driven Architectures (cont.)
- Advantages:
- Promotes re-use
- Easy to modify
- Disadvantages:
- Makes synchronization difficult
Architectural Styles in Context
- Some Domains:
- Instruction set architectures
- Microarchitectures
- Application architectures
- Network architectures
- Some Observations:
- Many styles are used in multiple domains
- Some issues arise in some domains but not others (e.g.,
geometry matters in chip design but not in application
programming)