【Architectural Pattern】Multitier Architecture

Posted by 西维蜀黍 on 2021-08-30, Last Modified on 2022-12-10

Multitier Architecture

In software engineering, multitier architecture (often referred to as n-tier architecture) or multilayer architecture is a client–server architecture in which presentation, application processing and data management functions are physically separated. The most widespread use of multitier architecture is the three-tier architecture.

N-tier application architecture provides a model by which developers can create flexible and reusable applications. By segregating an application into tiers, developers acquire the option of modifying or adding a specific layer, instead of reworking the entire application. A three-tier architecture is typically composed of a presentation tier, a logic tier, and a data tier.

Tier vs. layer

While the concepts of layer and tier are often used interchangeably, one fairly common point of view is that there is indeed a difference. This view holds that a layer is a logical structuring mechanism for the elements that make up the software solution, while a tier is a physical structuring mechanism for the system infrastructure.

The Contacts app on your phone, for example, is a three-layer application, but a single-tier application, because all three layers run on your phone.

The difference is important, because layers can’t offer the same benefits as tiers.

Layers

The “Layers” architectural pattern has been described in various publications.[4]

Common layers

In a logical multilayer architecture for an information system with an object-oriented design, the following four are the most common:

  • Presentation layer (a.k.a. UI layer, view layer, presentation tier in multitier architecture)
  • Application layer (a.k.a. service layer or GRASP Controller Layer)
  • Business layer (a.k.a. business logic layer (BLL), domain logic layer)
  • Data access layer (a.k.a. persistence layer, logging, networking, and other services which are required to support a particular business layer)
  • The book Domain Driven Design describes some common uses for the above four layers, although its primary focus is the domain layer.

If the application architecture has no explicit distinction between the business layer and the presentation layer (i.e., the presentation layer is considered part of the business layer), then a traditional client-server (two-tier) model has been implemented.[citation needed]

The more usual convention is that the application layer (or service layer) is considered a sublayer of the business layer, typically encapsulating the API definition surfacing the supported business functionality. The application/business layers can, in fact, be further subdivided to emphasize additional sublayers of distinct responsibility. For example, if the model–view–presenter pattern is used, the presenter sublayer might be used as an additional layer between the user interface layer and the business/application layer (as represented by the model sublayer).[citation needed]

Some also identify a separate layer called the business infrastructure layer (BI), located between the business layer(s) and the infrastructure layer(s). It’s also sometimes called the “low-level business layer” or the “business services layer”. This layer is very general and can be used in several application tiers (e.g. a CurrencyConverter).

The infrastructure layer can be partitioned into different levels (high-level or low-level technical services). Developers often focus on the persistence (data access) capabilities of the infrastructure layer and therefore only talk about the persistence layer or the data access layer (instead of an infrastructure layer or technical services layer). In other words, the other kind of technical services are not always explicitly thought of as part of any particular layer.[citation needed]

A layer is on top of another, because it depends on it. Every layer can exist without the layers above it, and requires the layers below it to function. Another common view is that layers do not always strictly depend on only the adjacent layer below. For example, in a relaxed layered system (as opposed to a strict layered system) a layer can also depend on all the layers below it.

Reference