Bird
Raised Fist0
LLDsystem_design~10 mins

Identifying classes from requirements in LLD - Scalability & System Analysis

Choose your learning style10 modes available
Scalability Analysis - Identifying classes from requirements
Growth Table: Identifying Classes from Requirements
ScaleWhat Changes?
100 usersSimple class list; few classes identified; manual analysis manageable
10,000 usersMore complex requirements; need automated tools to extract classes; more relationships
1 million usersHighly complex domain; classes must support scalability and concurrency; design patterns needed
100 million usersDistributed systems; classes represent microservices; focus on decoupling and scalability
First Bottleneck

At small scale, the bottleneck is understanding and correctly identifying all relevant classes from requirements. As complexity grows, the bottleneck shifts to managing class dependencies and ensuring classes can scale with user load and data volume.

Scaling Solutions
  • Small scale: Use manual analysis and domain expert interviews to identify classes.
  • Medium scale: Employ modeling tools (UML) and automated requirement analysis to extract classes.
  • Large scale: Apply design patterns (e.g., Factory, Singleton) to manage class creation and dependencies.
  • Very large scale: Break system into microservices; each service has its own class model to reduce complexity.
Back-of-Envelope Cost Analysis

Identifying classes is a design activity, so costs relate to time and effort:

  • At 100 users: Few hours to days of analysis.
  • At 10,000 users: Weeks of analysis with tooling support.
  • At 1 million users: Months of design with iterative refinement.
  • At 100 million users: Continuous design evolution with dedicated teams.
Interview Tip

Structure your scalability discussion by first explaining how you identify classes from requirements at small scale, then describe challenges as complexity grows, and finally explain how you adapt your approach (tools, patterns, microservices) to handle scale.

Self Check

Your database handles 1000 QPS. Traffic grows 10x. What do you do first?

Answer: Since the database is the bottleneck, first add read replicas and implement caching to reduce load before redesigning classes or architecture.

Key Result
Identifying classes starts simple but grows complex with scale; early bottlenecks are in understanding and managing class complexity, solved by tooling and design patterns, evolving to microservices at very large scale.

Practice

(1/5)
1. Which of the following is most likely a class when designing a library management system?
easy
A. Return
B. Borrow
C. Book
D. Search

Solution

  1. Step 1: Identify nouns in the requirement

    Classes usually come from nouns. Here, 'Book' is a noun representing an object.
  2. Step 2: Differentiate between nouns and verbs

    'Borrow', 'Return', and 'Search' are actions (verbs), so they are methods, not classes.
  3. Final Answer:

    Book -> Option C
  4. Quick Check:

    Class = Noun = Book [OK]
Hint: Pick the noun as class, verbs become methods [OK]
Common Mistakes:
  • Choosing verbs as classes
  • Confusing actions with objects
  • Ignoring nouns in requirements
2. In a ride-sharing app, which of these is the correct way to represent a class in code?
easy
A. class Driver {}
B. function Driver() {}
C. var Driver = 5;
D. let driver = 'John';

Solution

  1. Step 1: Understand class syntax in LLD context

    Classes are defined with the keyword 'class' followed by the class name.
  2. Step 2: Check options for class declaration

    class Driver {} uses 'class Driver {}' which is correct syntax for a class.
  3. Final Answer:

    class Driver {} -> Option A
  4. Quick Check:

    Class syntax uses 'class' keyword [OK]
Hint: Look for 'class' keyword to identify class declaration [OK]
Common Mistakes:
  • Using function instead of class
  • Assigning class name to variable
  • Confusing variables with classes
3. Given the requirement: "A hotel booking system must manage Guests, Rooms, and Bookings." Which of these is the correct set of classes identified?
medium
A. [Booking, Book, GuestList]
B. [Guest, Room, Booking]
C. [Guest, Book, RoomBooking]
D. [Room, Guest, ReservationList]

Solution

  1. Step 1: Extract nouns from the requirement

    The nouns are Guests, Rooms, and Bookings, which represent objects.
  2. Step 2: Match nouns to class names

    Classes should be singular nouns representing entities: Guest, Room, Booking.
  3. Final Answer:

    [Guest, Room, Booking] -> Option B
  4. Quick Check:

    Classes = Nouns = Guest, Room, Booking [OK]
Hint: Pick singular nouns as class names from requirements [OK]
Common Mistakes:
  • Using verbs as classes
  • Using plural or combined names incorrectly
  • Adding unrelated terms
4. You have a requirement: "The system should allow Users to login and logout." Which of the following is an error in identifying classes and methods?
medium
A. Class: User; Methods: login(), logout()
B. Class: UserAccount; Methods: login(), logout()
C. Class: User; Methods: authenticate(), logout()
D. Class: Login; Methods: user(), logout()

Solution

  1. Step 1: Identify nouns and verbs

    'User' is a noun (class), 'login' and 'logout' are actions (methods).
  2. Step 2: Check option correctness

    Class: Login; Methods: user(), logout() incorrectly uses 'Login' as a class and 'user()' as a method, which reverses noun and verb roles.
  3. Final Answer:

    Class: Login; Methods: user(), logout() -> Option D
  4. Quick Check:

    Class = noun, Method = verb [OK]
Hint: Classes are nouns; methods are verbs [OK]
Common Mistakes:
  • Using verbs as classes
  • Naming methods as nouns
  • Mixing class and method roles
5. A food delivery app requirement states: "Customers place Orders, Restaurants prepare Meals, and DeliveryAgents deliver Orders." Which classes should be created to model this system correctly?
hard
A. [Customer, Order, Restaurant, Meal, DeliveryAgent]
B. [Customer, PlaceOrder, Restaurant, Meal, Deliver]
C. [CustomerOrder, RestaurantMeal, Delivery]
D. [Order, Meal, DeliveryAgent, Place]

Solution

  1. Step 1: Identify all nouns in the requirement

    Nouns are Customers, Orders, Restaurants, Meals, DeliveryAgents.
  2. Step 2: Use nouns as class names and verbs as methods

    Classes should be Customer, Order, Restaurant, Meal, DeliveryAgent. Actions like 'place' and 'deliver' become methods.
  3. Final Answer:

    [Customer, Order, Restaurant, Meal, DeliveryAgent] -> Option A
  4. Quick Check:

    Classes = Nouns only, verbs become methods [OK]
Hint: Classes = nouns; actions = methods in those classes [OK]
Common Mistakes:
  • Using verbs as classes
  • Combining nouns incorrectly
  • Omitting important entities
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard