Your video is probably one of the best I have found in how to use design patterns in C++. It is really clear, and the fact that you show in real time what you are doing really helps follow the content.
Thank you for explaining these patterns so clearly and for keeping it simple. Other sources I tried made them seem very complicated and I almost gave up.. thankfully I came across your channel! I can't thank you enough.
Correct, unique_ptr should be the default that folks reach for. shared_ptr is appropriate if your object is referenced multiple times -- which is what I was thinking about in a gaming context :)
You could make stack allocations or otherwise use a custom allocator to decide where to allocate your new objects. I suppose this depends on the requirements of your design and how much stack space you have. Heap memory (at least on desktops) we have much more memory :)
Thanks for the clear explanation and great content. According to refactoring guru, the design pattern "factory method" would have a creator, concrete creators, product, and concrete products. In the example you provided, MakeGameObjectFactory seems to be an object creation function that abstracts away the object creation process and provides an easier way to create objects. I'm wondering if this is a simplified variation of the factory method, or if this still aligns well with the standard factory method? Thanks.
Your video is probably one of the best I have found in how to use design patterns in C++. It is really clear, and the fact that you show in real time what you are doing really helps follow the content.
Thank you for the kind words!
Thank you for explaining these patterns so clearly and for keeping it simple. Other sources I tried made them seem very complicated and I almost gave up.. thankfully I came across your channel! I can't thank you enough.
Cheers! More coming to this series tomorrow 🙂
amazing. I'm so lucky to have the chance to watch your videos!!!!!
Thank you for the kind words!
Man i just got the understanding of Factory Design pattern after watching it so easily
Thanks a lot 🙏
Cheers, glad to hear it!
Understood fully..loved this :)
Cheers!
Thank you Mike, best explanation.
Cheers!
amazing as always = thank you so much Dr. Mike
Cheers!
info vtbl was really cool. thank you.
You are most welcome!
Curious, Is there any reason to use shared_ptr? in general, by default people use unique_ptr.
Correct, unique_ptr should be the default that folks reach for. shared_ptr is appropriate if your object is referenced multiple times -- which is what I was thinking about in a gaming context :)
Can we keep factory method as static class method and keep class constructor private? so only from factory method we can create instance of class.
You can create a factory as a singleton if that is what you're asking -- sure!
Absolutely loved your teaching style! 🙌 Thanks for the cool tip: --tui
Does this pattern have to use heap allocation to work
You could make stack allocations or otherwise use a custom allocator to decide where to allocate your new objects. I suppose this depends on the requirements of your design and how much stack space you have. Heap memory (at least on desktops) we have much more memory :)
Thanks for the clear explanation and great content. According to refactoring guru, the design pattern "factory method" would have a creator, concrete creators, product, and concrete products. In the example you provided, MakeGameObjectFactory seems to be an object creation function that abstracts away the object creation process and provides an easier way to create objects. I'm wondering if this is a simplified variation of the factory method, or if this still aligns well with the standard factory method? Thanks.
Cheers -- yes this is an example of a factory method.
_thank you thank you thank you_ for the clear explanation
Cheers!
isn't it, same as command pattern ?
Factory is a separate pattern focused on creation of objects 🙂
thanks a lot for this explanation
Cheers, you are most welcome
Quality content
Cheers, thank you for the kind words!
Great video!
Cheers!