Live data from Hacker News

Don't make me think, or why I switched to Rails from JavaScript SPAs

reviewbunny.app

421–430 of 490 posts

Re: Don't make me think, or why I switched to Rails from JavaScript SPAs

#421
post #196

Seems like an "all or nothing" mentality. You either do it all in Javascript (both the frontend and backend) or you do it all in Rails. Why not do the backend in Rails and the frontend in Javascript/SPA?

you can also combine them.

Re: Don't make me think, or why I switched to Rails from JavaScript SPAs

#422

Earlier quoted context omitted.

This comment is ridiculous. You've shifted this from "too many options for everything" to "any options at all". Also, how are these things framework specific? The API vs templates argument also applies for Rails. Choosing an authentication method also applies to Rails. Choosing rendered emails via SMTP vs Sendgrid - also applies to Rails. And so on. You can't mix business requirements with "tooling choices".

Rails has a templating system for generating emails (standard HTML/ERB files). If you're running an ASP.NET Web API (not MVC) the best way of doing that I've found is via RazorLight which you have to set up manually - https://github.com/toddams/RazorLight For authentication, with Rails the standard is pretty much Devise or Omniauth (or both) - does everything for you. I've never found anything for ASP like Devise whi…

> I've never found anything for ASP like Devise which gives you an entire registration/login system with all the required views/models/migrations in a couple commands.

??????????????????????????????????????????? You know that this is built-in, right?

https://docs.microsoft.com/aspnet/core/security/authenticati... https://docs.microsoft.com/aspnet/core/security/authenticati...

also the same choices apply to rails.

Re: Don't make me think, or why I switched to Rails from JavaScript SPAs

#423

I built my last company with Go, Vue.js, gRPC, and Kubernetes. And, wow was it a slog. It was hard for new developers to jump in, we had separate engineers for frontend + backend, and there were things we never even touched - such as real-time/websockets or end-to-end testing. I recently started a new project in the same stack [1], and partway through paused because it was taking so long to deliver customer value. I…

I wish the Go community had a popular monolith framework that folks rallied behind using when necessary. Unfortunately it's a wild west of bodging together your own routing, config, auth, etc. and nothing is consistent.

I stopped writing go for this reason. Every discussion about frameworks seemed to be shut down in favor of "piece it together" + "standard library"

Re: Don't make me think, or why I switched to Rails from JavaScript SPAs

#424
post #74

It's true that there are many more choices to make for a JS SPA compared to RoR but isn't this just a fixed cost? Pick once and then stick to it. Use the same things for your next project. Done. I'd venture to guess that for a RoR newbie, it takes just as much time to understand the 'glue' (I've heard people refer to it as 'magic') that makes it all work together behind the scenes.

You have to know enough about the choices and their edge cases to make good choices. You are also at the mercy of all of those choices continuing to evolve in complementary ways in the future.

Re: Don't make me think, or why I switched to Rails from JavaScript SPAs

#425

I built my last company with Go, Vue.js, gRPC, and Kubernetes. And, wow was it a slog. It was hard for new developers to jump in, we had separate engineers for frontend + backend, and there were things we never even touched - such as real-time/websockets or end-to-end testing. I recently started a new project in the same stack [1], and partway through paused because it was taking so long to deliver customer value. I…

Reminds me of Paul Graham’s essay on language power “Beating the Averages”

“It must have seemed to our competitors that we had some kind of secret weapon-- that we were decoding their Enigma traffic or something. In fact we did have a secret weapon, but it was simpler than they realized. No one was leaking news of their features to us. We were just able to develop software faster than anyone thought possible.”

http://www.paulgraham.com/avg.html

Re: Don't make me think, or why I switched to Rails from JavaScript SPAs

#426

Earlier quoted context omitted.

"One group of web devs is great at picking the right tool for the job. Simple web applications get simple solutions. The complex SPA solutions only get brought out for applications that require it." You could replace SPAs with almost any technology (Queues, Kubernetes, an RDMS as opposed to BaaS, Servers as opposed to lambdas) and it would be correct depending on your own background and personal bias.

