Design Principles
Everything on SkillVeris tagged Design Principles — collected across the glossary, study notes, blog, and cheat sheets.
20 resources across 1 library
Interview Questions(20)
Composition vs Inheritance in OOP
Inheritance models an "is-a" relationship where a class derives from a parent, while composition models a "has-a" relationship where a class is built from othe…
What are SOLID Principles?
SOLID is five object-oriented design principles — Single Responsibility, Open/Closed, Liskov Substitution, Interface Segregation, and Dependency Inversion — th…
Aggregation vs Composition in OOP
Aggregation and composition are both "has-a" relationships between objects, but composition implies strict ownership where the part cannot outlive the whole, w…
What is the Single Responsibility Principle?
The Single Responsibility Principle states that a class should have only one reason to change, meaning it should own exactly one well-defined responsibility ra…
What is the Interface Segregation Principle?
The Interface Segregation Principle (the 'I' in SOLID) states that no client should be forced to depend on methods it does not use, so large interfaces should…
What is the Dependency Inversion Principle?
The Dependency Inversion Principle (the 'D' in SOLID) states that high-level modules should not depend on low-level modules — both should depend on abstraction…
Explain SOLID Principles with Real-World Examples
SOLID is a set of five object-oriented design principles — Single Responsibility, Open/Closed, Liskov Substitution, Interface Segregation, and Dependency Inver…
What is the Law of Demeter?
The Law of Demeter, also called the principle of least knowledge, states that a method should only call methods on itself, its own fields, its parameters, or o…
What is the DRY Principle?
DRY, short for "Don’t Repeat Yourself," is the design principle that every piece of knowledge or logic in a system should have a single, unambiguous, authorita…
What is the KISS Principle?
KISS, short for "Keep It Simple, Stupid," is the design principle that most systems work best when they are kept as simple as possible, favoring straightforwar…
What is the YAGNI Principle?
YAGNI, short for "You Aren’t Gonna Need It," is the design principle that a developer should not add functionality, flexibility, or abstraction until it is act…
What is the Tell, Don’t Ask Principle?
Tell, Don’t Ask is the object-oriented design guideline that you should tell an object what to do by calling a method that performs the behavior internally, ra…
What is the Composite Reuse Principle?
The Composite Reuse Principle states that classes should achieve code reuse through composition — holding references to other objects and delegating to them —…
Why Favor Composition Over Inheritance?
Composition is generally favored over inheritance because it produces looser coupling and more flexible designs: composed behavior can be swapped at runtime th…
Liskov Substitution Violation: A Concrete Example
A classic Liskov Substitution Principle violation is a Square class extending a Rectangle class: because setting a Square’s width must also change its height (…
What is a Code Smell?
A code smell is a surface-level indicator in source code that suggests a deeper design or maintainability problem, even though the code still compiles and work…
Information Hiding vs Encapsulation
Information hiding is the design-level principle of concealing decisions likely to change behind a stable interface, while encapsulation is the language-level…
Factory Method vs Abstract Factory
Factory Method defines a single method, usually overridden by subclasses, that creates one product, while Abstract Factory defines an interface with multiple f…
What is the Abstract Factory Pattern?
The Abstract Factory pattern provides an interface for creating families of related objects without specifying their concrete classes, guaranteeing that the ob…
Header Interface vs Role Interface
A header interface exposes every public method of a single concrete class as one large interface mirroring that class, while a role interface is a small, clien…