- Forward


Architectures and Architectural Styles
An Introduction


Prof. David Bernstein
James Madison University

Computer Science Department
bernstdh@jmu.edu

Print

Architectures and Architectural Styles/Idioms
Back SMYC Forward
  • 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
Back SMYC Forward
  • 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
Back SMYC Forward
  • 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
Back SMYC Forward
  • 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
Back SMYC Forward
  • Commonalities:
    • Entities are grouped based on the services that they provide
    • Each layer hides all of the layers above and below
  • Visualizations:
    • layered
      Expand
Layered Architectures (cont.)
Back SMYC Forward
  • 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
Back SMYC Forward
  • The Classic Three Tiers:
    • Presentation (Front End)
    • Application Logic
    • Storage (Back End)
  • Visualization:
    • three-tier
Client-Server Architectures
Back SMYC Forward
  • 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.)
Back SMYC Forward
  • Advantages:
    • Same as for layered architectures
    • Centralized control
  • Disadvantages:
    • "Single" point of failure
    • Difficult to scale (especially to balance loads)
Client-Server Example
Back SMYC Forward
  • The WWW:
    • Identify the client(s)
    • Identify the server(s)
  • X-Windows:
    • Identify the client(s)
    • Identify the server(s)
Pipe and Filter Architectures
Back SMYC Forward
  • 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
      Expand
Pipe and Filter Architectures (cont.)
Back SMYC Forward
  • 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
Back SMYC Forward
  • 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
    Expand
  • A Diagram:
    unixpipes
    Expand
Pipe and Filter Examples (cont.)
Back SMYC Forward
  • The Problem:
    • Read a file that contains Java source code and produce the associated byte code.
  • A Diagram of the Java Compiler:
    javacompiler
    Expand
Pipe and Filter Examples (cont.)
Back SMYC Forward
  • The Problem:
    • Read a file that contains invoices and payments and prints receipts and reminders.
  • A Diagram:
    pipe-and-filter_invoice
    Expand
Event Driven Architectures
Back SMYC Forward
  • Commonalities:
    • Entities are grouped into event generators/producers and event receivers/handlers
    • Generators and receivers communicate through an intermediary (called an event queue)
  • Visualization:
    • event-queue
  • Terminology:
    • Event generators post/announce events
    • The event queue invokes/fires to event handlers/receivers
Event Driven Architectures (cont.)
Back SMYC Forward
  • Advantages:
    • Promotes re-use
    • Easy to modify
  • Disadvantages:
    • Makes synchronization difficult
Architectural Styles in Context
Back SMYC Forward
  • 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)
There's Always More to Learn
Back -