Skip to content

About

An elegant, interactive playground for practicing and mastering Low-Level Design (LLD), High-Level Design (HLD), and clean code principles.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

40 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

System Design Sandbox Banner

🌌 System Design Sandbox (Java & Python)

An elegant, interactive playground for practicing and mastering Low-Level Design (LLD), High-Level Design (HLD), and clean code principles.

Languages Topic Status


πŸ“‚ Directory Structure

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

β˜• Java Low-Level Design Highlight: Document Editor

The Java portion features concrete practice exercises. The current implementation demonstrates how to build a flexible Document Editor with composition and structural pattern principles.

πŸ“Œ File Reference

🎨 Architecture & UML Diagrams

GitHub supports native rendering of these Mermaid diagrams. Hover or zoom in to inspect the class relations and messaging sequence:

Class Diagram (Structural View)

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
Loading

Sequence Diagram (Execution Flow)

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
Loading

πŸ’» Setup & Execution (Java)

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

🐍 Python Design Sandbox

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.

πŸ§ͺ Standard Python Design Template

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())

πŸ—ΊοΈ System Design & Patterns Checklist

Use this roadmap checklist to track your implementations in both languages:

1. SOLID Principles

Principle Description Java Python
SRP Single Responsibility Principle ⬜ ⬜
OCP Open/Closed Principle ⬜ ⬜
LSP Liskov Substitution Principle ⬜ ⬜
ISP Interface Segregation Principle ⬜ ⬜
DIP Dependency Inversion Principle ⬜ ⬜

2. Low-Level Design (LLD) / GoF Patterns

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 ⬜ ⬜

3. High-Level Design (HLD) Concepts

  • 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)

πŸ› οΈ Design Guidelines & Best Practices

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.


πŸ”— Author & Developer Profiles

Feel free to connect, collaborate, or follow my coding journey:

About

An elegant, interactive playground for practicing and mastering Low-Level Design (LLD), High-Level Design (HLD), and clean code principles.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages