WEB

1 ATT

1. Web Application Architecture and Lifecycle Models

The evolution of the web from static, read-only documents to highly interactive dynamic applications has transformed architectural requirements. In a modern ecosystem, understanding high-level architecture and development methodologies is the essential prerequisite for building scalable, maintainable software. This transition requires moving beyond simple file-serving to a model where logic is executed server-side to generate real-time responses.

Defining the Web Application

Synthesizing the modern standard, a web application is software that executes on a web server and is accessed by users via a web browser. Unlike traditional desktop software, it requires no local installation on the client's hardware, ensuring immediate accessibility and centralized updates.

Architecture & Hosting Ecosystem: The "Furniture Store" Analogy

To conceptualize the interaction between components, we use the analogy of a professional furniture store:

  • The Client (Browser): Acts as the storefront or receptionist. It is the point of entry where the user makes a specific request.

  • The Server (Web Server): Software such as NGINX, Apache, or IIS acts as the facility receiving the request.

  • The Framework (Application Logic): Entities like Django, Laravel, or FastAPI act as the workers or warehouse managers. They process the logic, verify the request, and coordinate with other departments.

  • The Database: Systems like PostgreSQL, MySQL, Oracle, or SQLite serve as the inventory/warehouse, storing and retrieving the raw data required by the framework.

These systems are supported by a hosting infrastructure that includes global providers like AWS and Microsoft Azure, as well as regional services like ps.kz or hoster.kz.

Primary Development Methodologies

Choosing an organizational structure is a strategic decision. The following table evaluates the primary models used in professional software engineering:

Methodology

Core Workflow

Strategic Use Case

Waterfall

Sequential phases (Requirements -> Design -> Dev -> Testing). Each phase must finish before the next begins.

Fixed, well-defined projects with stable, non-evolving requirements.

Agile

Iterative and flexible; emphasizes collaboration and incremental deliveries.

Projects with evolving requirements requiring high flexibility.

Scrum

A framework within Agile using "sprints" (time-boxed iterations) and daily status meetings.

Teams requiring high adaptability and frequent, tangible progress checks.

Spiral

Combines iterative development with Waterfall's systematic control, emphasizing risk analysis.

High-risk, complex enterprise projects requiring gradual refinement.

While these methodologies provide the project blueprint, the implementation begins with the foundational technologies of the frontend.

--------------------------------------------------------------------------------

2. Frontend Foundations: HTML5 and CSS Architecture

Strategic web development relies on the strict separation of concerns: using Semantic HTML for meaningful structure and modular CSS for presentation.

HTML5 & Semantic Structure

HTML5 moved the web away from generic containers toward elements with intrinsic meaning. Essential elements include standard headings, forms, and multimedia (audio/video). Modern standards emphasize Semantic HTML, utilizing tags like <header>, <footer>, <article>, <section>, and <nav> to improve SEO and accessibility.

Beyond structure, HTML5 introduced advanced graphical elements like SVG and Canvas, and specialized form input types such as color, date, email, and range.

CSS Mastery & The Box Model

Professional styling follows the DRY (Don't Repeat Yourself) principle to ensure maintainability.

  • The CSS Box Model: Every element is a rectangular box. The total width is calculated by the Content, Padding (internal space), Border, and Margin (external space). Note that margins and padding are transparent.

  • The Specificity Hierarchy: Browsers resolve style conflicts using a point-based scoring system:

    • Inline Styles: 1000 points.

    • IDs (#header): 100 points.

    • Classes/Attributes/Pseudo-classes (.nav, :hover): 10 points.

    • Elements (p, div): 1 point.

    • Combined Selectors: Scores are additive. For example, div.card scores 11 (1 for element + 10 for class).

    • Architect's Note: Avoid !important as it bypasses this logic and creates technical debt.

Advanced Layout Systems

Modern layouts utilize two primary engines:

  1. Flexbox (One-dimensional): Ideal for rows or columns. Key parent properties include justify-content and align-items. For children, we use flex-grow, flex-shrink, and the shorthand flex (e.g., flex: 1 0 auto).

  2. CSS Grid (Two-dimensional): Designed for simultaneous row and column management, defining layouts via grid-template-columns and grid-template-rows.

Static structures provide the skeleton, but JavaScript provides the dynamic engine required for modern interactivity.

--------------------------------------------------------------------------------

3. JavaScript: The Dynamic Engine and DOM Manipulation

JavaScript is a high-level, interpreted language that serves as the logic layer of the browser environment.

Core Syntax & Modern Idioms

JavaScript distinguishes between Primitives (Number, String, Boolean, Null, Undefined, Symbol, and BigInt) and Reference Types (Objects, including Arrays and Functions).

  • Modern Variable Rules: The legacy var is obsolete as its function-scoping leads to "leaking" variables. Modern standards mandate const for immutable references and let for reassignable variables, both of which are strictly block-scoped.

  • Idioms: Modern ES2020+ features include Template Literals Hello, ${user}), Optional Chaining (obj?.prop), and the Nullish Coalescing Operator (val ?? fallback), which only triggers for null or undefined.

Functional Programming Paradigms

Modern development favors functional array methods over imperative for loops for clarity and immutability:

const numbers = [1, 2, 3, 4, 5];

// map: Transform values
const doubled = numbers.map(val => val * 2); 

// filter: Keep matching items
const evens = numbers.filter(val => val % 2 === 0);

// reduce: Combine into single value
const sum = numbers.reduce((acc, val) => acc + val, 0);

The Document Object Model (DOM)

The DOM is a tree structure rooted at window.document.

  • Access: Use the recommended querySelector and querySelectorAll for CSS-based node selection.

  • Manipulation: Update content via textContent or innerHTML. For structure, use document.createElement(), appendChild(), and the modern element.remove().

  • Coordinate System: The DOM origin is at the upper left (0,0). Position is read via offsetLeft and offsetTop.

  • Interactivity: Logic is attached via addEventListener. Timers like setTimeout (delayed) and setInterval (repeated) handle time-based execution.

As logic scales, enterprise-grade frameworks like Angular are required to manage state and complex data flows.

--------------------------------------------------------------------------------

4. Modern Enterprise Frameworks: The Angular 21 Paradigm

Angular has undergone a paradigm shift, moving from the heavy Zone.js change detection to a "Zoneless" architecture for superior performance, smaller bundle sizes, and surgical UI updates.

Signals & State Management

In Angular 21's Zoneless world, plain property assignments (e.g., this.data = []) do not trigger UI updates. Developers must use Signals:

  • signal(initialValue) creates the state.

  • .set(newValue) or .update(fn) modifies the state and notifies the framework.

  • Template Execution: In HTML, signals must be called as functions: {{ posts() }}.

Services and Dependency Injection (DI)

Services are singletons providing reusable logic. While constructor injection is legacy, the inject() function is the modern preference. It aligns with functional patterns, works outside constructors, and simplifies testing.

Observables vs. Promises

Angular utilizes RxJS Observables to handle asynchronous data streams:

Feature

Promises

Observables

Value Emission

Single value

Stream of 0..N values

Execution

Eager (executes immediately)

Lazy (waits for .subscribe())

Cancelability

No

Yes (via .unsubscribe())

Operators

Limited

Rich (map, filter, switchMap, catchError)

Side-by-Side Migration (Legacy vs. Angular 21)

Concept

Legacy (Zone.js)

Modern (Zoneless/Signals)

State

posts: Post[] = []

posts = signal<Post[]>([])

Update

this.posts = data

this.posts.set(data)

DI

constructor(private s: Svc)

private s = inject(Svc)

Logic

*ngIf, *ngFor

@if, @for

--------------------------------------------------------------------------------

5. The Communication Layer: RESTful APIs and HttpClient

REST (Representational State Transfer) is the stateless architectural standard for client-server communication, exposing data as resources.

REST Principles and CRUD Operations

Standard HTTP methods map directly to CRUD actions:

  • GET: Read resources (e.g., /api/posts/42).

  • POST: Create new resources.

  • PATCH: Partial update of specific fields.

  • PUT: Complete replacement of a resource.

  • DELETE: Removal of a resource.

HTTP Status Code Reference

  • 2xx (Success): 200 OK, 201 Created, 204 No Content.

  • 3xx (Redirect): 304 Not Modified.

  • 4xx (Client Error): 400 Bad Request, 404 Not Found.

  • 5xx (Server Error): 500 Internal Server Error.

Angular HttpClient Implementation

In Angular 21, HttpClient is provided at the root by default in app.config.ts. Services use it to return typed Observables, often utilizing .pipe() with the catchError operator to ensure the application remains robust during network failures.

--------------------------------------------------------------------------------

6. Backend Fundamentals: Python Programming and Environments

Python’s philosophy emphasizes readability and a "comfortable" syntax, making it the preferred choice for backend logic and API development.

Language Essentials

Python's core is built on powerful data structures: Lists (sequences) and Dictionaries (key-value pairs). It uses None as its specific null type. Control flow utilizes if/elif/else and for/in loops, while functions support default arguments (e.g., def query(limit=10):).

Advanced Logic and Standards

  • Docstrings: Modules, classes, and functions should include string literals (e.g., """Documentation""") for built-in help.

  • Exceptions: Error handling is managed via try, except, else, and finally blocks to ensure graceful failure and resource cleanup.

  • PEP-8 Standards: Mandates 4-space indents, lower_case for methods/variables, and CamelCase for classes.

Environment Management

Because different projects require different library versions, professional Python developers avoid global package installation.

  • Package Managers: Use pip (modern standard) rather than the legacy easy_install.

  • Virtual Environments: virtualenv creates an isolated directory for dependencies.

  • Activation:

    • Mac/Linux: source myenv/bin/activate

    • Windows: myenv\Scripts\activate.bat

This integrated journey—from the semantic structure of HTML to the isolated backend environments of Python—provides the complete architectural foundation required of a full-stack engineer.