Glossary

Web Developer Dictionary

Визначення технічних термінів з PHP, DevOps, MySQL та AI — з прикладами коду та поясненнями простою мовою.

228 terms
27 letters
R
Race Condition
A race condition is a bug that occurs when the result depends on the order of execution of concurrent operations. Classic example: two requests simultaneously read a balance ($100), both withdraw $80, both write $20 — but the correct result should be -$60.In databasesSolved with transactions at the appropriate isolation level, or SELECT ... FOR UPDATE — locking the row until the end of the transaction.In cachesAtomic Redis operations (INCR, SETNX, Lua scripts) prevent race conditions at the cache level.Optimistic vs pessimistic lockingOptimistic — on write, check whether data has changed since reading (version number / CAS). No locks, but retries possiblePessimistic — lock the resource on read so no one else can change it. No retries, but reduces concurrency
RAG (Retrieval-Augmented Generation)
RAG is an architectural pattern that augments an LLM with up-to-date data from an external store. Instead of "memorising" all facts in model parameters, the needed information is retrieved at query time and passed as context.RAG flowUser asks a questionThe system uses vector search to find relevant documentsDocuments are added to the prompt as contextThe LLM generates an answer based on the contextBenefitsUp-to-date data without retraining the modelSource control — answers are grounded in specific documentsReduced hallucinations for factual questionsWhen neededQ&A over corporate documentation, search in a large knowledge base, a chatbot answering product questions.
Rate Limiting
Rate limiting restricts the number of requests from a single client (IP, token, user ID) per unit of time. It protects against DDoS, brute-force password attacks, API abuse, and reduces server load.AlgorithmsFixed window — N requests per fixed interval (e.g. 100 per minute). Simple, but vulnerable to burst attacks at window boundariesSliding window — a rolling window, more even distributionToken bucket — the client receives tokens at a fixed rate and spends one per request; allows short burstsLeaky bucket — requests are processed at a uniform rate, regardless of burstsImplementationStore counters in Redis — it supports atomic increment and TTL. The HTTP response when a limit is exceeded: 429 Too Many Requests with a Retry-After header.
readonly (PHP 8.1)
readonly is a PHP 8.1 modifier that allows a property to be written only once (in the constructor) and forbids any subsequent modification. Ideal for Value Objects and DTOs — guarantees immutability without extra code. Example class Money { public function __construct( public readonly int $amount, public readonly string $currency, ) {} } $price = new Money(100, 'USD'); echo $price->amount; // 100 $price->amount = 200; // Error: Cannot modify readonly property readonly class (PHP 8.2) PHP 8.2 added readonly class — all properties of the class automatically become readonly. No need to write the modifier for each one. readonly class Point { public function __construct( public float $x, public float $y, ) {} }
Recursion
Recursion is a function that calls itself to solve a smaller subproblem. Classic uses: tree traversal, divide-and-conquer, mathematical sequences.Two mandatory elementsBase case — the stopping condition. Without it recursion is infinite → stack overflowRecursive case — calling itself with a smaller / closer-to-base argumentExample: scanning directoriesfunction scanDir(string $path): array { $result = []; foreach (scandir($path) as $item) { if ($item === '.' || $item === '..') continue; $full = "$path/$item"; $result[] = is_dir($full) ? scanDir($full) : $full; } return $result; }Recursion vs IterationRecursion is elegant for problems with a naturally tree-like structure. But each call consumes stack space. Deep recursion can cause a stack overflow. For large depths, use an iterative approach with an explicit stack.
Redis
Redis is an in-memory data store with string, hash, list, set, sorted set, and stream structures. Since all data lives in RAM, operations execute in microseconds. Most commonly used as a cache, queue broker, and pub/sub system.Typical use casesCaching — store the result of an expensive SQL query for N secondsSessions — fast session storage instead of a databaseQueues — reliable broker for background jobs; workers read tasks via BRPOP or StreamsRate limiting — atomic counter increment per time windowPub/Sub — broadcast events between services in real timePersistenceRedis stores data in memory but supports two disk-dump modes: RDB (snapshots) and AOF (log of all operations). Persistence is not critical for caching — for queues, enable AOF.
Regular Expressions (Regex)
Regular expressions are a language for describing patterns in order to search, validate, and replace strings. A powerful tool, but hard to read: the expression /^[\w.-]+@[\w.-]+\.[a-z]{2,}$/i validates an email format.Basic syntax. — any character; * — 0+; + — 1+; ? — 0 or 1[abc] — one of these characters; [a-z] — a range^ — start of string; $ — end(…) — capturing group; (?:…) — non-capturing\d — digit; \w — letter/digit/underscore; \s — whitespaceWhen not to useRegex is not the right tool for parsing HTML/XML (use DOM parsers) or complex formats like JSON. But it is ideal for format validation and text search.Toolsregex101.com — online testing with an explanation of every token. Indispensable when debugging complex expressions.
Repository Pattern
Repository is a pattern that isolates business logic from data storage details. Instead of writing SQL queries or accessing the ORM directly in services, all database interaction is encapsulated in a dedicated repository class.What it providesBusiness logic does not know where data comes from: MySQL, Redis, or an external APIEasy to swap the implementation in tests for an in-memory or mock versionQueries are concentrated in one place — easier to find and optimiseBasic structureinterface UserRepository { findById(int $id): ?User; save(User $user): void; } class SqlUserRepository implements UserRepository { ... }When not neededIn small CRUD applications, a Repository is over-engineering. It is justified when business logic is complex and independence from the data source matters.
Responsive Design
Responsive design is a layout approach where a page displays correctly at any screen size — from a smartphone to a large monitor. Around 60% of internet traffic is now mobile.Key toolsFluid Grid — relative units (%, fr) instead of fixed pixelsFlexible Images — max-width: 100%, <picture> with different src for different sizesMedia Queries — CSS rules applied at specific screen widthsBreakpoints/* Mobile first */ .container { padding: 16px; } @media (min-width: 768px) { .container { padding: 24px; } } @media (min-width: 1280px) { .container { max-width: 1280px; margin: 0 auto; } }Mobile First vs Desktop FirstMobile First — base styles for mobile, expanded for larger screens (min-width). The recommended approach: forces you to think about the most important content first.
REST
REST (Representational State Transfer) is an architectural style for building APIs over HTTP. Resources are addressed via URLs, and actions on them use standard HTTP methods. REST is not a protocol or standard — it is a set of constraints that make APIs predictable and scalable.Key principlesStateless — each request contains all necessary information; the server stores no state between requestsUniform interface — GET reads, POST creates, PUT/PATCH updates, DELETE removesResources — nouns in URLs (/users/42), not verbs (/getUser)Cacheability — responses can be cached, reducing server loadResponse codes200 OK, 201 Created, 400 Bad Request, 401 Unauthorized, 404 Not Found, 422 Unprocessable Entity, 500 Internal Server Error — using them correctly makes an API self-documenting.
Rolling Update
Rolling update is a deployment strategy where a new version is rolled out gradually: instances are updated one at a time or in small batches while the old version continues handling requests. Zero downtime without doubling resources. Flow Start: [v1][v1][v1][v1] Step 1: [v2][v1][v1][v1] ← one instance updated Step 2: [v2][v2][v1][v1] Step 3: [v2][v2][v2][v1] End: [v2][v2][v2][v2] Parameters maxUnavailable — how many instances may be unavailable simultaneously maxSurge — how many extra instances above the desired count are allowed Version compatibility problem During a rolling update, v1 and v2 run simultaneously. If v2 changed the DB schema, v1 may not understand the new data. Solutions: backward-compatible migrations or feature flags. Vs Blue-Green, Canary Rolling update is the most resource-efficient option (no extra resources needed). Blue-Green requires double the resources. Canary offers finer-grained traffic control.