Architecture Patterns

Architecture Patterns

An architecture pattern is a high-level strategy or template, with an organized and structured description of good design practice, which has been tried and tested in different environments for successful structure and behaviour of system software.

These patterns provide proven solutions to recurring design problems and serve as a blueprint for creating robust, scalable and maintainable architecture. An architecture pattern expresses a fundamental structural organization or schema for a software system.

It provides a set of predefined subsystems, specifies their responsibilities and includes rules and guidelines for organizing the relationship between them.

There are different architectural patterns such as -

  1. Layered pattern architecture.

  2. Repository pattern architecture.

  3. Client-server pattern architecture.

  4. Pipe-filter pattern architecture.

  5. Model-view-controller.

Now let us understand about each of them in detail-

  1. Layered pattern architecture-

    Layered pattern architecture organises the software system into distinct, horizontal layers, each representing a specific level of abstraction or functionality. Each layer only interacts directly with the layer immediately and above it.

    Each layer has unique tasks to do and all layers are independent of one another since each layer is independent, one can modify the code without affecting others.

    This pattern is the most commonly used pattern for designing the majority of software. This layer is also known as a 4-tier architecture.

    These 4 layers are -

    1. Presentation layer- the user interface where we enter the data on an application. This layer helps users with its easy user interface and easy communication with the software.

    2. Business layer- this layer is responsible for executing business logic as per requests. This layer deals with the user interface management authentication and authorization.

    3. Application layer- this layer acts as a medium for communication between the presentation and data layer. This layer deals with the core business logic and application functionality system utilities.

    4. Data layer- this layer has database connectivity for managing the flow of the data. This layer mainly deals with the system support of the software.

Advantage - allow replacement of entire layer as long as the interface is maintained. Redundant facilities can be provided in each layer to increase the dependability of the system.

Limitation - In practice providing a clean separation between layers is often difficult and a high level may have to interact directly with a lower-level layer rather them through the layer immediately below it. Also, performance can be a problem because of multiple levels of interpretation of a service request as it is processed at each layer.

  1. Repository architecture-

    In repository architecture, the majority of systems that use large amounts of data are organized around a shared database or repository. This model is therefore suited to applications in which data is generated by one component and used by another. Organizing tools around a repository is an efficient way to share large amounts of data. There is no need to transmit data explicitly from one component to another. However, components must operate around an agreed repository data model.

    All data in a system is managed in a central repository that is accessible to all system components. Components do not interact directly, only through the repository.

    You should use this pattern when you have a system in which large volumes of information are generated that have to be stored for a long time.

    You may also use it in data-driven systems where the inclusion of data in the repository triggers an action or tool.

    In the example of an IDE where the components use a repository of system design information. Each software tool generates information which is then available for use by other tools.

  1. Client-server architecture-

    In a client–server architecture, the functionality of the system is organized into services, with each service delivered from a separate server. Clients are users of these services and access servers to make use of them.

    Used when data in a shared database has to be accessed from a range of locations. Because servers can be replicated, may also be used when the load on a system is variable.

    A system that follows the client–server pattern is organized as a set of services and associated servers, and clients that access and use the services. The major components of this model are:

    1. A set of servers that offer services to other components. Examples of servers include print servers that offer printing services, file servers that offer file management services, and compile servers, that offer programming language compilation services.

    2. A set of clients that call on the services offered by servers. There will normally be several instances of a client program executing concurrently on different computers.

    3. A network that allows the clients to access these services. Most client–server systems are implemented as distributed systems, connected using Internet protocols.

Client–server architectures are usually thought of as distributed systems architectures but the logical model of independent services running on separate servers can be implemented on a single computer. Again, an important benefit is separation and independence. Services and servers can be changed without affecting other parts of the system

In the example of a film and video/DVD library organized as a client–server system.

  1. Pipe and filter architecture-

    In this architecture pattern, the processing of the data in a system is organized so that each processing component (filter) is discrete and carries out one type of data transformation. The data flows (as in a pipe) from one component to another for processing.

    Commonly used in data processing applications (both batch- and transaction-based) where inputs are processed in separate stages to generate related outputs.

    This is a model of the run-time organization of a system where functional transformations process their inputs and produce outputs.

    The name ‘pipe and filter’ comes from the original Unix system where it was possible to link processes using ‘pipes’. These passed a text stream from one process to another.

    Variants of this pattern have been in use since computers were first used for automatic data processing. When transformations are sequential with data processed in batches, this pipe and filter architectural model becomes a batch sequential model, a common architecture for data processing systems.

    An example of a pipe and filter model is the billing system is a billing system

    -

  1. Model view controller-

    MVC is one of the most frequently used industry-standard web development frameworks to create scalable and extensive projects.

    The model view controller is an architecture pattern that separates an application into three logical components.

    This model view controller is used when there are multiple ways to view and interact with data and also used when the future requirements for interaction and presentation of data are unknown.

    Each of these components is built to handle specific development aspects of an application. These three components are -

    1. Model.

    2. View.

    3. Controller.

Let us understand about each of them in detail-

  1. Model:- this represents the application data and business logic. It encapsulates the data and behaviour of the application, responding to requests for information or changes in state.

    • It manages the system data and associated operations on that data.

    • It enforces business rules and logic.

    • It notifies the observer about state changes.

    • It manages data access and storage.

  2. View:- The view component defines and manages how the data is presented to the user. It represents the user interface and presentation layer. It displays data to the user and user input forwarding it to the controller for processing responsibilities.

    • It presents information to the user on the data from the model.

    • It captures user input and forwards it to the controller.

    • It updates its display in response to changes in the model.

  3. Controller:- The controller component manages user interaction and passes this information to the view and model, by acting as an intermediary between them.

    • It receives user input from the view.

    • It interacts with the model to perform necessary actions or updates.

    • It updates the view based on model changes.

Advantages of Model View Controller-

  1. Multiple developers can work simultaneously on the model, controller and view.

  2. MVC enables logic grouping of related actions on a controller together, the view for a specific model is also grouped.

  3. Models can have multiple views. The overall components of an application are easily manageable and are less dependent on each other for the proper functioning of the application.

  4. It supports asynchronous techniques.

  5. The modification does not affect the entire model.

Disadvantages of Model View Controller-

  1. The framework navigation can be complex because it introduces a new layer of abstraction and requires the user to adapt to the decomposition criteria of MVC.

  2. Knowledge of multiple technologies because the norm developers using MVC need to be skilled in multiple technologies.

This is all about the architecture patterns in software engineering.