/lld_by_ishan

Low level design questions

Primary LanguageJava

Low-Level Design Series by Ishan

Welcome to the Low-Level Design (LLD) series by Ishan! 🚀 💻 This repository is a comprehensive collection of detailed low-level design problems, structured into different modules covering Object-Oriented Programming (OOP), SOLID design principles, design patterns (Creational, Structural, Behavioral), and specific low-level design problems.

Table of Contents

  1. Object-Oriented Programming (OOP) 🔗
  2. SOLID Design Principles 🔗
  3. Design Patterns 🔗
    • Creational 🔗
    • Structural 🔗
    • Behavioral 🔗
      • Chain of Responsibility 🔄: Illustrated through a real-life example involving a hierarchical approval system within an organization. The chain involves managers, senior managers, and directors, each capable of approving specific types of requests, with unapproved requests cascading up the hierarchy.
      • Command Pattern 🛠️: Explored through two diverse examples:
        • Banking Scenario: Demonstrates how commands can be used to execute various banking operations.
        • Air Conditioner System: Introduces a flexible command pattern where commands are issued from a remote to the AC, allowing for easy addition of new commands without altering existing code.
      • Iterator Design Pattern 🔍: Focuses on the creation of a custom iterator that traverses a list of browsing history objects, providing a convenient way to obtain desired results.
      • Mediator Design Pattern 🤝: Examined through a chat server and client interaction, where communication between users is facilitated through a mediator (server). Also applied to an auction system, illustrating how live bids are managed.
      • Memento Design Pattern 🕰️: Explored using an article storage scenario, demonstrating how the pattern enables the storage of previous states that can be recovered at any point in the future.
      • Observer Design Pattern 🔍👀: Examined through multiple examples where a subject is tracked by various observers. The subject notifies registered observers, triggering their update methods.
      • State Design Pattern 🔄📦: Illustrated through two examples:
        • Order State Lifecycle: Captures the lifecycle of an order with various states.
        • TV State Management: Manages the state of a TV, showcasing the transition between different operational states.
      • Strategy Design Pattern 🎮🔧: Explored through diverse scenarios:
        • Bird Management System: Demonstrates how different birds have different flying and quacking behaviors.
        • Payment Strategy System: Applied during runtime for shopping payments, allowing flexible payment strategy selection.
      • Template Design Pattern 📜🎮: Demonstrated through examples in gaming, where different games share a common structure for initialization, start, and stop methods. The play method is intentionally not overrideable by child classes, ensuring a consistent template.
      • Visitor Design Pattern 🚗💳: Beautifully illustrated through two real-life scenarios:
        • Car Service Center: Represents a car visiting a service center to receive various services.
        • Offer System: Deals with multiple offers and credit cards, utilizing visitor methods for each card to interact with specific offers, creating numerous possible combinations.
  4. Low-Level Design Problems 🔗

OOP

The OOP module contains fundamental Java concepts, providing a solid foundation for understanding object-oriented programming.

SOLID Design Principles

Explore detailed explanations of the SOLID design principles, helping you write maintainable and scalable code.

Design Patterns

Dive into the world of design patterns, categorized into three sub-modules:

Creational

Discover design patterns that deal with object creation mechanisms, trying to create objects in a manner suitable to the situation.

Structural

Explore patterns that focus on simplifying the composition of classes or objects, emphasizing the composition of classes or objects.

Behavioral Design Patterns 🔗

In the Behavioral module of Design Patterns, we explore solutions that focus on algorithms, communication, and the assignment of responsibilities between objects.

1. Chain of Responsibility 🔗 🔄

Illustrated through a real-life example involving a hierarchical approval system within an organization. The chain involves managers, senior managers, and directors, each capable of approving specific types of requests, with unapproved requests cascading up the hierarchy.

2. Command Pattern 🔗 🛠️

Explored through two diverse examples:

  • Banking Scenario: Demonstrates how commands can be used to execute various banking operations.
  • Air Conditioner System: Introduces a flexible command pattern where commands are issued from a remote to the AC, allowing for easy addition of new commands without altering existing code.

3. Iterator Design Pattern 🔗 🔍

Focuses on the creation of a custom iterator that traverses a list of browsing history objects, providing a convenient way to obtain desired results.

4. Mediator Design Pattern 🔗 🤝

Examined through a chat server and client interaction, where communication between users is facilitated through a mediator (server). Also applied to an auction system, illustrating how live bids are managed.

5. Memento Design Pattern 🔗 🕰️

Explored using an article storage scenario, demonstrating how the pattern enables the storage of previous states that can be recovered at any point in the future.

6. Observer Design Pattern 🔗 🔍👀

Examined through multiple examples where a subject is tracked by various observers. The subject notifies registered observers, triggering their update methods.

7. State Design Pattern 🔗 🔄📦

Illustrated through two examples:

  • Order State Lifecycle: Captures the lifecycle of an order with various states.
  • TV State Management: Manages the state of a TV, showcasing the transition between different operational states.

8. Strategy Design Pattern 🔗 🎮🔧

Explored through diverse scenarios:

  • Bird Management System: Demonstrates how different birds have different flying and quacking behaviors.
  • Payment Strategy System: Applied during runtime for shopping payments, allowing flexible payment strategy selection.

9. Template Design Pattern 🔗 📜🎮

Demonstrated through examples in gaming, where different games share a common structure for initialization, start, and stop methods. The play method is intentionally not overrideable by child classes, ensuring a consistent template.

10. Visitor Design Pattern 🔗 🚗💳

Beautifully illustrated through two real-life scenarios:

  • Car Service Center: Represents a car visiting a service center to receive various services.
  • Offer System: Deals with multiple offers and credit cards, utilizing visitor methods for each card to interact with specific offers, creating numerous possible combinations.

Low-Level Design Problems

Each directory in this module corresponds to a specific low-level design problem. Inside each directory, you'll find a comprehensive solution along with explanations, diagrams, and code samples.

Contact Information

If you have a specific design problem you'd like me to cover or if you simply want to share your thoughts, feel free to reach out:

Thank you for being a part of the Low-Level Design Series community! 🚀

Show your Support

If you find this repository helpful or have suggestions for improvement, don't forget to ⭐️ it! Your support keeps this project active and encourages further development.

Happy coding! 🚀