Understanding Web Application and Software Architecture ( Go step by step thru the different concepts, functions, and components involved in architecting a web application) Flashcards
The different tiers in software architecture:
- What is a tier?
- Why do software applications have different tiers?
- How do I decide how many tiers my application should have?
- A tier is a logical separation of components in an application
components are: Database, Backend Server, User Interface, Messaging, Caching
Scalability
High Availability
Load Balancing
Monolith and Microservices
MicroFrontends
Database
Caching
Message Queue
Describe a Single Tier Application and its strengths and weaknesses
Examples; Desktop Apps like MS Office, PC Games, Image editing software like GIMP, Photoshop, etc
the User Interface, Backend Server Business Logic, and Database reside in the same machine
Strengths: 1) low latency due to all 3 components on one machine, 2) higher order of security since the user’s data is on the machine and doesn’t need to be transmitted over a network for persistence
Weakness: 1) NO ROOM FOR MISTAKES OR BUGGY CODE Once the software is shipped the creator does not have any control over the software application. There can not be any code updates or feature updates unless the user manually installs the updated software, 2) the application is vulnerable to being modified or reverse engineered from a competitor or bad actor (depending on your perspective this can be viewed as weakness) 3) Inconsistent user experience since a single tier app’s performance largely depends on the end user’s machine’s power and the configuration of that machine
Describe a Two Tier Application and its strengths and weaknesses
Examples of Two Tier Apps: To-Do List app, Planner App, Productivity App
A Two Tier Application is logically separated into Client and Server. Where the Client includes the User Interface and the Business Logic of the application in one machine. The Backend Server includes the Database is running on a different machine. The Database is hosted by the business, which has control over the database.
Client Server Architecture communicates via Request and Response Cycles
Strengths:
there are less network calls made to the backend server since the user interface and business logic reside on one machine. This results in Low Latency.
example 1: with the To-Do list app a user only makes a network call to the database when they finish creating their list and want to persist the data
example 2: with browser and mobile games, the user only makes network calls to the backend when they want to persist game state
Fewer server calls means less money spent on keeping the servers running
Describe a Three Tier Application, it’s use cases per business requirements, and strengths and weaknesses
Examples: blogs, news websites
Three Tier Applications: all three components; user interface, business logic, and database, are separated onto three different physical machines
A basic Three Tier app would have:
User Interface written in HTML, JavaScript, and CSS
Business Logic will run on Apache
Database will be MySQL
Describe an N-Tier Application, its use cases per requirements, and strengths and weaknesses
An N-Tier application is an application that has more than three components (UI, Backend Server, Database) involved in its architecture
These additional components are:
Cache
Message queues for asynchronous behavior
Load balancers
Search servers for searching through massive amounts of data
Components involved in processing massive amounts of data
Components running heterogenous tech commonly known as web services, microservices, etc
All the social apps like Instagram, Twitter, Facebook, TikTok, and large scale consumer services like Uber, Airbnb, online massive multiplayer games like Pokemon Go, Roblox, etc, are n-tier applications.
N-Tier applications are more popularly known as distributed systems
CRUX: What’s the need for so many tiers?
hint: Single Responsibility Principle, Separation of Concerns Principle
Two key principles to explaining the need for many tiers are: Single Responsibility Principle, and the Separation of Concerns
Single Responsibility Principle: refers to giving one dedicated responsibility to a component and letting that component execute that one responsibility flawlessly. Making a change to one component doesn’t impact the functionality of other components.
example: saving data, running application logic, delivery of messages throughout the system
example: a database should not hold business logic. It should only take care of persisting the data.
Single Responsibility Principle makes are code more flexible, making management easy. It make the components lego blocks. Can have dedicated teams and code repositories for each component
Separation of Concerns: Be concerned about your work/responsibility/component only and stop worrying about the other work. Keeping components separate makes them reusable.
Loosely coupled components allows us to scale our service easily when things grow beyond a certain scale in the future
Tiers vs Layers
in the industry the term Application Layers refers to user interface, business, service, and the data access layers
These layers are the logical/conceptual separation of an application at the code level.
Layers represent the conceptual/logical organization of code
Tiers represent the physical/logical separation of components in an application or service. The components are the database, backend application server, user interface, messaging, and caching
Tiers Quiz: What are two valid reasons to have a two-tier architecture?
- To lower network latency. This happens because the business logic is stored on the client so there are less network calls to the backend server which keeps the latency of the application low
- When we, developers/creators, need control over data in our application. Since all the data is stored in the database server hosted by the business. The business has complete control over the database component.
Tiers Quiz: What are two valid reasons for a three tier achritecture?
- When we need control over the code/business logic of our application and want it to be secure. The business logic reside in the backend server. No client has access to the backend code, and this make the code secure. And the business has complete control over it.
- When we need control over data in our application. All the data in the application is stored in the database server hosted by the business. The business has complete control over the database component.
Tiers Quiz: Why do software applications have different tiers?
- To assign dedicated roles/tasks to different components for a loosely coupled architecture. As a result, modifications or updates made on a specific component does not impact another component.
- To make the management, maintenance of a system, and the introduction of new features in the application easier.
Web Architecture: What is Web Architecture?
Web Architecture is a system that involves multiple components like a database, message queue, cache, user interface, etc., all running in conjunction to form an online service.
What is Client-Server Architecture?
Client-Server architecture is the fundamental building block of the web.
The Client-Server architecture works on a Request Response Model.
The Client sends a request to the Server for information.
The Server responds with the requested information.
Every website you browse is built on Client-Server architecture.
A very small % of business websites and applications use peer-to-peer architecture, which differs from client-server.
The Thick Client vs the Thin Client
There are primarily two types of clients. The thick client and the thin client.
Thin client only holds the user interface. The thin client does not contain any business logic.
For every action, the client sends a request to the backend server, just like in a three-tier application.
Thick client holds both the user interface and all or part of the business logic. These are two-tier applications. Examples are utility apps, online games, etc.
The Thick Client vs the Thin Client
There are primarily two types of clients. The thick client and the thin client.
Thin client only holds the user interface. The thin client does not contain any business logic.
For every action, the client sends a request to the backend server, just like in a three-tier application.
Thick client holds both the user interface and all or part of the business logic. These are two-tier applications. Examples are utility apps, online games, etc.