I had some difficulties understanding the design pattern factory and watched a few tutorials.
The tutorial I found most helpful for understanding: Christopher Okhravi's Factory Method Pattern – Design Patterns (ep 4)
(https://www.youtube.com/watch?v=EcFVTgRHJLM&ab_channel=ChristopherOkhravi)
This tutorial was good too and for me a good supplement to Okhravi's tutorial: Code with RaiGenics' Factory Method in C# I Design Pattern (Part 3) - How and When to use Factory Method
(https://www.youtube.com/watch?v=tdMOdeewTnc&ab_channel=CodeWithRaiGenics)
This may potentially due to it being later and I have been understanding a bit more after each video. I do not think so but wanted to mention for transparency. Below is the order that I watched the videos.
Microsoft Video Studio
https://www.youtube.com/watch?v=JEk7B_GUErc&t=427s&ab_channel=MicrosoftVisualStudio
This just did not help me understand why I needed a factory. There was an example about pizza which I later learned from my recommended video by Christopher Okhravi that this is from a book called "Head First Design Patterns" which sounds like the exact same example.
PRO: Robert Greene asked a couple good questions. Otherwise, nothing obviously helpful to me. It was the first video I watched. Watching again after understanding does not seem useful.
CON: The tech guy (Phil Japikse) is not very good at answering or describing the questions by host (Robert Greene).
IAmTimCorey
https://www.youtube.com/watch?v=2PXAfSfvRKY&t=246s&ab_channel=IAmTimCorey
I am usually a fan of IAmTimCorey videos but this video was very hard for me to follow as there were too many new terms for me to learn and understand like delegates, dependency injections, and Blazor. This may be good for those who have more experience.
PRO: This may be helpful later when I get into Blazor.
CON: Too advanced. I need to understand delegates, dependency injections, Blazor, and probably a few other things that I do not understand enough to even not understand.
Code with RaiGenics
https://www.youtube.com/watch?v=tdMOdeewTnc&ab_channel=CodeWithRaiGenics
This was a bit too technical to start off with but is also a good tutorial. This is include a good example in C# which is what I ultimately needed too.
PRO: Used most basic example and basic code to demonstrate factory design pattern.
CON: Seemed too technical at first but upon reviewing it again later, this video probably would have been fine. Although this had the best code example, it was just short of one of my biggest question. After I create the object, it is in the base class like IMobile. After I get the object, what if I want to use a specific method in the sub-class like SamsungA9? I am sure I can look this up and could be unrelated. I personally would have preferred that it added that one bit anyways.
Christopher Okhravi
https://www.youtube.com/watch?v=EcFVTgRHJLM&ab_channel=ChristopherOkhravi
PRO: I understood the example better. I agree the example about the pizza was a bit confusing to me too. The pizza example is still a bit confusing even after understanding the factory pattern. The UML diagram was also helpful in answering my question on what is the difference between interface and factory pattern. The other tutorials almost seemed like it was just explaining how to use an interface. The UML diagram helped me get over that hump. I would recommend this video as a good overview for the design pattern. For me, it was a bit better than RaiGenics'.
CON: No code example but it obviously was not meant to have one as it was a generic overview. For example, RaiGenics' code sample was the most helpful. For more advanced, Tim Corey may eventually be an ultimate code example as I do plan to eventually work with Blazor.
Summary
My recommendation is to start with Christopher Okhravi then RaiGenics and finally Tim Corey. MS Visual Studio was not helpful to me before or after understanding.
No comments:
Post a Comment