4 ms·
I agree. What are options here? Rails in API-only mode?
by roboben 3y ago
I agree. What are options here? Rails in API-only mode?
- Pungsnigel 3y agoYeah, that’s one approach. Works great
- crystaln 3y agoBut why? So many more performant frameworks for this in strongly typed languages to boot.
- roboben 3y agoWhich ones? Never saw another one which comes with the same comfort of batteries included like rails. For example having database migrations built in etc.
- ulizzle 3y agoYeah exactly. All that boilerplate stuff is such a pain to write or maintain long term.
- ssijak 3y agoBoilerplate is 1% of time, rest is solving real domain problems
- gomoboo 3y agoASP.NET (C#) has migrations: https://learn.microsoft.com/en-us/ef/core/managing-schemas/migrations/?tabs=dotnet-core-cli https://learn.microsoft.com/en-us/ef/core/managing-schemas/m...
- ssijak 3y agoMigrations are easy to do in literally every framework in any language
- KronisLV 3y ago> For example having database migrations built in etc. I actually went the exact opposite route, at least when possible: https://github.com/amacneil/dbmate https://github.com/amacneil/dbmate Pure SQL migrations, regardless of the back end technology that you use, completely decoupled from how each framework/library views things and therefore not dependent on them (you could even rewrite the back end in another technology later on, if needed; or swap ORMs; or avoid issues when there's a major ORM version update). It's really nice when you can generate entity mappings based on a live database, like with https://blog.jetbrains.com/dotnet/2022/01/31/entity-framework-core-inside-rider-ui-way/#existing-database-scaffolding https://blog.jetbrains.com/dotnet/2022/01/31/entity-framewor... So in my case, I can have: * a DB that has migrations applied with dbmate, completely decoupled from any back end(s) that might use it * a back end that has entity mappings for ORM (if used) generated from the live local test database container during development, used for an API and not much more * a front end that's typically a SPA using the API, but is otherwise just a bunch of prepared files that can be served off of any web server Of course, if you need SSR then things move around a bit, but that decoupling works great for me (but might not for others)!
- ulizzle 3y agoThat’s what a lot of people do. The value is still about convention over configuration IMO. If we are building a REST API, typical CRUD, you can go a long way with using Rails there and using something else when you need the performance or a certain feature.
- zoky 3y agoRuby is strongly typed.
- crystaln 3y agoExcuse me. Statically typed.
- berkes 3y agoThere is no agreed upon definition of "strongly typed", so it depends on your interpretation of that term. Ruby is not, however statically typed, nor does it have a type checker (well, there is sorbet and RBS) Those are fixed terms.
- deleted 3y ago[deleted]
- Rapzid 3y agoThe performance of Rails serializers is still a nightmare. God awful performance.
- crystaln 3y ago20 years on… “Just use another framework when you need performance” they say.
- Rapzid 3y agoAlso 20 years on the http client still doesn't have proper timeouts.
- berkes 3y ago> The performance of Rails serializers is still a nightmare Well, The performance of Ruby is still a nightmare. Not just serializers. It's that serializers in Rails are the most prominent place where you'll have cpu-bound performance made visible. But really. Just try anything cpu-bound (e.g. transform a huge list or CSV or so), and the lack of native, safe, threading, the horrendous performance of both the JIT compiler and the runtime and the language become apparent. This isn't to criticize Ruby. Because once you see all the runtime inflection, the way it can modify itself runtime and the DSL magic it allows, the current performance is a magnificent feat! It should be impossible to have it perform at all, given these features. That people managed to make such a beautiful language, with such marvelous features and still have it perform like it does, is a true engineering marvel.
- throwthrow5643 3y ago> It's that serializers in Rails are the most prominent place where you'll have cpu-bound performance made visible. Sorry, what other interpreted language has significantly better serializiation/deserialization performance than Ruby?
- berkes 3y agoPython, PHP and JavaScript have significantly better performance for cpu-bound programs. E.g. https://benchmarksgame-team.pages.debian.net/benchmarksgame/fastest/ruby-php.html https://benchmarksgame-team.pages.debian.net/benchmarksgame/... And I have measured ser/de for PHP, Ruby (and Rust, we needed to know how much faster JSON serde in rust would be, and compared it to Ruby and PHP). Php is probably much faster because the JSON ser/de is apparently written in C.
- diogenes4 3y agoSame reason as always—it's useful for rapid prototyping. It's not like the frontend was ever rails's strong suit.
- ulizzle 3y agoI think that’s pretty much it for big apps if we go with batteries included. Only Java frameworks compare on that front and if you’re a Ruby guy you likely don’t like Java. I’ve been liking Golang but I haven’t had a job that used it in a while. Who knows what’s it’s like right now