What's the difference between “Layers” and “Ti

2019-01-02 16:34发布

What's the difference between "Layers" and "Tiers"?

14条回答
宁负流年不负卿
2楼-- · 2019-01-02 16:57

1.In 3 layer architecture DAL(Databse layer), BLL(Bissiness layer) and UIL(UI layer) can work on same machine where as in a 3 Tier architecture a client in on one machine, the application Server is hosted in another machine and the database server resides in another machine.

2.Layer Architecture will improve readability and reusability, Minimizes the application changes due to impact of the changes in other layers. While 3 Tier Architecture has all advantages of 3 layer + scalability as application will be deployed in different machines so load will be shared among the tiers and scalability will increase.

查看更多
不流泪的眼
3楼-- · 2019-01-02 17:00
  1. In plain english, the Tier refers to "each in a series of rows or levels of a structure placed one above the other" whereas the Layer refers to "a sheet, quantity, or thickness of material, typically one of several, covering a surface or body".
  2. Tier is a physical unit, where the code / process runs. E.g.: client, application server, database server;

    Layer is a logical unit, how to organize the code. E.g.: presentation (view), controller, models, repository, data access.

  3. Tiers represent the physical separation of the presentation, business, services, and data functionality of your design across separate computers and systems.

    Layers are the logical groupings of the software components that make up the application or service. They help to differentiate between the different kinds of tasks performed by the components, making it easier to create a design that supports reusability of components. Each logical layer contains a number of discrete component types grouped into sublayers, with each sublayer performing a specific type of task.

The two-tier pattern represents a client and a server.

In this scenario, the client and server may exist on the same machine, or may be located on two different machines. Figure below, illustrates a common Web application scenario where the client interacts with a Web server located in the client tier. This tier contains the presentation layer logic and any required business layer logic. The Web application communicates with a separate machine that hosts the database tier, which contains the data layer logic.

Layers vs Tiers

Advantages of Layers and Tiers:

  • Layering helps you to maximize maintainability of the code, optimize the way that the application works when deployed in different ways, and provide a clear delineation between locations where certain technology or design decisions must be made.

  • Placing your layers on separate physical tiers can help performance by distributing the load across multiple servers. It can also help with security by segregating more sensitive components and layers onto different networks or on the Internet versus an intranet.

A 1-Tier application could be a 3-Layer application.

查看更多
美炸的是我
4楼-- · 2019-01-02 17:00

I like the below description from Microsoft Application Architecture Guide 2

Layers describe the logical groupings of the functionality and components in an application; whereas tiers describe the physical distribution of the functionality and components on separate servers, computers, networks, or remote locations. Although both layers and tiers use the same set of names (presentation, business, services, and data), remember that only tiers imply a physical separation.

查看更多
低头抚发
5楼-- · 2019-01-02 17:00

A layer is a logical module of software with its own core logic and boundaries.

A tier is a physical container of one or more layers, such as a server across a network or multiple instances of the same Virtual Machine, working in a load-balanced way.

查看更多
无色无味的生活
6楼-- · 2019-01-02 17:05

Logical layers are merely a way of organizing your code. Typical layers include Presentation, Business and Data – the same as the traditional 3-tier model. But when we’re talking about layers, we’re only talking about logical organization of code. In no way is it implied that these layers might run on different computers or in different processes on a single computer or even in a single process on a single computer. All we are doing is discussing a way of organizing a code into a set of layers defined by specific function.

Physical tiers however, are only about where the code runs. Specifically, tiers are places where layers are deployed and where layers run. In other words, tiers are the physical deployment of layers.

Source: Rockford Lhotka, Should all apps be n-tier?

查看更多
美炸的是我
7楼-- · 2019-01-02 17:08

Why always trying to use complex words?

A layer = a part of your code, if your application is a cake, this is a slice.

A tier = a physical machine, a server.

A tier hosts one or more layers.


Example of layers:

  • Presentation layer = usually all the code related to the User Interface
  • Data Access layer = all the code related to your database access

Tier:

Your code is hosted on a server = Your code is hosted on a tier.

Your code is hosted on 2 servers = Your code is hosted on 2 tiers.

For example, one machine hosting the Web Site itself (the Presentation layer), another machine more secured hosting all the more security sensitive code (real business code - business layer, database access layer, etc.).


There are so many benefits to implement a layered architecture. This is tricky and properly implementing a layered application takes time. If you have some, have a look at this post from Microsoft: http://msdn.microsoft.com/en-gb/library/ee658109.aspx

查看更多
登录 后发表回答