Glossary
Web Developer Dictionary
Визначення технічних термінів з PHP, DevOps, MySQL та AI — з прикладами коду та поясненнями простою мовою.
228
terms
27
letters
T
TCP and UDP
TCP and UDP are the two transport protocols of the internet. TCP guarantees delivery and order of packets at the cost of overhead. UDP is faster but "fire and forget" — no guarantees.TCP (Transmission Control Protocol)Connection-oriented: three-way handshake (SYN → SYN-ACK → ACK)Guaranteed delivery: lost packets are retransmittedOrdering: data arrives in the correct sequenceFlow control and congestion controlUses: HTTP/HTTPS, SSH, email, databasesUDP (User Datagram Protocol)No connection setup, no acknowledgementsLower latency — no TCP overheadPackets can be lost and arrive out of orderUses: video streaming, VoIP, DNS, online games, HTTP/3 (QUIC over UDP)
TDD (Test-Driven Development)
TDD is a development methodology: write a failing test first, then the minimum code to make it pass, then refactor. The "red → green → refactor" cycle repeats for each small piece of functionality.The Red-Green-Refactor cycleRed — write a test for new behaviour. It fails because the code does not exist yetGreen — write the minimum code to make the test pass. Any way worksRefactor — improve the code without changing behaviour. The test stays greenBenefitsNew code is 100% covered by definitionDesign naturally becomes testable — no tight dependenciesTests document behaviourCriticismSlows initial development. Hard to apply to UI, legacy code, and integrations. Most teams use TDD selectively, not universally.
Technical Debt
Technical debt is a metaphor for the consequences of deliberate or accidental shortcuts in code: "do it fast now, refactor later". "Later" often becomes "never", and the debt accumulates as slow, brittle, hard-to-change code.Types of debtDeliberate — a conscious decision: "deadline, we'll rewrite after the release". Fine if you actually rewrite itInadvertent — the result of insufficient knowledge or experience at the time of writingBit rot — accumulates gradually: every "patch rather than fix" adds to the debtConsequencesEvery new feature in an indebted codebase costs more: harder refactoring, more bugs, slower onboarding. At the extreme, debt makes a project practically unmaintainable.ManagementAllocate regular time for debt repayment (10–20% of a sprint). Document known debt as tasks, not as // TODO: fix later comments.
Trait
A trait is a code-reuse mechanism for languages with single inheritance. A trait contains real methods and properties that are "inserted" into a class with the use keyword. PHP has supported traits since version 5.4.When usefulWhen several unrelated classes need the same behaviour, but a shared base class is not appropriate. For example, Timestampable, SoftDeletable, HasSlug — behaviours that have no logical connection to each other.PitfallsA trait is code copying, not abstraction — it does not replace an interfaceName conflicts between two traits require explicit resolution via insteadof / asHard to unit-test independently from the class that uses it
Transaction (DB)
A transaction is a unit of database work that either completes in full or not at all. If an error occurs during a money transfer between two accounts — after the debit but before the credit — the transaction rolls back and balances remain unchanged.ACID propertiesAtomicity — all operations succeed or all are rolled backConsistency — the database moves from one valid state to anotherIsolation — concurrent transactions cannot see each other's uncommitted changesDurability — after COMMIT, changes are persisted even on failureSQL syntaxBEGIN;
UPDATE accounts SET balance = balance - 100 WHERE id = 1;
UPDATE accounts SET balance = balance + 100 WHERE id = 2;
COMMIT;If an error occurs between BEGIN and COMMIT — issue a ROLLBACK to undo all changes. Most drivers and ORMs wrap this automatically.
Tree (data structure)
A tree is a hierarchical data structure of nodes and edges. One root node; each node can have children. No cycles. The HTML DOM, filesystem, and syntax tree of a program are all trees.Key termsRoot — the single node with no parentLeaf — a node with no childrenHeight — maximum depth from root to leafTypes of treesBinary Tree — each node has ≤ 2 childrenBST (Binary Search Tree) — left child < node < right child. Search O(log n)B-Tree — multi-way, balanced. The foundation of MySQL/PostgreSQL indexesTrie — string tree for fast prefix search (autocomplete)TraversalsPre-order (root → left → right), In-order (left → root → right; yields a sorted BST), Post-order, BFS (level by level).
Trigger (DB)
A trigger is a database procedure that executes automatically in response to INSERT, UPDATE, or DELETE. No manual call needed — the DBMS fires it when a specific event occurs.
Example (MySQL)
CREATE TRIGGER after_order_insert
AFTER INSERT ON orders
FOR EACH ROW
BEGIN
UPDATE users
SET orders_count = orders_count + 1
WHERE id = NEW.user_id;
END;
BEFORE vs AFTER
BEFORE — fires before the operation. Can modify NEW.* values or cancel the insert
AFTER — fires after the operation. Data is already written; can update related tables
Use with caution
Triggers hide logic: an INSERT silently triggers a chain of changes in other tables. Hard to debug and invisible in application code. For most tasks, application-level event handlers are preferable.
Two-Factor Authentication (2FA)
Two-factor authentication (2FA/MFA) protects an account with two independent proofs of identity. Even if a password is compromised, an attacker cannot log in without the second factor.Three factor typesSomething you know — password, PINSomething you have — SMS code, TOTP app (Google Authenticator, Authy), hardware key (YubiKey)Something you are — fingerprint, Face IDTOTPTime-based One-Time Password — the most common method. The app and server share a secret and the current time. Every 30 seconds both generate the same 6-digit number using HMAC-SHA1.SMS 2FAMost convenient but least secure: vulnerable to SIM-swapping and SS7 attacks. For critical systems, TOTP or hardware keys are preferred.
Type Juggling
Type juggling is PHP's implicit automatic conversion of types during operations between different types. PHP is dynamically typed: "5" + 3 = 8 (the string becomes a number). Convenient, but a source of subtle bugs.
Classic traps
// Loose comparison ==
0 == "foo" // true (before PHP 8: "foo" → 0)
0 == "" // true (before PHP 8)
"1" == "01" // true
100 == "1e2" // true
null == false // true
// PHP 8 fixed: non-numeric strings compare as strings
0 == "foo" // false in PHP 8+
The rule
Always use strict comparison === and !== — it checks both type and value. Enable declare(strict_types=1).
var_dump vs print_r
var_dump() shows type and value — indispensable when debugging type-related issues.