Web Application & Software Architecture Flashcards
Definition of a Tier:
Logical and physical separation of components in an application or service.
Separation occurs at a component level, not the code level.
Components include database, backend server, user interface, messaging, caching, etc.
Purpose of Tiers:
To structure and organize an application’s components.
Enable scalability, maintainability, and flexibility.
Facilitate easier management and upgrades.
Determining Tiers in an Application:
Factors: Complexity, scalability needs, performance requirements, business logic.
No one-size-fits-all approach; depends on the application’s specific needs.
Types of Tiers and Examples:
Presentation Tier:
Responsible for user interaction.
Example: User Interface (UI) components like web browsers, mobile apps.
Application Tier (Middle Tier):
Contains business logic and processes requests from the presentation tier.
Example: Backend application servers, application logic components.
Data Tier:
Handles data storage and management.
Example: Databases (SQL, NoSQL), data storage systems.
Infrastructure Tier:
Supports the application by providing resources.
Example: Servers, networking infrastructure, cloud services.
Single-tier applications
In a single-tier application, the user interface, backend business logic, and the database reside in the same machine.
Single-Tier Applications -Upsides
No Network Latency: Components on the same machine, enhancing performance.
Immediate Data Availability: All components accessible on the local machine.
Data Privacy: User data stays on their machine, enhancing privacy and safety.
Performance Dependency:
Relies on the machine’s hardware and capabilities.
Single-Tier Applications -Downsides
Limited Control Over Updates: Publishers can’t update code/features post-shipment without manual user intervention.
Vulnerability to Buggy Code: No post-shipment updates could lead to user dissatisfaction.
Security Vulnerabilities: Source code exposure allows tweaking, reverse engineering, and potential security risks.
Inconsistent Performance/Look: Rendering varies based on user machine configuration.
Two-Tier Structure:
Client: Contains user interface and business logic on one machine.
Server: Hosts the database on a separate machine controlled by the business.
Need for Two-Tier Applications:
Reduced Network Calls: Locally hosted business logic minimizes backend server requests, lowering latency.
Use Cases: Suited for applications where security risks are minimal (e.g., to-do lists, productivity apps, games).
Examples:
To-Do List App: Backend calls triggered only upon data persistence.
Browser/Mobile Games: Heavy game files downloaded once, with minimal backend calls for game state persistence.
Cost Efficiency:
Fewer server calls lead to cost savings in server maintenance.
Choice of tier depends on business requirements and use cases.
Consideration for Future Tiers:
Design flexibility allows migration to three-tier architecture as per evolving business needs.
Three-Tier Applications
User Interface: Composed of HTML, JavaScript, CSS on one machine.
Business Logic: Runs on a server (e.g., Apache) on a separate machine.
Database: Stored separately, e.g., MySQL, on another machine.
Use Cases:
Popular on the Web: Commonly used for simple websites like blogs, news websites, etc.
Physical Separation: Components reside on different machines, creating distinct tiers.
Example:
Simple Blog: UI written in HTML, JavaScript, CSS; backend logic on Apache; MySQL for the database.
Benefits:
Structure and Separation: Organized division of UI, logic, and database.
Scalability and Maintenance: Allows scalability and easier maintenance.
N-tier applications
Components in N-Tier Applications:
Cache
Message Queues (Asynchronous Behavior)
Load Balancers
Search Servers (Handling Massive Data)
Components for Processing Massive Data
Heterogeneous Tech (Web Services, Microservices)
Examples of N-Tier Applications:
Social Applications: Instagram, Facebook, TikTok
Consumer Services: Uber, Airbnb
Massive Multiplayer Games: Pokémon Go, Roblox
Need for Multiple Tiers:
Single Responsibility Principle:
Dedicated Responsibilities: Components handle specific tasks flawlessly.
Flexibility and Management: Easier management, cleaner code, dedicated teams.
Loose Coupling: Changes in one component don’t impact others, enhancing robustness.
Stored Procedures Concerns:
Database Logic: Advocates against storing business logic in databases for future flexibility.
Separation of Concerns:
Reusability: Loosely coupled components enable reuse across services.
Scalability: Enables easy scaling of services as they grow.
Layers vs. Tiers:
Layers: Conceptual/logical organization of code (UI, business logic, data access).
Tiers: Physical separation of components across machines.
Difference Clarification:
Layers: Code-level organization.
Tiers: Physical separation of components.
Web App Architecture
Web Application Components:
1. Database
2. Message Queue
3. Cache
4. User Interface
Client-Server Architecture
Fundamental Web Building Block:
Request-Response Model: Client sends requests, server responds.
Ubiquity in Web Applications:
Usage in Websites and Apps: WordPress blogs, Facebook, Twitter, banking apps.
Rare Usage of Peer-to-Peer Architecture: A small percentage in business websites and apps.
Client
Role of the Client:
Holds User Interface: Presentation aspect of the application.
Responsible for Look and Feel: Composed of HTML, JavaScript, CSS.
Client Platforms:
Variety of Devices: Mobile apps, desktops, tablets (e.g., iPad), web-based consoles.
Gateway to the Application: Interface for interaction with the backend.
Technologies for Client-Side:
**Popular Libraries: **Vanilla JavaScript, jQuery, React, Angular, Vue, Svelte.
JavaScript Foundation: Majority of these libraries are JavaScript-based.
Platform-Specific Frameworks:
Diversity Based on Platform: Different tools for Android, Apple, Windows OS.
Platform-Specific Requirements: Tailored frameworks for distinct platforms.
Thin & Thick client
A thin client is a client that holds just the user interface of the application. It contains no business logic of any sort. For every action, the client sends a request to the backend server, just like in a three-tier application.
A thick client holds all or some part of the business logic. These are the two-tier applications.
The typical examples of fat clients are utility apps, online games, and so on.
Web Server
Role of a Web Server:
Receiving and Responding: Receives client requests, executes business logic, and provides responses.
Foundation for Online Services: Crucial for running online services.
Types of Servers:
Application Servers: Common servers for running web applications.
Other Servers: Proxy, Mail, File, Virtual, Data Storage, Batch Job Servers, etc.
Varied Configuration Based on Use Case: Specific servers chosen based on requirements (e.g., Apache Tomcat, Apache HTTP Server).
Focus on Application Servers:
Central for Web Application Components: Database, message queue, cache, user interface, etc., require servers to function.
Dedicated Hosting: UI components hosted separately on dedicated servers.
Server-Side Rendering:
Rendering Technique: Backend rendering of UI, sending generated data to the client.
Pros and Cons with Client-Side Rendering: To be discussed in upcoming lessons.
REST API Architecture
Request-Response Model:
Client-Server Interaction: Client sends a request, server responds with data.
Dependence on Request for Response: No response without a preceding request.
HTTP Protocol:
Data Exchange Protocol: Entire communication over HTTP.
**Stateless Nature: **Processes executed independently without knowledge of past processes.
Protocol for Web Information Exchange: Defines web data transmission.
REST API and API Endpoints:
Foundation of Modern Web Communication: Clients interact with REST endpoints on the backend.
Upcoming Detailed Discussion: Rest API and API Endpoints in the next lesson.