Live data from Hacker News

Show HN: Cot: a Rust web framework for lazy developers

mackow.ski

31–40 of 115 posts

Re: Show HN: Cot: a Rust web framework for lazy developers

#31
post #29

>Cot was born out of frustration - the kind that every Rust developer feels when searching for a batteries-included, Django-like web framework What about Django?

this is rust community, "we" even try oxidizing linux

aside from joke, "I want every good thing about C++ but easiness of high level language" seems the norm

Re: Show HN: Cot: a Rust web framework for lazy developers

#32
post #9
post #2

> The ORM is very lacking at the moment and the automatic migration generator only works with a small subset of possible operations, I would have hoped that by 2025, new projects would have moved away from ORMs entirely. They really are a useless abstraction layer that always brings tons of trouble and usually makes queries harder to write. Looking at the first example in the docs https://cot.rs/guide/latest/db-model…

Composability is the often cited benefit. As an example, I can do the following in Active Record (Ruby): class Account { where.not(active_at: nil) } belongs_to :user end class User (born_on) { where(birthdate: born_on) } end active_users_with_birthdays_today = Account.active.joins(:user).merge(User.born_before(Date.today)) Contrived, of course, but it's not hard to see how you can use these sorts of things to build u…

The thought process can be the same in SQL. You can start by writing SELECT * FROM Account; then add your JOIN to User, then add your predicates. Then you can refine it – here, if I’m understanding the code correctly, you’re using User for a JOIN but never return anything from that table, so you could turn it into a semi-join (WHERE EXISTS) and likely get a speed-up.

Re: Show HN: Cot: a Rust web framework for lazy developers

#33
post #24
post #2

> The ORM is very lacking at the moment and the automatic migration generator only works with a small subset of possible operations, I would have hoped that by 2025, new projects would have moved away from ORMs entirely. They really are a useless abstraction layer that always brings tons of trouble and usually makes queries harder to write. Looking at the first example in the docs https://cot.rs/guide/latest/db-model…

Writing raw SQL is perhaps indeed easier for simple queries, but put some foreign keys inside or slightly more complex relationships between tables and you'll probably quickly fall into the trap of having to remember your entire database schema to write anything. Yes, the example from the documentation is slightly more complicated, but it checks at compile time the exact column names and types, so you get feedback mu…

I never understood the hate against ORMs. It always seems like a superiority complex or some claim that SQL is “so simple”.

Yeah SQL is extremely simple to write, that isn’t really the problem ORMs solve for me, but rather they solve composability and reuse of queries.

I think there is a similar vein of people crying about sites not using 100% vanilla js without a framework. They are missing the point or don’t have enough experience with the actual problems the abstractions solve.

Re: Show HN: Cot: a Rust web framework for lazy developers

#34
post #2

> The ORM is very lacking at the moment and the automatic migration generator only works with a small subset of possible operations, I would have hoped that by 2025, new projects would have moved away from ORMs entirely. They really are a useless abstraction layer that always brings tons of trouble and usually makes queries harder to write. Looking at the first example in the docs https://cot.rs/guide/latest/db-model…

It's 2025, and some ORMs are quite good (eg. Django, ActiveRecord). You can have an ORM with escape hatch of SQL. I do not understand the people who are so against ORMs.

I use ORM query interfaces 80% of the time, and for performance critical queries I can use direct SQL. But the query sanitization, smart preloading and performance checks, schema management and migration tools they often provide, and type checks / hints are really nice features of ORMs.

Furthermore, ORMs are ESPECIALLY useful in teams where you have more junior devs who need these guardrails.

I think the issue here is trying to reinvent a new ORM.

Re: Show HN: Cot: a Rust web framework for lazy developers

#35
Frameworks that do “everything” are not a good idea. I’m from the Java ecosystem. Spring is the “batteries included” framework there. If you have migrated any real world application to a new major version once, you’ve learned forever that “all in one” frameworks are bad. Please don’t do it!

Instead, use scaffolding tools, that give you a head start on creating a new project, using smaller, specialized libs.

Also, don’t use an ORM. Just write that SQL. Your future self will be thankful.

Re: Show HN: Cot: a Rust web framework for lazy developers

#36
post #21

another web framework for rust (nice) I wonder how this par with something like https://loco.rs/

From the article: > And yes, there’s Loco (which, by the way, has started after the idea for Cot was born), which is a great framework, but [...]

which totally say nothing and vague idea, because loco already easy enough and more higher than that would introduce "magic layer" that would really hard to customize (?)

Re: Show HN: Cot: a Rust web framework for lazy developers

#37
post #18
post #2

> The ORM is very lacking at the moment and the automatic migration generator only works with a small subset of possible operations, I would have hoped that by 2025, new projects would have moved away from ORMs entirely. They really are a useless abstraction layer that always brings tons of trouble and usually makes queries harder to write. Looking at the first example in the docs https://cot.rs/guide/latest/db-model…

I've yet to see an ORM which doesn't just eventually make everything harder. Especially when it comes to automatic migrations, which seldom seem to take into account production necessities like multi-node deployment, downtime considerations and not destroying your production data silently because it doesn't fit.

ORMs are one of those things that make sense for really tiny projects but fail to scale once complexity settles in.

Re: Show HN: Cot: a Rust web framework for lazy developers

#39
post #25
post #9

Earlier quoted context omitted.

Composability is the often cited benefit. As an example, I can do the following in Active Record (Ruby): class Account { where.not(active_at: nil) } belongs_to :user end class User (born_on) { where(birthdate: born_on) } end active_users_with_birthdays_today = Account.active.joins(:user).merge(User.born_before(Date.today)) Contrived, of course, but it's not hard to see how you can use these sorts of things to build u…

I'm not sure why you think you’d need an ORM for that. Most SQL client libraries allow you to compose queries, and query builders, which are not ORMs, can handle that just fine too.

By the time you have a query builder that will rewrite queries so that column name and table names to be compatible with composition you basically have an ORM.

Especially if you are defining types anyways to extract the data from the sql into.

Re: Show HN: Cot: a Rust web framework for lazy developers

#40

What is the competitive landscape looking like these days for Rust web frameworks? I couldn't help but feel a bit insecure last time I was exploring the various options because none of them seemed to have the maturity or longevity of frameworks from other languages (for obvious reasons). Is there one framework that stands out from the rest from an "investment risk" perspective? In other words, if my company is going…

Axum is most likely to be supported long term since it has quite a bit of support and is a Tokio project but it's not nearly as batteries included as something like Rails or Django. I doubt any of the current batteries included Rust web frameworks will last.
Post reply on HN