Live data from Hacker News

Rocket v0.4: Typed URIs, Database Support, Revamped Queries

rocket.rs

51–60 of 91 posts

Re: Rocket v0.4: Typed URIs, Database Support, Revamped Queries

#51

Once rocket makes it to stable, I think it will be the go to choice for web development in Rust. The focus on creating a great developer story makes rocket a joy to use. I am shocked that Sergio maintained rocket alone for so long. I would have figured there was a team of 3-4 people working on rocket. Glad to see he is getting help!

I'm really eager to push for use of rocket (and thus rust) at work, but while rocket being on version 0.x it probably is a tough sell. The benefits rocket (at least seems to) bring feels obvious and I notice every now and then at work that "hey, this would be so easy to do with rocket".

> benefits rocket (at least seems to) bring feels obvious

Sorry I am not a webdev. Curious what these are compared to something like RoR.

Re: Rocket v0.4: Typed URIs, Database Support, Revamped Queries

#52

Earlier quoted context omitted.

Rocket specifically? Lots of people like it. Rust generally? Stuff like https://andre.arko.net/2018/10/25/parsing-logs-230x-faster-w... is one success story we’ve already seen.

gp is asking abt rocket inside lambda.

I don't personally think that there's anything inherently specific to Rocket that makes it better for lambdas than any other Rust web framework.

That's just my opinion, of course.

Re: Rocket v0.4: Typed URIs, Database Support, Revamped Queries

#53

Earlier quoted context omitted.

gp is asking abt rocket inside lambda.

I don't personally think that there's anything inherently specific to Rocket that makes it better for lambdas than any other Rust web framework. That's just my opinion, of course.

Ah okay.

I wasn't sure if bare-bones Rust+Lamba-Rust-Runtime was already enough.

Re: Rocket v0.4: Typed URIs, Database Support, Revamped Queries

#54
post #4

I've never tried Rust or Rocket, but it appears to be gaining popularity, so I have the following questions for existing users: What's it like to work with? Do you prefer it to JS/PHP/Python for web related projects? Can you iterate on code quickly, or is there a compile step on every iteration? Are there stable libraries for interacting with MySQL/Redis/Postgres asynchronously? Is there good IDE support, for example…

I did a lot of stuff with Django and Flask. On current project I was free to choose a platform, so I went with Rocket.

The framework itself is similar to Flask in productivity and amount of boilerplate, though it's even better. It converts all input data to proper types for you using type signatures of handlers. So I don't need to convert strings into ints, or into json and then check if it conforms to a schema. If handler is called, input is parsed and converted.

Rust itself is more verbose than python. Typical data manipulation, like put something in dict, extract/count uniques, "transpose" a datastructure, load data from file, usually takes 1.5x-3x as much chars. For this price you get strict compile-time type checks that take lots and lots of mental load off code refactoring, C++ level performance, and real multithreading, including easy data parallelism with libs like rayon. Rust also has enums (aka algebraic types or tagged unions) that can help to represent problem space better and make fewer logic mistakes later.

It would be all unicorns and rainbows for me if a more concise database interface was awailable. Currently the go-to ORM is Diesel, and it's very verbose comparing to, say, python's sqlalchemy. Current solution is to move database access from views into methods of a model.

About iteration: code requires recompilation. Changes to non-compiled templates do not. I use Maud templates and they make html look suprisingly clean, they compile and are fast, but well, you need to recompile them every time. Currently debug build takes ~10s, though parsing and typecheking are done in the first several seconds.

Diesel doesn't support async yet, AFAIK. But async is usually used to save on context switches and stack space, allowing to support tens of thousands of live connections. You won't ever have tens of thousands of connections to database like Postgres. 100 connections is quite generous. 500 connections may be possible on the fattest DB boxes. Postgres is not async itself, it allocates a 4MB scratch buffer for each client from the start, IIRC. The only good reason to use async for communication with postgres may be if all of your other code is async and you don't want to deal with sync/async impedance mismatch. Though you'll likely want have connection pool anyway.

