SpinTheMic
Pro

Interview practice question

Same validation logic copied in five places

Backend Engineering · OOP and Design Patterns · Beginner

The same email validation logic is copied in five services, and a bug fix was applied to only two of them. How do you fix this?

What a strong answer covers

Your AI report card counts how many of these ideas you cover.

  • DRY violation for a business rule.
  • Extract to one function/value object.
  • Email value object validates on creation.
  • Replace copies, add tests.
  • Shared library if across services.
Practise this topic

Start without signing up. Sign in free to get an AI report card on your answer.

See all topics