SpinTheMic
Pro

Interview practice question

Order status logic scattered everywhere

Backend Engineering · OOP and Design Patterns · Intermediate

Order status checks like if status == "PAID" && !isCancelled are spread across 50 places, and invalid transitions keep happening. How do you fix the design?

What a strong answer covers

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

  • Centralise in a state machine.
  • State pattern or transition table.
  • Methods on Order enforce transitions.
  • Single status field, remove redundant flags.
  • Tests per transition.
Practise this topic

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

See all topics