An open API service indexing awesome lists of open source software.

https://github.com/stormdotcom/low-level-design-lld-

sample code demonstrating SOLID principles and Dependency Inversion implemented in both Java and JavaScript.
https://github.com/stormdotcom/low-level-design-lld-

java javascript js lld oops

Last synced: 11 months ago
JSON representation

sample code demonstrating SOLID principles and Dependency Inversion implemented in both Java and JavaScript.

Awesome Lists containing this project

README

          

# SOLID Principles, Dependency Injection, OOPs Sample Code

Sample code demonstrating SOLID principles and Dependency Injection, OOPs Sample Code implemented in both Java and JavaScript/TypeScript.

## Introduction

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.

### SOLID Principles: Guidelines for Better Software Systems

1. **Maintainability**:

- Ensure Bug-Free Code
- Enhance Readability and Understandability
- Facilitate Easy Debugging and Maintenance

2. **Extendability**:

- Enable Addition of New Features with Minimal Impact
- Promote Scalability and Adaptability to Future Requirements
- Support Seamless Integration of Enhancements

3. **Reusability**:

- Encourage Componentization and Modularization
- Foster Creation of Highly Cohesive and Loosely Coupled Modules

4. **Easily Testable**:
- Test Coverage should be their
5. **Modular**
- Easy to read the code
- Easy to debug code

- ##### Single Responsibility Principle [SRP](SOLID/SRP/SRP.md)
- ##### Open/Closed Principle [OCP](SOLID/OCP/ocp.md)
- ##### Liskov Substitution Principle [LSP](SOLID/LSP/lsp.md)
- ##### Interface Segregation Principle [ISP](SOLID/ISP/isp.md)

### Folder Directory

```
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/
```

## Getting Started

To get a local copy of the sample code up and running, follow these steps:

1. Clone the repository:

```
git clone https://github.com/stormdotcom/Low-Level-Design-LLD-
```

2. Navigate to the `java` or `root` ( for js/ts) directory, depending on the language you want to explore.

3. Choose a specific SOLID principle or Dependency Inversion example folder.

4. Explore the code.

## Java Samples

- **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.

## JavaScript/TypeScript Samples

- **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.