Загрузка страницы

Builder Design Pattern Introduction

1. What is Builder Design Pattern
2. Implementation Guidelines
3. Builder design pattern in action

Healthy diet is very important both for the body and mind. If you like Aarvi Kitchen recipes, please support by sharing, subscribing and liking our YouTube channel. Hope you can help.
https://www.youtube.com/channel/UC7sEwIXM_YfAMyonQCrGfWA/?sub_confirmation=1

Text version of the video
http://csharp-video-tutorials.blogspot.com/2017/09/builder-design-pattern-introduction.html

Slides
http://csharp-video-tutorials.blogspot.com/2017/09/builder-design-pattern-introduction_18.html

Design Patterns Tutorial playlist
https://www.youtube.com/watch?v=rI4kdGLaUiQ&list=PL6n9fhu94yhUbctIoxoVTrklN3LMwTCmd

Design Patterns Text articles and slides
http://csharp-video-tutorials.blogspot.com/2017/06/design-patterns-tutorial-for-beginners.html

All Dot Net and SQL Server Tutorials in English
https://www.youtube.com/user/kudvenkat/playlists?view=1&sort=dd

All Dot Net and SQL Server Tutorials in Arabic
https://www.youtube.com/c/KudvenkatArabic/playlists
What is Builder Design Pattern

Gang Of Four Definition

Builder Pattern belongs to creational pattern

Definition: “Separate the construction of a complex object from its representation so that the same construction process can create different representations”

Builder Pattern solves the situation of increasing constructor parameters and
Constructors of a given class by providing a step by step initialization of
Parameters. After step by step initialization, it returns the resulting constructed
Object at once

Implementation Guidelines

We need to Choose Builder Design Pattern when
1. We need to break up the construction of a complex object
2. We need to create a complex object and it should be independent of the parts that make up the object
3. The construction process must allow multiple representations of the same class

Business Requirement

Provide an option to choose and build configuration of the system which is allocated to the employees. The configuration options that user can choose are RAM, HDD, USB Mouse. Etc

If you look at the illustrated diagram of Builder Design Pattern

1. Builder: Defines a template for the steps to construct the product. To simplify, Builder Specifies an abstract interface for creating parts of a Product object.
2. Concrete Builder: Implements the builder interface and provides an interface for getting the product.
3. Director: Is responsible to constructs the object through the builder interface.
4. Product: is the Main object that's constructed and Represents the complex object.

Steps to solve the above business requirement

Step 1: Add SystemConfigurationDetails to the existing Employee table

Step 2: Open EmployeePortal.edmx under the Models folder of the solution and update the model from the database (Right click on the model designer and choose update from database option)

Step 3: Create BuildSystem Action method and generate a view out of it.

Step 4: Create a new class and name it as computer system with RAM and HDDSize as the constructor parameters and Build as method that builds the system

Step 5: To the added BuildSystem view add dropdown lists to choose RAM and HDDSize.

Step 6: Create an action method BuildSystem to build the system on Submit.

Step 7: Run the application and Build a system for selected employee

Step 8: Choose the configurations and click on create to build the system

Though we have achieved the business requirement

The current approach will not fit if we need to add more configurations to the current system and it gets complicated.

Also, if we need to enhance the current code itself to segregate the configurations differently between a laptop and desktop the current approach is not feasible and it becomes complicated.

In these kind of situations builder pattern comes to our rescue to address these problems.

In the next session let’s discuss how we can address these problems using Builder design pattern.

Видео Builder Design Pattern Introduction канала kudvenkat
Показать
Комментарии отсутствуют
Введите заголовок:

Введите адрес ссылки:

Введите адрес видео с YouTube:

Зарегистрируйтесь или войдите с
Информация о видео
19 сентября 2017 г. 0:54:54
00:13:45
Яндекс.Метрика