0
0
LLDsystem_design~10 mins

YAGNI (You Aren't Gonna Need It) in LLD - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to apply the YAGNI principle by avoiding unnecessary features.

LLD
if user_needs_feature:
    implement_feature()
else:
    [1]
Drag options to blanks, or click blank then click option'
Awrite_complex_logic()
Bdo_nothing()
Cadd_extra_code()
Doptimize_prematurely()
Attempts:
3 left
💡 Hint
Common Mistakes
Adding code for features not currently needed.
2fill in blank
medium

Complete the code to follow YAGNI by not adding unused parameters.

LLD
def process_data(data[1]):
    # process data
    pass
Drag options to blanks, or click blank then click option'
A, config
B, required_param
C, data_format
D, unused_param
Attempts:
3 left
💡 Hint
Common Mistakes
Adding parameters that are never used in the function.
3fill in blank
hard

Fix the error in the design by removing the unnecessary caching layer as per YAGNI.

LLD
class DataFetcher:
    def fetch(self):
        [1]
        # unnecessary cache layer removed
Drag options to blanks, or click blank then click option'
Areturn self.database.query()
Breturn self.cache.get_data()
Creturn self.cache.refresh()
Dreturn self.cache.clear()
Attempts:
3 left
💡 Hint
Common Mistakes
Using cache methods when cache is not required.
4fill in blank
hard

Fill both blanks to implement a simple feature without extra complexity, following YAGNI.

LLD
def calculate_total(items):
    total = 0
    for item in items:
        total [1] item.price
    return total [2] discount
Drag options to blanks, or click blank then click option'
A+=
B-=
C*
D+
Attempts:
3 left
💡 Hint
Common Mistakes
Using multiplication or subtraction unnecessarily.
5fill in blank
hard

Fill all three blanks to create a minimal class design that avoids unnecessary features, following YAGNI.

LLD
class User:
    def __init__(self, [1], [2]):
        self.name = [3]
        self.email = [4]
Drag options to blanks, or click blank then click option'
Aname
Bemail
Cpassword
Daddress
Attempts:
3 left
💡 Hint
Common Mistakes
Adding unnecessary attributes in the constructor.