Code AnalysisBeginner 60s
Analyze: feature envy smell
Identify the code smell in this pseudo-code and the principle it most violates.
class OrderPrinter:
print(order):
total = 0
for i in order.items:
total += i.price * i.qty
for i in order.items:
print(i.name)
print(order.customer.name)
print(order.customer.address.city)
Which refactor is most appropriate?
Think you can answer under pressure?
Get matched and answer live questions in 3-minute 1v1 battles. Elo ranking, badge tiers and bragging rights on the line.