Contents
Pipe and Filter
- Suitable for applications that require a defined series of independent computations.
- Components read streams of data on their inputs and produce streams of data on their outputs.
Components: Filters, apply local transformations to their input streams and often do their computing incrementally so that the output begins before all input is consumed. Connectors: Pipes, serve as conduits for the streams, transmitting outputs of one filter to inputs of another.
Types:
- Pipelines: Restricts topologies to linear sequences of filters.
- Batch Sequential: A degenerate case of a pipeline architecture where each filter processes all of its input data before producing any output.
Examples:
- Unix Shell Scripts
- Traditional Compilers
Advantages:
- Easy to understand.
- Supports reuse.
- Easily maintainable.
- Specialized analysis.
- Supports concurrent execution.
Disadvantages:
- Not good for handling interactive systems.
- Loss of performance.
- Increased complexity.
Repository Style
- Suitable for applications in which the central issue is establishing, augmenting, and maintaining a complex central body of information.
- Typically, the information must be manipulated in a variety of ways. Long-term persistence is required.
Components: Central data structure representing the current state of the system. A collection of independent components that operate on the central data structure. Connectors: Typically, direct memory access.
Specializations:
- Changes to the data structure trigger computations.
- Data structure in memory. This is a persistent option.
- Data structure on disk.
- Concurrent computation.
Types:
- Blackboard: The repository is active and can activate the components in response to changes in itself. Whereas, in the repository style, the repository is inactive and just maintains the central data.
Examples:
- Central Code Repository Systems.
- Programming Environments.
- Graphical Editors.
- Database Management Systems.
- Games - multiple users editing and interacting with the same world.
Advantages:
- Efficient way to store large amounts of data.
- Sharing model is published as the repository schema.
- Centralized management.
Disadvantages:
- Must agree on a data model before.
- Difficult to distribute data.
- Data evolution is expensive.
- Single point of failure.
Implicit Invocation Style
- Suitable for applications where the creators do not need to know who or how many will need to use the data.
- A component broadcasts outputs that are consumed by one or more of the other components.
Components:
- Data generators.
- Data consumers.
Connectors:
- Event bus.
- Procedure calls.
Publish - Subscribe Variant:
- Subscribers register to receive specific messages.
- Publishers maintain a subscription list and broadcast messages to subscribers.
- Subscribers connect to publishers directly.
- Diagram is generally scattered between publishers and subscribers.
- Examples: Twitter / Environment Canada.
Event-Based Variant:
- Components asynchronously emit and receive “events” communicated over the event bus.
- Components do not directly talk to each other.
- Diagram is generally sequential between the event bus and subscribers/publishers.
- Examples: Debugger breakpoint announcement / Editors scroll to appropriate source line and highlights it.
Advantages:
- Provides strong support for reuse.
- Eases system evolution.
- Efficient dissemination of one-way info.
Disadvantage:
- Need special protocols when the number of subscribers is very large.
- When a component announces an event:
- It has no idea what other components will respond to it.
- It cannot rely on the order in which the responses are invoked.
- It cannot know when responses are finished.
Layered Style:
The layered style of architecture separates the system into ordered layers where a program in one layer may obtain services from a layer below it.
Components: Layers that perform local calculations and communicate with adjacent layers.
Connectors: Pre-determined protocols for communication between layers.
Examples:
- Layered Communication Protocols: Network/Link/Physical layer.
- Operating Systems.
Advantages:
- Facilitates design, enhancement, and reuse.
Disadvantages:
- Not all systems are easily structured in a layered fashion.
- Performance requirements may not be met.
Client-Server Style:
The client-server style is suitable for applications that involve distributed data and processing across a range of components.
Components:
- Clients.
- Servers.
Connectors: The network.
Examples:
- File Servers: Sharing files across the network.
- DB Servers:
- More efficient use of distributing power than file servers.
- Client passes SQL requests as messages to the DB servers; results are returned over the network.
Advantages:
- Data distribution is straightforward.
- Transparency of location.
- Mix and match heterogeneous platforms.
- Easy to add new servers or upgrade existing servers.
Disadvantages:
- No central register of names and services – might be hard to find out what services are available.
Process Control Style:
The process control style is suitable for applications whose purpose is to maintain specified properties of the output of the process at given reference values. It is also called a feedback control system.
Components:
- Process Definition.
- Control Algorithm.
Connectors:
- Process Variables:
- Controlled variable.
- Input variable.
- Manipulated variable.
- Set Point.
- Sensors.
Example: Various realtime systems (Nuclear Power Plants, Car Cruise Control).
Serverless Architecture:
The serverless architecture involves using and paying for functionality on an as-needed basis.
Components:
- Function (Container).
Connector:
- Event:
- Synchronous (HTTP request).
- Asynchronous (Message Queue).
Advantages:
- Pay per use.
- Less maintenance.
- Fast deployment.
- Easy to debug.
Disadvantages:
- 3rd party dependency.
- Initial latency (cold start).
- Stateless nature - won’t remember the previous state.
Microservices Architecture:
The microservices architecture focuses on building single function modules with well-defined interfaces and operations. It is suitable for applications that require short release cycles and must be highly scalable.
Components: Self-contained services.
Connectors:
- Synchronous: HTTP.
- Asynchronous: Advanced Messaging Queue Protocol.
General Properties:
- Single responsibility.
- Can be developed and maintained by single independent teams.
- It is not overly dependent on another service. If so, merge.
- It must be separately deployable.
- It maintains the integrity and consistency of the data overall.
Advantages:
- Independently deployable.
- Easy CI/CD integration.
- Independently scalable.
- Reduce downtime.
- Team autonomy.
- Simple to maintain.
Disadvantages:
- Expensive.
- More distributed complexity.
MVVM - Model View View Model:
The MVVM architecture separates the UI from business logic.
Components:
- View.
- ViewModel.
- Model.
Connectors:
- Events and method calls.
Example:
- Any RSS reader app or any app with UI and some data in the back to be manipulated.
Advantages:
- Abstraction helps in:
- Testing.
- Different teams work independently.
Disadvantages:
- MVVM can be overkill for simple applications.
- Debugging can be more difficult with the abstraction layers.
MVC vs MVP vs MVVM
- Controller (C) - Connects the Model with the View, but is not required to be organized.
- Presenter (P) - Gets data from the Model and the UI rules from the View, and applies them to the data.
- ViewModel (VM) - Similar to the Presenter, but more organized. It associates the data with the View, and separates the actual presentation logic of the UI, making it easier to test.