Live data from Hacker News

I Miss Rails

chanind.github.io

201–210 of 522 posts

Re: I Miss Rails

#201
post #45

I personally don't missed Rails mostly because boilerplate doesn't really bother me. I'm more afraid of using the wrong abstraction. Rails (v4 was my last experience) was hard for me and I think my reasoning is as follow: - I like to dig deep into the framework I work with but Rails have so much meta programming (a.k.a magic) that I struggle real hard figuring out stuff. You often have to go into runtime, hit method…

> - Lastly, I firmly believe MVC is a leaky abstraction

Then what is the abstraction that you think it should replace it?

Re: I Miss Rails

#202

I actually have gone back to writing server-rendered apps like it's 2012 and it's been wonderful. Server-rendered used to mean slow and clunky but I've found that using Go my page loads are super fast. The inter-page transitions can sting a little on really really slow connections, it's true. But users are much more willing to deal with them if they haven't first been subjected to a minutes-long spinner while the SPA…

How many "quality of life" features does your website have that require some JavaScript that you end up writing as one off functions/endpoints/etc? (various kinds of autocompletion, live search, notifications, messaging, etc.)

I'm all for server side rendering - I maintained several vanilla PHP/HTML/CSS websites in the 2000s, and only used jQuery sparingly when things grew in complexity. I later used Django for many years similarly, and when react/ember/angular/etc. started blowing up is when I started feeling like performance was something we had to worry more about.

That being said, server side rendering shows its limits when you build an application with lots of actions your users can perform on the data shown in their window, and reloading the page every time would significantly slow them down. That's when you're tempted to start going the SPA route, but those frameworks tend to be pretty opinionated about how you should structure your code and data, a slippery slope that leads to the stereotypical bloated, unresponsive JavaScript mess some websites have become famous for.

There is certainly a balance to be found, but it's a tricky one.

Re: I Miss Rails

#203
Ruby on Rails out of the box gets a lot of bad rep for being slow and non-performant. Has anyone replaced MRI with JRuby or TruffleRuby to mitigate that? Were there any significant "gotchas" with integrating it?

Re: I Miss Rails

#204
Having just deployed Discourse and Diaspora its obvious Ruby and Rails was not designed for end user use. There is complete and total dependency hell and a hard requirement for a build environment for basic app deployment.

This kind of engineering directly leads to endless wasted hours troubleshooting errors, routine build fails and apps that think nothing of pulling in hundreds of dependencies that in turn have their own dependencies that can fail at any time.

This is plainly wasting millions of man hours of end users time if its not a SAAS app. Compared to that Go is an ode to simplicity, PHP just works, Python is relatively painless and even Java causes little stress. Its node and ruby that seem to be designed by people who revel in complexity and have zero concern for deployment and end users.

Re: I Miss Rails

#205

I could never get into Rails because of all the magic. “It just works” doesn’t cut it for me, if I as an engineer, can’t understand exactly what’s going on under the hood.

After Rails' memory usage, I would say that the "magic" is the worst part of Rails. Wish I could have Rails, except a bit more explicit.

That said, with pry, it's pretty easy to dig down into the "magic" and see wtf's going wrong when something is borked.

Despite that minor grumbling, I'd say that Rails is still darn good! It's very mature framework (or perhaps more accurately, collection of frameworks) at this point. You can get stuff done quickly.

Most things really don't need to be SPA, and many (most?) don't need to serve up more than a few hundred or a few thousand responses per core per second.

Re: I Miss Rails

#206
post #163

Earlier quoted context omitted.

Static-typing seems so at odds with Ruby/Rails that I can't even imagine what that would look like.

Stripe has built a type checker for Ruby that they're using internally. I don't think it has been released yet, but you can get a preview of it at https://sorbet.run/ .

[deleted]

Re: I Miss Rails

#207
post #202

I actually have gone back to writing server-rendered apps like it's 2012 and it's been wonderful. Server-rendered used to mean slow and clunky but I've found that using Go my page loads are super fast. The inter-page transitions can sting a little on really really slow connections, it's true. But users are much more willing to deal with them if they haven't first been subjected to a minutes-long spinner while the SPA…

How many "quality of life" features does your website have that require some JavaScript that you end up writing as one off functions/endpoints/etc? (various kinds of autocompletion, live search, notifications, messaging, etc.) I'm all for server side rendering - I maintained several vanilla PHP/HTML/CSS websites in the 2000s, and only used jQuery sparingly when things grew in complexity. I later used Django for many…

