What's the difference between "Layers" and "Tiers"?
Asked Answered
M

14

258

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

Moneymaking answered 23/9, 2008 at 11:32 Comment(2)
Almost everyone I've met in software world uses these two terms interchangeably as if they are exactly the same.Evette
"Layers refer to the inside of a cake, which can be anywhere between two and six layers of sponge, sandwiched together by buttercream before being decorated. Tiers refer to the number of cakes of increasing size that are stacked on top of each other." Yes, that's a real cooking definition, and pretty enlightening if you compare it to the selected answer: https://mcmap.net/q/109341/-what-39-s-the-difference-between-quot-layers-quot-and-quot-tiers-quotColfin
K
304

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?

Ketonuria answered 23/9, 2008 at 11:44 Comment(0)
J
51

Read Scott Hanselman's post on the issue: A reminder on "Three/Multi Tier/Layer Architecture/Design":

Remember though, that in "Scott World" (which is hopefully your world also :) ) a "Tier" is a unit of deployment, while a "Layer" is a logical separation of responsibility within code. You may say you have a "3-tier" system, but be running it on one laptop. You may say your have a "3-layer" system, but have only ASP.NET pages that talk to a database. There's power in precision, friends.

Januaryjanuisz answered 23/9, 2008 at 11:34 Comment(0)
B
47

Layers refer to the logical separation of code. Logical layers help you organize your code better. For example, an application can have the following layers.

  1. Presentation Layer or UI Layer
  2. Business Layer or Business Logic Layer
  3. Data Access Layer or Data Layer

The above three layers reside in their own projects, maybe 3 projects or even more. When we compile the projects we get the respective layer DLL. So we have 3 DLLs now.

Depending upon how we deploy our application, we may have 1 to 3 tiers. As we now have 3 DLL's, if we deploy all the DLLs on the same machine, then we have only 1 physical tier but 3 logical layers.

If we choose to deploy each DLL on a separate machine, then we have 3 tiers and 3 layers.

So, Layers are a logical separation and Tiers are a physical separation. We can also say that tiers are the physical deployment of layers.

Bodi answered 3/6, 2011 at 10:6 Comment(2)
What i understood from your answer that we can deploy 3 layers(DLL) on three different server. Right ? Can you please tell me how can i give reference of Business Logic layer on presentation layer ?Apologize
@MazharKhan You might want to use a service to expose the business layer functionality to the presentation layerOperate
H
45

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

Herbal answered 6/5, 2015 at 10:11 Comment(0)
M
17

I've found a definition that says that Layers are a logical separation and tiers are a physical separation.

Moneymaking answered 23/9, 2008 at 11:42 Comment(0)
H
15
  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.

Hennahane answered 19/12, 2013 at 5:32 Comment(0)
P
11

Layers are logical separation of related-functional[code] within the application and Communication between the layers is explicit and loosely coupled. [Presentation logic, Application logic, Data Access logic]

Tiers are Physical separation of layers [which get hosted on Individual servers] in an individual computer(process).

enter image description here

As shown in diagram:

1-Tier & 3-Layers « App Logic  with out DB access store data in a files.
2-Tier & 3-Layers « App Logic & DataStorage-box.
2-Tier & 2-Layers « Browser View[php] & DataStorage[procedures]
2-Tier & 1-Layers « Browser View[php] & DataStorage, query sending is common.
3-Tier & n-Layer  « Browser View[php], App Logic[jsp], DataStorage

n-Tier advantages:
Better Security
Scalability : As your organization grows You can scale up your DB-Tier with DB-Clustering with out touching other tiers.
Maintainability : Web designer can change the View-code, with out touching the other layers on the other tiers.
Easily Upgrade or Enhance [Ex: You can add Additional Application Code, Upgrade Storage Area, or even add Multiple presentation Layers for Separate devises like mobile, tablet, pc]

enter image description here Diagram from the blog

Pistol answered 13/3, 2016 at 13:26 Comment(0)
R
9

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.

Restricted answered 5/7, 2017 at 6:10 Comment(0)
P
8

Yes my dear friends said correctly. Layer is a logical partition of application whereas tier is physical partition of system tier partition is depends on layer partition. Just like an application execute on single machine but it follows 3 layered architecture, so we can say that layer architecture could be exist in a tier architecture. In simple term 3 layer architecture can implement in single machine then we can say that its is 1 tier architecture. If we implement each layer on separate machine then its called 3 tier architecture. A layer may also able to run several tier. In layer architecture related component to communicate to each other easily.
Just like we follow given below architecture

  1. presentation layer
  2. business logic layer
  3. data access layer

