DevDocsDev Docs
Design Principles

Design Principles

Master the fundamental principles that guide great software design

Design Principles

Software design principles are time-tested guidelines that help developers create maintainable, scalable, and robust code. These principles represent decades of collective wisdom from the software engineering community.

Why Principles Matter

Principle Categories

SOLID Principles

The five fundamental principles of object-oriented design, promoted by Robert C. Martin (Uncle Bob).

General Principles

Fundamental guidelines that apply to all programming paradigms.

Coupling & Communication

Principles that govern how components interact with each other.

Architectural Principles

Higher-level principles for system design.


Quick Reference

PrincipleMnemonicCore IdeaProblem Solved
SRPSingle ResponsibilityOne reason to changeGod classes, mixed concerns
OCPOpen/ClosedExtend, don't modifyFragile code, regression bugs
LSPLiskov SubstitutionSubstitutable subtypesBroken polymorphism
ISPInterface SegregationSpecific interfacesFat interfaces, forced implementations
DIPDependency InversionDepend on abstractionsTight coupling, hard to test
DRYDon't Repeat YourselfSingle source of truthScattered changes, inconsistency
KISSKeep It SimpleSimplest solution winsOver-engineering
YAGNIYou Aren't Gonna Need ItBuild for todayWasted effort, bloat
LoDLaw of DemeterTalk to friends onlyTrain wrecks, hidden dependencies
CoIComposition over InheritanceCombine, don't inheritRigid hierarchies

Balance is Key

These principles sometimes conflict. Use judgment based on your specific context. The goal is maintainable, working software—not dogmatic adherence to rules.

On this page