It depends on the application of course, but some of them do end up sprouting a bunch of little "quality of life" JS functions. Writing these is happily a much simpler experience than it was in 2012! The most complex app I run also has the deepest browser support requirements, back to IE11. That said, I still have document.querySelector in all my target browsers so I find I don't even need jQuery.

For autocompletion, datepickers, etc I use drop-in components. These tend to be jQuery based but it's not the end of the world.

When I do have a particular view or flow that outgrows the "bits and pieces of JS" phase it's actually pretty straightforward to use a modern UI library like React or Elm on that view alone. Reducing the scope of the area you're using the framework in rather than writing the entire app in it simplifies things pretty dramatically. The JS doesn't need to worry about routing, pushState, etc etc etc. It just deals with its own little patch of DOM and state.

Re: I Miss Rails

#208

First of all, you should use the right tool for the job. Having said that, Rails kept giving me the icky feeling. What you gain in speed of development, you lose in performance and server costs and all sorts of crazy gem meta-magic. My current middle-ground stack is Golang API (I use go-chi) + (LitElement front-end (web components) + Redux). I'm kinda happy, though my gripe is with Go sometimes, not the stack. To the…

I tend to describe my issues with Rails in a nutshell: it felt like everything was optimized for day 0 instead of day 30 or 300. Devise was the ultimate example of this. `rails generate devise:install`. Instant authentication system with almost zero changes to your code base. Yet now something as central and important as authentication is implemented outside of your application in some highly abstracted software. To…

   > Rails was the first "language" I learned so I was its best case subject. It was able to indoctrinate me in the beauty of metaprogramming and things like that. Yet that still wasn't enough to keep the light from shining through the veneer when working on a real world projects where you just want to know how something works by reading application or glue code
I think the hidden magic is the worst part, but after a while I got pretty good at simply diving into various gems to see where the magic's happening (or failing to happen) and I don't mind that aspect now.

pry is an awesome tool. Put a `binding.pry` breakpoint in your code, do a `show-source Foo.borked_method` and explore from there.

Also, popular Rails-related gems tend to have good tests. I learned that those tests often demonstrate things that the docs don't.

Re: I Miss Rails

#209
post #14

Elixir and Phoenix are excellent, and you'll recognize many of the same concepts in these. The communities are excellent as well, and welcoming to newcomers.

They're fantastic and I hope the future is bright for them but I've had to pick Rails for a few projects over the last few months because the library support is so much more established. The more I get to use Phoenix, the more I am convinced it is the most well designed web framework there is, so I hope to use it a lot going forward.

Elixir/Erlang's emphasis on uptime/fault-tolerance/scalability/concurrency (admittedly at the cost of performance and the abstraction of a VM) is perfectly suited to web/mobile use-cases.

On paper, Pheonix should be the default choice for large and small web/mobile MVC applications. I think the question of if that becomes the case is directly tied to adoption of Elixir.

Re: I Miss Rails

#210
post #176

Earlier quoted context omitted.

Agnostic of stack, SPAs provide a clear separation of concerns. The api layer is responsible for transforming data between the client and controlling access. The client is responsible for presenting the data structures provided by the api to the user, and turning user inputs into data structures that the api can consume.

I feel like this line of thinking is very analogous to the whole microservice craze -- you shouldn't need to introduce a network boundary to write well architected software. There's no reason you can't have a clear separation of concerns in a server side rendered application.

What does that actually mean, though?

And "there's no reason you can't, if you wanted" is a far cry from "sure, the work is already done."

For example, something as simple as having a server-side rendered forum built with your favorite back-end language and now you want to build a client for it (web, iOS, Android).

That basically means massive duplication as you create a json interface boundary.

Yeah, you were already passing a { user, topic, posts } object to the template, so you can just serialize it your json api, right? But you can't because when you wrote that code, you knew the data never left the process. You didn't need to scrub the user.password_digest. Adding an api on top of an existing system is a lot of work no matter how much you hand wave about "well architected software."

But forget over the air network boundary. How about just wanting to implement the view layer of your Rails app with Go one day? How exactly would a "well architected" Rails app help you out?

The truth is that one reason that SSRs are simpler is because they are monoliths which spares you from certain classes of concerns. That's the trade-off you have to pay for if you want to cleave the monolith one day.

Post reply on HN