Glossary
Web Developer Dictionary
Визначення технічних термінів з PHP, DevOps, MySQL та AI — з прикладами коду та поясненнями простою мовою.
228
terms
27
letters
G
Garbage Collection
Garbage collection (GC) is automatic freeing of memory from objects that are no longer in use. Instead of manual memory management (malloc/free in C), the runtime tracks and cleans up unreachable objects automatically.AlgorithmsReference Counting — a counter tracks references to an object. At 0 — the object is freed. PHP, CPython. Problem: circular referencesMark and Sweep — traverses the object graph, marks reachable objects, deletes unmarked ones. Java, Go, JavaScriptGenerational GC — young objects (short-lived) are collected more often than old ones. JVM, .NET, V8PHP and GCPHP uses reference counting + a cyclic garbage collector. Circular references (A → B → A) are not freed by reference counting — the cyclic GC handles them. gc_collect_cycles() triggers it manually.Performance impactGC pauses can affect latency. Go's GC is concurrent — pauses under 1 ms. Older JVM GC pauses were measured in seconds.
Generators (yield)
A generator is a function that returns values one at a time using yield, without loading the entire result into memory. Ideal for processing large datasets: CSV files, DB results, infinite sequences.Examplefunction csvReader(string $file): Generator {
$fh = fopen($file, 'r');
while (!feof($fh)) {
yield fgetcsv($fh);
}
fclose($fh);
}
foreach (csvReader('million_rows.csv') as $row) {
process($row); // only one row in memory
}Advantages over arraysAn array of millions of rows takes hundreds of MB. A generator uses O(1) memory regardless of size. Execution is lazy: the next value is computed only when requested.yield fromyield from delegates execution to another generator or iterable — useful for composing generators.
Generics
Generics are a mechanism for parameterised types: write a class or function once that works with any type while preserving type safety. The compiler checks types at build time, not at runtime.Example (TypeScript)function firstItem(arr: T[]): T | null {
return arr.length ? arr[0] : null;
}
const n = firstItem([1, 2, 3]); // number
const s = firstItem(['a', 'b']); // stringIn PHPPHP has no built-in generics, but PHPStan/Psalm support them via @template annotations and doc blocks. They are checked statically, not at runtime./** @template T */
class Collection {
/** @param T $item */
public function add($item): void { ... }
}Where usedCollections, repositories, Result types, any container. Java, C#, TypeScript, and Go (since 1.18) have built-in generics.
Git
Git is a distributed version control system. Every developer has a complete copy of the repository (including the full history), can work offline, and syncs with the team via push/pull. The de facto standard in software development.Key conceptsCommit — a snapshot of file state with a message. Immutable once createdBranch — a parallel line of development. Cheap and fast in GitMerge / Rebase — integrating changes from one branch into another. Merge preserves full history; rebase creates a linear oneRemote — a copy of the repository on a server (GitHub, GitLab, Bitbucket)Basic commandsgit init / git clone
git add . && git commit -m "message"
git push / git pull
git checkout -b feature/name
git merge / git rebaseBranching strategiesGit Flow (develop/release/hotfix), GitHub Flow (main + feature branches), Trunk-Based Development — no long-lived branches. The choice depends on team size and release frequency.
GitOps
GitOps is the practice of managing infrastructure and deployments through Git as the single source of truth. The desired system state is described in a repository; a dedicated operator automatically synchronises the real state with the declared one.
Key principles
Declarative — infrastructure state is described in files (Kubernetes manifests, Helm charts)
Git as single source — every change goes through a Pull Request with review and CI
Automatic sync — an operator (ArgoCD, Flux) watches Git and applies changes
Observability — easy to compare the cluster's current state with what is described in Git
GitOps vs CI/CD Push
Push — the CI pipeline deploys directly (kubectl apply). Requires credentials in CI
Pull (GitOps) — an operator inside the cluster pulls changes from Git. Smaller attack surface
Tools
ArgoCD and Flux CD are the most popular GitOps operators for Kubernetes.
Graceful Degradation
Graceful degradation is an approach where a system continues to function partially when components fail, instead of stopping entirely. "Degrading gracefully" is better than "crashing completely".ExamplesSearch is down → show popular content instead of an errorRedis unavailable → increased DB load, but the site keeps workingPayment provider down → accept the order and process it laterJavaScript blocked → a basic HTML version of the page is still accessibleProgressive Enhancement vs Graceful DegradationProgressive Enhancement — start with a base experience and progressively add features for supported environmentsGraceful Degradation — design for the modern environment but provide fallbacks for weaker onesImplementationCircuit Breaker, fallback responses, timeout + retry, feature flags to disable problematic features.
Graceful Shutdown
Graceful shutdown is the process of stopping a service without abruptly terminating it: the service first stops accepting new requests, finishes processing active ones, and only then stops. The alternative — kill -9 — cuts connections mid-flight.
Why it matters
Avoid interrupting in-flight HTTP requests
Complete database transactions
Acknowledge queue messages before stopping
Avoid showing errors to users during deployment
Unix signals
SIGTERM — a request to terminate (graceful). SIGKILL — forced termination (cannot be intercepted). On deploy, SIGTERM is usually sent, waited on for N seconds (timeout), then SIGKILL.
In PHP
pcntl_signal(SIGTERM, function () {
$this->shouldStop = true; // stop worker loop after current task
});
pcntl_async_signals(true);
Kubernetes
terminationGracePeriodSeconds — the wait time between SIGTERM and SIGKILL. Default: 30 seconds.
Graph (data structure)
A graph is a data structure of vertices (nodes) and edges between them. It models any kind of relationship: social networks, road maps, package dependencies, microservices.
Types of graphs
Directed / Undirected — edges are directed (A→B) or not (A—B)
Weighted — edges have a weight (distance, cost)
Cyclic / Acyclic — contains cycles or not
DAG (Directed Acyclic Graph) — directed with no cycles. The npm/composer dependency graph
Representations
Adjacency Matrix — 2D array. O(1) edge lookup, O(V²) memory
Adjacency List — list of neighbours. O(V+E) memory, usually more efficient
Traversal algorithms
BFS (Breadth-First Search) — level by level, queue. Shortest path in an unweighted graph
DFS (Depth-First Search) — in-depth, stack. Cycle detection, topological sort
GraphQL
GraphQL is a query language for APIs developed by Facebook. The client describes exactly which fields it needs and gets precisely those — no extra data (overfetching) and no need for multiple requests (underfetching).GraphQL vs RESTREST: GET /users/42 returns the entire User object — the client uses only name. GraphQL: query { user(id: 42) { name } } — the server returns only name. One endpoint instead of dozens.Key conceptsQuery — reading dataMutation — changing dataSubscription — real-time via WebSocketSchema — a typed contract between client and serverWhen to choose GraphQLIdeal for mobile clients (minimal traffic), complex nested data, and when multiple clients have different data needs. REST is simpler for straightforward CRUD.
gRPC
gRPC (Google Remote Procedure Call) is a framework for inter-service communication that uses Protocol Buffers for serialisation and HTTP/2 as transport. 5–10× faster than JSON/HTTP in most scenarios.Protocol BuffersThe schema is described in a .proto file, from which client and server code is generated for any supported language. The binary format is more compact and faster than JSON.message User {
int32 id = 1;
string name = 2;
}
service UserService {
rpc GetUser (UserRequest) returns (User);
}Advantages over RESTSpeed: binary serialisation, HTTP/2 multiplexingStreaming: unidirectional and bidirectionalStrong typing: schema changes are caught at compile timeLimitationsgRPC is poorly suited for public APIs (browsers require a grpc-web proxy). Ideal for internal communication between microservices.