SamuKata
noboilerplate
noboilerplate

patreon


Compiler-Driven Development in Rust

When I write a new Rust program, I don't start with functions or methods or any runtime code. I start with the model of my application, expressed with Rust's rich type system.

Interacting with the real-world, on disk or through the network is too slow for me, at first, I need to iterate faster than that, to sketch out my ideas, unconstrained by the outside world.

This compile-checked whiteboarding I call Compiler-Driven Development.

---

PR: https://github.com/0atman/noboilerplate/pull/69

---

Hi friends! As you might be able to guess by a video being forthcoming, I have turned a corner with my RSI. I'm still having to actively manage it, but I've built enough of a solid framework of exercise, strict timeboxing, and environment tweaks that I can start work again.

I'll likely post more about it AFTER I'm through the woods and out the other side (the irony of all this is I can't talk about it much because I have to focus my limited keyboard hours on work) and you, my supportive patrons will be the first to know all the details.

I'm so touched that you've stuck with me through this period of silence and unproductivity. That you are reading this today shows you are one of the very best, and I am truly grateful for your support!

---

Today's video was tough, not just for RSI reasons, but it's a challenging to explain concept. I hope the TDD analogy works for you? I'd love to know what you think ahead of the public video early next week! (As ever, if you like you can comment directly on the PR if that makes feedback easier, and I'm grateful for any thoughts)

Thank you so much again, I'm excited to be getting back to doing what I love!

Tris <3

Compiler-Driven Development in Rust

Comments

I do use type for sketching ideas first. Just typings. In-out, parts. It’s better than a schema using drawing. The typings can do things. I've started as self-taught PHP, making a living since 2002. Knew absolutely nothing about anything (really). Just a high school degree barely succeeded. I'm an example of an undiagnosed kid (ASD was an hypothesis closed in 2021, coming back again in 2024, in mid fourties. ADHD diagnosed in my 30s). In retrospect, that's why I felt so good when I bit the bullet of learning typing systems in PHP after I had "peace of mind" by doing TDD against all my projects and partners and employers wouldn't let me (i.e. it's not worthwhile, it'll be fine). The anxiety I would have. So, by pain and a long road. I learned that it's always best to TDD in a way or another. Not necessarily everything. But what matters; the logic the system is doing or displaying. 20y of experience, many businesses, bankruptcy. The Web wasn't taken that seriously for years!. (and now an explanation of my non-linear way of writing. sorry) TDD is more expensive (in JavaScript, PHP, TypeScript) than compiler driven. Using type system and the compiler's quick feedback just to "draw" the ins and outs of the system you're building. But you're doing one step more. That'll be definitely the next thing I do. Learn Rust. Thanks to WebAssembly (!!) I'll be able to build system tools and stuff that can run in a browser. Things that I worked long and hard to be proficient at.

Renoir Boulanger

You are exactly right - the string splitting CDD example will not feature in the final video, I've replaced it with an enum/method example. Thank you so much for this good feedback!

No Boilerplate

Oh certainly, just *start* with CDD :-D

No Boilerplate

Very amazing. Where does unit tests fit in Rust? Could you do both?

Companion Technology

I find the video a bit incohesive. You start out by saying (roughly) -I model my application using only types and structs, not even writing any functions. Then proceed to show an (otherwise excellent) example using only a function definition and body, not a single user-defined type.

Magnus Markling

thank you so much! Fixed for the public video

No Boilerplate

Thank you so much, if I had more time, I would be even shorter and more organised :-D

No Boilerplate

small note: on the slide with the table of tests vs compiler, "everywhere" is missing its "r"

lowmagnet

Although you touched on it here, code driven modeling/design is an often undervalued practice that you could probably do a video on. I encounter a surprising number of people who believe that code is just an artifact that happens after design, and overlook code having a place in validating and exploring system design options. Code provides a familiar syntax to model boundaries, interfaces, relationships and data ownership, all with logical validity, in ways that boxes and arrows cannot.

Luke Barton

I love the clarity and organization of your thinking, Tris.

J


More Creators