at least for me, that's the difference between someone on a senior level and someone that is not on that level yet. sometimes you just need to be pragmatic and say "this should be on an ec2 server with a simple html page -- no need for a react frontend that talks to a graphql endpoint that sends message to rabbitmq so another microservice can consume it". also, being able to accept that a simple solution is good with…

Just using an EC2 server typically involves a load balancer, a web server (nginx/Apache) and another web server like unicorn to manage the threads, and then a database at the bare minimum. That’s not objectively than using an SPA and a BaaS.

If you’re a front end engineer who’s used to working with node then an SPA + BaaS might be much simpler to you than running an EC2 instance that serves basic html.

Edit: and that doesn’t even get into securely managing updates, access controls, infrastructure, etc. those things might seem fairly trivial today but in the future imagine getting dinged for them in an interview.

Re: Don't make me think, or why I switched to Rails from JavaScript SPAs

#427
post #422

Earlier quoted context omitted.

Rails has a templating system for generating emails (standard HTML/ERB files). If you're running an ASP.NET Web API (not MVC) the best way of doing that I've found is via RazorLight which you have to set up manually - https://github.com/toddams/RazorLight For authentication, with Rails the standard is pretty much Devise or Omniauth (or both) - does everything for you. I've never found anything for ASP like Devise whi…

> I've never found anything for ASP like Devise which gives you an entire registration/login system with all the required views/models/migrations in a couple commands. ??????????????????????????????????????????? You know that this is built-in, right? https://docs.microsoft.com/aspnet/core/security/authenticati... https://docs.microsoft.com/aspnet/core/security/authenticati... also the same choices apply to rails.

I mentioned Identity in my first comment. I've never found it as simple as Devise though - especially in an API only setting.

With Devise there's a third-party Gem you can use called devise_token_auth which deals with everything automatically.

https://github.com/lynndylanhurley/devise_token_auth

Re: Don't make me think, or why I switched to Rails from JavaScript SPAs

#428
post #228

Earlier quoted context omitted.

As someone who came from other MVC frameworks outside of Ruby, learning Rails has been a cluster-f of searching through documentation circa 2013. The whole rails “convention over configuration makes it easier” is a load of bologna, because the only way to know the “convention” is to either have gone to a rails boot camp, reading the docs top to bottom, or maybe watching rails casts. The best way to work on rails is t…

the same BS happens with django

As a beginner, I didn't find this to be true. Django worked fine and could do what I wanted.

I suspect that if I were coming from Javascript where "I know what I want to do" if only I could "make Django do it", I would feel the impedance mismatch.

This is a very standard problem--"You can write FORTRAN in any language." Leaving behind the idioms you are used to and adopting the idioms of your new environment takes time and energy.

Re: Don't make me think, or why I switched to Rails from JavaScript SPAs

#430
post #228

Earlier quoted context omitted.

As someone who came from other MVC frameworks outside of Ruby, learning Rails has been a cluster-f of searching through documentation circa 2013. The whole rails “convention over configuration makes it easier” is a load of bologna, because the only way to know the “convention” is to either have gone to a rails boot camp, reading the docs top to bottom, or maybe watching rails casts. The best way to work on rails is t…

What are some specific “magical things” that are not mentioned in the rails guides? There’s always room for improvement and the documentation is an important part of the framework.

AFAIK there's nothing in the rails guides to help with authorisation. I googled and couldn't decide between pundit and cancancan. I went with the latter because of some tutorial videos I found. But it wasn't easy: 1. I couldn't find documentation for methods so common as `can?` [1], and 2. the 'magic' of how rails automatically sets instance variables differently and sometimes not at all before each action was also very confusing. Like many other things, it was confusing until you understood what it was doing, but figuring out exactly what it was doing and why took hours of experimenting with the behaviours of each action, and being the recipient of quite a lot of condescension on stack overflow for even asking.

[1] https://stackoverflow.com/q/63674415

Post reply on HN