You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Class — user-defined type representing an abstraction; encapsulates state and behavior to improve code reuse.
Encapsulation — bind data with its behavior and expose only a minimal interface.
Inheritance — extend functionality, and narrow type; derive specialized subtypes from a base to reuse and extend behavior.
Polymorphism — same call, different implementations; let each receiver provide its own.
Structural Composition — build higher-level, more complex abstractions by combining smaller collaborating parts.
Aggregation — a whole references parts with an independent lifecycle; loose ownership.
Separation of Concerns — isolate responsibilities by separate implementations to reduce coupling and cognitive complexity.
Dependency Injection — pass dependencies from outside (via constructor, fields, or setters) and store them in fields.
Tell, Don’t Ask — give objects the job themselves rather than pulling out their data and doing the work elsewhere.
Mutable vs Immutable — prefer state that never changes after creation for safety; prefer mutable state for performance and memory optimization.
Duck Typing — rely on contracts and object compatibility by behavior rather than inheritance hierarchy.
Entity vs Value Object — entities are tracked by ID, values by content equality.
Delegation — forward work to a collaborator (separate abstraction) for code reuse or flexibility.
Information Hiding — keep state private, expose only controlled behavior.
Law of Demeter (LoD) — talk only to your immediate collaborators; avoid deep access by multiple dots.
Generics — parametric types that let code be written once and reused for many concrete types while preserving type safety.
Resource allocation: Constructor, destructor, disposable — a constructor acquires resources; a destructor releases resources automatically at object end-of-life; a disposable is an explicit protocol to release unmanaged resources deterministically.