Sample code demonstrating SOLID principles and Dependency Injection, OOPs Sample Code implemented in both Java and JavaScript/TypeScript.
SOLID is an acronym for five design principles intended to make software designs more understandable, flexible, and maintainable. emphasizing the decoupling of high-level modules from low-level modules by introducing an abstraction layer between them.
This repository contains sample code illustrating each of the SOLID principles and Dependency Injection, OOPs in both Java and JavaScript/TypeScript.
-
Maintainability:
- Ensure Bug-Free Code
- Enhance Readability and Understandability
- Facilitate Easy Debugging and Maintenance
-
Extendability:
- Enable Addition of New Features with Minimal Impact
- Promote Scalability and Adaptability to Future Requirements
- Support Seamless Integration of Enhancements
-
Reusability:
- Encourage Componentization and Modularization
- Foster Creation of Highly Cohesive and Loosely Coupled Modules
-
Easily Testable:
- Test Coverage should be their
-
Modular
- Easy to read the code
- Easy to debug code
-
Single Responsibility Principle SRP
-
Open/Closed Principle OCP
-
Liskov Substitution Principle LSP
-
Interface Segregation Principle ISP
SOLID/
└── js or ts
├── SIP/
├── OCP/
├── LSP/
├── ISP/
└── DIP/
DesignPattern/
├── FlyWeight/
├── Observer/
├── Adapter/
├── Decorator/
├── Facade/
├── Factory/
├── Prototype/
├── SingleTon/
├── Strategy/
└── UML-Diagram/
java/
├── DesignPattern/
│ ├── FlyWeight/
│ ├── Observer/
│ ├── Adapter/
│ ├── Decorator/
│ ├── Facade/
├── SOLID/
│ ├── SIP/
│ ├── OCP/
│ ├── LSP/
│ ├── ISP/
│ ├── DIP/
To get a local copy of the sample code up and running, follow these steps:
-
Clone the repository:
git clone https://github.com/stormdotcom/Low-Level-Design-LLD-
-
Navigate to the
java
orroot
( for js/ts) directory, depending on the language you want to explore. -
Choose a specific SOLID principle or Dependency Inversion example folder.
-
Explore the code.
- Single Responsibility Principle (SRP): Demonstrates how to design classes that have a single responsibility.
- Open/Closed Principle (OCP): Shows how to design classes that are open for extension but closed for modification.
- Liskov Substitution Principle (LSP): Illustrates how to use subclassing without introducing bugs.
- Interface Segregation Principle (ISP): Demonstrates how to segregate interfaces to make them more focused.
- Dependency Inversion Principle (DIP): Shows how to design modules that depend on abstractions rather than concrete implementations.
- Single Responsibility Principle (SRP): JavaScript/TypeScript examples demonstrating classes with single responsibilities.
- Open/Closed Principle (OCP): JavaScript/TypeScript examples showing how to extend functionality without modifying existing code.
- Liskov Substitution Principle (LSP): JavaScript/TypeScript examples illustrating substitution of derived classes for base classes.
- Interface Segregation Principle (ISP): JavaScript/TypeScript examples demonstrating how to split interfaces to keep them focused.
- Dependency Inversion Principle (DIP): JavaScript/TypeScript examples showing how to invert dependencies to decouple components.