Live data from Hacker News

Why I believe Rails is still relevant in 2019

devbrett.com

61–70 of 264 posts

Re: Why I believe Rails is still relevant in 2019

#61
post #49

Earlier quoted context omitted.

I've tried to work with ActiveAdmin on several consecutive projects, and I do not understand the draw. It's a fussy DSL that requires you work with your data in a way that feels very un-Rails. You basically have to approach building out your UX from the perspective of what the tool is designed to do. This seems a shame, in the context of Rails - a framework that's actually pretty great at getting out of the way in th…

I hate ActiveAdmin because of exactly what you say, but tbh it is indeed a very powerful tool and still allows you to very quickly spin up admin pages (to a certain limit, but this limit is pretty high). I yet have to find something similar.

While it is not a 1:1 replacement for the end-goal of a drop-in admin, I've had some success with datagrid: https://github.com/bogdan/datagrid

A good way to think of it is as a drop-in for the index view of many admin modules, which is the filtering, sorting and pagination of tabular data. This is the specific pain I want to be abstracted away... not the entirely conceptual UX of my admin in general.

Re: Why I believe Rails is still relevant in 2019

#63

how relevant is Rails in the age of SPAs? How well does it work with making JSON APIs and hosting static React apps?

Quite well. From Rails 5 there’s an API only init flag which removes the view layer and then you can just return JSON from controllers. Chuck nginx in front to proxy backend requests and serve your static front end bundle and you’re golden.

Re: Why I believe Rails is still relevant in 2019

#64

In my opinion, Rails / Ruby is nearly unbeatable in terms of productivity when you add trailblazer to the mix.

I love that Rails is flexible enough for me to both agree completely AND be thrilled to not use Trailblazer, because I prefer interactor, state_machines, rolify, pundit and draper. Considering the talk about how heavy Rails is in this thread, I feel like I have all of the options in terms of customization and in a very mature ecosystem that still values developer happiness.

Re: Why I believe Rails is still relevant in 2019

#65

I don't know how to quantify how relevant Rails is today, but I do think it's interesting to explore why Rails isn't as popular as it once was. I remember just eight years ago, Rails was on the HN frontpage almost daily. Some ideas: I think the most critical trend has been the dissemination of the Ruby ecosystem's most popular and best ideas into every other ecosystem, which I would summarize as a culmination/caricat…

I think that your perspective is fair and balanced. I'd just like to say that nobody is forcing you to use method_missing or RSpec.

Anyhow, definitely peek at https://gist.github.com/andyyou/834e82f5723fec9d2dc021fb7b81... which I consider to be something of a missing manual for the bleeding edge.

I think that most folks would be completely shocked to realize that they can run a command like: rails new future --skip-sprockets --skip-coffee --webpack=react --database=postgresql

Although, I would argue that they should check out StimulusJS instead of defaulting to React... it pairs up beautifully with Turbolinks 5. All preconceived notions about earlier versions of TL need to be discarded because it's actually pretty awesome now.

Re: Why I believe Rails is still relevant in 2019

#66

Earlier quoted context omitted.

Okay, I have lots of good news for you. First, CoffeeScript is formally deprecated. Turbolinks sucked, but Turbolinks 5 is an entirely new beast and it rocks. You need to give it a second look. I recommend this talk, sped up to 1.5x: https://www.youtube.com/watch?v=SWEts0rlezA&t=3m22s Finally, there absolutely is an opinionated client library that is designed to pair beautifully with Turbolinks 5. It's called Stimulu…

Thanks, it's an almost complete guide. But there's one important missing piece: Universal routing. How about taking the routing config which can be applied for both server and client ?

If you're talking about React-style routing via navigation or whatever, then yeah, you need to evaluate what's best for you.

One reason I love Stimulus + Turbolinks 5 is that you don't have to think in terms of client-side routing.

Re: Why I believe Rails is still relevant in 2019

#67
post #30

Build your app using whatever you're most comfortable with because in the end an existing product is better than no product. Will you enjoy spending an extra hour per day working with this framework over another? That's an hour more of progress. Personally I think Spring Boot with Kotlin is a way better choice today for monoliths that transition well to micro services. But if you're already deep in the RoR world just…

Personally I think Spring Boot with Kotlin is a way better choice today for monoliths that transition well to micro services. What do you use for an ORM in this case? Is there anything comparable to ActiveAdmin?

I recommend to not use an ORM. Really, with a modern language, an ORM is mostly redundant. If on Spring boot, simply use JDBCTemplate and TransactionTemplate to deal with raw SQL queries and transactionality. Get rid of all the annotation magic around this.

Then you need a bare minimum of mapping code. Mostly this boils down to a single line of code to call the relevant constructors while you extract columns from your rows in a type-safe way. Kotlin makes this stupidly easy. I'd argue this type of code is actually easier to maintain than misc annotation cruft all over your codebase. One way or another you end up expressing in some place that column foo is of type Int and goes into some property of a class MyLovelyFoo with a foo field. So MyLovelyFoo(foo=row.getInt("foo")) kind of does that in a really compact way and there's not a lot more to it. Of course Kotlin having default arguments, sane property handling, immutable data classes, etc. helps a lot. Mostly ORM made sense when people were doing JavaBeans on Java.

The problem with many Java persistance frameworks is the amount of magic that happens that leads to hard to understand bugs, sub optimal joins, and other stuff that just isn't worth having. A side effect of using an ORM is also overengineered table structures because people are pretending they are doing OO and thus end up with way to many tables and columns, fragile and more frequent migrations, and a lot of silly joins. This magnifies all of the above problems.

If you know what you are doing, you can actually fix this of course and do it properly even while using an ORM like hibernate. At this point you lose most of the advantages of using an ORM because now you are knee deep into framework complexity and trying to coerce it to do the right thing while spending disproportionate amounts of time inspecting and guiding all the magic it does for you. I've been parachuted in more than a few hibernate projects gone bad. The fix is always pruning back all the copy paste annotation magic propagated by juniors, vastly cutting down on the number of model classes, use of inheritance and the silly hacks that come with that, fixing the transactionality, etc.

Re: Why I believe Rails is still relevant in 2019

#68

Does any free web framework have something more thorough than rails' Active Admin? Django admin seems pretty unfinished by comparison. Haven't seen anything actually better.

I use hanami (https://hanamirb.org/) instead of Rail. My admin interface of choice is Forest (https://www.forestadmin.com/) since I cannot use ActiveAdmin outside of Rails.

Re: Why I believe Rails is still relevant in 2019

#69
post #23

Rails is a great monolith framework, but a monolith will eventually reach its limits, due to size/complexity of the team or the task at hand. I think providing a better story around how to prepare for or handle that transition would definitely serve Rails a lot better in the long run. But, as long as the main target audience of Rails is Basecamp (a saas tool with 12 developers), I don't see it in the future.

The company I work at is transitioning from a rails monolith to many smaller rails micro services - it’s the best if both worlds.

I think the best is to have nicely designed modular monolith application. Sadly this something that Rails backwards conventions makes very hard to achieve.

Re: Why I believe Rails is still relevant in 2019

#70
I have this joke that I noticed ruby/rails developers seems to use a lot of their extra time (which they get with the high productivity you seem to get with rail) talking about how great ruby and rails are and how efficient they are with it ^^
Post reply on HN