Difference of High-Level Design (HLD) and Low-Level Design (LLD)

High-Level Design (HLD) and Low-Level Design (LLD) are software design concepts that are not specific to any programming language. However, to illustrate the differences between HLD and LLD, we can use C# programming language examples.

Suppose we are designing a software system that involves creating a payment gateway application in C#.  Here are examples of HLD and LLD for this system:

High-Level Design (HLD):

  1. Define the functional requirements of the payment gateway system, such as processing payment transactions, handling errors, and providing a user interface.

  2. Identify the non-functional requirements, such as performance, scalability, and security.

  3. Identify the key components of the payment gateway system, such as payment processing engine, database, user interface, and error handling.

  4. Create an architecture diagram that shows how these components will fit together to form the payment gateway system.

  5. In HLD, the focus is on defining the system's overall structure and architecture. At this stage, the classes identified are usually high-level classes that represent major components or modules of the system. These classes are not yet implemented, but they describe the overall structure of the software system.

Examples of HLD classes for an e-commerce website might include:

In C#, an example of High-Level Design (HLD) for a simple e-commerce website might include the following classes:

  1. UserAccount: This class represents the user account and includes properties such as name, email, and password.

  2. ProductCatalog: This class represents the product catalog and includes properties such as product name, description, and price.

  3. ShoppingCart: This class represents the shopping cart and includes properties such as the list of products, total cost, and shipping information.

  4. OrderManagement: This class represents the order management system and includes properties such as the list of orders, order status, and order history.

  5. PaymentGateway: This class represents the payment gateway and includes properties such as payment method, payment amount, and transaction ID.

The interactions between these classes can be described using a UML diagram, which shows the relationships between the classes and the flow of data between them.

Here's an example of a UML diagram for the e-commerce website HLD:

+----------------+           +----------------+
|   UserAccount  | <-------> |  OrderManagement|
+----------------+           +----------------+
         ^                             ^
         |                             |
         |                             |
+----------------+           +----------------+
| ProductCatalog |           | PaymentGateway |
+----------------+           +----------------+
         ^                             ^
         |                             |
         |                             |
+----------------+           +----------------+
|  ShoppingCart  |           |   OrderDetail  |
+----------------+           +----------------+

In this example, the UserAccount class interacts with the OrderManagement class to create and manage user accounts and orders. The ProductCatalog class interacts with the ShoppingCart class to add and remove products from the cart. The OrderManagement class interacts with the PaymentGateway class to process payments, and the OrderManagement class interacts with the OrderDetail class to manage order history.

This example shows how HLD classes provide a high-level overview of the system's architecture and how the different components of the system interact with each other.

Low-Level Design (LLD):

  1. Define the implementation details for the payment processing engine component, such as how it will interact with the payment gateway API, how it will validate payment data, and how it will handle exceptions.

  2. Define the database schema, including tables, columns, and relationships.

  3. Define the user interface, including the design of the screens and the functionality of the buttons.

  4. Define the error handling mechanism, including the types of errors that can occur and how they will be logged and reported.

In C#, an example of Low-Level Design (LLD) for the e-commerce website might include the following classes:

  1. UserAccountManager: This class is responsible for managing user accounts and includes methods such as CreateAccount, UpdateAccount, and DeleteAccount.

  2. ProductCatalogManager: This class is responsible for managing the product catalog and includes methods such as AddProduct, UpdateProduct, and DeleteProduct.

  3. ShoppingCartManager: This class is responsible for managing the shopping cart and includes methods such as AddProductToCart, RemoveProductFromCart, and UpdateCart.

  4. OrderManager: This class is responsible for managing orders and includes methods such as CreateOrder, CancelOrder, and ViewOrderDetails.

  5. PaymentGatewayManager: This class is responsible for processing payments and includes methods such as ProcessPayment, ValidatePayment, and GetTransactionDetails.

Here's an example of how the LLD classes might interact with each other:

+------------------+             +------------------+
|UserAccountManager|             |ProductCatalogManager|
+------------------+             +------------------+
          ^                              ^
          |                              |
          |                              |
+------------------+             +------------------+
|ShoppingCartManager|   <---->   |    OrderManager   |
+------------------+             +------------------+
          ^                              ^
          |                              |
          |                              |
+------------------+             +------------------+
|PaymentGatewayManager|             |    OrderDetail    |
+------------------+             +------------------+

In this example, the UserAccountManager class interacts with the ProductCatalogManager class to manage user accounts and product catalogs. The ShoppingCartManager class interacts with the OrderManager class to manage shopping carts and orders. The PaymentGatewayManager class interacts with the OrderManager class to process payments, and the OrderManager class interacts with the OrderDetail class to manage order history.

This example shows how LLD classes provide more detailed information on the implementation details of the software system and how each component interacts with one another.

Summary :

These classes are responsible for implementing the functionality of the system. They define the properties and methods required to implement the functionality of the software system.

In summary, HLD is focused on defining the system's overall structure and architecture, while LLD is focused on defining the implementation details of each component. The output of HLD is a high-level design document that describes the system's architecture, while the output of LLD is a low-level design document that provides the implementation details for each component.

Comments

Popular posts from this blog

Send API POST Request in MS SQL Server

Delete Empty Rows or Null Rows in Datatable in C#

Restrict Special Characters in Windows Application using c#

Use immutable data structures to avoid unnecessary change detection In Angular

Domain Driven Design (DDD) in .NET Core

Configure the API gateway in Microservices Architecture with example in .NET Core

Export to Excel in Angular 6 | 7 | 8 | 9 | 10

Create Custom Form Control for ng-select in Angular

Display PDF Or Tiff Files In IFrame