Thông báo


Chia sẻ
Tùy chọn
Xem bài viết cuối
Offline admin  
#1 Đã gửi : 09/04/2015 lúc 02:17:51(UTC)

Danh hiệu: Administration

Chức danh:

Nhóm: Administrators
Gia nhập: 23-07-2013(UTC)
Bài viết: 6,117
Viet Nam
Đến từ: Vietnam

Cảm ơn: 10 lần
Được cảm ơn: 2 lần trong 2 bài viết

The 3-Tier Architecture - Software Architecture Pattern

Three-tier architecture can often be referred to as N-tier architecture and funcitons specifically to help seperate all of the areas of concern within your application.

A 3-tier application typically consists of the following levels : 

  • Data-Access  - used for actually interacting with your database and accessing data (Computer Data Storage).
  • Business Logic - used for adding in your specific business rules, processing and manipulating data and other calculations (Functional Process Logic)
  • Presentation - used for presenting the actual data to the user (User Interface)

Each of these areas will be completely seperate from one another within your application and may even be broken up into seperate Folders or Projects and can even be broken down into additional tiers depending on the level of complexity of your application. The layers will all be housed inside the same solution and will be deployed "as one", however this is just a means of organizing your application and seperating all of your concerns.

Within MVC, these of these tiers maps almost directly to one of the concepts within MVC. So within your application, you would handle all of your data-access within your Controller, apply all of your business logic within your models and finally pass the model to your Views which would be your presentation layer : 

  • Data-Access - Controllers/ Web API Services - Repositories
  • Business Logic - Models
  • Presentation - Views

Three-tier architecture:

Presentation tier

This is the topmost level of the application. The presentation tier displays information related to such services as browsing merchandise, purchasing and shopping cart contents. It communicates with other tiers by which it puts out the results to the browser/client tier and all other tiers in the network. (In simple terms it is a layer which users can access directly such as a web page, or an operating systems GUI)

Application tier (business logic, logic tier, or middle tier)

The logical tier is pulled out from the presentation tier and, as its own layer, it controls an application’s functionality by performing detailed processing.

Data tier

The data tier includes the data persistence mechanisms (database servers, file shares, etc.) and the data access layer that encapsulates the persistence mechanisms and exposes the data. The data access layer should provide an Application Programming Interface (API) to the application tier that exposes methods of managing the stored data without exposing or creating dependencies on the data storage mechanisms. Avoiding dependencies on the storage mechanisms allows for updates or changes without the application tier clients being affected by or even aware of the change. As with the separation of any tier, there are costs for implementation and often costs to performance in exchange for improved scalability and maintainability.

Integrating N-Tier or 3-Tier Architecture and Examples

You can find several different examples demonstrating N-Tier architecture from the sites below and although they apply to MVC, N-Tier architecture is commonly used and is completely agnostic to the technology you are using :

I'm sure if you search around on one of the many open-source sites such as github and CodePlex, you will be able to find many more examples, which should provide you with a few more detailed examples of what more real-world applications might look like.

Additional Articles

There is no "best" way to implement this and each implementation will vary slightly depending on your application, requirements and specificiations, however these are some very basic ways of structuring an application as a "3-Tier" application.

You can check out the following tutorials and walkthroughs which may be helpful as well : 

Ai đang xem chủ đề này?
OceanSpiders 2.0
Di chuyển  
Bạn không thể tạo chủ đề mới trong diễn đàn này.
Bạn không thể trả lời chủ đề trong diễn đàn này.
Bạn không thể xóa bài của bạn trong diễn đàn này.
Bạn không thể sửa bài của bạn trong diễn đàn này.
Bạn không thể tạo bình chọn trong diễn đàn này.
Bạn không thể bỏ phiếu bình chọn trong diễn đàn này.

| Cung cấp bởi YAF.NET | YAF.NET © 2003-2022, Yet Another Forum.NET
Thời gian xử lý trang này hết 0.562 giây.