Simplify Configuration via Polymorphism

preview_player
Показать описание
Learn how to leverage polymorphism and various design patterns in order to simplify configurations in your application!

🕗 Timestamps:
0:00 - Introduction
0:18 - Problem
2:14 - Solution Part 1 (Decorator)
8:07 - Solution Part 2 (Builder)
13:02 - Summary

➖➖➖➖➖➖➖➖➖➖

© Credits
Рекомендации по теме
Комментарии
Автор

Great video Sean, yes you had me itching for you to convert this to the Fluent Builder Pattern :)
Keep up the great work!

rlyonsiii
Автор

The builder in itself violates the open-closed principle, does it not? To remedy this, you could add a CartItemBuilder With(Func<ICartItem, ICartItem>) method. The factory method could be any decorator constructor with any number of additional parameters such as a variable discount. It is verbose, but you can still chain instead of composing. Another alternative could be CartItemBuilder With<TCartItem>(params object[]), but it would have to rely on reflection.

JulienCourseau-ow
Автор

Ctrl+Shift+A -> fast adding new file to the project. VS generate template basing on file extension

adam-xtte
Автор

why no having a list of element of type configuration in the list, so you don't have to add a boolean for every configuration. you only would have to add configurations to the list and then build will apply each one with a loop over the list

masterycgi
Автор

Codding is still an art (FIGHT ME), it's still refreshing whenever you see a fellow programmer just trying stuff.

feitan
Автор

I think the csharp missing discriminated unions really is pretty glaring here. In fsharp this would be a simpler solution that uses a D U and favors composition over inheritance more fluently and simply.

WillEhrendreich
join shbcf.ru