You are designing a simple note-taking app. The team suggests adding a complex tagging system with nested tags and tag analytics before the app's first release. Which statement best reflects the YAGNI principle?
YAGNI encourages avoiding building features before they are truly needed.
YAGNI means you should not add functionality until it is necessary. Adding complex features early can waste time and resources.
You are designing a web service expected to handle 100 requests per second initially. The team suggests building a microservices architecture with complex service discovery and load balancing from the start. According to YAGNI, what is the best approach?
Consider starting simple and only adding complexity when justified.
YAGNI advises against premature optimization or over-engineering. Starting simple reduces complexity and development time.
Your team plans to build a chat application. They want to provision servers to handle 1 million concurrent users immediately, but current projections estimate only 10,000 users in the first year. How does YAGNI guide your capacity planning?
Think about starting with what is needed, not what might be needed.
YAGNI suggests not preparing for unlikely future scenarios prematurely. Start with realistic capacity and scale as needed.
You are designing a payment processing system. The team debates whether to support multiple currencies now or add it later. Supporting multiple currencies adds complexity but may attract more users in the future. How should YAGNI influence this decision?
Consider designing for flexibility without adding unnecessary features immediately.
YAGNI encourages avoiding unnecessary features but does not forbid designing for easy extension later.
Examine the following class design for a user profile component. Which part violates YAGNI?
class UserProfile {
String username;
String email;
String phoneNumber;
String address;
Map socialMediaLinks; // planned for future use
List favoriteGenres; // planned for future use
void updateEmail(String newEmail) { /* ... */ }
void updatePhoneNumber(String newPhone) { /* ... */ }
// Methods for socialMediaLinks and favoriteGenres not implemented yet
} class UserProfile { String username; String email; String phoneNumber; String address; Map<String, String> socialMediaLinks; // planned for future use List<String> favoriteGenres; // planned for future use void updateEmail(String newEmail) { /* ... */ } void updatePhoneNumber(String newPhone) { /* ... */ } // Methods for socialMediaLinks and favoriteGenres not implemented yet }
YAGNI warns against adding unused features or data structures prematurely.
Adding fields for future features that are not yet needed or implemented violates YAGNI by increasing complexity unnecessarily.