Happy Sunday! I'm very interested to hear how you've been using Fluent Interface Design in your projects! Builders? Functional? Immutable or Mutable? Let me know! 👍
Even though most of these videos are beyond my skill level, I still try to pay close attention to learn any little thing I can. 1% better every day and this channel is a gold mine of knowledge!
One reason I love these types of videos is that even though I do this often, I didn't even know it had a name (or I just forgot :V), so now I can look for even more info about it!! Thanks for the great work as always!!
Really enjoy watching your videos - I could watch you code all day, lol! ..For me, as someone new to Unity/C# just this year, most of your coding videos kinda fly over my head, but I watch and feel inspired and try to take away what I can, plus I kinda bookmark somethings so I can come back when my kung-fu increases. I think your a great fit for these more advanced coding sessions, but if you ever wanted to take it back to the beginning a little more, I'd certainly be here for that! (For example, I don't even fully understand what static methods/classes can do for me and why I should consider them. I do know what static is, I just don't always know when to and when not to use them - along with many other similar fundamental's !) ...But you're great at what you do, so perhaps it's best to stick to what you're good at - cause you are darn good! There are plenty of beginner videos out there, ofc! Thanks for all your work! Keep it up!
Great! I belive Fluent Design is one of the most satisfying parts of programming. Also great for testing. I was wondering if you have any plans of making a video about multi language features in Unity. Thats a nice feature to care about this days. I have been using XMLs and adding componets to texts objects, but after watching your videos I am thinking about a sceneContext that loads everything included texts per scene, something crazy like that haha Thanks for the new perspectives. Anyways I would like to hear any tips from you Master. Thanks for the weekly video.
Thanks! I had not considered talking about any of the multi-language features yet, but maybe you've given me a good idea for a potential good use case. I'll give it a bit more thought!
In general nice video. I'd still like to nitpick a bit :) 0:15 not really a fair comparison, as you'd get the same with just creating (local or nested-class) methods and calling them in order. I'd also argue that this Clone method is not even a good example for a fluid approach (creating fluid interfaces is mostly useful if you write an API that is meant to be used "often" (either by yourself or by many others) and it is supposed to make usage easier. Which (probably) does not apply to the stuff within that Clone method. Especially unfair is the comparison, if you need to ensure that the (some) methods are only allowed in a specific order (e.g. ClearParameters before CopyParameters), because then you need to return some interfaces (that also your type needs to implement, so only availble for types you own) (which becomes a terrible mess if you have optional or conditional steps in between, which makes this approach really only worth it, if it IS for an often used API). 1:10 I'd flip both if statements around with early returns. But that's personal preference 11.10 Should be "CopyDefaultState" instead of "Set" (as set would imply that you'd have a "State" argument to pass to it. Especially if you leave them all be public. probably would've been better to move them into a private-nested class "Internal" - sadly then they _cannot_ be extension methods, so you'd have to call them in a non fluid way, but better hides the helper methods.
Thank you so much for keeping things going on your channel. I've come to a standstill with my own development, along with keeping up with your vids. I've been bookmarking them for when I have time to dig into some of them. Really looking forward to seeing more from you in the future!
Love the way you are presenting these concepts. One thing that bugs me though is that when returning the component (AnimationController in this case) in a function I would think initially that returns a copy of it. But what it does is updating the target and returns it, so you can chain multiple commands. sometimes that would get me tricked if using external libraries.
Yes, I had considered that. Often when making a fluent builder, we keep things mutable... but a more functional style would definitely want to keep it immutable. For a method that is cloning one object into a new one that has already been created in the caller - it's hard to say which is best, and in some (other) cases there may be performance considerations. This is probably a great subject for another video.
Thank you for the time and effort you always put into your videos, it has helped me a lot to code better and fix a lot of bloat in my unity projects! By far the best channel that delves into coding in a whole different way! Been doing this for a long time, and very happy I can learn new things even now. I do have a request :D, would it be possible some time in the future if you could make a video that covers all the code patterns as a short understanding of what they are, and what their purpose is. I have thoroughly enjoyed learning about the different patterns and wish I had more time to delve into all of them.
Thanks for the comment! I don't know if I'll make one video that covers all patterns, but I do have plans to make a few videos that show how to combine patterns. And of course, there is an entire playlist about patterns you could watch one by one: th-cam.com/play/PLnJJ5frTPwRMCCDVE_wFIt3WIj163Q81V.html
A great use case for this sort of fluent system is XR interactions, there is so much conditional setup that gets turned on or off in XR that this sort of thing really makes extending and implementing much easier.
the amazingness of this as a tool is almost overlooked in the video until the end, as it isn't really the purpose of the video... but the tool is sort of game changing. One Animator that can effectively be re-used regardless of the rig. that's a really nice time saver if you have a lot of rigs that usually require their own animators due to extra layers or things like wings. it also reduces the chance for human error when making all the conditions/transitions. you can still use overrides for rigs with different weapons or whatever. its a really big efficiency gain! Thanks!
@realtimberstalker yes but cloning the animator controller doesn't allow you to select the components to ignore and such. So you can clone it and then still have to delete things or tweak things a lot. This becomes very handy with layers or blend trees. If you only have a few monster rigs it's no big deal. What I'm working on though has about 30 unique rigs. Manually handling units animator controllers is pretty tedious. Anything that reduces the need to manually change the animator controller us a pretty solid win.
Amazing video as always! Method chaining / Fluent Builder pattern has become one of my favorite patterns after DoTween's amazing architecture showed how powerful it can be. I do wonder however. Isn't the functionality of your clone tool doing the same that Unity's built-in Animator Override Controller does? Your version does however allow for a much wider degree of freedom from the developer!
Thank you! An Animator Override Controller is generally used to swap in new animations for existing ones in an Animator Controller, whereas this tool is for copying some (or all) of the parts of an Animator Controller (states, transitions, properties and motions) into a new one.
Hello, I love your videos man, helped me get a good job. I am a unity developer with 6 years with experience but after lay offs I started doubting myself. Now Things are good again. One question, are planning on sharing your Rider settings? would love to see those. (reformating, clean up)
Thank you! Glad to hear about the job, times are challenging these days. I actually do have a setup/config video planned, and I'll be sure to include some Rider specific things.
It wouldn't be my preference for where to use the builder pattern when there's a partial order to the method calls, i.e. you have to have created the layers for some of the other functions to work, but since this is technically always wrapped in the (pseudo-Director) Clone method, it's not exposed as a library so you retain control to it. It still does the job of cleaning up smelly code! Also, when you talk about the switch, I think you missed saying that it's prime for being converted when the if conditions are checking the same variable values, switch (true) is an equally bad pattern! In my work (not games), we use it a lot for cleaning up the business logic (in the director layer) when we're rendering data (just to view models) that may have come from differently-formatted data sources. You can have the same builder interface to set information for rendering (e.g. setting number of items, show/hide things), but have a completely different implementation underneath for each data source. The builder always outputs something else at the end so that mutability doesn't matter, they're very temporary, otherwise it's like the house builder moving in with you when you buy a new property!
Thanks for sharing your insights with a real-world use case! I like the house analogy. Regarding the switch statement, you're absolutely right. Converting if conditions that check the same variable values to a switch case can indeed streamline the code and improve readability, but using `switch (true)` is generally not recommended.
Being new to programming i wish to ask which resources do you recommend to learn c# and programming in general , you seem very knowledgeable so i wish to know
If you join the Discord, take a look in the #programming section - there is a pinned list of recommended reading to help people progress from Beginner to Advanced
While I love fluent interfaces, I'm not sure if I would use it inside of a utility like that. This does not really add a lot of readability over just using regular static methods. Using them for factories or other configurations, like you mentioned, seems way more beneficial to me. There the branching options allow you to get more usage out of the extension methods. Great video with another awesome topic!
Thanks for the comment. Myself, I also primarily like using it for constructing other objects or configs. Maybe we can touch more on branching and extending it in a future video.
Sometimes i just wonder... Why is this not in the original library that comes with the package? I feel you need to start poking Unity, cuz stuff like this belongs there! :)
Happy Sunday! I'm very interested to hear how you've been using Fluent Interface Design in your projects! Builders? Functional? Immutable or Mutable? Let me know! 👍
Even though most of these videos are beyond my skill level, I still try to pay close attention to learn any little thing I can. 1% better every day and this channel is a gold mine of knowledge!
Thanks for watching! A lot of people forget that professional development compounds with that daily investment. That 1% makes all the difference!
One reason I love these types of videos is that even though I do this often, I didn't even know it had a name (or I just forgot :V), so now I can look for even more info about it!! Thanks for the great work as always!!
I'm so glad!
Im a senior software developer, but i didn't even know how to do that. Thanks!
Glad you enjoyed it!
Really enjoy watching your videos - I could watch you code all day, lol!
..For me, as someone new to Unity/C# just this year, most of your coding videos kinda fly over my head, but I watch and feel inspired and try to take away what I can, plus I kinda bookmark somethings so I can come back when my kung-fu increases.
I think your a great fit for these more advanced coding sessions, but if you ever wanted to take it back to the beginning a little more, I'd certainly be here for that! (For example, I don't even fully understand what static methods/classes can do for me and why I should consider them. I do know what static is, I just don't always know when to and when not to use them - along with many other similar fundamental's !)
...But you're great at what you do, so perhaps it's best to stick to what you're good at - cause you are darn good! There are plenty of beginner videos out there, ofc!
Thanks for all your work! Keep it up!
Thanks for the comment and suggestions!
Great! I belive Fluent Design is one of the most satisfying parts of programming. Also great for testing.
I was wondering if you have any plans of making a video about multi language features in Unity. Thats a nice feature to care about this days.
I have been using XMLs and adding componets to texts objects, but after watching your videos I am thinking about a sceneContext that loads everything included texts per scene, something crazy like that haha Thanks for the new perspectives.
Anyways I would like to hear any tips from you Master. Thanks for the weekly video.
Thanks! I had not considered talking about any of the multi-language features yet, but maybe you've given me a good idea for a potential good use case. I'll give it a bit more thought!
In general nice video. I'd still like to nitpick a bit :)
0:15 not really a fair comparison, as you'd get the same with just creating (local or nested-class) methods and calling them in order.
I'd also argue that this Clone method is not even a good example for a fluid approach (creating fluid interfaces is mostly useful if you write an API that is meant to be used "often" (either by yourself or by many others) and it is supposed to make usage easier. Which (probably) does not apply to the stuff within that Clone method.
Especially unfair is the comparison, if you need to ensure that the (some) methods are only allowed in a specific order (e.g. ClearParameters before CopyParameters), because then you need to return some interfaces (that also your type needs to implement, so only availble for types you own) (which becomes a terrible mess if you have optional or conditional steps in between, which makes this approach really only worth it, if it IS for an often used API).
1:10 I'd flip both if statements around with early returns. But that's personal preference
11.10 Should be "CopyDefaultState" instead of "Set" (as set would imply that you'd have a "State" argument to pass to it.
Especially if you leave them all be public.
probably would've been better to move them into a private-nested class "Internal" - sadly then they _cannot_ be extension methods, so you'd have to call them in a non fluid way, but better hides the helper methods.
All valid nitpicks I'd consider (and maybe even add myself) in a code review. Thanks for the comment!
Thank you so much for keeping things going on your channel. I've come to a standstill with my own development, along with keeping up with your vids. I've been bookmarking them for when I have time to dig into some of them. Really looking forward to seeing more from you in the future!
You are so welcome!
Love the way you are presenting these concepts. One thing that bugs me though is that when returning the component (AnimationController in this case) in a function I would think initially that returns a copy of it. But what it does is updating the target and returns it, so you can chain multiple commands. sometimes that would get me tricked if using external libraries.
Yes, I had considered that. Often when making a fluent builder, we keep things mutable... but a more functional style would definitely want to keep it immutable. For a method that is cloning one object into a new one that has already been created in the caller - it's hard to say which is best, and in some (other) cases there may be performance considerations. This is probably a great subject for another video.
Thank you for the time and effort you always put into your videos, it has helped me a lot to code better and fix a lot of bloat in my unity projects! By far the best channel that delves into coding in a whole different way! Been doing this for a long time, and very happy I can learn new things even now. I do have a request :D, would it be possible some time in the future if you could make a video that covers all the code patterns as a short understanding of what they are, and what their purpose is. I have thoroughly enjoyed learning about the different patterns and wish I had more time to delve into all of them.
Thanks for the comment! I don't know if I'll make one video that covers all patterns, but I do have plans to make a few videos that show how to combine patterns. And of course, there is an entire playlist about patterns you could watch one by one: th-cam.com/play/PLnJJ5frTPwRMCCDVE_wFIt3WIj163Q81V.html
A great use case for this sort of fluent system is XR interactions, there is so much conditional setup that gets turned on or off in XR that this sort of thing really makes extending and implementing much easier.
Great example!
the amazingness of this as a tool is almost overlooked in the video until the end, as it isn't really the purpose of the video... but the tool is sort of game changing. One Animator that can effectively be re-used regardless of the rig. that's a really nice time saver if you have a lot of rigs that usually require their own animators due to extra layers or things like wings. it also reduces the chance for human error when making all the conditions/transitions. you can still use overrides for rigs with different weapons or whatever. its a really big efficiency gain! Thanks!
This is already how animatorcontrollers work no?
Thanks. For me, I think the benefit is in the ability to only copy some parts and not the entire thing.
@realtimberstalker yes but cloning the animator controller doesn't allow you to select the components to ignore and such. So you can clone it and then still have to delete things or tweak things a lot. This becomes very handy with layers or blend trees. If you only have a few monster rigs it's no big deal. What I'm working on though has about 30 unique rigs. Manually handling units animator controllers is pretty tedious. Anything that reduces the need to manually change the animator controller us a pretty solid win.
Nice ill try to incorporate it in my own coding
Great, let me know how it goes!
your videos are better than therapy
Haha thanks!
Amazing video as always! Method chaining / Fluent Builder pattern has become one of my favorite patterns after DoTween's amazing architecture showed how powerful it can be. I do wonder however. Isn't the functionality of your clone tool doing the same that Unity's built-in Animator Override Controller does? Your version does however allow for a much wider degree of freedom from the developer!
Thank you! An Animator Override Controller is generally used to swap in new animations for existing ones in an Animator Controller, whereas this tool is for copying some (or all) of the parts of an Animator Controller (states, transitions, properties and motions) into a new one.
Hello, I love your videos man, helped me get a good job. I am a unity developer with 6 years with experience but after lay offs I started doubting myself. Now Things are good again. One question, are planning on sharing your Rider settings? would love to see those. (reformating, clean up)
Thank you! Glad to hear about the job, times are challenging these days. I actually do have a setup/config video planned, and I'll be sure to include some Rider specific things.
@@git-amend Great news! I will be looking forward to it.
You content keeps amazing me.
Thank you!
It wouldn't be my preference for where to use the builder pattern when there's a partial order to the method calls, i.e. you have to have created the layers for some of the other functions to work, but since this is technically always wrapped in the (pseudo-Director) Clone method, it's not exposed as a library so you retain control to it. It still does the job of cleaning up smelly code!
Also, when you talk about the switch, I think you missed saying that it's prime for being converted when the if conditions are checking the same variable values, switch (true) is an equally bad pattern!
In my work (not games), we use it a lot for cleaning up the business logic (in the director layer) when we're rendering data (just to view models) that may have come from differently-formatted data sources. You can have the same builder interface to set information for rendering (e.g. setting number of items, show/hide things), but have a completely different implementation underneath for each data source. The builder always outputs something else at the end so that mutability doesn't matter, they're very temporary, otherwise it's like the house builder moving in with you when you buy a new property!
Thanks for sharing your insights with a real-world use case! I like the house analogy. Regarding the switch statement, you're absolutely right. Converting if conditions that check the same variable values to a switch case can indeed streamline the code and improve readability, but using `switch (true)` is generally not recommended.
Being new to programming i wish to ask which resources do you recommend to learn c# and programming in general , you seem very knowledgeable so i wish to know
If you join the Discord, take a look in the #programming section - there is a pinned list of recommended reading to help people progress from Beginner to Advanced
could this pattern be useful to write a sequence of actions? for example, NPC.GoForward().Wait2seconds().Reload().ShootGuns()
Sequences are a great use case, though ones that need to wait or run a coroutine may need special consideration
You could use the builder pattern and your api would look basically like above and still use timers. I think amend has a video on it.
While I love fluent interfaces, I'm not sure if I would use it inside of a utility like that. This does not really add a lot of readability over just using regular static methods.
Using them for factories or other configurations, like you mentioned, seems way more beneficial to me. There the branching options allow you to get more usage out of the extension methods.
Great video with another awesome topic!
Thanks for the comment. Myself, I also primarily like using it for constructing other objects or configs. Maybe we can touch more on branching and extending it in a future video.
@@git-amend sure thing! It's just a matter of preference of course
Sometimes i just wonder... Why is this not in the original library that comes with the package? I feel you need to start poking Unity, cuz stuff like this belongs there! :)
Haha, yeah maybe. You could say the same about custom processing of Animations, especially humanoid rigs - always requires writing some custom code.
Brilliant!
Thank you!
Amen 🙏
NICE.
Thanks!
@@git-amend almost at 500,000 total views on all your videos, that's crazy. i'm still only just over 100k, your hard work is paying off.
Hard to believe isn’t it
SUNDAY
Thanks for watching again! Cheers!