What is the first step in identifying classes from requirements?
The first step is to carefully read and understand the requirements to find important nouns and noun phrases that represent potential classes.
Click to reveal answer
beginner
Why are nouns in requirements important for identifying classes?
Nouns often represent objects, entities, or concepts in the system, which can be modeled as classes in the design.
Click to reveal answer
intermediate
What role do verbs play when identifying classes from requirements?
Verbs help identify behaviors or methods that classes should have, showing what actions the classes can perform.
Click to reveal answer
intermediate
How can you differentiate between a class and an attribute when analyzing requirements?
If the noun represents something with its own identity and behavior, it is likely a class; if it describes a property of a class, it is an attribute.
Click to reveal answer
advanced
What is a common technique to validate identified classes from requirements?
Use scenarios or use cases to check if the classes and their interactions make sense and cover the required functionality.
Click to reveal answer
Which of the following is most likely a class in a library management system?
ARead
BBorrowed
CQuickly
DBook
✗ Incorrect
Book is a noun representing an entity, suitable as a class. 'Borrowed' is a verb form, 'Quickly' is an adverb, and 'Read' is a verb.
When identifying classes, what should you do with nouns that represent simple properties?
AModel them as attributes of classes
BIgnore them completely
CTreat them as separate classes
DConvert them into methods
✗ Incorrect
Simple properties should be modeled as attributes of classes, not as separate classes.
Which of these is NOT a good indicator of a class in requirements?
APerson
BTransaction
CCalculate
DAccount
✗ Incorrect
'Calculate' is a verb indicating an action, not a class.
What is the best way to confirm if identified classes are correct?
AIgnore requirements and guess
BUse scenarios or use cases to test them
CAdd as many classes as possible
DOnly use nouns without verbs
✗ Incorrect
Using scenarios or use cases helps validate if classes and their interactions fulfill requirements.
Which of the following is a behavior that might belong to a class?
AWithdraw money
BName
CAge
DBalance
✗ Incorrect
'Withdraw money' is an action or method, while the others are attributes.
Explain the process of identifying classes from a set of system requirements.
Think about how nouns and verbs in sentences relate to objects and actions.
You got /5 concepts.
Describe how you would differentiate between a class and an attribute when analyzing requirements.
Consider if the noun can stand alone as an object or just describes something else.
You got /4 concepts.
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
Step 1: Identify nouns in the requirement
Classes usually come from nouns. Here, 'Book' is a noun representing an object.
Step 2: Differentiate between nouns and verbs
'Borrow', 'Return', and 'Search' are actions (verbs), so they are methods, not classes.
Final Answer:
Book -> Option C
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
Step 1: Understand class syntax in LLD context
Classes are defined with the keyword 'class' followed by the class name.
Step 2: Check options for class declaration
class Driver {} uses 'class Driver {}' which is correct syntax for a class.
Final Answer:
class Driver {} -> Option A
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
Step 1: Extract nouns from the requirement
The nouns are Guests, Rooms, and Bookings, which represent objects.
Step 2: Match nouns to class names
Classes should be singular nouns representing entities: Guest, Room, Booking.
Final Answer:
[Guest, Room, Booking] -> Option B
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
Step 1: Identify nouns and verbs
'User' is a noun (class), 'login' and 'logout' are actions (methods).
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.
Final Answer:
Class: Login; Methods: user(), logout() -> Option D
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
Step 1: Identify all nouns in the requirement
Nouns are Customers, Orders, Restaurants, Meals, DeliveryAgents.
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.
Final Answer:
[Customer, Order, Restaurant, Meal, DeliveryAgent] -> Option A
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 unknownstrongwhile earning +1 Grip toward your certificate.