State Design Pattern (C#)
HTML-код
- Опубликовано: 8 фев 2025
- The state design pattern explained with examples in code. Change behaviour of an object based on it's state.
Patreon 🤝 / raw_coding
Courses 📚 learning.raw-c...
Shop 🛒 shop.raw-codin...
Discord 💬 / discord
Twitter 📣 / anton_t0shik
Twitch 🎥 / raw_coding
Playlist: • c# design patterns
Source: github.com/raw...
#csharp #state #designpatterns
I like this pattern because very often I end up with a switch statement with nested if checks, and it is too complex for me to try to keep it in my head next week. I have common issues of making a change, that breaks the previous (how?) or next state. This pattern is really good for isolating states and following the OCP of SOLID. But it also adds some overhead, that can be more complex than a simple switch statement. Everything is a trade off is what I learned in architecture and software development.
drunk, tired and caffeinated? just a normal monday morning as a dev
Not sure what you’re talking about ))
@@RawCoding lol play dumb
thanks for your great videos
According to Wikipedia, in Software Engineering, behavioral design patterns are design patterns that identify common communication patterns among objects and realize these patterns. By doing so, these patterns increase flexibility in carrying out this communication. Behavioral patterns are those patterns that are concerned with the interaction between the objects. The interaction between the objects should be in such a way that they are talking to each other and still are loosely coupled. The loose coupling is the key to n-tier architecture.
Thank you for sharing
The structural state pattern could come in handy while using enum in code
What a good analogy with the drinking state.
Cheers
my man Anton is trying to ddos youtube with design pattern videos. lets Gooo
;)
Fantastic!
Cheers
Damn good, thanks mate!
Thank you for watching)
Great explanation)
Cheers
Should have also shown how to call methods on Pen class from main method
Drunk coding!
Underrated!
👍🏽
)
drinking state- oh, the russian in you! I don't understand why you don't get google ads so you could get promoted and get more views
Haha, I haven’t tried but I don’t think it’ll be a good trade off
@@RawCoding your video will show up as suggestions. If people don't click on your video you don't get charged. If they do is like 0.02-0.04$ per click. The good part is that if someone clicks and likes your content most likely will share with others with no charge for you, also you start with 50$ credit.
FIrst
👏