Live data from Hacker News

Zero to Production in Rust

zero2prod.com

11–20 of 195 posts

Re: Zero to Production in Rust

#11
post #2

This looks really great. £35 Individual, £100 Team, £600 Company, seems like fair/straightforward pricing for a team that has members who know some Rust but haven't built out a production API with it yet. I wish every tech stack had a book like this, and I think it'll be particularly valuable for an exciting new language with a learning curve like Rust. I will note, though, that I'm currently consulting on a team tha…

Wouldn't Golang be the TypeScript here as alternative to Rust ?

Why? Golang has a much less advanced type system, comparable runtime performance, a smaller developer community, and a smaller package ecosystem.

Plus, if you're building a backend for a webapp, TS allows your engineers to build full-stack features in the same language, avoiding context-switching, code duplication, and other overhead.

Re: Zero to Production in Rust

#12
post #10
post #9

Earlier quoted context omitted.

"difficult to onboard", yeah why not if your juniors are not self learning. But "too slow"? What?! Edit: oh I get it, "too slow" as in "compilation time". I guess they really needed excuses to move back to another language.

I think "too slow" is "too slow to onboard juniors", not "too slow in terms of performance".

Correct – it took about 6 months for people to become fully productive in Rust, which matches what I've heard elsewhere.

Though I will note that the Rust compilation times were also far more painful than I'd expected – even the tiny (~5k sloc) app at hand would take what felt like a minute to recompute the red squigglies in my editor.

TS felt slow if it took 5-15sec, and Sorbet (for Ruby) was usually Rust was in the realm of "just don't use this language if you have ADHD" since you really can't make progress without the compiler's exacting approval, and I'd constantly get distracted while waiting.

Re: Zero to Production in Rust

#13

So I've just tinkered around a bit in Rust, and I'm not intimately familiar with the language. My experience has been pretty good, but I don't see how it's a good fit for the web domain. At least not the enterprisey, CRUD, business apps I'm used to building. I'd be curious to hear from people who have been using Rust for their web backends, though. Beyond the classic selling points of speed and safety, what benefits…

The DB space for Rust is a bit young, though there are several good projects like sqlx making it much more pleasant.

Rust shares many of the benefits of Go:

- statically linked binaries for ease of deployment

- good concurrency

- builtin testing framework

But it's a much sharper tool than Go:

- Really great error handling with Result/Option and the ? marker

- Like, really really good error handling, esp compared to Go

- Very pleasant logging and tracing

- Serde is fantastic at automatically serializing/deserializing datastructures

- Generics make Map/Reduce/Filter really easy and readable

- Really good project management through modules/Cargo.toml

- Crates.io is like NPM - really discoverable and easy to upload (with its goods and bads)

- FFI with Swift, C, C++, Node, etc to share code everywhere

- Builtin documentation

- Builtin benchmarking

- Powerful hygienic and non-hygienic macros

There's a lot more. I would say people choose Rust over other web frameworks not because of the language, but the emphasis on great tooling. Being able to test, document, benchmark, deploy, package, with a language that feels like a child between Go, JavaScript, and C++ is very attractive. Plus, it's fast - like really fast - and it's really obvious where optimizations can be made when the time comes.

I've worked a decent amount with Go, but I'm also frustrated with the size of projects balloon. When I compare my Rust and Go code, the Rust code ends up being much smaller (LoC) and much more dense/terse.

I've been working with it for a few years now, and I'm 100% willing to trade some complexity when doing Advanced Stuff (tm) for the 1st-class tooling. I hate having to decide which testing/documentation/building/benchmark/etc framework to use in other languages. I just want to build, not futz around with Jest/Babel/Webpack/Poetry/PyEnv/Opam/CMAKE etc.

If you're looking into using Rust for web, I recommend https://github.com/http-rs/tide - it's the most pleasant web framework I've ever used.

Re: Zero to Production in Rust

#14

So I've just tinkered around a bit in Rust, and I'm not intimately familiar with the language. My experience has been pretty good, but I don't see how it's a good fit for the web domain. At least not the enterprisey, CRUD, business apps I'm used to building. I'd be curious to hear from people who have been using Rust for their web backends, though. Beyond the classic selling points of speed and safety, what benefits…

It's a bit early for Rust to be widely applicable to web development, because common web backend frameworks require nightly Rust which is not appropriate for production. But most of these nightly dependencies are being resolved.

Re: Zero to Production in Rust

#15

So I've just tinkered around a bit in Rust, and I'm not intimately familiar with the language. My experience has been pretty good, but I don't see how it's a good fit for the web domain. At least not the enterprisey, CRUD, business apps I'm used to building. I'd be curious to hear from people who have been using Rust for their web backends, though. Beyond the classic selling points of speed and safety, what benefits…

It's a bit early for Rust to be widely applicable to web development, because common web backend frameworks require nightly Rust which is not appropriate for production. But most of these nightly dependencies are being resolved.

That's no longer the case. There are many web frameworks working on stable, and Rocket, which was one of the most popular nightly-only backends, has been building on stable for nearly a year now!

Re: Zero to Production in Rust

#16
post #9
post #2

This looks really great. £35 Individual, £100 Team, £600 Company, seems like fair/straightforward pricing for a team that has members who know some Rust but haven't built out a production API with it yet. I wish every tech stack had a book like this, and I think it'll be particularly valuable for an exciting new language with a learning curve like Rust. I will note, though, that I'm currently consulting on a team tha…

"difficult to onboard", yeah why not if your juniors are not self learning. But "too slow"? What?! Edit: oh I get it, "too slow" as in "compilation time". I guess they really needed excuses to move back to another language.

> if your juniors are not self learning

At least one team member was a recent MIT course 6 graduate who was able to pick up other new technologies quite quickly without any oversight or assistance. They could get things done in Rust, too, but after a few months felt far from confident.

Re: Zero to Production in Rust

#17
I have been writing rust for personal projects for years. I love how the book structures the project and it is test driven. I will be using it as an example when I do projects moving forward. I like that it is one complete project a lot as well.

It is off topic for the book but I want to add a yew.rs frontend. I call it the PAY stack (Postgres actix and yew).

Re: Zero to Production in Rust

#18
post #10
post #9

Earlier quoted context omitted.

"difficult to onboard", yeah why not if your juniors are not self learning. But "too slow"? What?! Edit: oh I get it, "too slow" as in "compilation time". I guess they really needed excuses to move back to another language.

I think "too slow" is "too slow to onboard juniors", not "too slow in terms of performance".

It would be interesting to know where the difficulty was in training juniors to write comparatively simple code in Rust. Was it all about fighting the borrowck, or was there more to it?

Re: Zero to Production in Rust

#19

Earlier quoted context omitted.

It's a bit early for Rust to be widely applicable to web development, because common web backend frameworks require nightly Rust which is not appropriate for production. But most of these nightly dependencies are being resolved.

That's no longer the case. There are many web frameworks working on stable, and Rocket, which was one of the most popular nightly-only backends, has been building on stable for nearly a year now!

With the caveat that you have to use _nightly_ Rocket straight from GitHub (but still stable Rust, which is definitely preferable).

Re: Zero to Production in Rust

#20

Earlier quoted context omitted.

It's a bit early for Rust to be widely applicable to web development, because common web backend frameworks require nightly Rust which is not appropriate for production. But most of these nightly dependencies are being resolved.

That's no longer the case. There are many web frameworks working on stable, and Rocket, which was one of the most popular nightly-only backends, has been building on stable for nearly a year now!

They're working on it but they don't have an actual released version that works on stable Rust. So you'd end up having to pick stable Rust or stable framework, which is not great.
Post reply on HN