Тёмный

Design Patterns: Factories 

Microsoft Visual Studio
Подписаться 324 тыс.
Просмотров 55 тыс.
50% 1

This is the sixth of an eight part series where Robert is joined by Phil Japikse to discuss design patterns. A design pattern is a best practice you can use in your code to solve a common problem. In this episode, Phil demonstrates the Simple Factory, Factory Method and Abstract Factory patterns. The Simple Factory pattern encapsulates object creation in one place. The Factory Method pattern uses factory methods to deal with the problem of creating objects without having to specify the exact class of the object that will be created. The Abstract Factory pattern provides a way to encapsulate a group of individual factories that have a common theme without specifying their concrete classes.
Resources:
- Sample code: github.com/skimedic/presentat...
- Design Patterns: Elements of Reusable Object-Oriented Software book: www.amazon.com/Design-Pattern...
- Head First Design Patterns book: www.amazon.com/Head-First-Des...

Наука

Опубликовано:

 

10 авг 2017

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 43   
@fwd79
@fwd79 5 лет назад
Full list for this series: 0. SOLID Design Patterns (start from here): ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-agkWYPUcLpg.html 1. Design Patterns: Command/Memento: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-zRbHlDeon3E.html 2. Design Patterns: Strategy: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-QZIvlny1Onk.html 3. Design Patterns: Template Method: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-MfAvs0n9uMs.html 4. Design Patterns: Observer and Publish-Subscribe: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-72bdaDl4KLM.html 5. Design Patterns: Singleton: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-sbML3xFHRbI.html 6. Design Patterns: Factories: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-JEk7B_GUErc.html 7. Design Patterns: Adapter and Façade: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-XYa0rmRMZ1Q.html 8. Design Patterns: Decorator: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-6PPMR0GWrZQ.html
@samihimas
@samihimas 10 месяцев назад
Hi, thank you for your comment. Do we need to follow those videos in a specific order? Thank you.
@rakeshkulkarni2125
@rakeshkulkarni2125 7 месяцев назад
I really like the type of questions the host asks, these are the type of the question I usually have, like "you eventually have to create an instance" type of questions, and then the teacher says, creating and using is separated, really great series. Thank you for this Microsoft.
6 лет назад
Can you group all videos in Design Pattern series into to one play list ? many thanks :)
@fwd79
@fwd79 5 лет назад
Full list for this series: 0. SOLID Design Patterns (start from here): ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-agkWYPUcLpg.html 1. Design Patterns: Command/Memento: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-zRbHlDeon3E.html 2. Design Patterns: Strategy: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-QZIvlny1Onk.html 3. Design Patterns: Template Method: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-MfAvs0n9uMs.html 4. Design Patterns: Observer and Publish-Subscribe: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-72bdaDl4KLM.html 5. Design Patterns: Singleton: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-sbML3xFHRbI.html 6. Design Patterns: Factories: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-JEk7B_GUErc.html 7. Design Patterns: Adapter and Façade: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-XYa0rmRMZ1Q.html 8. Design Patterns: Decorator: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-6PPMR0GWrZQ.html
@ThePrinceSadie
@ThePrinceSadie 4 года назад
@@fwd79 MVP
@evergreen-
@evergreen- 3 года назад
@@ThePrinceSadie here's that list in an actual playlist created by somebody: ru-vid.com/group/PLT2NrqLzZng3YMek58eVZVkBiW3NyVSef
@muxahx3096
@muxahx3096 3 года назад
This is MOST CLEAREST exploration I have seen or read. My deep respect! This guy explains the problem and roots of the pattern. step buy step. p.s. really want to give this video +100500
@joshfraser3991
@joshfraser3991 4 года назад
Great videos by Phil and Tom! I wish I ould see more by Phil!
@srinarasimhakatte9241
@srinarasimhakatte9241 6 лет назад
Phil, Is there any reason why you have used IPizza interface as well as Pizza abstract class where you have inherited the abstract class Pizza from IPizza?
@sasukesarutobi3862
@sasukesarutobi3862 4 года назад
"If you write something once, you should encapsulate it. If you write the same thing twice, you need to back up and encapsulate it. If you write the same thing three times I would ask you to stop being a programmer." 😂
@hpandeymail
@hpandeymail 4 года назад
Namastey Sir 🙏.. You are simply super . 2 of you on screen make it that much natural and easy environment for learning .. thanks for sharing the knowledge 🙂
@rohitgalgali5512
@rohitgalgali5512 6 лет назад
Hi, these episodes helped me alot. Thanks alot. Can you please take a session on "Code to interface" topic. That will be really helpful! Kind regards.
@slavakotelnikov2440
@slavakotelnikov2440 5 лет назад
Is it possible to get code samples they use in the video?
@yummyexpress92
@yummyexpress92 7 лет назад
9:29 It is probably an enterprise feature because I can't find it in pro
@peteredenburg6464
@peteredenburg6464 6 лет назад
I must be doing something wrong. In VS2017 prof I installed the 4.7 .NET Framework (NDP47-DevPack-KB3186612-ENU.exe). I created a new solution and added both the CreationalPatterns and the CreationalPatternsTests. At the 3:40 minute mark the code was shown for the first time and you had the SimpleFactoryTests.cs file on screen. When I open that file I get a warning about these lines: line 15 'using Xunit; | line 19 [Collection("CreationalPatternsTests")] | line 23 [Theory] | line 24 [InlineData(PizzaType.NewYork)] | line 41 Assert.NotNull(pizza as NewYorkPizza); | line 43 [Fact] and finally line 48 Assert.NotNull(sut as NewYorkPizza); Some of these line are also in the other Test.cs files on other line numbers. So this is about things I need get into this project dealing with testing. I have not yet learned about that, but I would like to follow along and participate. What must I do? Thanks in advance.
@kaidzz
@kaidzz 4 года назад
I think it's okay if you guys are looking at the camera, not sure though if you're comfortable with that.
@rezaz7167
@rezaz7167 2 года назад
These guys make me anxious!! 😕
@yeaitsme6834
@yeaitsme6834 7 лет назад
The car metaphor was like really confusing...
@joshfraser3991
@joshfraser3991 4 года назад
I found it very helpful! To each there own
@TonyTigerTonyTiger
@TonyTigerTonyTiger 4 года назад
@@joshfraser3991 *their
@xXL1VE4IDE4LSXx
@xXL1VE4IDE4LSXx 3 года назад
I mean the guy wanted to be addressed by the name of filter pixie... or something like that. What can you expect?
@DiamondGB
@DiamondGB 5 лет назад
"Umbrella Corp" 0:23
@TonyTigerTonyTiger
@TonyTigerTonyTiger 4 года назад
Surprised more people haven't commented on that
@Coffeecupdev
@Coffeecupdev 2 года назад
Copy and paste and now "Clipboard inherit" heheh Good one.
@yapayzeka
@yapayzeka 5 лет назад
i hate these pizza examples they are everywhere and so confusing. the car example at the beginning is awesome.
@chudchadanstud
@chudchadanstud 2 года назад
lol the pizza example is from the head first into design patterns book.
@omirrrr
@omirrrr 4 года назад
Didn't know Gino D'Acampo was into coding
@codeintermediate4529
@codeintermediate4529 4 года назад
Factory method is explained well in this video - ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-tdMOdeewTnc.html
@tothimre7950
@tothimre7950 6 лет назад
Not bad videos about Design Patterns, however this one is quite bad. By definition Abstract Factory is: "Provide an interface for creating families of related or dependent objects without specifying their concrete classes." The key here is "families of related or dependent objects"!! In the video there is an abstract class which has a factory which != Abstract Factory...
@olegsuprun7590
@olegsuprun7590 3 года назад
true, but this is still viable, the main point of abstract factory is that it is injected or passed into client as an interface
@moslemkhalili8577
@moslemkhalili8577 6 дней назад
I didn't catch what he said!
@xXL1VE4IDE4LSXx
@xXL1VE4IDE4LSXx 3 года назад
I feel so sad for Robert Greene Cx
@TonyTigerTonyTiger
@TonyTigerTonyTiger 4 года назад
I have an idea. Instead of sticking to 1 analogy, how about we use 4 or 5. We can start by talking about a car analogy, then move on to a pizza analogy, then move on to an Amazon Prime delivery analogy, then move on to an analogy about mayors making bets on the World Series, ...
@debunkingcars2359
@debunkingcars2359 4 года назад
Visual studio lesson, but the instructor has a Rider sticker 🤔
@FirstContactX
@FirstContactX 4 года назад
Thats the Resharper logo. Rider is the RD not R#
@TonyTigerTonyTiger
@TonyTigerTonyTiger 4 года назад
I have another idea. Instead of talking about just factories, let's also talk about singletons, inversion of control, template pattern, command pattern, etc.
@GenericName0
@GenericName0 4 года назад
No offense, but this was a terrible explanation.
@TonyTigerTonyTiger
@TonyTigerTonyTiger 4 года назад
So this guy is a fan of over-engineering. Even if you have just 1 class - not a set of 2 or more related classes - you should have an interface for it?? Because OCP? Abusing the OCP is not good design.
@pmanha
@pmanha 4 года назад
He not only adressses that but also explains why you might do it. In summary, if you can anticipate that you will need such a thing, you will end up saving time if you build it from the get go. And why is that abusing the OCP? Example: if you are developing the data repository for an application using sql server as the database, but some time down the line you need to have the option to use mysql, or any other, will the actions of said repository not stay the same for whatever engine you use on the backend and chuck the nitty gritty of the instantiation of that repository to the implementation? And I think they mention this in passing but: as a best practice, its up to you to judge the applicability of such best practice to your work.
@FleetingDream755
@FleetingDream755 4 года назад
@@pmanha but isn't this a recipe for over-enginerring? It violates the KISS principle. If we don't need another data store, then we don't code it. Isn't that just doing more than you need to because of a "might"? This is in general, data sources are usually coded to interfaces but in general, if the requirement is to create A, I shouldn't anticipate B and code for it because it's wasting time. Unless something in the requirements suggests such a change might come. Otherwise it's gold-plating. Of course I could be wrong.
Далее
Design Patterns: Singleton
16:11
Просмотров 28 тыс.
Design Patterns: Adapter and Façade
22:29
Просмотров 17 тыс.
Qalpoq - Kichkina tabib (hajviy ko'rsatuv)
30:41
Просмотров 297 тыс.
Why Use Design Patterns When Python Has Functions?
23:23
Design Patterns: Command/Memento
31:08
Просмотров 34 тыс.
Dependency Injection
45:17
Просмотров 146 тыс.
Design Patterns: Decorator
17:21
Просмотров 25 тыс.
Abstract Factory Pattern - Design Patterns (ep 5)
25:54
Here’s a More Pythonic Factory Pattern
23:18
Просмотров 100 тыс.
Factory Pattern in C#: Creating Objects with Ease
12:54