About IDEs I can't say much, I use emacs with LSP, it works most of the time.

Re: Rocket v0.4: Typed URIs, Database Support, Revamped Queries

#55
post #39

Earlier quoted context omitted.

I assumed, I guess incorrectly, that Racket was more than a 1-2 person team. Also was perturbed that they were only at a v0.4. Not sure how things like SAP and Oracle are valid in a conversation about Racket...

FYI: This is Rocket, a web framework for Rust, not Racket, the programming language.

Ah my bad, assume we have to use a nightly build then?

Re: Rocket v0.4: Typed URIs, Database Support, Revamped Queries

#56

Is anyone able to lay out some of the reasons why you might want to write web applications in rust? I was under the impression rust was designed as a safer language for low level systems programming. Thanks!

It's fast. It's type safe. Solid developer tooling story.

Those three things are very appealing, whether it's web or anything else.

Re: Rocket v0.4: Typed URIs, Database Support, Revamped Queries

#57
post #53

Earlier quoted context omitted.

I don't personally think that there's anything inherently specific to Rocket that makes it better for lambdas than any other Rust web framework. That's just my opinion, of course.

Ah okay. I wasn't sure if bare-bones Rust+Lamba-Rust-Runtime was already enough.

If you're not trying to run a website on lambda, sure that's enough and there's no need for rocket.

Re: Rocket v0.4: Typed URIs, Database Support, Revamped Queries

#58
post #24

I am truly moved by what this small (probably one, maybe two person?) team has accomplished here. Just look at their code and its organization, while noting how languages like Rust, Nim, and Go show us how to tackle the software complexity in various software domains. Having been in the enterprise field for a handful of decades, I am convinced that work such as this is signaling a brave new world of software developm…

> a brave new world of software development that is just ahead of us -- small teams, phenomenal productivity

It's also the brave new world that lies behind us. Doom, one of the most influential computer games due to technical innovation, was created by a team of 3 programmers (and 8 non-programmers).

Small teams of brilliant people can produce phenonemal results. Unfortunately in big companies a manager is not only measured by his results, but also by his budget and the number of people under him. The division of 100 people simply looks more impressive than the room of 10. So you end up hiring lots of (at best) mediocre programmers, pay them as little as possible, and use big architectures and processes designed to cope with idiots (Enterprise architectures and Enterprise processes, as we call them).

Re: Rocket v0.4: Typed URIs, Database Support, Revamped Queries

#59
post #53

Earlier quoted context omitted.

I don't personally think that there's anything inherently specific to Rocket that makes it better for lambdas than any other Rust web framework. That's just my opinion, of course.

Ah okay. I wasn't sure if bare-bones Rust+Lamba-Rust-Runtime was already enough.

Speaking as the co-author AWS's Rust Lambda Runtime: there's no fundamental impediment for us supporting Rocket (or any other web framework), but I suspect there'd need to be changes made in Rocket to support how Lambda expects input. Namely, Lambda functions don't see raw HTTP requests, but instead, fully parsed JSON. This blog post shows how Lambda expects data to be formatted: https://aws.amazon.com/blogs/networking-and-content-delivery...

Re: Rocket v0.4: Typed URIs, Database Support, Revamped Queries

#60
post #24

I am truly moved by what this small (probably one, maybe two person?) team has accomplished here. Just look at their code and its organization, while noting how languages like Rust, Nim, and Go show us how to tackle the software complexity in various software domains. Having been in the enterprise field for a handful of decades, I am convinced that work such as this is signaling a brave new world of software developm…

While you're correct it's becoming more of the rule, this has been true a for a very long time.

Clayton Christen wrote about this in 1997 with "The Innovator's Dilemma". He believed it was still repeatable in large organizations via 'intrapreneurship', which I'm not convinced is entirely true... considering the enterprises continued obsession with middle management and hierarchy, and top-down R&D.

Post reply on HN