Skip to content
Learn Netverks
Company prep GitLab
Junior (1–3 years) Technical deep dive Easy

Apply Strategy pattern for multiple payment methods

Reported in GitLab European engineering loops. OOD pattern question focused on replacing condition-heavy logic.

Role
Backend Engineer
Location
London, UK

Context for GitLab candidates:

Support card, UPI, wallet, and net banking with clean extensible design.

Try answering aloud first

Cover trade-offs, structure, and a concrete example before revealing the baseline response.

Spoiler-free prep mode

How to frame this at GitLab: Connect your answer to measurable impact, clarity of thought, and trade-offs the team cares about. Below is a strong baseline response you can adapt with your own project examples.

Define a common PaymentStrategy interface with methods like authorize and capture. Concrete strategies implement provider-specific behavior while checkout flow depends only on the interface.

This removes large if-else branches and allows adding new methods without modifying stable orchestration code. Pair Strategy with factory or dependency injection to select implementation at runtime.

Interviewers like hearing about testability gains: each strategy can be unit tested independently with mocked gateway clients.

Comments (0)

Share how this question came up in your loop, or add tips for others preparing.

Log in to comment on this question.