【Architectural Pattern】Overall

Posted by 西维蜀黍 on 2024-10-01, Last Modified on 2024-10-01

From Mud to Structure (High level decompositions)

  • Layers
  • Pipes and Filters
  • Blackboard

Distributed Systems

  • Broker

Interactive Systems

  • MVC (Model-view-controller)
  • Presentation-Abstraction-Control

Adaptable Systems

  • Microkernel
  • Reflection

From Mud to Structure (High level decompositions)

Layer (Layered architecture)

Communication between the layers

There are two basic models:

  • Push: In the push model, a layer N pushes a request down to a lower layer N–1 for processing.
  • Pull: The pull model works the other way: A layer N–1 asks layer N

Example

Web applications

Web applications commonly use a three-tier architecture, in which the tiers are the layers.

a typical architecture with a presentation layer on the top, a business logic layer in the middle, and a database layer on the bottom.

TCP/IP

Advantages and Disadvantages

  • Advantages

    • Reuse of layers

    • Standardization of tasks and interfaces

    • Only local dependencies between layers

    • Programmers and users can ignore other layers

    • Different programming teams can handle each layer

  • Disadvantages

    • Cascades of changing behavior
    • Lower efficiency of data transfer
    • Difficult to choose granularity of layers
    • Difficult to understand entire system

Pipes and Filters

The Pipes and Filters pattern structures the processing of a stream of data. Each processing step is implemented as a filter, with information flowing between the filters through a pipe.

Blackboard

Distributed Systems

Broker

Decoupled components interact through remote service invocations. Communication is coordinated by a broker component which does things like forwarding requests and relaying results.

drawbacks

  • Overall system performance will not be as high as that of a system with direct client/server connections.
    • The direct-communications broker variant improves performance by allowing direct communication between client and server.
  • The broker introduces a single point of failure into the architecture.
    • All messages must flow through the broker, so if the broker is unavail-able, the entire service is unavailable.
  • Testing and debugging are both easier and harder in a broker a tecture

Publish-Subscribe

Master-Slave

The Master-Slave pattern is useful in a couple application areas:

  • Fault tolerance is enhanced through multiple computations that are compared and factored into the “correct” response.
    • You can use the results of the slaves to check one another for correctness by using different but semantically equivalent approaches as the individual parts. The master contains the voting algorithm that triggers the computation, compares the results, and selects one.
    • NASA used this approach, which is very useful in fault-tolerant systems, to coordinate the space shuttle’s main computers.
  • In parallel computing, the Master-Slave pattern spreads the workload across multiple processors. This is how Google’s Map-Reduce works, by spreading the work across multiple slaves.
    • This is how Google’s Map-Reduce works, by spreading the work across multiple slaves.

Reference