How do you identify classes from a problem statement in LLD?
Fast recall
Quick revision
Core answer
Ability to extract entities from requirements and map them to object-oriented design elements — the foundational skill of Low-Level Design.
Treating every noun as a class without filtering, or missing behavioral entities like managers and controllers that coordinate system operations.
Mention that you'd also identify relationships (has-a, is-a) and potential design patterns while reading the problem statement, creating a mental dependency graph.
Interview-ready guide
Interview answer
My go-to technique is noun-verb analysis. I read the problem statement and underline the nouns, because nouns are usually the candidate classes — things like Member, Book, Order, ParkingSpot. The verbs become candidate methods, so borrow, pay, park. And adjectives or descriptive words usually become attributes, like a book's title or a spot's size.
But I don't blindly turn every noun into a class. I filter. A real class should have both data and behaviour and a single clear responsibility. So something like price is just a value — it's an attribute on a product, not its own class. A word like late is a condition, not an entity. I also watch for synonyms; if the prompt says customer in one place and user in another, that's probably one class, not two.
The one thing freshers often miss is actor classes. Words like manager, librarian, or administrator describe people who act on the system, and they frequently deserve a class or at least a service, especially when they have permissions or behaviour that differs from a regular user. Once I have my filtered list of classes, I treat that as step one and move on to the relationships — which classes contain which, which inherit from which. Identifying the classes is the foundation, but the design only takes shape once you connect them.
How do you identify classes from a problem statement in LLD
Direct Answer
Identify nouns in the problem statement — these become candidate classes. Filter to entities that have both data (attributes) and behavior (methods). Actors like managers and controllers often become classes or interfaces. Validate each class by ensuring it has clear responsibilities.
Deep Dive & Architecture
Candidate entities from nouns and rules
Underline nouns, verbs, and rules in the prompt. Nouns suggest entities or values, verbs suggest behaviour, and rules suggest invariants. In “a member borrows a book copy and receives a fine when it is late,” Member, BookCopy, and Loan have identity or state. “Late” is a condition, not a class by itself.
Entity responsibility test
Ask whether the candidate owns state, enforces a rule, or coordinates a use case. Loan deserves a class because it records issue and due dates. FinePolicy may be an interface when different member types use different rules. A vague LibraryManager is not a useful answer until its exact job is named.
Walk one use case through the objects
For borrowing, Catalog finds an available copy, BorrowingService checks the member and creates a Loan, and BookCopy changes from available to loaned. Walking the flow exposes missing objects and misplaced behaviour. The first class list is a draft; refine it after responsibilities and relationships are clear.
Code Example
// Prompt: "A member borrows a book; if returned late, a fine applies."
// Nouns -> classes; verbs -> methods; adjectives -> fields.
class Member { // noun -> class
private String name; // attribute
void borrow(Book book) { } // verb -> method on the actor
}
class Book { // noun -> class
private String title; // attribute
private boolean available; // adjective -> field
}
class Fine { // noun -> class (has data + behaviour)
private BigDecimal amount;
BigDecimal calculate(long overdueDays) { return amount.multiply(BigDecimal.valueOf(overdueDays)); }
}
Keep only nouns that have state and behaviour; "late" is a condition, not a class.
Common Mistakes & Pitfalls
- Turning every noun into a class — "late", "name", "price" are attributes/values, not classes.
- Missing actor classes — "librarian" or "manager" often need a class or service.
- Classes with data but no behaviour — that's a struct; ask what it does.
- Ignoring relationships — finding classes is step one; how they connect is step two.
Check your understanding
Answer these without looking back at the article.
- What are enums useful for in LLD and how do you use them?
- How do you model a one-to-many relationship in LLD Java classes?
- How do you define the responsibilities of each class in an LLD?
Looking for a structured roadmap?
Every module on this page is also part of the full Java backend interview track.