BTI Beyond The Interviews

System Design & Architecture · 10 sections

OOP Principles

Encapsulation, inheritance, polymorphism, SOLID, and the design patterns interviewers probe — with correct, compiling examples.

Premium · preview 105 cards Updated 24 Oct 2026
Free to preview. The first 3 cards and the full outline are below — the rest of this sheet is part of the System Design bundle.

What's inside

Preview — first 3 of 105 cards

Encapsulation

Bundle data with the methods that operate on it and keep the representation private behind a public API. Protects invariants, prevents invalid states, and lets the implementation change without breaking callers. Information hiding is the mechanism; leaking fields (or internal collections) breaks it.

class Account {
  private BigDecimal balance = BigDecimal.ZERO;

  public void deposit(BigDecimal amount) {
    if (amount.signum() <= 0) throw new IllegalArgumentException("must be positive");
    balance = balance.add(amount);
  }

  public BigDecimal balance() { return balance; }   // read-only view
}

Abstraction

Expose only the essential behavior and hide the details behind a contract (interface or abstract class). Callers depend on what an object does, not how. Implementations can then be swapped without touching clients.

interface PaymentGateway { Receipt charge(Money amount); }

final class StripeGateway implements PaymentGateway {
  public Receipt charge(Money amount) { return client.charge(amount); }
}

Abstraction vs encapsulation

Abstraction is about what an object does (a simplified contract). Encapsulation is about how state is protected (private fields, validation, no leaks). A public field is abstraction without encapsulation; a private helper nobody can call is encapsulation without useful abstraction.

interface PaymentGateway { Receipt charge(Money m); }  // abstraction: the what

final class Account {                                  // encapsulation: hides the how
  private BigDecimal balance;
}

102 more cards in this sheet

Unlock the System Design bundle — ₹399

One-time payment. Unlocks this sheet and 10 other sheets in the bundle, plus a typeset PDF of each.

Unlock the bundle See all bundles

Or get all 76 sheets for ₹999 — one payment, every future sheet included.