Web Application & Software Architecture Basics - tarunchhabra/parakalo GitHub Wiki
Introduction
What is a Tier?
Why do software applications have different tiers? What is the need for them? How do I decide how many tiers should my application have? What Is A Tier? # Think of a tier as a logical separation of components in an application or a service. And when I say separation, I mean physical separation at the component level, not the code level.
What do I mean by components?
Database Back-end application server User interface Messaging Caching These are the different components that make up a web service.
Single Tier Applications # A single-tier application is an application where the user interface, backend business logic & the database all reside in the same machine.
Advantages Of Single Tier Applications # The main upside of single-tier applications is they have no network latency since every component is located on the same machine. This adds up to the performance of the software.
There are no data requests to the backend server every now and then, which would make the user experience slow. In single-tier apps, the data is easily & quickly available since it is located in the same machine.
Though it largely depends on how powerful the machine is & the hardware requirements of the software, to gauge the real performance of a single-tier app.
Also, the data of the user stays in his machine & doesn’t need to be transmitted over a network. This ensures data safety at the highest level.
Disadvantages Of Single Tier Applications # One big downside of single-tier app is that the business has no control over the application. Once the software is shipped, no code or features changes can possibly be done until the customer manually updates it by connecting to the remote server or by downloading & installing a patch.
In the 90s due to this, if a game was shipped with buggy code, there was nothing the studios could do. They would eventually have to face quite some heat due to the buggy nature of the software. The testing of the product has to be thorough, there is no room for any mistakes.
The code in single-tier applications is also vulnerable to being tweaked & reversed engineered. The security, for the business, is minimal.
Also, the applications’ performance & the look and feel can get inconsistent as it largely depends on the configuration of the user’s machine.
Two Tier Application # A Two-tier application involves a client and a server. The client would contain the user interface & the business logic in one machine. And the backend server would be the database running on a different machine. The database server is hosted by the business & has control over it.
The Need For Two Tier Application #
In these scenarios, it won’t cause the business significant harm, even if the code is accessed by a third person. On the contrary, the upside is since the code & the user interface reside in the same machine, there are fewer network calls to the backend server which keeps the latency of the application low.
The application makes a call to the database server, only when the user has finished creating his to-do list & wants to persist the changes. Also, fewer server calls mean less money to be spent on the servers which is naturally economical.
Three Tier Applications
In a three-tier application the user interface, application logic & the database all lie on different machines & thus have different tiers. They are physically separated.
N-Tier Application # An N-tier application is an application which has more than three components involved.
What are those components?
Cache Message queues for asynchronous behaviour Load balancers Search servers for searching through massive amounts of data Components involved in processing massive amounts of data Components running heterogeneous tech commonly known as web services etc. All the social applications like Instagram, Facebook, large scale industry services like Uber, Airbnb, online massive multiplayer games like Pokemon Go, applications with fancy features are n-tier applications. There is another name for n-tier apps, the “distributed applications”.
Why The Need For So Many Tiers? # Two software design principles that are key to explaining this are the Single Responsibility Principle & the Separation of Concerns.
Architecture Tradeoffs https://www.developertoarchitect.com/lessons/lesson17.html
Analysing Tradeoffs - https://www.developertoarchitect.com/lessons/lesson145.html
Classifying Architecture Patterns - https://www.developertoarchitect.com/lessons/lesson6.html
Components - https://www.developertoarchitect.com/lessons/lesson8.html
Analysing Architecture: Macro Techniques & Coupling https://www.developertoarchitect.com/lessons/lesson9.html
Analyzing MS Architecture anti patterns : https://www.developertoarchitect.com/lessons/lesson10.html