Skip to content
0:00 / 0:00

#algebraicdatatypes#typestatepattern#domain-drivendesign

Rust Data Modelling Without Classes

No Boilerplate

290K subscribers • 11 videos on Hallway

YouTube
  • Recommended by 8 people: 8 in engineering communities.
  • Presented by Tris Oaten, creator of No Boilerplate
  • Linked in the description0atman/noboilerplate
  • An opinion. It argues one side of a question engineers disagree on.

Intermediate. Assumes working knowledge.

246K views3 years ago8 recommendations

Programming languagesSoftware designRustDesign patternsSoftware architecture

Tris Oaten explains how to design software in Rust using its type system instead of object-oriented inheritance and classes.

Today we're talking about how to design your projects in Rust without using inheritance. 👉Get Rust training from Let’s Get Rusty: letsgetrusty.com/begin-with-tris Thanks very much to today's sponsor Quadratic. Head to quadratichq.com/ to try it out! ❤️ If you would like to support what I do, I have set up a patreon here: patreon.com/noboilerplate - Thank you! 📄 All my videos are built in compile-checked markdown, transcript sourcecode available here github.com/0atman/noboilerplate this is also where you'll find links to everything mentioned. 🖊️ Corrections are in the pinned ERRATA comment. 🦀 Start your Rust journey here: doc.rust-lang.org/stable/book/ 🙏🏻 CREDITS & PROMO My name is Tris Oaten and I produce fast, technical videos. Follow me here twitter.com/0atman Website for the show: noboilerplate.org Come chat to me on my discord server: discord.gg/mCY2bBmDKZ If you like sci-fi, I also produce a hopepunk podcast narrated by a little AI, videos written in Rust! lostterminal.com If urban fantasy is more your thing, I also produce a podcast of wonderful modern folktales modemprometheus.com 👏🏻 Special thanks to my patreon sponsors: - JC Andrever-Wright - Miah Beach And to all my patrons!

Why it's here

8 people recommend this

What people say. Engineers frequently recommend this video for learning how to leverage Rust's type system to make invalid states unrepresentable.

u/-Redstoneboi-in r/rust • Recommends

On “Do you use DDD (Domain driven design) with Rust ?”

YouTube, Rust: Make Invalid States Unrepresentable Seems to align with what you want. Maybe.

u/Sermunsin r/rust • Recommends

On “Advanced Rust users, what is the most valuable skill to become more productive with the language?”

link to this video Actually ALL of No Boilerplate's videos. So good!

u/KingofGamesYamiin r/rust • Recommends

On “What made you switch to or from Rust?”

I recommend this video for a good explanation of this.

u/Firakein r/rust • Recommends

On “Rust Newbie”

link to this video This guys videos feel a bit like ads but they have good info usually once you get past that.

u/SV-97in r/rust • Recommends

On “Learning Rust ASAP”

Don't sweat it too much. Some C++ concepts like RAII translate but not having done too much C++ recently might actually be beneficial because you don't have to unlearn as much. A lot of rust felt rather pythonic to me when I first got into the language so knowing python might be quite helpful despite the language's huge differences :) You might struggle a bit with algebraic types / functional patterns and explicit ownership modeling at first and getting into truly idiomatic rust might take a bit. Some videos might help with wrapping your head around those things: No boilerplate has some good short videos, as do code aesthetic, let's get rusty, code to the moon... the "crust of rust" serie…

u/anlumoin r/rust • Recommends

On “A mathematician's perspective”

I can recommend this video about why Rust's type system is so great.

u/phazer99in r/rust • Recommends

On “Resources For Rust's Type System”

Some examples: * Make invalid states unrepresentable * Type state builder pattern But some of the most interesting and useful patterns are found in the combination of the Send and Sync traits with the aliasing and ownership rules. For example, the implementations of channels, Mutex, rtrb (a SPSC ring buffer) etc. which contains some `unsafe` code internally, but with clever design patterns expose an API that is statically guaranteed to be safe for multi-thread usage. Libraries like this would be much more error prone to implement and use in other languages.

u/funkdefiedin r/rust • Recommends

On “20% to get 80% done”

Things to hit on: The borrow checker. Understand errors, don’t just bang your head against them until the borrow checker stops complaining. “Make invalid states unrepresentable.” Learn to model data and systems and problems as types. Learn to appreciate how much of your system can be solved at compile time with good types. Traits and traits definitions. This is related to the previous point. Learn what abstractions can be created with traits. Things to not worry about: The inner workings of `async` code. Just use tokio for async code and be done with it. Don’t dive too deep there. Know how to _use_ async/await, but don’t worry too much about how the runtime is implemented. `unsa…