Skip to content
Sharp

Design patterns · interview question

In a payment processing system, you notice that adding a new payment processor requires modifying multiple classes. Which design pattern might help refactor this architecture to make it more scalable?

Multiple choiceHardchapter-13-curatedpremiumdesign-patternsfactory-pattern
Choose one answer
Answer and explanation

Correct answer

A. Factory Pattern

Why

The Factory Pattern can be used to encapsulate the instantiation logic of payment processors, allowing new types to be added without modifying existing client code, thus adhering to the Open/Closed Principle.

Test yourself on Design patterns

A free test with instant, explained results. No account needed.

Start free test
All Design patterns questions →