Live data from Hacker News

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

reviewbunny.app

461–470 of 490 posts

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

#461

What I've gathered, over the years, is that the people who dislike Rails because it makes a lot of decisions for them think they're just too cool for that. It insults their programming ability. OK, I can see that. So, go ahead; have it your way. But while you're still writing thousands of lines of boilerplate in both the front and back ends, and getting your types sorted out, I'm done with my app, and moving on to th…

I dislike it because I prefer code over configuration OR convention. Please give me code I can understand-by-reading and not code I have to understand-by-synthesizing-with-a-non-collocated-knowledge-set. This is why the “worse” of golang is better than the “better” of rails

This simple class in Rails:

  class Assignment 
Would represent several hundred lines in Java and Angular.

Do you really need to see every line of code required to explain every object and how they relate to each other to the various compilers in your application?

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

#462

Earlier quoted context omitted.

Yeah, SPA approach would separate the frontend and backend conceptually to different microservices. Frontend is served separately off CDNs, backend isn't involved with it. When frontend team decides on a different framework/approach, they can switch, and the frontend just consumes the backend API. Backend focuses on building an API, doesn't have to deal with templates etc. The other server side piece doesn't necessar…

I think he wanted to know why you decided that you actually needed React on the front-end, as opposed to doing it «the Rails-way»: HOTwire Stimulus etc.? https://hotwired.dev/

Some back end devs unwilling to learn React are planning to try it.

However as I understand, it's using WebSocket. At my previous job, building a customer service view that used it solely for real time updates, I wouldn't use it for anything critical without some heavy fault tolerance (like checksums or a simple incrementable number to count how many messages have been sent). The messages can be randomly dropped by whatever is in between.

I wouldn't want to write in Stimulus as a front-end dev. It looks like writing AngularJS from 2012, way too imperative. Template and logic are also separate which makes legibility harder compared to JSX.

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

#463
post #218

Am I the only one who simply looks at the business requirements when considering an SPA? Ive built music players, games, real-time chat apps, etc that would be very difficult or impossible with a server side rendering app.

The state-of-the-art in server side is simpler and, arguably, more powerful than SPA + APIs. We wrote a demo social music player with Phoenix LiveView: https://fly.io/blog/livebeats/ And Remix has another great take: https://remix.run/docs/en/v1/tutorials/jokes PHP is amazingly capable too: https://laravel-livewire.com/ Even Rails + Hotwire go a long way.

Don't forget SvelteKit / transitional apps!

Have Single-Page Apps Ruined the Web? | Transitional Apps with Rich Harris, NYTimes: https://www.youtube.com/watch?v=860d8usGC0o

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

#464
post #450

Rails and Ruby bake in a lot of really nice, ergonomic features for every day programming, not just larger architectural decisions. For instance I am working on a React Native app in my spare time and so much of Javascript seems tedious. Example is dealing with date ranges. Contrived example: import { isWithinInterval, subDays, addDays } from 'date-fns'; const today = new Date(); let range = { start: subDays(today, 1…

Use https://momentjs.com instead moment('2022-02-05').isBetween(moment().startOf('day').subtract(1, 'day'), moment().endOf('day')); Still requires one import but that's hard to avoid. Don't be afraid of them, the IDE will usually add them automatically and hide them anyway. It's a good way to increase tracability maintainability, instead of magic stuff happening in the background.

moment is dead, nowadays there are better libraries

https://momentjs.com/docs/#/-project-status/

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

#465
post #346

Earlier quoted context omitted.

Have you looked at Svelte? We've been migrating over to it from Redux/React, and it's so far been a great experience. It's greatly simplified a lot of our code, and eliminated a whole lot of redux/state boilerplate.

Haven't tried Svelte yet. Do you think its mature enough? Just hoping it is a relatively less painful can of worms to explore :)

Definitely mature enough. Take a look at their really awesome interactive tutorial to see how well-developed all the pieces of Svelte are: https://svelte.dev/tutorial/basics

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

#466

Google searches for React and node.js exceed searches for Ruby on Rails by 100% and 50%, respectively [1]. Some people have used this to argue that React/node are more popular than Rails. But I wonder if perhaps this discrepancy appears in Google Trends because it takes more google searches to accomplish the same thing in React/node versus Rails. I feel the Rails ethos of "convention over configuration" allows me to…

I doubt this, at least for my country a simple search in LinkedIn of "NodeJS" and "React" have tenfold the results of searching for "Rails" or even "Django".

It might be a bubble but basically every new startup and small/midsize company are using NodeJS and even big companies are building new services with it.

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

#467

Earlier quoted context omitted.

Widgets require JS, of course. Javascript was born to sprinkle some of it on top of an HTML page, not to make a whole meal out of it. This is what GP is arguing about and I tend to agree. Single Page Apps are not worth the effort in my experience, apart from very niche use cases. The velocity proposition and fantastic developer experience of writing JS in the backend and frontend and data layer is overrated and misle…

"Sprinkling" JS means you end up with a messy mix and match of markup on the frontend and backend, inconsistent behavior, etc.

Not always. The Rails ‘stack’ has a preference for StimulusJs which has a nicely ordered way of sprinkling the JS. No inconsistency there

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

#468
post #378
post #291

Earlier quoted context omitted.

That's interesting to hear, I would have guessed that Python had long won everything that could be ruby but isn't rails. Clearly, nothing will stop the inertia of someone who just happens to be productive through experience (you can probably find works-for-me wizards for almost anything, perhaps not for vba or ada but I wouldn't bet on it). Is there much happening in terms of libraries outside the rails scope or is i…

Thor is gorgeous for command line apps. http://whatisthor.com/ Capybara is fantastic for automated testing https://github.com/teamcapybara/capybara . Gosu for 2d Games: https://www.libgosu.org/ Example 2d game with Gosu: https://github.com/victords/super-bombinhas CRuby will be in browsers! https://bugs.ruby-lang.org/issues/18462

Thor looks great! I'd be surprised if something similar didn't exist for most languages, but with many of them living in obscurity because discovery is so hard without a well-established name for that class of tool. Some googling for "CLI framework" led me to oclif ("Thor for js"?) and to https://www.nexmo.com/legacy-blog/2020/06/12/comparing-cli-b... , but that can't be everything.

PS: https://github.com/shadawck/awesome-cli-frameworks also lists some for go and rust, getting there! (though most probably not half as complete as Thor, self-documentation should definitely be a first-class citizen!)

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

#469

Earlier quoted context omitted.

I've skimmed the guides. They never contain anything useful. They're just a bunch of recipes. They don't actually document a darned thing. Programming is not regurgitating recipes without understanding. Copilot can do that. Programming is actually understanding both the problem domain and the solution space, and knowing how to find some permutation of elements in the solution space to address anything in the problem…

Err, wouldn't you look at the source for most of these things? What framework do you use where that isn't true?

The source is an over-engineered mess of nested abstractions. So yes, you can do this, and I have, but it's not a lot of fun.

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

#470
post #366

Earlier quoted context omitted.

The problem with RoR is that it's an all-encompassing framework. It gives you a huge collection of things you typically don't need — entire major layers like the database are frequently completely irrelevant to projects. This isn't just true of small projects, but can often extend to a large part of a career. One of the grave dangers that older/wiser programmers have learned is to stop trying to pathologically "drink…

> Unfortunately, Rails just isn't special. This is why Rails is so good at what it does. I don't want it to be special. I want it to be mature, work, and allow me to be productive. I have work to do!

This, if it works for you and your coworkers thats all that matters.
Post reply on HN