Rails, still?
blog.phusion.nl
blog.phusion.nl
This is an important point. If you've ever developed a non-trivial application using Sinatra, Express or any other "micro" or "non-opinionated" framework, you'll have hit this wall quickly.
To riff on Greenspun's Tenth Rule, "Any sufficiently complicated $MICRO-FRAMEWORK application contains an ad hoc informally-specified bug-ridden slow implementation of half of Ruby on Rails."
Not really. You want an ORM? choose an ORM library. You want templates, choose a templating library. You want to send mails, choose a mailing library. I don't see how big frameworks like Rails make all these things better, especially when they don't give you the choice as to what tool to use. If you ever developed a non trivial application, you also know that your first concern will be to avoid unnecessary bloat and complexity and only bring in libraries that are strictly required. And as we are moving from traditional html rendered server apps, big frameworks lost even more value since there is no need for a templating libraries, html form libraries,...
You also get a uniformity of understanding of your library and a support network.
The sweet spot that Rails covers, however, is a pretty common sort of web application - one in which you're primarily doing CRUD on different sorts of objects. If you treat every single application as a unique snowflake that needs a 100% bespoke collection of libraries to solve, you'll end up wasting a whole lot of time on architecture and library selection and not a lot of time on solving actual problems.
Rails excels at being the web layer in this situation. All the heavy lifting is done by the DB to spit back feature structures or do routing and native libraries to do image composition.
That’s not always perfect or suitable for every use case, but it’s not a bad thing.
This sentiment also was a major theme of my forward to The Rails Way.
I’ve been thinking about this stuff a lot in the context of Rust...
Do you mind extrapolating further, or will that be the topic of a future blog post?
I'm, admittedly, out of the loop when it comes to Node, but I do remember Sails looking promising when it was first announced. I recently suggested it to someone (who uses Node regularly) as a possible solution for a project we're working on and they'd never heard of it. So, between that reaction and the fact that I haven't heard of anyone else using it (or anything similar), I think you're right that a Railsy solution never took off.
Elixir is an interesting counterpoint, though. It seems like Phoenix was released and saw broad adoption very early on.
I'm wondering if this dichotomy is a result of where people are coming to these newer languages from: people writing Elixir probably aren't coming from the FE/JS world, but there's a very good chance people writing Node are. Prior to the somewhat recent proliferation of JS client app frameworks, using a smattering of libraries was a very common approach to solving problems. (It arguably still is, albeit at a different level of abstraction in React/Babel/Webpack land.)
Anyways, I'll be looking forward to reading the post you alluded to above, should it ever come together.
But I'd rather spend my time creating business value than researching ORMs, templating libraries and mailers. And since I've never not been able to accomplish something with the ones Rails includes by default, I've never seen the need to use something else.
So now you need to factor in research time. Then, continual research time, every time a new library or version of a library comes out. And if your research turns up that, no, in fact, version X or new lib Y is not substantively better (by whatever metric you're looking at), do you count that research time as 'wasted'?
> how do you know you're not wasting time and effort?
You look at the results of what you're doing vs what expectations were, firstly. You can then, periodically, look at your efforts, and compare reports from others who are claiming to do the same thing, and ... occasionally... spend time determining if a different approach offers radically better returns on the effort/results you have now. Switching to XYZ may also involve huge amounts of refactoring, upgrade, migration, etc. How do you know all that effort won't be "wasted" if new platform XYZ is abandoned 18 months from now?
"efficiently" doesn't necessarily mean "at maximum efficiency". Also, "business value" is almost always intertwined with hitting particular date/time goals, which often trump technical metrics.
That's different than if I don't know that Sequel exists and I blindly use ActiveRecord. They're both ORMs. They can both read and write data from a database. And guess what — ActiveRecord is better for the vast majority of situations and everyone in the Rails community knows it, so my research into Sequel would have been time wasted.
Rails helps you avoid wasting time on this kind of stuff and pre-packages stuff that most everyone needs and where the alternatives are not substantively different.
If you're building a CRUD app (most are), then any popular MVC (Rails/Django/Laravel/.NET MVC/etc) will likely do. If you're worried about "Twitter/Facebook/Google scale" when you're starting, then you're doing it wrong.
And, anyway, Rails is pretty modular; you can rip out and replace anything that isn’t to your taste.
When working with a framework that doesn't make those decisions for you, you end up with two big downsides - you waste time and energy arguing over which of these low-value choices you want to take, and new developers take longer to come up to speed with your particular architecture, since they need to learn each of the choices and how they are integrated, whereas in Rails it's obvious where everything is and how it's configured if you're familiar with the framework.
Bloat is also over-emphasized, particularly for the backend. You'll load the gems in memory, sure, but they're a fairly small footprint on their own and it's not like Rails is calling the parts of the framework it's not using (save maybe middleware, although most of that is useful for most web applications).
It really helps team cohesion for DHH to tell you that you're using X instead of Y as opposed to the most domineering devs getting their way every time. In my mind this even compensates for some suboptimal choices Rails may make.
All people I worked with that had your philosophy didn't so that last part, and it had important consequences for the whole project duration.
I totally understand the desire for a minimal and clean codebase. If I’m not going to use 80% of Rails, why would include it, right?
But in practice, I have found there is basically zero cost to using Rails instead.
I don’t know if the codebase has stabilized but the transition between 2.x to 3.x to 4.x was pretty rocky from my recollection. Hopefully it’s better, since Rails is probably the best framework to get a site up and running quickly.
v2 -> v3 also was the merb merging and a pretty significant rewrite, so it's pretty impressive that we didn't have even more trouble IMO.
Since that time both ruby and rails have stabilized their upgrades significantly. The biggest issue since then was updating to strong params, and that was only an issue for apps with a large CRUD surface area.
These days I think Rails is the perfect balance of stable and flexible for a wide swath of prototypes and apps. The areas where I'd look for an alternative would be web sockets, heavy concurrency (ie. needing more than background workers), or where raw compute is the bottleneck.
Just thought I'd provide some counter data here. I've built small services in Sinatra, which did not warrant the usage of Rails and never had to change anything, having them in fully functional operation for years.
I could have built these little apps in Rails, but I did not need it, never did, and my code/deployment/etc. is cleaner and smaller because of it.
Also these services have always been quite small (a few endpoints or functions), which is what I think Sinatra is best for.
Non optionated means that I can really easily setup the model that I want/need without having any framework in my way. Love it. One caveat: I am a senior engineer 7+ years of experience. I would not have been comfortable having to do those design choices earlier in my career and Rails would have been better suited then.
At the company I used to work for we built our invoicing system's API with it and it was fantastic, plain succinct Ruby with Sinatra, Sequel and not much else.
For public-facing apps that require signup, clever routing, image uploads and other non-trivial functionality, Rails definitely makes more sense.
I think the answer to 90% of these "framework A vs. framework B" discussions comes down to "use the best tool for the job".
The simplicity of these frameworks allows arbitrary changes with minimal friction, patterns, restrictions, and other people's opinions, i.e. conventions.
But that's also the value in it: After you constructed a big enough Sinatra application you understand why and how Rails is doing the things it does. I think that's very useful.
I actually always say that despite the apparent easiness of the micro framwork hello world, you have to actually be very skilled to use them correctly to do anything beyong a few pages. While a full feature framework will make a beginer produce a decent work by default.
When using flask, you have to be able to make decisions about those. Many devs are not able to.
I'm ok with it: not everybody has to be an expert to be a great element in a company. But flask gives those profile a false sense of easiness.
> But flask gives those profile a false sense of easiness.
It allows you to prototype very fast, not everyone needs nor wants the hand-holding that django provides.
Don't get me wrong I think django is fantastic at what it gives out of the box but saying that flask is insecure is just fud.
Also - try Pyramid, you'll never know when it suits your needs https://trypyramid.com/
You see because flask is so minimal, many beginers use it for an easy start, only to rewrite square wheels when the project gets real.
I agree that, should a system get significantly complex, eventually you will want Django; but a lot of projects simply never get there. That's why it's good to have a choice anyway.
E.g : sqlalchemy sessions are very often badly handled. Of course you could write sql by hand, but then you loose the entire ecosystem of blueprints.
Blueprints for models?
Relatively few lines of code that comes with validation, API playground, and defined routes plugged in via the swagger doc.
The main I ssue is having a nice admin page, tbh. Flask doesn’t have one like Django but eh. Good enough I suppose.
After that, I needed to make some microservices orchestration and NodeJS (using Koa as the HTTP server wrapper) was a better tool to deal with all these asynchronous tasks.
But: Routing? Parsing JSON? Storing files in S3? Dealing with databases? Serve some static assets (e.g. Swagger)? Up to you! And good luck finding the up-to-date and standard library for your needs.
Overall, using workers, doing asynchronous tasks (e.g. starting a thread after hitting an endpoint) and coding orchestration endpoints (e.g. GraphQL) was a enjoyable experience where you have almost full control of what you were doing, but I still miss those days working with Rails where the community was so helpful in finding a friendly path to dealing with some common problems. My impression is that it feels less fragmented overall.
I haven't found myself an ORM as good and expressive as ActiveRecord or Sequel. Overall I think it has to do with all the metaprogramming tools you have available on Ruby. That's something amazing to deal with cookie-cutter problems, but also a problem when you need to do more granular control or get out of the typical CRUD problems.
ORM, sessions, auth, administration, form validation, template rendering, API infrastructure, static file management, RSS feeds, ...
If you think your service will ever need more that 2 of these, use a framework. These will integrate well with each other and save time.
Use the solution to fit your problem. Microframeworks for small composable problems.
For some reason rails devs see it as the hammer for every nail, screw, bolt, pipe fitting and joint.
I have developed very nontrivial applications with Modern, which can be thought of as Sinatra-like, without regretting the choice or without implementing a bunch of Rails things. The web application is an immutable spec and defined as such; state is offloaded to dependent services pushed into your HTTP action handlers. Done. But, then, in 2018 (or 2016 when I started its predecessor), "an application" no longer required bashing into it ERB templates or the like, so I'll grant that it's a little easier.
https://github.com/modern-project/modern-ruby
That said, in the Node world I do use Hapi over Express, as it conforms better to the way I think about things.
This is pretty amazing. Both GitHub and Shopify are huge, billion dollar companies running on the original apps made over a decade ago. And they now both on the latest Rails, helping to push the framework forward [1]
I can't wait for y'all to see what we upstream now that we're in a position to give back and improve Rails. My keynote; Rails 6.0: Scalable by Default [2] at RailsConf was just a small portion of our plans for Rails. [3]
There are also work from Discourse on Rails performance, Ruby is getting a Method JIT. [4] and working on more pref work. TruffleRuby is close to 1.0 and it is available on all ruby manager [5]. The Open Source build is now also available on macOS as well.
There are lots more, and all of them were years in making, It took a year for Github to get to latest Rails release. For the past few years, many have been writing off Ruby Rails, Ruby is comparatively expensive to scale ( and it still is ) , we expect other frameworks to catch up in terms of productivity, and will spell doom to Ruby Rails. Not only has such framework yet to appear, Ruby Rails continues to improve on all front.
I say the best days of Ruby Rails has yet to come.
[1] https://twitter.com/dhh/status/1030528476250562569
[2] https://speakerdeck.com/eileencodes/railsconf-2018-the-futur....
[3] https://twitter.com/eileencodes/status/1030461847256875008
[4] https://twitter.com/k0kubun/status/960112559343878144
[5] https://github.com/oracle/truffleruby/blob/master/doc/user/r....
https://www.techempower.com/benchmarks/#section=data-r16&hw=...
Both frameworks have huge communities. The laravel community has seen a huge growth lately. I'm not sure it's an advantage anymore. In fact the popularity has grown in favour of laravel. https://www.netguru.co/hs-fs/hubfs/image1-4.png?t=1535725104...
Comparing php to ruby php is clearly faster https://benchmarksgame-team.pages.debian.net/benchmarksgame/...
I get the feeling that laravel has surpassed rails.
...Why?
If your question is more like "why the hell would you ever want to run Webpack and Rails simultaneously together":
You will increasingly find tools you want to use that more-or-less require Webpack (or a similar JS build tool). Because of things like e.g. the asset pipeline, it's extremely frustrating trying to get those tools to work in concert with each other as micro-services that know nothing about each other. It's much easier to use something like Webpacker so they can play nicely with each other.
You have Laravel for web apps, the Statamic CMS for blogs and content heavy sites, Jigsaw for landing pages, Maizzle as email framework, all using tech and conventions that Laravel devs know. On the frontend they promote Vue and Tailwind CSS across the board.
They actually make it possible for smaller shops or freelancers to have everything under their control. It's basically like a polished Wordpress ecosystem.
If Ruby/Rails is an option, you're sort of baking into the comparison the idea that being expressive at the cost of performance is an adequate tradeoff. Ruby is going to win over PHP on that metric every time. In general, trading performance for expresssivity tends to be good; Rails has succeeded in spite of its performance, not because of it.
[5] https://github.com/oracle/truffleruby/blob/master/doc/user/r...
[1]: https://react-etc.net/entry/microsoft-office-rewrite-to-reac...
Furthermore, I don't see GitHub as a great application for an in-browser state management system. Rich state frameworks are great when you're making an system with a real load of state in the frontend. For example, a spreadsheet or a rich word processor or design layout application. For an application with little mutable user state in the frontend, all you do by using a full-on UI framework is add complexity and introduce a huge state-synchronization / distributed systems problem, as well as introduce the need for complex/hacky server-side rendering workarounds for users, snapshots, and search engines which don't have full runtime capability. Using React on your blog is almost certainly a mistake and using React for GitHub feels like it's right on the edge of being one as well.
IMO people are still using rails because a bunch of orgs moved to it from Java years ago, or started with it after some successful hackathon. It's in wide demand because a large number of orgs mindlessly (or mindfully) chose it long ago. Basically all enterprise/large company apps I've seen have been in either Java or Rails. Some places are still using COBOL. Some places are still maintaining/starting codebases in COBOL. I assume that people will be able to make this same argument about NodeJS in ~2-5 years.
Also, the the point about micro-frameworks being bad being made in the comments because you eventually re-implement rails seems to be wrong or badly articulated -- that's exactly the point of using a smaller-yet-composable tool, you don't use any parts until you need them. Sinatra has also leaned into this by allowing pieces of rails to be loaded, and providing a path to transitioning to Rails proper.
I dislike rails because there's too much magic, and too many ways to do things -- it's precisely why I like micro frameworks. Also, the (request, response, next) middleware/handler paradigm is the most composable way to write server software I've ever seen.
I get things done faster and more maintainably (for future me and other devs) when I do it in rails. Hopping into apps that rely on (request, response, next) always hits me with a learning curve every single time I come back to em, which gets worse as complexity rises. It could also be that I'm very bad at thinking in terms of pipes and need to practice that more.
I also find that in rails, there really aren't _that_ many ways to do things. And, in general, apps that age gracefully always figure out how to phrase their domain concepts through the smallest restful url's/resource mappings they need. There's a lot to be learned from the approach the smaller micro frameworks take, and you can get the best of both worlds in a lot of ways.
Rails performance relative to JVM+Scala+Play is tricky to measure but the closest thing to a decent benchmark I know of is this: https://www.techempower.com/benchmarks/#section=data-r16&hw=...
My own experience at ChartMogul with building production services in Ruby, Go and Rust is that the overall throughput of REST API type services increases a disappointing amount.
With JRuby you get to retain all the benefits of the Rails ecosystem. Most of the Go and Scala community is driven by much larger companies who do open source libraries but they don't really build frameworks to help developers build software quickly.
I did a cursory google search and found:
https://stackoverflow.com/questions/29697787/rails-call-same...
More generally, my point was that smaller libraries have less space for multiple ways to do things/overlapping concepts. In the codebases I've worked with, I've found myself questioning whether to use one specific rails concept or the other and the resulting "right" choice seemed arbitrary -- like whether I should make a controller mixin or create a helper.
For example, if you look at a framework like sinatra, the smallest/simplest thing you use to respond to a request is just a function. How to use functions properly is pretty clear, there's not much else to debate over.
But people that can do it and make it easy for the team to scale are unicorns.
I've yet to meet one that stays on this kind of missions for long because they get a better offer, leaving the custom project to people without the skill to manage it.
And if you think all that is easy, you are not that unicorn because you don't have a perspective going beyong your code files.
I think the increased productivity, beautiful language that rails is pushed everyone in the right direction, I just personally think stopping there is a bad idea, and that while rails is great it's not necessarily the reason it's in widespread use.
I didn't see any mention in the article of comparing install rates for rails versus other platforms (since of course this info is hard to get) -- and there are tons of rails-ish software out there (django being a huge one). If django had been the thing to break through and rails came after I think the roles would simply be reversed.
This was a common complaint about Rails years ago. What are the "magic" parts in current-day Rails that you dislike?
(I disliked the dynamic finder methods, e.g. find_by_city_and_state, which you would now do using arguments to where(). I also disliked the default routing which made every public controller action routable, if I remember right. Those are now either deprecated or removed.)
I haven't even looked at Rails 5 or worked in a recent Rails 4 codebase so I'm sure things are much better but the code I remember the feeling of being perplexed so often at how a worked in previously wasn't my own so I can't go back and remember what parts really made me angry.
Disliking Rails’s built in abstractions seems to come down to only liking abstractions your own devs created which sounds like not invented here syndrome.
The author has no idea what they are talking when it comes to the alternatives.
I was making simple CRUD apps in Phoenix (the types of apps I would normally use rails for) for a year before I even looked at OTP. You can become productive in elixir and Phoenix very quickly especially if you come from a ruby/rails background.
I recall a blog post by dockyard where they said they had new hires making commits within the first week.
When I was learning Phoenix, I spent a substantial amount of time learning Elixir as well and OTP is one of the first few things they put in front of you. Don't get me wrong, I loved learning about it personally, but I am not surprised that a lot of people would consider it too much effort.
PHP works fine. COBOL works fine.
Nobody ever said Rails doesn't work. Or doesn't work fine. That's a straw man.
It's just that Rails, and Ruby in general, is in clear decline. Not just because some new flavor of the month frameworks are coming out, but because a lot of the concepts Rails supports are antiquated, and Rails hasn't shown to be that adaptable to more modern front end trends after years of efforts from DHH.
Hell, I'm sure that even DHH himself would be very upset if people settled for something that "works just fine". He's just not happy that this time around, that characterization is being used to describe his creation.
I actually see Rails as a framework that has managed to keep up with the times better than most. Django, for instance, has aged less well than Rails imo.
2) "Rails hasn't shown to be that adaptable to more modern front end trends"
Would you mind elaborating? What Rails concepts are "antiquated", and what "modern front end trends" does Rails not adapt to?
I've never done any Rails development, but understand the general idea of how it works, so I don't have any skin in the game. I'm just honestly curious about what you were referring to.
Can you provide some examples? Rails is quite forward thinking when you consider Action Cable and upcoming Active Storage.
And as for Action Cable, I hear anycable.io can give you a performance boost if you need it. I've used websockets in both Node.js and Java Spring and although it's awesome for some use cases, a majority of apps will never reach for it. So this is a good example of Rails focusing on things that will help most people without trying to cover every tool that everyone will ever desire.
As for modern front end trends, Rails is getting better in this regard, especially since 5.0. Most people typically have a separate frontend and backend codebase anyways, so in that sense Rails API is all you need, and that's baked in now.
[Citation Needed]
In my experience the demand for rails has only gone up within the last few years and rails is only getting better.
> Rails hasn't shown to be that adaptable to more modern front end trends
You clearly haven't been keeping up with rails .. Rails now integrates seamlessly with React, Vuejs,.. and has built in support for yarn and webpacker .
In addition, with the introduction of ActionCable, you can have websocket integration as well with Pub/Sub.
All in all, Rails remains a very mature, robust framework to build your business on.
Not apples to apples but I don't see the decline in Rails. I would say that I definitely see fewer job postings for Rails work overall and more for separate backend and React work.
For comparison here's the one for express: https://trends.builtwith.com/framework/Express
PHP suffers from an abundance problem where programmer opportunities are concerned. There are a lot of “PHP” developers with skill levels that are highly variable, from Wordpress devs to really hardcore programmers.
For a while Meteor seemed to be that framework, but for a number of reasons — performance issues, lack of support for SSR - it hasn't taken off. While it's often good practice to separate the API and the frontend, for solo developers or small startups that's often overkill and adds complexity.
Of course you risk making monoliths with this approach, but like I said I'm primarily looking for something that makes it easy for solo developers or small teams.
It ships with webpacker and can generate a scaffolded React, Vue, or whatever-you-want app.
Approaching 1.0 it’s the most unique approach to the problem I’ve seen.
We’ve all seen the video where the Erlang guys live update the code on a telephone switch without closing any of the calls that are on-going.
Elixir runs on the Erlang VM.
Does Drab support hot code reloading? Does it handle modifications of templates without breaking existing client sessions?
With Node+NPM you basically can take what you need and leave these bloated things behind.
But I have to admit, I've worked on many projects where devs build their own bloat with many small modules.
I try really hard not to use too much third party stuff, but am happy that I can easily add them if needed.
If only they had come out with routing baked into the project, and react baked in. They would have survived. None of this "we support 29 different routers but zero documentation on how to integrate it with meteor."
Now it's dead, used only by legacy apps or tinkerers. No real mass use applications are being written with Meteor these days.
Once Rails projects get beyond a certain size though they start getting exponentially more difficult to maintain. My sense is that Node is going to surpass Rails by sheer brute force eventually. When I work in JS now I'm just amazed at how much better the tooling and performance is than Ruby and ES6/7 is overall a pretty nice language to work with. And having something like Typescript is essential once a codebase gets big enough.
- Oh wow this framework looks great I wish rails had that. I am gonna try and use this when the opportunity arises
- Aha this is the perfect project for that framework I saw
- hmm how do I do... Oh. Well I guess I'll just build it myself.
- This plugin is the equivalent of paperclip, perfect! Great DSL, great documentation. Hmm what is this error. 3 hours later github issue time.
- Turns out this wasn't the right project for me to try out this framework, maybe the next one.
- Oh rails n+1 is out can't wait to try it
You don't need to learn OTP to become productive in Elixir/Phoenix. It's abstracted away from you, but also gives you the ability to dive in if you want/need.
Erlang has been around for 30+ years...there’s a lot. Doesn’t mean you need to use it all.
It's like saying you can build a Rails app without understanding classes/objects - sure maybe you could throw something together because the tools are so friendly, but you would get lost pretty quick when trying to do something on your own. Learn those basics up front, and you can get a long way without having to delve into more advanced topics.
Similarly, while I'm not a huge fan of ORMs im general, ActiveRecord is pretty hard to beat pound for pound.
I don’t use rails regularly anymore, but I used it long enough to appreciate what it gives you. As long as developer efficiency and time to market is more important than than micro performance optimizations, Rails and other options that emphasize developer efficiency will continue to succeed.
Unless you’re in an established enterprise environment, that is generally going to be the story.
This is false, you do not need to know OTP to be productive.
These days if I'm forced to work with Rails, I almost always write functionaly-kinda-ish Ruby code. Elixir sold me heavily on the idea of one input in, one input out and all the other good that comes from functional programming.
I probably no longer write idiomatic Rails code (40 methods in a ruby model).
In my opinion, OTP is not the reason why the learning curve is steep. If anything, the learning curve is steep for those trying to switch from something like Ruby to a functional programming language for the first time. A language with immutability as the default, no concept of classes or objects (though viewed through the Alan Kay lens, processes could be seen as "true" objects). If it is your first FP language, most of one's object-oriented experience is not going to help, so there is a lot to absorb before you even get to Phoenix or OTP.
processes, messaging, supervision
Spaghetti code is no fun, but you can still write that same style today in .erb files.
Even when I was programming primarily in rails in it's hay-day (2010 - 2013), I was always swapping out my inefficient AR queries with just custom SQL. I am generally a "performance doesn't matter that much" kind of guy, especially when people try to micro-optimize, but one place it matters a lot is with your data. These days I just go straight for SQL and save myself a lot of trouble. There will always be impedance mismatch between your data store and models, and ORMs in their ambitious attempt to serve every use case, at times, generate some really inefficient queries. ORMs really like to stay within relational SQL databases as well, with half-baked support for a couple NoSQL stores like Mongo, but then get into Cassandra or Dynamo territory and they are useless.
Ok I'll bite:
- Because it had it's milkshake drunk by nodejs which has better support for modern front end workflows and great languages like typescript built in top of it. And is faster and better supported.
- because it's slow and difficult to scale
- because it has years and years of baggage
- because I prefer elixir it golang or rust or Scala
- because it's not a perfect fit for every project
- because I do not like stateful object oriented languages with magic so I can trust my intern and Jr devs to write something decently maintainable
2. It's not any more difficult to scale than Node, you'll just need more servers to handle the load. Horizontal scaling works basically the same for both platforms.
3. Well understood baggage is better than baggage only a handful of people in your company know about as a result of your custom web framework.
4/5 of course nothing is a perfect fit for every project and everyone has their preferences, but this can be said for any language or platform so it's sort of a non argument.
6. Good luck finding interns and junior devs who can be productive writing in some esoteric functional language.
extend ActiveSupport::Concern
attr_accessor :foo
class << self
included do
def method_missing(name) do
define_method(:after_save) do |bar|
...
end
end
end
end
What do you mean? This stateful, first class mixin OO metaprogrammed magic, implicitly globally mixed in to your application, makes it super easy to understand the flow of your application and the capabilities of your system. It's also super easy to see where things are defined, and the structure of methods/classes/object doesn't depend on luck / the order your program _executes_ in! Fat models are the way to go, there's obviously no problem with stateful mixins to "separate" model logic and make sure your model can do absolutely everything, because what is data, really?Perfect for junior and senior devs alike.
edit: I forgot to include `method_missing`, which definitely isn't a design flaw, and there's absolutely no fundamental community problem that Ruby developers don't see any problem with using it.
It was released in 2004. Youtube and twitter didn't even exist then. The iPhone and Android were still 3+ years away, which means mobile internet as we know it today wasn't around then either. ROR has been around the block.
Rails' biggest problem is that it isn't JavaScript, and thus code is not portable between client and server.
The GIL in CRuby means you need one process per core but that's also true of NodeJS.
Processes and threads aren't as different as you think. Linux pthreads are "just" processes which are allowed to write into the same memory. PostgreSQL remains process based to the day, although it does give them a little pain.
I've been using Node.js/React together for a while, and I haven't found code reuse across client and server to be as important as I initially thought. The only code that I've tended to share is validation and a handful of utilities, which are a tiny proportion of the total, and even for those the business rules aren't always the same.
I've also found it useful to have TypeScript on client and server to be able to share types between them.
Also, when using React, Node on your server makes server-side rendering a lot easier.
Are you being serious?
It always occupied a strange niche between stuff like WordPress and SPA/PWAs (sinatra+front-end fw)
Wat?
I'm being facetious but then I feel like this whole thing is a joke, so it's kind of fitting.
The people want postgres, give them Postgres.
You can also use something like Firestore if your backend is primarily a place to store data. Combined with e.g. Next.js you can develop quite quickly with it.
This. Rails is perfect for fast development of CRUD in MVC, but if you're building anything complicated, you need something that supports more options than MVC. People can laugh at PHP all they want, but a framework like Symfony runs circles around Rails. You can do both simple and complex in it. I haven't tried Hanami yet, but while the frameworks concept seems much more promising than Rails, it's community is much smaller.
Still Rails is very populair, also here on Hackernews. Probably because the things we need to do in real life are actually not that complicated as we often make them out to be.
Ok Which circles, specifically, does Symfony run around Rails?
But rails can be more fun.
I agree that Rails enables a lot of messes, but I don't think the solution is to make your framework prescriptive about every single detail. I'd rather have the flexibility and enforce some standards per project than expect the framework dictate everything, because once you hit scale you have to do your own thinking and architecture anyway.