C# Design Patterns Tutorial | Abstract Factory Example

preview_player
Показать описание

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

As some say this is just normal factory, if you want to create more different types, for example db, documents and clients, you may use the same "abstract factory" to group different small factories for each class, in this case you may need one contructor for each smaller factory (or just one if everything needs to be created as one object). In your video just a normal factory would work with no problem I suppose.

davidgarciamoran
Автор

This is simply a factory example, not an Abstract Factory. You still have 1 interface implemented by them both, which is why factory pattern suffice. Abstract factory is often where you have incompatible interfaces, which is why you have a factory, providing a group of factories, to interact with the specific object that the group of factories relate to (which is e.g. 2 incompatible datasources, such as xls vs SQL, rather then 2 SQL based datasources)

justplainoldme
Автор

This is not not example for abstract factory.

MrSantuSarkar
Автор

This isn't Abstract Factory. Abstract Factory is what you would use to put together 2 or more objects of different interfaces (incompatible) and return a single handle / object for it. Most importantly, the object creation should be "abstracted" i.e. it should not be implemented in the main method.

karthikkeyan
Автор

This doesn't seem accurate at all. The object creation is handled inside a GUI event. I was expecting the factory to be a method of a class that that builds these objects based on an argument.

nikhilverma
Автор

Abstract factory? O' Reily? Oh really?

hopext
welcome to shbcf.ru