Glossary

Web Developer Dictionary

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

228 terms
27 letters
M
Match Expression (PHP 8)
Match expression is a PHP 8.0 alternative to switch with strict comparison (===), no fall-through, and mandatory exhaustiveness. It returns a value rather than executing statements. Switch vs Match // switch — loose, fall-through, no return value switch ($status) { case 'active': $label = 'Active'; break; case 'banned': $label = 'Banned'; break; default: $label = 'Unknown'; } // match — strict, no fall-through, returns value $label = match($status) { 'active' => 'Active', 'banned' => 'Banned', 'pending', 'unverified' => 'Waiting', // multiple conditions default => 'Unknown', }; Advantages Strict comparison: match(0) ≠ match('foo') If no arm matches and there is no default, an UnhandledMatchError is thrown More compact, readable code
Memoization
Memoization is an optimisation where the results of expensive function calls are cached by their arguments and returned without recomputation on the same input. A specialised form of caching where the cache key is the function's arguments. Example function memoize(callable $fn): Closure { $cache = []; return function() use ($fn, &$cache) { $key = serialize(func_get_args()); if (!isset($cache[$key])) { $cache[$key] = $fn(...func_get_args()); } return $cache[$key]; }; } $fib = memoize(function(int $n) use (&$fib): int { return $n
Message Broker
A message broker is an intermediary that accepts messages from producers and delivers them to consumers. It decouples services: the sender does not know the receiver and does not wait for a reply. RabbitMQ, Kafka, and Amazon SQS are popular brokers.Exchange and Queue (RabbitMQ)A producer sends a message to an exchange. The exchange routes it by rules into one or more queues. A consumer reads from the queue. If the consumer is unavailable, the message waits in the queue.Topic and Partition (Kafka)Kafka stores messages in topics split into partitions. Messages are not deleted after reading — they can be replayed. Ideal for event streaming and audit logs.When broker, when HTTPHTTP is a synchronous request-response. A broker is async delivery with guarantees. Use a broker when: the sender must not wait, the consumer can be temporarily unavailable, or a single message must reach multiple consumers.
Micro-frontends
Micro-frontends is an architectural approach that brings microservices ideas to the frontend: the application is split into independent parts, each developed, tested, and deployed by a separate team. Motivation A large monolithic SPA becomes painful: 5–10 teams edit one repository, deploys are blocked, dependency conflicts arise. Micro-frontends let teams work independently. Integration approaches Build-time integration — npm packages. Simple, but deployment is still coupled Runtime via iframe — isolation, but limited interaction Web Components — native browser isolation Module Federation (Webpack 5) — most popular. Dynamic imports across separate builds Challenges Code duplication (multiple versions of React) Consistent UX across teams More complex debugging Justified for large products (5+ teams). For small ones — unnecessary complexity.
Microservices
Microservices is an architectural approach where an application is split into small, independent services — each responsible for one business function, with its own database, deployed separately.Monolith vs microservicesA monolith is one application, one database, one deploy. Simple to build initially, but hard to scale individual parts — and one bug can take down the whole system. Microservices are more complex, but each service can be scaled, deployed, and developed independently.Service communicationSynchronous — HTTP REST or gRPC (response needed immediately)Asynchronous — message broker (RabbitMQ, Kafka): a service emits an event and does not waitWhen to consider themMicroservices are justified under significant load with a large team. For a startup or small product — a well-structured monolith is simpler, cheaper, and faster to build.
Middleware
Middleware is an intermediate handler that intercepts an HTTP request before it reaches the controller — or a response before it reaches the client. Middleware form a chain: each one can pass the request along, modify it, or immediately return a response.Typical usesAuthentication and authorization — verify a token before executing an actionRate limiting — restrict requests per IPLogging — record request/response detailsCORS — add headers for cross-origin requestsResponse compression — gzip before sendingThe chain-of-responsibility patternEach middleware implements one method: receive the request, do its job, pass it on. If a condition is not met — return a response and break the chain. This pattern is framework-agnostic and appears identically in PHP, Python (WSGI), Node.js (Express), and Go.
Migration (DB)
A migration is a version of a database schema expressed as code. Instead of manually running SQL ALTER TABLE statements on each server, migrations are stored in the repository and applied with a single command on any environment.Why it mattersMigrations solve the schema synchronisation problem between local, staging, and production. A new migration in code means a new change on all servers after running the migration command.Typical structureEach migration has two methods: up() — applies the schema change, down() — reverts it (rollback). The filename contains a timestamp to guarantee the application order.Important rulesNever edit an already-applied migration — create a new one insteadKeep migrations in version control alongside your codeFor safe deploys on large tables, use tools like gh-ost or pt-online-schema-change
Mocking (Test Doubles)
A mock is a fake object that simulates the behaviour of a real dependency in tests. Instead of a real email service, database, or external API — a mock returns preset data and verifies that the code behaves correctly.Types of test doublesStub — returns preset values. No call verificationMock — additionally verifies that certain methods were (or were not) calledSpy — records calls but delegates to the real implementationFake — a simplified real implementation (in-memory repository)Dummy — a placeholder object passed but never usedWhen not to mockMock external dependencies (email, S3, payment systems), not your own code. If you find yourself mocking your own classes, that is a signal the architecture needs refactoring.
Monitoring and Observability
Monitoring is tracking system state in real time and alerting on deviations. Observability is the broader concept: the ability to understand why the system is behaving the way it is, not just what is happening.Three pillars of observabilityMetrics — numeric measurements over time: RPS, p99 latency, error rate, CPU. Prometheus + Grafana is the standardLogs — structured event records. Centralised collection: ELK Stack (Elasticsearch, Logstash, Kibana), LokiTraces — tracking a request's path through multiple services. Jaeger, Zipkin, OpenTelemetryThe Four Golden Signals (Google SRE)Latency, Traffic, Errors, Saturation — four metrics that describe the health of any service. Alerting on them covers 80% of incidents.
Monorepo
A monorepo is a single Git repository for multiple projects or packages. All code (frontend, backend, shared libs, mobile apps) lives together. The opposite is a polyrepo (a separate repository per service).AdvantagesChanges to shared code are immediately visible in all projects — no "which library version" problemAtomic commits: an API change and the corresponding refactor of all consumers — in one PRUnified CI/CD, linting, tests — less configuration duplicationDisadvantagesSlower CI without caching tools (need to run only changed parts)More complex access control across different projectsToolsNx (JavaScript/TypeScript), Turborepo (JS), Bazel (Google, multi-language). Large monorepos: Google, Meta, Microsoft keep all their code in a single repository.
Mutation Testing
Mutation testing is a method for evaluating test quality: a tool automatically introduces small changes (mutations) into the code and checks whether existing tests detect them. If mutated code passes the tests — the tests are not thorough enough. Typical mutations + → -, > → >=, === → !== Removing a condition: if ($x > 0) → if (true) Changing a return: return true → return false Metric: Mutation Score MS = killed mutants / total mutants * 100%. MS 80%+ is considered a good result. Differs from code coverage: 100% coverage does not guarantee detection of logic bugs. Tools PHP: Infection. JavaScript: Stryker. Java: PIT. Cost Mutation testing is slow — it runs the test suite for every mutant. Typically applied to critical parts of the code, not the entire project.
MVC
MVC (Model-View-Controller) is an architectural pattern that splits an application into three layers with clear responsibilities. This lets you change logic, presentation, and data independently of each other.Three layersModel — data and business logic: database interaction, validation, calculations. Knows nothing about how data will be displayedView — a template that turns data into HTML (or JSON). Contains no logic — display onlyController — receives the HTTP request, calls the right model, passes the result to the view. A thin conductor layerThe "thin controller" ruleControllers should contain no business logic — only orchestration. If a controller method exceeds 10–15 lines, that is a signal to move the logic into a service or model.