Data Modelling without in Rust WITHOUT OOP
🕑 Added 2023-04-20 10:41:45 +0000 UTCToday we're talking about how to design your projects in Rust without using inheritance.
I'd love your thoughts on this method, melding normalisation with state machines is not something I've seen elsewhere, I hope it's a good idea. (I think it is!)
Thanks so much for your support, I had a great time with this one, once I'd figured out the right state machine demo!
Keep an eye out for an extra announcement next week, things are HAPPENING!
Tris <3
Comments
Renoir Boulanger
OMG. (In context of Web application maintenance) That’s another argument for having Rust handle business critical state management and logic. When I come to think the abstraction and tooling work to do to make things understandable and easy to digest in JS world. And not be ostracized by “asking” to be allowed to build in that way at the employer. The UIs I’ve had to debug because of poorly implemented checks with flood of conditional (often mutated as side effects to the surrounding scope 🤮
No Boilerplate
the beauty of rust is that you KNOW with certainty that this code can be very easily modified to work safely in an async environment. If you want a lot of folks to wade in on this question, ask in #programming on my discord! :-)
Abhishek Tripathi
This might not be the best question. But I'll still go ahead. What would be the best way to model such state machines to model Long running transitions? Say, the mario transitions happen at random times in 5 minute game. One thing that comes to my mind is use some async wrapper on top of the mario model .
No Boilerplate
Noted, going to rewite bits for the public release today, thank you!
Evan B
I think the title might be mixed up a bit. I’ve noticed one weakness with Typescript where I want to make a custom simple type like an integer that’s called “identifier”. Sometimes, I want to make sure that only an identifier generated by a specific library is stored in that field. Typescript would allow any number into that field unless you make it an object, which then incurs significant runtime cost. Rust better supports this with type aliases, but also creating a struct no longer is something that has to be so avoided due to zero cost abstraction.
No Boilerplate
Thank you so much! :-D
vildemare
Great video! This is one of those videos I know I'm going to watch again!
No Boilerplate
Structs are product types, enums are indeed sum types. I made the distinction in the video, I hope? That section needs a bit of a rewrite actually, I'm going to rewrite the "Schrödinger's cat" example I think it's weak. Apologies!
99codemister
Maybe I missed it... did you mention that enum are "sum types" and tuples are "product types"?