Everyone who's coded for some time has probably heard about these principles, but do you know them?
If you were ever afraid to ask, here's your chance to understand them easily and in just a few minutes each!
The principles in their mnemonic order:
- Single Responsibility Principle
- Open-Closed Principle
- Liskov Substitution Principle
- Interface Segregation Principle
- Dependency Inversion Principle
My recommended way to approach them, from easiest to "hardest", is:
- Single Responsibility Principle
- Liskov Substitution Principle
- Interface Segregation Principle
- Open-Closed Principle
- Dependency Inversion Principle
You can install the things with npm install
and then just go at each file with npx ts-node src/{filename}.ts
.
Or, if you're lazy, you can also copy the individual TS file's contents into the TypeScript playground if you want to avoid cloning and installing anything at all.