by VikingCoder · 3y ago · 0 comments
Being able to write my code as though it's synchronous is the most important aspect of this to me.
Writeline("What's your first name?");
string First = await Readline();
Writeline($"Hello, {First}, what's your last name?");
string Last = await Readline();
I understand what you're saying about using a state object. But then I'm responsible for keeping track of the state machine of my code. It stops looking like async/await code, and starts looking like event-driven code again.
All you have is requests and responses. They don’t come in a predictable order.
Whether you use async/await or not it’s irrelevant.
Loading and restoring the state is trivial. If you just want one state object per user, you can load and save it in your framework middleware. In real life you typically need more state than just per user state, which is why it’s uncommon to see that.
In the end you’ll find yourself back at the typical application server plus database architecture.