Low-level design glossary
- Abstract class
- A class that cannot be created with `new` and may leave some methods without a body for subclasses to write. Unlike an interface, it can hold fields and shared code. Lesson
- Abstract factory (also kit)
- An object that creates a whole family of related objects that must match, such as an SMS sender and its matching template formatter for one provider. Swap the factory and every product changes together. Lesson
- Abstraction
- Showing callers what an object does and hiding how it does it. A caller asks `wallet.pay(amount)` and never sees which ledger table or API call does the work. Lesson
- Activation (also activation bar, execution specification)
- The thin bar drawn on a lifeline in a sequence diagram. It shows the time during which that object is busy running a method, including the calls it makes to others. Lesson
- Adapter (also wrapper)
- A class that makes an existing class fit the interface your code expects. A `RazorpayAdapter` implements your `PaymentGateway` interface and translates each call into the Razorpay SDK call. Lesson
- Aggregation
- A "has-a" relationship where the part can live without the whole, such as a `Team` and its `Rider` objects. In UML it is a line with a hollow diamond at the whole. Lesson
- Association
- A lasting link where one class holds a reference to another and uses it, such as an `Order` that knows its `Customer`. In UML it is a plain solid line, often with an arrow and a label. Lesson
- Atomic operation (also atomic, AtomicInteger, compare-and-set, CAS)
- An operation that other threads see as done completely or not at all, never half done. `AtomicInteger.incrementAndGet()` reads, adds and writes as one step, so no update is lost. Lesson
- Behavioural pattern (also behavioral pattern)
- A design pattern about how objects share work and talk to each other at runtime, such as Strategy, Observer, State, Command, Chain of responsibility and Template method. Lesson
- Blocking queue (also BlockingQueue)
- A thread-safe queue that makes a taker wait while it is empty and, if it has a size limit, makes a putter wait while it is full. Java gives `ArrayBlockingQueue` and `LinkedBlockingQueue`. Lesson
- Builder (also builder pattern, fluent builder)
- A helper object that collects the fields of a complex object step by step and then creates it with `build()`. It replaces constructors with many optional parameters, and `build()` can check the values. Lesson
- Chain of responsibility (also handler chain, pipeline)
- Passing a request along a list of handlers, where each handler checks one thing and then passes it on or stops it. An order can go through stock, address and payment checks this way. Lesson
- Check-then-act
- Code that checks a condition and then acts on it, such as "if stock > 0, reduce stock". With two threads, both can pass the check before either acts, so the pair must run as one atomic step. Lesson
- Class
- A template that defines the fields (data) and methods (behaviour) of a kind of thing, such as `Coupon`. Each coupon you create from it is an object. Lesson
- Class diagram (also UML class diagram)
- A UML drawing of classes as boxes (name, fields, methods) and the lines between them that show how they relate. It is the main picture in an LLD discussion. Lesson
- Code smell (also smell)
- A visible sign in code that the design may have a problem, such as a very long method, a `switch` on type repeated in many places, or a class that changes for many reasons. Lesson
- Cohesion
- How closely the fields and methods of one class belong together. A `CouponValidator` whose methods all check coupons has high cohesion; a class that also sends emails has low cohesion. Lesson
- Combined fragment (also alt box, loop box, opt box, fragment)
- A labelled box in a sequence diagram that wraps some messages. `alt` shows if/else branches, `opt` shows an optional step and `loop` shows repeated messages. Lesson
- Command (also command pattern, action object)
- A pattern that turns an action into an object with an `execute()` method, and often `undo()`. Commands can be queued, logged, retried or undone because they are plain objects. Lesson
- Composite (also composite pattern, tree structure)
- A pattern where a single item and a group of items share one interface, so code treats them the same. A category tree works this way: a category's item count adds up the counts of its children, whether they are products or subcategories. Lesson
- Composition
- A strong "has-a" relationship where the part belongs to one whole and is created and destroyed with it, such as an `Order` and its `OrderLine` items. In UML it is a filled diamond at the whole. Lesson
- Composition over inheritance (also favour composition, has-a over is-a)
- The advice to build behaviour by holding other objects (has-a) rather than extending a parent class (is-a). You can swap a held object at runtime, but a parent class is fixed when you compile. Lesson
- Concurrent map (also ConcurrentHashMap)
- A map that many threads can read and update safely without one big lock, such as `ConcurrentHashMap`. Methods like `computeIfAbsent` and `merge` update one key atomically. Lesson
- Constructor injection
- Giving an object its dependencies as constructor parameters, such as `new Checkout(paymentGateway)`. The object cannot exist without them, the fields can be `final`, and tests can pass in fakes. Lesson
- Coupling (also tight coupling, loose coupling)
- How much one class depends on the details of another. With tight coupling, a change in one class forces changes in the other; depending on a small interface keeps coupling loose. Lesson
- Creational pattern
- A design pattern about how objects get created, so callers do not hard-code `new ConcreteClass()`. Factory method, abstract factory, builder and singleton are creational patterns. Lesson
- Critical section
- The lines of code that read and change shared data and so must be run by only one thread at a time. You protect it with a lock or `synchronized`, and keep it as short as you can. Lesson
- Deadlock
- Two or more threads waiting for each other forever, each holding a lock the other needs. Taking locks in the same fixed order everywhere, or using a timeout, prevents it. Lesson
- Decorator (also wrapper, decorator pattern)
- A class that wraps an object with the same interface and adds behaviour before or after passing the call on. Gift wrap and express delivery can each wrap a `PriceCalculator` and add their fee. Lesson
- Dependency (also uses relationship)
- The weakest relationship: a class uses another only for a moment, as a method parameter, a local variable or a return type, and keeps no field for it. In UML it is a dashed arrow. Lesson
- Dependency injection (also DI)
- Passing an object the things it needs from outside, instead of letting it create them with `new`. This lets you swap a real payment gateway for a fake one in a test. Lesson
- Dependency inversion principle (also DIP, depend on abstractions)
- The D in SOLID: high-level code (checkout rules) and low-level code (a Paytm client) should both depend on an interface, so the business rules never import a vendor class. Lesson
- Design discussion round (also LLD discussion, object-oriented design round, OOD round)
- An interview round where you talk through a class diagram for a problem and explain how it changes when the interviewer adds a requirement. Little or no code runs. Lesson
- Design pattern (also pattern, GoF pattern)
- A named, reusable shape of classes that solves a common design problem, such as Strategy or Observer. A pattern is a tool for a specific pain; using one with no pain adds code for nothing. Lesson
- Double booking (also overbooking)
- Two users both getting the same seat, slot or item because two requests checked "is it free?" at the same time. A lock or a version check makes only one of them succeed. Lesson
- Driver class (also main, driver, demo class)
- The class with `main` in a machine-coding answer. It builds the objects, wires them together and runs a short demo scenario so the interviewer can see the program working. Lesson
- DRY (also Don't Repeat Yourself)
- Do Not Repeat Yourself: each rule or piece of knowledge should live in one place. If the GST rate is written in five classes, a rate change means five edits and one will be missed. Lesson
- Edge case (also corner case)
- An input or situation at the limits of normal use, such as an empty cart, a coupon used twice, a zero amount, or two users booking the last slot. Interviewers check that you name and handle these. Lesson
- Encapsulation (also data hiding)
- Keeping an object's data private and changing it only through its own methods, so the object can protect its rules. Nobody outside can set a wallet balance to minus 500. Lesson
- Entity (also domain object)
- A main thing in the problem that has its own identity and data, such as `Order`, `Rider` or `Coupon`. Finding the entities is the first step from requirements to classes. Lesson
- Enum (also enumeration)
- A type with a fixed list of named values, such as `OrderStatus { PLACED, PACKED, DELIVERED }`. It stops invalid values like a misspelt string and works well in a `switch`. Lesson
- Extensibility (also extensible design)
- How easily the design accepts a new requirement, such as a new payment method or vehicle type, by adding a class instead of editing many old ones. Interviewers test it with "now add X". Lesson
- Facade (also facade pattern)
- One simple class in front of several classes that callers would otherwise have to call in the right order. A `CheckoutFacade.placeOrder()` can call cart, stock, payment and notification for you. Lesson
- Factory method (also factory, simple factory, static factory)
- A method that creates and returns an object, so the caller asks for "a notifier for SMS" and never calls `new SmsNotifier()` itself. Adding a channel changes the factory, not every caller. Lesson
- Fragile base class (also fragile base class problem)
- The problem where a change inside a parent class breaks subclasses that relied on how it worked inside. Deep inheritance trees make this risk larger. Lesson
- Generalisation (also generalization, inheritance arrow, is-a arrow)
- The UML name for inheritance: a subclass is a special kind of its parent class. It is drawn as a solid line with a hollow triangle pointing at the parent. Lesson
- God class (also god object, blob)
- One class that knows and does too much, such as an `OrderManager` with 40 methods covering pricing, payment, stock and email. Every change touches it, so it is hard to test and risky to edit. Lesson
- Guard (also guard condition)
- A condition on a transition in a state diagram, written in square brackets such as `[payment ok]`. The transition happens only when the event arrives and the guard is true. Lesson
- Idempotent (also idempotency, idempotency key)
- An operation that has the same effect whether it runs once or many times. A second "payment success" event for an order already PAID changes nothing, so retries and duplicate events are safe. Lesson
- Immutability (also immutable object, final fields)
- An object that cannot change after it is created: all fields `final`, no setters, and any change returns a new object. Many threads can share an immutable object with no locks. Lesson
- In-memory repository (also in-memory store, HashMap repository)
- A repository that keeps its data in a map or list inside the program instead of a database. Machine-coding rounds use one so you spend time on design, and a real database can replace it later. Lesson
- Inheritance (also extends, subclassing, is-a)
- Making a class (child) from an existing class (parent) so it gets the parent's fields and methods and can change some of them. Use it only for a true "is-a" relationship. Lesson
- Interface (also contract)
- A named list of methods with no state, which classes promise to provide, such as `PaymentMethod.pay(amount)`. Callers depend on the interface, so any class that implements it can be used. Lesson
- Interface segregation principle (also ISP)
- The I in SOLID: prefer several small interfaces over one large one, so no class is forced to implement methods it does not need, such as a `CashOnDelivery` forced to write `refundToCard()`. Lesson
- Invariant (also class invariant)
- A rule about an object's data that must always be true, such as "wallet balance is never negative". Encapsulation lets the object check it in every method that changes the data. Lesson
- Inversion of control (also IoC)
- Letting outside code decide which objects a class works with and when its methods run, instead of the class deciding itself. Dependency injection is the most common form. Lesson
- Lazy initialisation (also lazy initialization, lazy loading)
- Creating an object only when it is first needed, not at startup. A proxy or singleton may do this; with many threads, the "is it created yet?" check must be made thread-safe. Lesson
- Lifeline
- A box at the top of a sequence diagram with a dashed line going down from it. It stands for one object, and the messages it sends and receives are arrows to and from its line. Lesson
- Liskov substitution principle (also LSP, substitutability)
- The L in SOLID: any subclass must work wherever its parent type is expected, with no surprises. A `refund()` that throws "not supported" in one subclass breaks it. Lesson
- Lock (also mutex, mutual exclusion, ReentrantLock)
- An object that only one thread can hold at a time. A thread takes the lock before a critical section and releases it after, so other threads wait their turn. `ReentrantLock` is the usual Java class. Lesson
- Machine coding round (also machine coding, LLD coding round)
- An interview round where you build a working, well-structured program for a problem, such as a parking lot, in about 90 minutes, then demo and extend it. Code quality is graded, not only output. Lesson
- Message (also sequence message, return message)
- An arrow between two lifelines in a sequence diagram, meaning one object calls a method on the other. A dashed arrow back shows the return value. Lesson
- Mock (also fake, stub, test double)
- A fake object used in a unit test in place of a real dependency, such as a payment gateway that always succeeds. It lets the test run fast and check how the class under test called it. Lesson
- Multiplicity (also cardinality)
- Numbers at the ends of a UML line saying how many objects take part: `1` exactly one, `0..1` zero or one, `*` many. One `Order` has `1..*` order lines. Lesson
- Object (also instance)
- One instance of a class, with its own field values, created at runtime with `new`. Two `Coupon` objects share methods but can hold different codes and discounts. Lesson
- Observer (also listener, publish-subscribe, pub-sub, event listener)
- A pattern where an object keeps a list of listeners and calls each one when its state changes. When an order ships, SMS, email and push listeners are told without the order knowing them. Lesson
- Open/closed principle (also OCP, open-closed principle)
- The O in SOLID: a class should be open for extension but closed for modification. You add a new discount rule as a new class, without editing the code that applies discounts. Lesson
- Optimistic locking (also optimistic concurrency, version check)
- Letting updates proceed without a lock, then checking a version number when saving. If someone else changed the row since you read it, your save fails and you retry. Good when clashes are rare. Lesson
- Overloading (also method overloading, compile-time polymorphism)
- Several methods in one class with the same name but different parameter lists, such as `add(Item)` and `add(Item, int qty)`. The compiler picks one from the arguments. Lesson
- Overriding (also method overriding, @Override)
- A subclass giving its own body for a method its parent or interface already declares, with the same signature. Which body runs is chosen at runtime by the object's real class. Lesson
- Pessimistic locking (also SELECT FOR UPDATE, exclusive lock)
- Taking a lock on the data before reading it and holding it until the update is done, so no one else can change it in between. Safe under heavy contention, but other requests wait. Lesson
- Polymorphism (also runtime polymorphism, dynamic dispatch)
- One call that behaves differently depending on the object's real class. `method.pay(amount)` runs UPI code for a `UpiPayment` and card code for a `CardPayment`, with no `if` on type. Lesson
- Producer-consumer (also producer consumer problem, work queue)
- A design where producer threads put tasks into a shared queue and consumer threads take them out and process them. The queue lets each side run at its own speed. Lesson
- Proxy (also proxy pattern, caching proxy, protection proxy)
- A class with the same interface as a real object that stands in front of it and controls access, such as by caching results, checking permissions or loading the object only when first used. Lesson
- Race condition (also data race, lost update)
- A bug where the result depends on the timing of threads. Two threads read stock as 1, both reduce it, and two orders get the last packet of milk. Lesson
- Realisation (also realization, implements)
- The UML relationship where a class implements an interface. It is drawn as a dashed line with a hollow triangle pointing at the interface. Lesson
- Repository (also repository pattern, DAO)
- A class that stores and finds objects of one type, such as `OrderRepository.save(order)` and `findById(id)`, and hides whether the data lives in a map, a file or a database. Lesson
- Sequence diagram
- A UML drawing of one scenario over time: objects across the top, time going down, and arrows for each method call between them. It shows who calls whom, in what order. Lesson
- Single responsibility principle (also SRP)
- The S in SOLID: a class should have one reason to change. If tax rules and the invoice email format both force edits to one class, split it into two. Lesson
- Singleton (also singleton pattern)
- A class that allows only one instance and gives global access to it. It hides dependencies and makes tests share state, so creating one object at startup and passing it in is usually better. Lesson
- SOLID (also SOLID principles)
- Five design principles for classes that are easy to change: single responsibility, open/closed, Liskov substitution, interface segregation and dependency inversion. Lesson
- State diagram (also state machine diagram, statechart)
- A UML drawing of the states one object can be in, such as PLACED, PACKED and DELIVERED, with arrows for the allowed moves between them and the events that cause them. Lesson
- State machine (also finite state machine, FSM)
- A model where an object is always in exactly one of a fixed set of states and moves between them only by allowed transitions. An order cannot go from DELIVERED back to PACKED. Lesson
- State pattern (also state)
- A pattern where each state of an object is its own class with the same methods, and the object hands calls to its current state. It replaces a large `switch` on status in every method. Lesson
- Static member (also static, class variable, class method)
- A field or method that belongs to the class itself, not to any one object, such as `Coupon.MAX_DISCOUNT`. In a UML class box it is underlined. Lesson
- Strategy (also strategy pattern, policy)
- A pattern where each way of doing one job (such as computing a delivery fee) is its own class behind one interface, and the caller picks one at runtime. Adding a rule adds a class, not a `case`. Lesson
- Structural pattern
- A design pattern about how classes and objects are put together into larger structures, such as Adapter, Facade, Decorator, Composite and Proxy. Lesson
- Synchronized (also synchronized block, intrinsic lock, monitor)
- A Java keyword that makes a method or block run by one thread at a time per lock object. It also makes the changes inside visible to the next thread that takes the same lock. Lesson
- Tell, don't ask (also tell dont ask)
- Tell an object to do the work instead of asking for its data and doing the work yourself. Call `wallet.debit(100)` rather than reading the balance, checking it and setting a new one. Lesson
- Template method (also template method pattern, hook method)
- A parent class method that fixes the order of steps and lets subclasses fill in some steps. A payout report always loads, computes and exports, while each report type writes its own compute step. Lesson
- Thread pool (also ExecutorService, worker pool)
- A fixed group of worker threads that take tasks from a queue and run them, so the program does not create a new thread per task. In Java, `Executors.newFixedThreadPool(4)` makes one. Lesson
- Thread-safe (also thread safety)
- Code that gives correct results when many threads call it at the same time, without the caller adding locks. A plain `HashMap` is not thread-safe; `ConcurrentHashMap` is. Lesson
- Transition (also state transition)
- A move from one state to another in a state machine, caused by an event, such as `pack()` taking an order from PLACED to PACKED. Code should reject a move that is not allowed. Lesson
- Unit test (also JUnit test)
- A small automated test that checks one class or method on its own, with fakes for its dependencies. A test that a coupon below the minimum cart value is rejected is a unit test. Lesson
- Visibility (also access modifier, access level)
- Who can see a member of a class. UML marks it with `+` public, `-` private, `#` protected and `~` package. Fields are usually private and the main methods public. Lesson
- YAGNI (also You Aren't Gonna Need It)
- You Aren't Gonna Need It: do not build a feature or extension point until a requirement asks for it. In a 90-minute round, an unused plugin system costs time and earns no marks. Lesson