Layered Architecture.
Taken from The Architecture Guide Version 2.0a from the Microsoft Patterns and Practices. For those of us who like it in the language of Cervantes:
Layered architecture focuses on the distribution of roles and responsibilities in a hierarchical manner, providing a very effective way of separating responsibilities. The role indicates the mode and type of interaction with other layers, and the responsibility indicates the functionality being developed.
For example, a typical web application is composed of a presentation layer (user interface related functionality), a business layer (business rule processing) and a data layer (data access related functionality).
The layered architecture style is identified by the following characteristics:
• It describes the decomposition of services in such a way that most of the interaction occurs only between neighboring layers.
• The layers of an application can reside on the same physical machine (same tier) or can be distributed across different computers (n-tier).
• The components of each layer communicate with other components in other layers through very well-defined interfaces.
• This model has been described as an “inverted pyramid of reuse” in which each layer adds responsibility and abstraction to the layer directly above it.
Key principles
The common principles that apply when designing to use this architecture style include:
• Abstraction. Layered architecture abstracts the view of the model as a whole while providing enough detail to understand the relationships between layers.
• Encapsulation. The design makes no assumptions about data types, methods, properties or implementation.
• Clearly defined functionality. The design clearly defines the separation between the functionality of each layer. Upper layers such as the presentation layer send commands to lower layers such as the business layer and the data layer, and data flows to and from the layers in either direction.
• High cohesion. Each layer contains functionality directly related to the task of that layer.
• Reusable. Lower layers have no dependency on upper layers, allowing them to be reused in other scenarios.
• Loose coupling. Communication between layers is based on abstraction, which provides decoupling between the layers.
Benefits
The main benefits of the layered architecture style are:
• Abstraction. Layers allow changes to be made at an abstract level. You can increase or decrease the level of abstraction used in each layer of the hierarchical “stack”.
• Isolation. The layered architecture style makes it possible to isolate technology changes to certain layers, reducing the impact on the overall system.
• Performance. Distributing the layers across multiple (physical) systems can increase scalability, fault tolerance and performance.
• Improved testing. Testing benefits from having well-defined interfaces for each layer, as well as the ability to switch to different implementations of each layer's interfaces.
• Independence. The layered architecture style removes the need to consider hardware and installation problems as well as external interface dependencies.
Examples
Some common types of layered applications include:
• Line-of-business (LOB) applications, such as accounting and customer management systems.
• Corporate web applications and websites
• Corporate desktop applications or smart clients with centralized application servers hosting business logic.
The following are some variations of the layered architecture style:
Enjoying this? Get more like it, once a week.
• Strict layering. Each layer can only invoke the layer directly below it.
• Layer skipping. Layers can invoke layers deeper than the ones directly below them. This can increase performance but impacts portability.
• Black-box layering. The boundaries of the layers and their dependencies are strictly defined using interfaces, which supports run-time extensions, interception and improves testability.
• White-box layering. Classes that collaborate across layer boundaries and are highly coupled.
N-Tier / 3-Tier Architecture
This architectural deployment style describes the separation of functionality into separate segments in a very similar way to the layered style, but in which each segment is located on a physically separate computer. This style has evolved from the component-based approach, generally using platform-specific communication methods associated with a platform instead of the message-based approach.
Key Principles.
The following are the key principles of the N-tier/3-tier architecture style:
• It is a style for defining the deployment of the tiers in an installation.
• N-tier architecture is characterized by the functional decomposition of the application, the service components and their distributed deployment, improving scalability, availability, manageability and resource utilization.
• Each tier is completely independent of the other tiers, except for the one immediately below it. Tier n only needs to know how to handle a request from tier n+1, how to make the request to tier n-1 (if it exists) and how to handle the result of the request.
• N-tier architecture has at least three separate tiers or parts, each of them with its own responsibility, located on different servers.
• A layer is deployed on a specific tier if more than one service or application is exposed by that layer.
Benefits.
The main benefits of the N-tier/3-tier architecture style are:
• Improved maintainability. Because each tier is independent of the others, changes or updates can be made without affecting the application as a whole.
• Scalability. Since the tiers are based on different machines, scaling the application out is reasonably straightforward.
• Flexibility. Since each tier can be managed and scaled independently, flexibility is increased.
• Availability. Applications can take advantage of the modular architecture of enabled systems, using components that scale easily, which increases availability.
Examples.
Some examples of the N-tier/3-tier architecture style are:
• A financial Web application where security is important and the business tier needs to be installed behind a firewall, which forces the presentation tier to be installed on a separate tier of the perimeter.
• A connected rich client application, where the presentation tier is on the client machines and the business and data tiers are installed on the server.
Juan Carlos Pelaez
Software Architect.
Keywords: 3Metas, Juan Pelaez, Architecture, Entrepreneurship, Software Development, Distributed Applications, Juan Carlos Pelaez, Colombia, Software Development, Solutions, Silverlight, Sharepoint, WCF, WPF, Web Application Development, Intranet Application Development, Web 2.0, New Media.
Published at: www.juanpelaez.com
Advertising: Do you need Architects for solutions based on the Microsoft platform? 3Metas Corp has a group of specialists who can support your solution design, construction and implementation processes. Contact us at the email address sales@3metas.com
Need Expert Help?
Let's discuss how I can help with your technical challenges
Schedule a Consultation