Principles
Solid Principles
Single Responsibility Principle (SRP) - Do one thing and do it well.
Open/Closed Principle - Donβt modify existing code; extend it instead.
Liskov Substitution Principle (LSP) - Derived classes must extend without changing functionality.
Interface Segregation Principle (ISP) - Many small interfaces are better than one large one.
Dependency Inversion Principle (DIP) - Depend on abstractions, not concretions.
General OOPs Principles
Encapsulation - Hide implementation details; expose only what is necessary
Prefer Composition over Inheritance - Favor has-a over is-a relationship
Tell, Don't Ask - Ask for what you need, not how to get it
Code Simplicity & Maintainability Principles
KISS (Keep it Simple, Stupid) - Complexity is the enemy of maintainability
YAGNI (You ain't gonna need it) - Avoid unnecessary features
DRY (Don't Repeat Yourself) - Every piece of knowledge must have a single representation.
Law of Demeter (LoD) - Talk only to your friends, not strangers.
Design and Architecture
Separation of Concerns - Each module should have a clear purpose.
Cohesion & Coupling - Tightly coupled systems are harder to maintain. High Cohesion, Low Coupling.
Fail Fast - Crash early, fix early. Detect Early errors rather than failing silently
Convention over Configuration - Less configuration, more productivity. Use sensible Defaults.
Poka - Yoke (Mistake - Proofing) - Make incorrect states impossible
Single Level of Abstraction - Donβt mix high and low-level details in the same function.
You shouldn't Optimize prematurely - Premature optimization is the root of all evil. Donald Knuth
C10k & C10M Problem Awareness - Plan for high concurrency. Be mindful of 10k+ concurrent connections in server
Horizontal Scaling vs Vertical Scaling - Scale out, not up. Prefer Horizontal Scaling.
Software Development Process Principles
Agile Manifesto - Prioritize individuals, working software, customer collaboration, and flexibility . - Respond to change over following a plan.
Boy Scout Rule - Leave the code better than you found it . - Always leave the campground cleaner than you found it.
Test Driven Development (TDD) - Write tests first , then write the code to pass them. - Red β Green β Refactor.
CI/CD - Automate testing and deployment. - Deploy fast, deploy often.
Feature Flags/Toggle - Enable or disable features without deploying code . - Separate deployment from release.
Security & Reliability Principles
Principle of Least Privilege - Donβt give a process more power than it needs.
Fail Safe, Not Open - Systems should default to a safe state in case of failure. - Security should not rely on obscurity.
Indepotency - The same request should produce the same result if repeated. - Safe to retry.β
CAP Theorem - In distributed systems, you can have only two out of three :
* Consistency (all nodes see the same data)
* Availability (system always responds)
* Partition Tolerance (handles network failures)
Back to top