News for hackers. Stuff that matters.
Re:Why use Rust on the back end? by hot_gril on Monday March 20, 2023 @06:24PM (#35239670)
I've given up on trying to wrap SQL in any way. Too many bad experiences. I just use it as-is with fully dynamic types. My go-to stack is Postgres + NodeJS, no Typescript. No query builders, no ORMs especially. Postgres is meant to be used on its own with a minimal client lib. It works beautifully.

And my system is safer in the end because I take that time I would've spent fighting the type system / tooling and instead spend it writing integration tests. I get to do full TDD often. And the bugs I catch are never due to mishandled types.

Re:Why use Rust on the back end? by davidatbu on Tuesday March 21, 2023 @08:17AM (#35245174)
> And my system is safer in the end because I take that time I would've spent fighting the type system / tooling and instead spend it writing integration tests.

I'm a type-safety kind of guy, but this argument (that time spent "fighting" the type system) is better spent writing tests when it comes to DB queries, has me very very curious. Would love others' opinions/experience on this!

Re:Why use Rust on the back end? by hot_gril on Tuesday March 21, 2023 @12:55PM (#35248976)
Small clarification, the tests aren't on the DB queries alone. Like it spins up a test backend, calls some API endpoints to seed the DB, then calls some others to test their behavior. It's not specifically looking for type problems, but those would easily cause test failures too (e.g. I sign up a user named "Bob" and his name comes back as "undefined").
Re:Why use Rust on the back end? by davidatbu on Thursday March 23, 2023 @01:55AM (#35270931)
Ah, in that case, I'm much less interested :D , because that would mean that you let the untypedness of the DB queries propagate through pretty much the entire codebase.
Re:Why use Rust on the back end? by hot_gril on Thursday March 23, 2023 @06:43PM (#35282474)
Oh, yeah. Except I just remembered that I use an OpenApi spec, so at least the API param and return types are enforced.