by noobermin · 2y ago · 0 comments
I once worked on the integration of an existing Rails app into an existing C# webapp (both living side-by-side, kind of a split-application thing, but seamless to the end user). It was almost hilarious how many LOC the C# teams (!) were having to write for every LOC I (alone) was writing in Rails. Looking through their diffs, it seemed like they were reinventing fire compared to me writing `render :success if SomeModel.update(model_params)`.
Rails simply does more for you out the box with just a few macros.
More like 50-100x.
In regular "line of business" code this difference might be a bit difficult to see in between the calls waiting for DB and third-party dependencies, so I went with more conservative numbers. On the more complex code this difference will be totally observable.
For this set of teams, at least, their code wasn’t very performant because it took 3 months to get from Jira ticket to production. They were always getting themselves tied into knots about how to handle rollbacks across their nine microservices required to change a birthday.
Meanwhile, I’m in my corner with my nice little monolith that could read data from their database easier than they could read it.
I personally got tired of the monkey patching, ActiveRecord's proclivity towards n+1 queries, and complete lack of types / static analysis, among other things. Having to keep a mental model of the types of the entire project, and having to write tests around types takes up a significant amount of my headspace, energy, and time. The older a project gets, the more of a headache these things become. There is an element of "just write better code" to avoid these pitfalls, and that works to an extent, but the older I get the more I realize that the tooling does play a large role in the outcome.
A lot of issues in and with Rails code leans heavily on this idea. It often comes in other flavors like "You can write rails apps that perform really well" or "Its perfectly doable to write a clean easy maintainable codebase in rails".
And is apparent in the "Provide sharp knives" doctrine as "And by capable, I mean knowledgeable enough to know when and how, accordingly to their context, they should use the different and sometimes dangerous tools in the drawers."
I really dislike this approach. I don't want something that is full of foot-guns and therefore requires me to recognise them when I lack all information to do so.
I've written terrible Rails apps, exactly because it allowed me to so, and I didn't know they would become terrible, until they were. I now recognise the (design) patterns that are foot-guns, I now know the tell-tales that show me where the sharp knives are dangerously placed. But then I get dropped into a Rails codebase that has seen 20+ developers coming and going over a decade, as the 21st developer, and I see it filled with these footguns and dangerously wielded "sharp knives". Often there's a lot of history apparent from these previous devs who saw this too and fixed some of it. But the overall state is still abysmal.
Sure, it's all these devs that made it abysmal. But the ecosystem, the framework and the language allowed, and sometimes even encouraged them to make it that.
It's true that monkey patching is a problem. I hear you. It's more and more problem of the past though. People realized it's too sharp of a knife and stopped doing that.
At work I have been using Ruby for longer than rails has existed. In those days there were lots of neat uses for Ruby (one of the most interesting being at NASA), but none of us knew if it would ever catch on. We didn't care -- Ruby made programming _fun_, and we were happy to use it even if no one else ever did.
It was partly the language that made Ruby fun but also the community. And it's out of this community that projects like chef, puppet, shoes, etc. were born. Matz has called Ruby human- oriented programming, and I can think of like that is human- oriented than community.
EDIT: also cocoapods
People adopted Ruby because of Rails.
Another more adopted Ruby software are probably fluentD and maybe Jekyll. The rest kind of comes and goes.
Majority sys-admin toolings have always been dominated by Python and with k8s hype, some of the toolings have been geared towards k8s automation written in Golang.
In general, sys-admin toolings are a mixed bunch: perl, shell, python, ruby
1. React burst on the scene in 2014
2. the hyperscale FANG companies were dominating the architecture meta with microservices, tooling etc, which worked for them at 500+ engineers, but made no sense for smaller companies.
3. there was a growing perception that "Rails doesn't scale" as selection bias kicked in - companies that successfully used rails to grow their companies, then were big enough to justify migrating off to microservices, or whatever.
4. Basecamp got caught up in the DEI battles and got a ton of bad press at the height of it.
5. Ruby was legitimately seen as slow.
The big companies that stuck with Rails (GH, Shopify, Gitlab, etc, etc) did a ton of work to fix Ruby perf, and it shows. Shopify in particular deserves an enormous amount of credit for keeping Ruby and Rails going. Their continued existence proves that Rails does, in fact, scale.
Also the meta - tech-architecture and otherwise - seems to be turning back to DHH's favor, make of that what you will.
- While most 2nd or 3rd tier tech companies don't need Google scale infrastructure, SOA in Java/C# and then Go is incredibly prevalent. Many teams never had a reason to even look at RoR and its considerably worse language and runtime.
- Good ideas from RoR were copied by pretty much every ecosystem; again, most people never wanted Ruby in the first place.
- Plenty of small web shops simply stuck to PHP.
The number of hi-tech companies that grew from 37signals size to Uber size have also increased due to various reasons: SaaS becoming more and more accepted, WallStreet loves SaaS, and in general just more investment money in the market.
The other day, I was exploring Next.js and the number of features, possibilities were astonishing to me as someone that's pretty anti React. I do Svelte[kit] but it isn't there at all where NextJS is especially when paired with Drizzle and auth.js topped with Shadcn/Material UI/Ant Design, a skilled craftsman can crank out apps as fast as it would be for a Rails developer if not any faster.
Unfortunately, the cognitive load that comes in JS ecosystem is mainly at three levels:
- Understanding the packaging (npm, node_modues, CJS/MJS)
- Understanding the bundlers (webpack/vite/Rollup)
- Understanding the transpilers (Typescript, Babel, Less and Tailwind lately)
EDIT: Typos
Maybe you don't hear the constant clickity-clack of endless change as a result. Also true that Ruby's most popular in writing web apps and services, where it and Rails continue to shine.
webdev FWIW is a ginormous part of this little internet thing. You know, those Web-based applications and services that run the entire global economy and human society, such as it is.
Both languages emerged in the early to mid nineties (together with Python and a few other things). But Rails was much later than that. Now the demographic of the typical Ruby/Rails developer that got into Ruby about 20 years ago straight out of college is a forty something. Still relevant but a clear minority relative to the mass of developers that came after that grew up on things like Go, Rust, Node.js, etc. And of course Python made a comeback because of AI. So, you now see a lot of relatively young people doing a lot of stuff in Python that wouldn't typically be exposed to any Ruby.
I always looked at python and ruby as similarly capable scripting languages. With python a bit more oriented towards people who were simply looking to get shit done perhaps and ruby more geared towards computer science types obsessing about things like meta programming. A lot of that crowd moved on to other languages.
Ruby so far hasn't had a comeback movement like Python. Lots of people still use it of course but it's not an obvious choice to people that haven't used it before. All the AI stuff sort of flew by it. People do a lot of stuff client side these days which makes view oriented frameworks like Rails less relevant. Though with the server side rendering come back there is still some relevance of course. But that's more of a performance optimization that came out of the node.js community. And of course Rails inspired a lot of other frameworks for different languages so its unique selling point kind of went away.