SpinTheMic
Pro

Interview practice question

Report generators with duplicated steps

Backend Engineering · OOP and Design Patterns · Intermediate

You have PDF, CSV and Excel report generators that all fetch data, filter, sort and format, with the first three steps copied in each. How do you remove the duplication?

What a strong answer covers

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

  • Same process, different format step.
  • Template method in base class.
  • Or pipeline with pluggable formatter (strategy).
  • Prefer composition.
  • Test shared steps once.
Practise this topic

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

See all topics