Тёмный
No video :(

When, Why, and How to use Builder and Fluent Builder Programming Patterns 

git-amend
Подписаться 15 тыс.
Просмотров 16 тыс.
50% 1

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

 

5 сен 2024

Поделиться:

Ссылка:

Скачать:

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

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 81   
@the_gobbo
@the_gobbo 11 месяцев назад
In 11 minutes you taught me more than 7 whole classes about software engineering
@git-amend
@git-amend 11 месяцев назад
Thank you, that's a very encouraging comment! The channel is definitely starting to grow a little faster lately because of this video, and more like it to come! Cheers!
@phoenixfire6559
@phoenixfire6559 11 месяцев назад
@@git-amend You need to leverage your skills as a senior software engineer. Most tutorials/ videos target beginner levels. I've been working through all of yours, and they're all really informative. I also note your consistent release schedule. Just keep at it, once you hit a certain number you'll hopefully get a lot more subs because this channel deserves it. My main advice so far is have a look at your thumbnails, the text is really important and I often see "3D" or "Shoot Em Up" really clearly but can't see the rest - I personally don't think 3D or Shoot Em Up should have been the most prominent words but would have clicked if I had seen Parallax or Player Controller. In this thumbnail, "Game Programming Patterns" was very clear. The fluent builder less so, but I clicked based on programming patterns. Anyways, the video and audio quality are excellent and you are presenting really well. Its more of a case of getting that youtube algorithm to favor you. I've subscribed, hopefully the high quality content continues.
@git-amend
@git-amend 11 месяцев назад
@@phoenixfire6559 Thanks for the comments and constructive criticism - it's always welcome. I think you are right about the text; I'm going to make some changes based on that suggestion - thank you!
@hoaxygen
@hoaxygen 11 месяцев назад
THANK YOU! I didn't know I needed this knowledge and it fit right into my project, cleaning up a bit of code. It was so cool and easy to implement the builder with interfaces despite its complexity.
@git-amend
@git-amend 11 месяцев назад
Awesome! I'm really glad it helped you out!
@git-amend
@git-amend 11 месяцев назад
Leave a comment if there is a particular programming pattern you'd like me to feature in a future episode - already planning Factory, Adapter and Mediator patterns. Hit the bell so you don't miss a thing!
@eduardoddutra
@eduardoddutra 11 месяцев назад
Awesome video! Very well explained! I could definitely watch a playlist of 30 of these video tutorials about other patterns and good practices, it's so hard to identify when to use it, it always looks like magic to me...
@git-amend
@git-amend 11 месяцев назад
Thanks! More to come!
@derboss66
@derboss66 11 месяцев назад
This guy is the hero we didn’t know we needed.
@matteocampana7582
@matteocampana7582 28 дней назад
Great video, I would like to see more of this type of content.
@git-amend
@git-amend 28 дней назад
Thanks, make sure to check out the rest of the playlist!
@gnendraaw
@gnendraaw 2 месяца назад
I am so grateful that I found your channel! Really help me alot learning game programming the better way since I am learning by myself. This is an absolute gem
@git-amend
@git-amend 2 месяца назад
Great to hear! Welcome aboard!
@switbitz
@switbitz 5 месяцев назад
Your channel is top tier for advance programming topics not limited to game development. Great work!
@git-amend
@git-amend 5 месяцев назад
Glad you think so! Cheers!
@JiwonSong95
@JiwonSong95 9 месяцев назад
This one single video made my understanding of design pattern whole new level. Very high quality content.
@git-amend
@git-amend 9 месяцев назад
Wow, thanks!
@rabrar6200
@rabrar6200 11 месяцев назад
nice idea for thumbnail! really caught my eye.
@AkakiAkakievitch-kc2vk
@AkakiAkakievitch-kc2vk 4 месяца назад
There are a lot of tutorials about how to make games, but very few about how to write effective and clean code! Thank you for that. I'll definitely browse carefully the content of your channel! A gold mine!
@git-amend
@git-amend 4 месяца назад
Thanks for the kind words!
@SirSone7
@SirSone7 11 месяцев назад
Hey, even tho you are not as popular as you should be, this channel is a true knowledge treasure for my level so i hope you keep uploading regardless of your views and subs. these are super helpful and your explanations are easy to understand. thank you I would love if you can cover Strategy , Command , State patterns as well
@git-amend
@git-amend 11 месяцев назад
I appreciate the comment! Those are great suggestions!
@PurpleDaemon_
@PurpleDaemon_ 4 месяца назад
The last tip with interfaces is awesome!!!
@git-amend
@git-amend 4 месяца назад
Right on!
@satibel
@satibel 11 месяцев назад
Depending on what you're doing, you could use what I call self builder, where you merge the builder and the class, so you could have a boolean ready, that you set once the class is set properly (can also have it read only and use an initialization method). That's useful if you need to modify the class a lot and you're not using inheritance, because the builder is somewhat redundant, because you need setters anyway. So instead of Var Eb=new enemybuilder() Eb.health=100 Eb.behavior=behavior.followplayer Var enemy=Eb.build() You have Var E=new enemy() E.health=100 E.behavior=behavior.followplayer E.init() (You can also use that with a fluent builder, where you return this, I did it that way for clarity as it's just an idea, this assumes properties which call setters with that syntax, which aren't available in all languages.) Otherwise you're juggling between 2 or 3 classes for basically no reason. Though where you'd want to use an external builder is if you need to enforce a "non null" (not necessarily null, but there's no desirable default) behavior, like for example, you want every enemy to have their hp or behavior set (could be more complex, like requireing either a sprite or a 3d model), an external builder can just return null, while with a self builder you have to check that it has been initialized. (I.e. with a builder you can't create a class with an invalid state, while with a self builder you can have one)
@git-amend
@git-amend 11 месяцев назад
Great insights on the 'self builder' approach! It's a neat way to streamline object creation, especially when inheritance isn't a factor. Thanks for sharing this alternative!
@Hazzel31337
@Hazzel31337 4 месяца назад
i am still pretty confused about most of your advanced topics, but i am getting there slowly, your content helps, thanks
@git-amend
@git-amend 4 месяца назад
Glad to hear that!
@Broudy001
@Broudy001 11 месяцев назад
I've learnt so much from your channel, some goes over my head like this one, I'll need to watch it a few more times, and try putting it into a project before I get the hang of it I suspect
@git-amend
@git-amend 11 месяцев назад
Absolutely. Try it out a few times, and it will click!
@satibel
@satibel 11 месяцев назад
Congratulations on pleasing the algorithm and hitting that programming/manhwa recap cross section with your thumbnail
@git-amend
@git-amend 11 месяцев назад
Thanks! I had a lot of fun with the thumbnail! Stay tuned for more!
@arjanb7158
@arjanb7158 11 месяцев назад
Using the fluent builder as a child class of a scriptable object finally lets me create instances in tests without making public setters. Amazing!
@git-amend
@git-amend 11 месяцев назад
That's a great usecase!
@setroid8235
@setroid8235 11 месяцев назад
This is great information! The video would be better if the audio were higher quality, and the intro was better (or simply removed). I don't see very many smaller channels, but the first thing I notice in smaller channels is the lower quality audio. I liked the video. :)
@git-amend
@git-amend 11 месяцев назад
Glad you liked the info! Thanks for the feedback - all suggestions are welcome!
@friedcrumpets
@friedcrumpets 10 месяцев назад
I'd be very curious to see your take on a Composite Tree or even a behaviour tree. I built an implementation after reading a blog post by the developer of Project Zomboid, however I've had some trouble finding great use cases for it. Fantastic tutorials. I really hope your channel gains some traction
@git-amend
@git-amend 10 месяцев назад
Great suggestion! I have a related topic already on my todo list, and I'll jot this down as well. Thanks!
@trell_7842
@trell_7842 10 месяцев назад
Whooa, Great thx. Now i finnaly understand what difference between the two. Not as big as i excepted.
@git-amend
@git-amend 10 месяцев назад
Awesome!
@Broudy001
@Broudy001 4 месяца назад
I finally managed to implement one of the patterns for something useful, I think :S
@git-amend
@git-amend 4 месяца назад
Excellent!
@popuzin
@popuzin 10 месяцев назад
Just a comment for support. Good stuff 💪keep it up!
@git-amend
@git-amend 10 месяцев назад
Appreciate it!
@timurnikolaev1438
@timurnikolaev1438 4 месяца назад
nice and clear
@git-amend
@git-amend 4 месяца назад
Thank you!
@6Abdellah9
@6Abdellah9 4 месяца назад
I watched abt 10 vids within the last hour I feel 10x smarter already
@git-amend
@git-amend 4 месяца назад
Awesome!
@Frank_G_Finster
@Frank_G_Finster 11 месяцев назад
I learned, i liked, i subscribed. I will put this knowledge to good use in my Godot project. Thank you very much.
@git-amend
@git-amend 11 месяцев назад
Awesome, thank you! Nice thing about programming patterns is you can use the knowledge in almost all modern programming languages!
@kecia9988
@kecia9988 4 месяца назад
Great video!, btw on 3:40 you wrote that we should consider initializing the Builder with a prefab but how is that done? what if your "Enemy" class is the prefab in question? Should I put the prefab as a parameter of the method Build()?
@git-amend
@git-amend 4 месяца назад
I would consider using a prefab if you have several components that are common to all of a particular type of thing, like an Enemy. So all Enemies might have the same mesh and colliders for example, and the prefab saves you having to create a new game object and set those for each one. You could pass a reference to that prefab as a parameter, and that way you only need to instantiate a version of that prefab with the additional settings you want set by the Builder. You could also have a factory that has references to many variations of Enemy prefabs that has a CreateEnemy() method - it might choose a prefab at random from a List, then use the Builder to do some additional configuration and return a ready to use Enemy.
@oldshamen
@oldshamen 10 месяцев назад
Great tutorial. In the interest of completeness, could you suggest how you build from a prefab instead of creating and setting up a gameobject from code (as suggested in one of the on-screen tips in the video)?
@git-amend
@git-amend 10 месяцев назад
Sure - you could either pass in the prefab as part of the constructor, or in the final Build() method. Here is an example: public class Builder { GameObject enemyObject; public Builder(GameObject prefab) { enemyObject = GameObject.Instantiate(prefab); } public Builder WithName(string name) { enemyObject.name = name; return this; } public Builder WithHealth(int healthValue) { var healthComponent = enemyObject.GetOrAdd(); healthComponent.SetHealth(healthValue); return this; } public GameObject Build() { return enemyObject; } }
@ragerungames
@ragerungames 10 месяцев назад
Great explanation!! Thank you!
@git-amend
@git-amend 10 месяцев назад
You're very welcome!
@kevin41307
@kevin41307 7 месяцев назад
amazing tutorial...!
@git-amend
@git-amend 7 месяцев назад
Haha are you binge watching all the videos? 😀
@kevin41307
@kevin41307 7 месяцев назад
@@git-amend yeah, it is really helpful. The real-world example in video are great. I wish I can watch these video earlier. Thanks a lot.
@SirDMX
@SirDMX 11 месяцев назад
Pretty useful thank you :D
@git-amend
@git-amend 11 месяцев назад
Awesome!
@shadyleegamer
@shadyleegamer 2 месяца назад
How do you get to use the single line and multiline code prediction and completion in Rider?
@git-amend
@git-amend 2 месяца назад
There are 2 ways, and I have both but in the videos I use GitHub Copilot: github.com/features/copilot The other way is to use JetBrains AI Assistant: www.jetbrains.com/ai/ Both of these are paid plugins and cost $10/mo.
@stickguy9109
@stickguy9109 11 месяцев назад
I like this kinda videos. My code always suffers from excess spaghetti
@git-amend
@git-amend 11 месяцев назад
Awesome! Using patterns can make a world of difference in your projects!
@bhaktijpatil
@bhaktijpatil 4 месяца назад
I'm used to Java at work and follow most design patterns. But I'm really struggling to use them with Unity 3D. I'm trying to build a minecraft like block system for my game and can't quite figure out a way to do this in a way that's very extendible. For now I'm just trying to figure out a way to create 100s of blocks in a way that I have a base block with all the properties for ex: isFlammable, isTransparent, textures (6 for each face) but I'd like a way to select uniformMaterialSetup, distinctMaterialSetup, topDownSidesMaterialSetup, etc. And then I just create 100s of prefabs? And store it somewhere, or in a way that I can apply a block type to any baseblock and it gets all the properties. I've explored scriptableobjects, OOP mechanics and patterns so far. But even in my head I can't build a proper architecure I'm happy with. Most of my struggles come from how the inspector interacts with classes and mesh vs code. Your videos have helped a lot after trying a lot of things for a few days, but I'd appreciate a guideline for how I should start thinking about this. Thanks a lot for these videos.
@git-amend
@git-amend 4 месяца назад
Thanks for the comment. I wonder if the Flyweight pattern might help you out with the blocks. By separating intrinsic data (e.g., textures, flammability) from extrinsic state (e.g., position, specific material setups), you can create a base block type and then efficiently instantiate and manage variations through shared data structures. The Flyweight can reference your base prefab. Then maybe a Factory / Builder combination to create all kinds of variations?
@bhaktijpatil
@bhaktijpatil 4 месяца назад
@@git-amend wow, I just started reading about this as I've not used it ever before and what it intends to do aligns very closely with what I want. I understand that in the end I will end up using most common patterns, but this is exactly what I was struggling with. What should be the outermost pattern if that makes any sense. Thank you so much. I will read more about this and comment back when I make progress.
@git-amend
@git-amend 4 месяца назад
@@bhaktijpatil Sounds good. I also have a video called Flyweight Factory that does something like this. The video is about projectiles, but you could do something similar for blocks.
@axiomgamesofficial
@axiomgamesofficial 11 месяцев назад
Subscribed!
@git-amend
@git-amend 11 месяцев назад
Awesome, welcome to the channel! More great content is on the way!
@ugurkarabulut8598
@ugurkarabulut8598 10 месяцев назад
Can you make a video about adapter pattern
@git-amend
@git-amend 10 месяцев назад
Yes, I've got that on my to-do list!
@Sworn973
@Sworn973 9 месяцев назад
Meh, the only think I really don't like about the "fluent builder strategy" that is done here, is that you end up coping the entire object that you want to build, having the builder return itself is the way to go, but without making a clone of the target object. So you don't have to duplicate everything. Quick example is to just add a new property like "isActive", so you have the get/set for the actual class, and now you have to duplicate everything in the builder, a new isActive property with also its getter and setters.
@octia2817
@octia2817 11 месяцев назад
Cool video, but some of the sound effects near the beginning were too loud.
@git-amend
@git-amend 11 месяцев назад
Thanks for the feedback, I'll keep that in mind.
@Cxdyy
@Cxdyy 11 месяцев назад
Why you still using unity? Just curious
@git-amend
@git-amend 11 месяцев назад
That's a good question, and a few people have asked if I will make a video about that - which I still need to decide. While I'm not happy about the actions of Unity management, I'm also not interested in watching it burn to the ground completely and potentially destroying the work of so many, especially those who make their living making tools for Unity. For the next few weeks at least, I'll focus on making videos that are more about software engineering principles, which are transferable to any modern programming language.
@kmsskyquake7330
@kmsskyquake7330 Месяц назад
BUILDER USING INTERFACES IS SO COOOOOOLLL !! , I am a noob, and seriosly all of these patterns appears like magical recipies, is there some grimoire pattern , that contains all these patterns ??😝
@git-amend
@git-amend Месяц назад
Haha not really... just a compiled list in my head from years of building things.
Далее
3d printed demon core vs real
00:24
Просмотров 7 млн
Паук
01:01
Просмотров 2,8 млн
How to use the Decorator Pattern (Card Game Example)
14:55
AVOID These Programmer Resume Mistakes!
15:46
Просмотров 5 тыс.
It's EASY to think your code will always be UGLY!
15:28
Clean Code using the Strategy Pattern
12:34
Просмотров 13 тыс.
D in SOLID - I wish I learned the LAST letter FIRST
18:00
Optimize Game Sounds: Pooling Audio Sources in Unity
18:45
3d printed demon core vs real
00:24
Просмотров 7 млн