An elegant, interactive playground for practicing and mastering Low-Level Design (LLD), High-Level Design (HLD), and clean code principles.
Here is a visual roadmap of how the repository is structured to separate concerns and languages:
SystemDesign/ (Workspace Root)
βββ .gitignore # Workspace-level Git ignore rules (Java & Python)
βββ README.md # Interactive guide and roadmap (You are here!)
βββ assets/ # Graphic banners, diagrams, and static assets
β βββ system_design_banner.png
β
βββ SystemDesign/ # Java-based Design Practice
β βββ src/
β β βββ DESIGNING_PRINCIPLES/ # SOLID and Clean Code Examples
β β β βββ SOLID/ # SRP, OCP, LSP, ISP, DIP implementations
β β βββ HLD/ # High-Level Design diagrams & architectures
β β βββ LLD/ # Low-Level Design / GoF Patterns
β β βββ DocumentEditorClient.java
β βββ SystemDesign.iml # IntelliJ Project metadata
β βββ document.txt # Test output generated by LLD clients
β
βββ python_design/ # Python-based Design Practice (Coming soon!)
βββ designing_principles/ # Python clean code and SOLID examples
βββ hld/ # Python architectural design scripts & specs
βββ lld/ # Python Low-Level Design patterns
The Java portion features concrete practice exercises. The current implementation demonstrates how to build a flexible Document Editor with composition and structural pattern principles.
- Implementation: DocumentEditorClient.java (No hardcoded absolute paths, git-friendly!)
GitHub supports native rendering of these Mermaid diagrams. Hover or zoom in to inspect the class relations and messaging sequence:
classDiagram
direction TB
class DocumentElement {
<<interface>>
+render() String
}
class TextElement {
-text: String
+render() String
}
class ImageElement {
-imagePath: String
+render() String
}
class NewLineElement {
+render() String
}
DocumentElement <|.. TextElement
DocumentElement <|.. ImageElement
DocumentElement <|.. NewLineElement
class Document {
-documentElements: List~DocumentElement~
+addElements(DocumentElement) void
+render() String
}
Document --> DocumentElement : composes
class Persistance {
<<interface>>
+save(String) void
}
class FileStorage {
+save(String) void
}
class DBStorage {
+save(String) void
}
Persistance <|.. FileStorage
Persistance <|.. DBStorage
class DocumentEditor {
-document: Document
-persistance: Persistance
-renderDocument: String
+addText(String) void
+addImage(String) void
+addNewLine() void
+renderDocuments() String
+saveDocument() void
}
DocumentEditor --> Document : aggregates
DocumentEditor --> Persistance : uses
sequenceDiagram
autonumber
actor Client as DocumentEditorClient
participant Editor as DocumentEditor
participant Doc as Document
participant Storage as FileStorage (Persistance)
Client->>Editor: Instantiate(Document, FileStorage)
Client->>Editor: addText("Hello, world!")
Editor->>Doc: addElements(TextElement)
Client->>Editor: addNewLine()
Editor->>Doc: addElements(NewLineElement)
Client->>Editor: addImage("picture.jpg")
Editor->>Doc: addElements(ImageElement)
Client->>Editor: renderDocuments()
Editor->>Doc: render()
Doc-->>Editor: concatenated String
Editor-->>Client: return String
Client->>Editor: saveDocument()
Editor->>Storage: save(data)
Storage-->>Storage: Write to document.txt
To compile and run this low-level design client manually:
# Navigate to the Java src folder
cd SystemDesign/src
# Compile the package files
javac LLD/DocumentEditorClient.java
# Run the client class
java LLD.DocumentEditorClient㪠Click to expand: Simulated Console Output
[TextElement@1b6d1f0d]
[TextElement@1b6d1f0d, NewLineElement@4516af24]
[TextElement@1b6d1f0d, NewLineElement@4516af24, TextElement@7c30a50]
[TextElement@1b6d1f0d, NewLineElement@4516af24, TextElement@7c30a50, NewLineElement@279f2327]
[TextElement@1b6d1f0d, NewLineElement@4516af24, TextElement@7c30a50, NewLineElement@279f2327, TextElement@2e0fa5d3]
[TextElement@1b6d1f0d, NewLineElement@4516af24, TextElement@7c30a50, NewLineElement@279f2327, TextElement@2e0fa5d3, NewLineElement@5b21e916]
[TextElement@1b6d1f0d, NewLineElement@4516af24, TextElement@7c30a50, NewLineElement@279f2327, TextElement@2e0fa5d3, NewLineElement@5b21e916, ImageElement@3419b40f]
Hello, world!
This is a real-world document editor example.
Indented text after a tab space.
picture.jpg
Document saved to document.txt
For the Python implementations under python_design/, standard Object-Oriented standards are enforced. This includes using the standard library's abc module to represent Interfaces/Abstract Base Classes and implementing strict type hinting.
When adding custom patterns in Python (e.g. under python_design/lld/), use this standard blueprint:
from abc import ABC, abstractmethod
from typing import List
# 1. Define Interface
class Renderable(ABC):
@abstractmethod
def render(self) -> str:
pass
# 2. Implement Concrete Subclasses
class Heading(Renderable):
def __init__(self, text: str):
self.text = text
def render(self) -> str:
return f"# {self.text}\n"
# 3. Use Composition
class Page:
def __init__(self):
self._elements: List[Renderable] = []
def add_element(self, element: Renderable) -> None:
self._elements.append(element)
def render_all(self) -> str:
return "".join(element.render() for element in self._elements)
if __name__ == "__main__":
page = Page()
page.add_element(Heading("System Design in Python"))
print(page.render_all())Use this roadmap checklist to track your implementations in both languages:
| Principle | Description | Java | Python |
|---|---|---|---|
| SRP | Single Responsibility Principle | β¬ | β¬ |
| OCP | Open/Closed Principle | β¬ | β¬ |
| LSP | Liskov Substitution Principle | β¬ | β¬ |
| ISP | Interface Segregation Principle | β¬ | β¬ |
| DIP | Dependency Inversion Principle | β¬ | β¬ |
| Category | Design Pattern | Java | Python |
|---|---|---|---|
| Creational | Singleton | β¬ | β¬ |
| Factory Method / Abstract Factory | β¬ | β¬ | |
| Builder | β¬ | β¬ | |
| Prototype | β¬ | β¬ | |
| Structural | Composite (e.g., DocumentEditor) |
βοΈ Active | β¬ |
| Adapter / Decorator | β¬ | β¬ | |
| Facade / Proxy | β¬ | β¬ | |
| Behavioral | Observer (Pub-Sub) | β¬ | β¬ |
Strategy (e.g., Persistance injection) |
βοΈ Active | β¬ | |
| Command / State / Iterator | β¬ | β¬ |
- Load Balancers & Reverse Proxies (Nginx, HAProxy)
- Caching Strategies (Write-through, Write-back, Cache-aside using Redis/Memcached)
- Database Sharding & Partitioning (Horizontal vs. Vertical)
- Message Queues & Event-Driven Architecture (Kafka, RabbitMQ)
- Microservices vs. Monoliths (Service Discovery, API Gateways)
Tip
Keep Interfaces Small: When designing new elements or subcomponents, follow the Interface Segregation Principle (ISP) to ensure implementing classes only depend on methods they actually use.
Note
Testing Your Designs: Always accompany complex LLD patterns with a simulation client (like DocumentEditorClient) or unit tests to demonstrate the instantiation and run-time behavior of your components.
Feel free to connect, collaborate, or follow my coding journey:
- π Personal Portfolio & Website: ajayv.online
- π GitHub Profile: @Ajay-v44
- π§ LeetCode Profile: @Ajay_v44