Software Design Principles

DRY

  • stands for Do not Repeat Yourself
  • Any logic should not be duplicated
  • There is Rule of Three which says that you are allowed to copy and paste the code once, but that when the same code is replicated three times, it should be extracted into a new procedure.

Curly’s Law

  • Says Do one thing
  • It is about choosing a single, clearly defined goal for any particular bit of code

KISS

  • stands for Keep it simple stupid
  • It says that most systems work best if they are kept simple rather than made complicated
  • Simplicity should be a key goal in design, and unnecessary complexity should be avoided.

YAGNI

  • stands for You aren't gonna need it
  • Always implement things when you actually need them, never when you just foresee that you need them.
  • Premature Optimization is the Root of All Evil

SOLID

  • Single Responsibility Principle
  • Open Closed Principle
  • Liskov’s substitution principle
  • Interface Segregation Principle
  • Dependency Inversion Principle

POLA

  • stands for Principle of least astonishment
  • aka principle of least surprise
  • In UI design and software design, a component of a system should behave in a way that most users will expect it to behave, and therefore not astonish or surprise users.