A client could interact to "presentation layer", but they access public component of below layer's (like business logic layer's public component) to "business logic layer" due to security reason.
Q * why we use layer architecture ? because if we implement layer architecture then we increase our applications efficiency like

==>security

==>manageability

==>scalability

other need like after developing application we need to change dbms or modify business logic etc. then it is necessary to all.

Q * why we use tier architecture?

because physically implementation of each layer gives a better efficiency ,without layer architecture we can not implement tier architecture. separate machine to implement separate tier and separate tier is implement one or more layer that's why we use it.
it uses for the purposes of fault tolerance. ==>easy to maintain.

Simple example

Just like a bank open in a chamber, in which categories the employee:

  1. gate keeper
  2. a person for cash
  3. a person who is responsible to introduce banking scheme
  4. manager

they all are the related components of system.

If we going to bank for loan purpose then first a gate keeper open the door with smile after that we goes to near a person that introduce to all scheme of loan after that we goes to manager cabin and pass the loan. After that finally we goes to cashier's counter take loan. These are layer architecture of bank.

What about tier? A bank's branch open in a town, after that in another town, after that in another but what is the basic requirement of each branch

  1. gate keeper
  2. a person for cash
  3. a person who is responsible to introduce banking scheme
  4. manager

exactly the same concept of layer and tier.

Permafrost answered 11/3, 2013 at 10:50 Comment(1)
Great explanation dearDrachma
O
6

I use layers to describe the architect or technology stack within a component of my solutions. I use tiers to logically group those components typically when network or interprocess communication is involved.

Obliging answered 23/9, 2008 at 11:37 Comment(0)
D
2

Technically a Tier can be a kind of minimum environment required for the code to run.

E.g. hypothetically a 3-tier app can be running on

  1. 3 physical machines with no OS .
  2. 1 physical machine with 3 virtual machines with no OS.

    (That was a 3-(hardware)tier app)

  3. 1 physical machine with 3 virtual machines with 3 different/same OSes

    (That was a 3-(OS)tier app)

  4. 1 physical machine with 1 virtual machine with 1 OS but 3 AppServers

    (That was a 3-(AppServer)tier app)

  5. 1 physical machine with 1 virtual machine with 1 OS with 1 AppServer but 3 DBMS

    (That was a 3-(DBMS)tier app)

  6. 1 physical machine with 1 virtual machine with 1 OS with 1 AppServers and 1 DBMS but 3 Excel workbooks.

    (That was a 3-(AppServer)tier app)

Excel workbook is the minimum required environment for VBA code to run.

Those 3 workbooks can sit on a single physical computer or multiple.

I have noticed that in practice people mean "OS Tier" when they say "Tier" in the app description context.

That is if an app runs on 3 separate OS then its a 3-Tier app.

So a pedantically correct way describing an app would be

"1-to-3-Tier capable, running on 2 Tiers" app.

:)


Layers are just types of code in respect to the functional separation of duties withing the app (e.g. Presentation, Data , Security etc.)

Drews answered 7/3, 2019 at 11:23 Comment(0)
T
1

When you talk about presentation, service, data, network layer, you are talking about layers. When you "deploy them separately", you talk about tiers.

Tiers is all about deployment. Take it this way: We have an application which has a frontend created in Angular, it has a backend as MongoDB and a middle layer which interacts between the frontend and the backend. So, when this frontend application, database application, and the middle layer is all deployed separately, we say it's a 3 tier application.

Benefit: If we need to scale our backend in the future, we only need to scale the backend independently and there's no need to scale up the frontend.

Tonytonya answered 8/8, 2018 at 10:0 Comment(0)
M
0

Layers are conceptual entities, and are used to separate the functionality of software system from a logical point of view; when you implement the system you organize these layers using different methods; in this condition we refer to them not as layers but as tiers.

Monanthous answered 12/2, 2014 at 15:0 Comment(0)
B
0

IBM's Three-Tier Architecture article has a section dedicated to this topic:

In discussions of three-tier architecture, layer is often used interchangeably – and mistakenly – for tier, as in 'presentation layer' or 'business logic layer.'

They aren't the same. A 'layer' refers to a functional division of the software, but a 'tier' refers to a functional division of the software that runs on infrastructure separate from the other divisions. 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.

Bonze answered 8/12, 2022 at 17:46 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.