It's the ultimate irony reading statement like these, when ruby powers some of the largest web applications on the web today and handling millions of users and requests.
Github, Gitlab, Shopify, Stripe, AirBnb, Crunchbase, Dribbble, Kickstarter, .. etc
I'm not sure how many more are needed for this meme to die. Is ruby perfect? absolutely not, but to neither is any other language. You will always have to tweak things regardless of the tool you chose, because scaling is difficult.
With some technologies, like Erlang/Elixir, scaling is almost effortless though. Only the deployment platforms with very strict boundaries like Heroku make it pretty much impossible to shard and distribute load. With most VPS-es you just share one file between them, introduce a well-setup VPC, and you're done, your servers are distributing load and you spent like an afternoon on it.
Additionally, with very fast languages like Go and Rust (even Elixir but only on I/O bound projects, which is like most of them?) you delay your scaling measures that far in the future that most apps never even need to grow beyond one app server and one DB server, and the team never actually even thinks about scaling at all. Because let's face it, most apps will never exceed 500x - 5000x reqs/sec. A well-made Phoenix web app or API gateway easily achieves 500 reqs/sec even on a Raspberry Pi 4.
I used Rails for 6 years and deployed it on Heroku, company-rolled Dokku setups, AWS EC2, DigitalOcean droplets and GCP -- usually servers in the range of $25 - $100 per month (I usually work for small or medium-small businesses). I hated that beyond 10-20 reqs/sec we had to start beefing up the server or add others. It's just how Rails (or rather, ActiveRecord) is: very inefficient, optimised for human productivity, and to hell with machine resources. Many business still like it though and that's cool with me. They don't mind a mean response time of 300ms with the minority of responses (95-th percentile) going to 2500+ ms.
> Github, Gitlab, Shopify, Stripe, AirBnb, Crunchbase, Dribbble, Kickstarter, .. etc
I wish for that meme to die. Bigger players using it means absolutely nothing except that they have the budget to keep working with Rails even after it showed its warts (hard to maintain when the project grows and big hosting costs being the top 2).
Smaller players like Basecamp have very stringent policies on how to work with it. I've seen local companies utilise similar techniques mostly successfully. More power to them. I know it can be made to work with the right management techniques.
Half-related: do remember that Facebook preferred to make a PHP runtime and maintain it, as opposed to actually train programmers to use another backend language.
> I'm not sure how many more are needed for this meme to die.
You might call it a meme. I call it "I tried for years and eventually got frustrated and moved on".
Nothing against Ruby or even Rails. But they make me think of scalability much, much earlier compared to a "slow" dynamic language like Elixir (even though it maintains predictable lag even under very heavy load... and its Phoenix framework mean response time in identical setups as the Rails projects is between 5ms to 30ms).
Let's not even introduce Go or Rust web apps in this picture. If made well (although that takes much more effort than Rails or Phoenix so for me their human productivity tradeoffs aren't worth it!) they can easily serve anywhere from 5_000x to 30_000x reqs/sec on the cheap business VPS-es ($25 - $100 a month). In all fairness, those had to use a bit more expensive DB servers though ($250+) because the cheaper DB servers couldn't keep up with the demand.
when you start to learn a new programming language, you look up what people are doing. ruby let programmers write incomprehensible and unfriendly code. my experience is that it has been a huge turn off for beginners. there was a rush to make popular websites in the rails era, but that ended quickly.
as another example, cpp used to be a cool language to read and write in. they even taught it as first programming language. since then, they added some crazy stuff that made the language very unfriendly when put in the hands of some people. it is now very beginner unfriendly.
the syntax of python will remain a great inspiration for readability if they don't make the same mistakes. it always amazes me to see people from all levels read python the first time and get it.
Oh please. I like python and use it a lot, but it's readability can be awful.
Constructs like 'delimiter_string'.join( list_var ) may have logic behind them, but the readability for someone accustomed to OOP paradigms is backasswards.
Comprehensions are quite powerful, but ironically they're nearly incomprehensible.
Lambdas are a sad sad attempt at closures/anonymous functions.
There are many conventions in python made early on that have not aged well in regards to readability.
I think python had already crossed that bridge, at least for webapps and ml (albeit not at the syntax level). Consider what you must bring in for a real webapps deployment: virtualenv, uwsgi, celery, nginx, at a minimum, probably rabbitmq for many apps. Deployment is a nightmare.
For ml, you'll need to pick your library, version it correctly (some ml models are even firmly stuck in python 2.7), probably manage it all in conda if you are testing different models, since your source is bound to different tensorflow/pytorch/python/cuda version dependencies, and deployment is a nightmare.
Maybe I'm missing some python best practices due to the places I've been (django/angular shops that don't write tests) but ultimately I think this is Not very beginner-friendly at all.
Packaging is a known pain-point in Python and does make the language less approachable. But beyond that I don't understand your criticisms. uwsgi, celery, nginx, RabbitMQ are all useful tools that are oftentimes used in web applications. What language are you using that magics away the need for tools like these? All these same tools or their equivalent still exist in the Rails ecosystem.
I don't have much hands on experience with ML, so I guess I can't comment on that. Is there something about Python that exacerbates the issues you've laid out?
If I had to rank learning difficulty I've found various languages, I'd say Ruby was the easiest one I've ever encountered. It's very consistent, everything is an object, it's flexible and you don't need to learn anywhere near all of it to become productive with it.
Python is fairly beginner-friendly too, but it's less consistent, significant whitespace leads to a certain class of mistakes that are maddening for a beginner and at least when I used it pip was nowhere near as nice to work with as gems and bundler.
Both are much easier than JavaScript or anything where you manage your own memory, though!
I so much want to agree with you here but I can't. 99% of all business people I've ever met are all about "Alright! We got the perfect idea! Let's have the first iteration done next week!" -- has been the sad reality of most of my bootstrapping conversations. Even if they aren't a young-ish enthusiastic bunch they still are going to go to whoever promises them the fastest delivered MVP.
IMO to this day Rails is a big winner in the MVP area -- although I will immediately agree that nowadays there are no small amount of other technologies that can give you a pretty good-looking and well-working MVP (mostly in JS land I think). But a lot of business people just managed to memorise that Rails is the way to go for MVPs. Their mind isn't easily changed. Now those several whom I talked with in the last 1-2 year were like "yeah yeah, you techies always chase the newest thing" -- and sadly they are often correct. So the hope of breaking free from Rails' "monopoly" on making MVPs looks pretty slim lately, to me at least.
I fully understand the business people's desire for things not to change often. But they vastly overestimate the viability of most of the tech out there. Or maybe it suits their bias. No clue.
But, man, the Python import system is so vastly superior to Ruby's "invisible distributed magic" way of handling the same thing.
The sad part is that there is no reason a good language could't have the good parts of both languages. But here we are...
Python 3 is a much better language than Python 2. More consistent and much better designed.
I miss the Ruby standard library though. All those string, array and hash methods make things so easy. I often get stuck looking for Python equivalents.
> The sad part is that there is no reason a good language could't have the good parts of both languages.
There is: backwards compatibility. Most of the time it's impossible to fix a language because the result would be two different languages that have the same name. Python broke compatibility with version 3 and it is still competing with version 2 to this day. Ruby also did the same thing in version 1.9 but thankfully the scale was much smaller.
As such, you'd gut large parts of the language if you stopped evaluating code on require.
# a.rb
class A
end
# irb
require 'a'
Object::A.new
All code evaluation modifies global interpreter state. Honestly it's not much better than the C preprocessor's #include directive.A better design: files are always evaluated with a clean interpreter state and they can return values just like methods.
# a.rb
class A
end
A
# irb
a = require 'a'
a.new
This makes all state local to each script by default. Users will only have access to the returned value which can contain anything or nothing. If a module needs to modify existing classes, they could return modules that can be mixed in or metaprogramming methods that perform the modifications when called with the targeted class as parameter. Perhaps existing classes could even be passed as parameter: require 'extensions', Object, Kernel
Of course, these changes would break compatibility with all existing gems. The result would be a completely different language that happens to also be called Ruby.Most modern Ruby code avoids monkey-patching "unasked" unless that is an explicit purpose of the project and using the gem is explicitly "asking for it" in the first place. Providing modules to include or making you explicitly call methods or explicitly require files documented to do optional monkey-patching has been the idiomatic way of handling it for years.
Adding the ability to explicitly provide guarantees that the required code is sandboxed might be useful and might particularly help tooling reason better about the code, but it would have quite little practical effect on most modern Ruby.
Hi btw! Just now noticed it's you. :) Was thinking to write you an e-mail very soon. Which one do you prefer?
> Hi btw! Just now noticed it's you. :) Was thinking to write you an e-mail very soon. Which one do you prefer?
Sure :) Same old e-mails (also on my HN profile page).
I mean, Javascript's modules also are dynamically executed and then returned as a singleton module object (also cached, so only the first require actually runs the code before the module export). This means you can make a module which requires other modules and monkey patches methods inside them (this is how mocking actually works), wrecking havoc amongst all other dependencies, but library authors just don't.
Personally, it's a bit puzzling to me why the ML community ran with Python and why there isn't a popular alternative for Ruby. It's very capable in terms of making DSLs.
My hunch is that the number-crunching libraries were better in Python (numpy etc).
1. NumPy is really fast and has a lot of features. Even if they don't need all of them they feel more at ease knowing that they can use them should the need arise.
2. Python is very familiar to them, their professors know it, they know it, it's easy to teach to new people in the team so everybody just goes with the flow.
As much as I think the bigger IT area is in a desperate need of innovation... I can actually agree with those two points. Tinkering should be left to us the programmers and sysadmins. Everybody else has a job to do and they cannot and won't spend a lot of time evaluating all tech possibilities.
That's okay. It's our job to tempt them with something irresistible. :)
Maybe the watershed moment was when MIT switched from Scheme to Python? I don't know.
It's 1995. Python has been around for 5 years. Guido is working with the scientific community and adding better complex number, array, and matrix support to Python. Ruby has just started and everything is in Japanese. Scientists and Engineers at US universities and FFRDCs (Federally Funded R&D Centers) keep plugging away at Python for scientific purposes. Finally in late 2000, the first book about Ruby is published in English. Ruby is still pretty unknown. In 2005 Rails hits the scene and the English-speaking world notices Ruby. But this is 10 years after the scientific community starts investing in Python and 15 years after the Python language came out. By this time, the community had Numeric, numarray, and finally NumPy to unify their efforts.
Ultimately, Python's BDFL started working with the scientific/numeric community before Ruby existed. It would be 10-15 years after Python that Ruby would start making inroads in the English-speaking world and by that time there was already good numeric/scientific tools in Python. Scientific communities weren't looking to learn new languages for the sake of new languages. Many still just use MATLAB.
MIT hadn't switched to Python when a lot of this happened. I think it's more that Ruby wasn't widely known to exist until 2005 and was "brand new" to the English-speaking world then. Python had been plugging away at numerical libraries for a decade by then and NumPy (which had learned from previous numeric/scientific libraries) came out basically when Rails came out.
Once all these numeric libraries exist for Python, are you getting grad students excited to work on an open-source numeric system for Ruby? Are you getting FFRDCs interested in creating libraries for a language that's quite similar to Python without any significant advantage? How do you justify that work? How do you get people excited about it when the reaction of most users is going to be "we're already happy with what we've got"?
Rails burst onto the scene at a time when people were often unhappy with their tools. Rails was a breath of fresh air with clean separation of concerns and a lot of helpful stuff. This is back when Java meant XML sit-ups, C# was closed-source and this is before most of what the community knows today existed, Scala had just appeared, Python was still in the Plone/Zope era (remember when an object DB in Python seemed good?), PHP was pretty dominant but often ended up a mess and didn't have the same framework that Rails was offering. Rails offered something compelling and new which meant attention. Many other communities followed Rails - Django, .NET MVC, JAX-RS, etc. Still, Rails was there first and got a lot of mind-share.
Similarly, Python was there first in scientific/numeric computing and people haven't provided enough to compel people to move off it.
At the same time, I saw no substantial interest in persuing the same dedicated effort at the same scale in any other ecosystem. Rails was what everyone did in Ruby (aside: recalling that the ffi changed between 1.x and 2.x and it wasn't a trivial API change, and how the only documentation seemed to be the code, would have broken any prior work... I can't imagine putting long-term effort in this direction), java and jvm hosted languages didn't seem to gain any traction from users for these problem spaces (maybe the inability to easily dynamically allocate more heap on demand in user code made this unfeasible?)
Looking back I think the fact that numerical work has found success being built on a huge foundation of stable libraries that are glued into a dynamic interpreted language and which is then often treated as a finished artifact, I can't think of another major language that is more appropriate than python.
Specifically relative to Ruby: at its core Ruby is matz's place to experiment about ideas in programming languages. If you are going to build your business around a few million lines of glue code that relies on the internals of a language, you want to have strong guarantees about the stability of what you're building on.
Looking back I think the python 2 to 3 transition period actually made this better for python by providing a very stable foundation in python2 while experiments and destabilizing changes were mostly pushed to 3, which kept ahead. When finally transitioning to 3, the needs of the scientific python community and ecosystem were so well known and represented that it was unlikely to simply get forgotten, left out, or left behind.
edit: Which lines up with my recollection, Ruby was synonymous with Rails and web dev while Python wasn't type cast yet.
But I believe (can't prove) that you are correct on the outset: some big org switched, then a lot of people went like "oh well, Org X can't be wrong", and the rest is history.
With the scientific python stack you entered a new world with unlimited seats, you could at least try to run the same experimental/exploratory code with minimal changes in a production environment, etc.
So in short it didn't need some tentpole user/customer/exemplar. In almost any situation it was free and it started making money as soon as it was downloaded installed and run.
I vaguely recall that Python documentation was generally much better at the time, and especially so the parts on writing extension modules. With Ruby, it felt like the English reference docs were largely an afterthought - you pretty much had to get a book on it to get far, and the more advanced sections (like extensibility) were especially lacking.
After a few different options such as Octave, numerical computation in the free software space coalesced around Python.
The Python ecosystem - it's change and release processes (PIPs etc) - thorough API documentation - make for a good target language, over other languages that simply do not have that infrastructure.
I don't know what the state of Ruby documentation is these days for instance, but back in the day, it was simply incomplete.
>It's very capable in terms of making DSLs.
Which is a double edged sword. Too many DSLs means you have to learn and remember a lot more to write code.
ISTM (supporting a system written in Ruby at the time) that a large number of the libraries were broken when used in concert with each other -- and that language experts knew how to monkey patch their way around these issues, but didn't bother documented these fixes.
I've been told that things are much more mature and stable now -- but that experience put me off the language.
I am not trash-talking that phenomena but I also found it off-putting and eventually moved away from Ruby/Rails after 6 years with them.
This is why I opted out of Ruby. Feels too much like macros and C++ templates. I just don't want to be that smart.
I keep going back to Bill Joy's goal of enabling working both in the big and in the small at the same time.
Mid 90s, Java was logical step from C-ish towards Scheme-ish and Simula-ish (SmallTalk, Self). I could focus more on design and less on wrestling the compiler. Much progress since then, in Java and elsewhere.
But I wish language (and stack) designers also removed features. Cull deprecated stuff. More generalizations. Fewer primitives. Fewer classes. Etc.
That was probably ~80% of why I opted out as well (the rest ~20% are mutability and bad parallelism story).
> Feels too much like macros and C++ templates. I just don't want to be that smart.
I don't even view it as being smart. It's more like a specialised area of expertise that you need to grind through in order to be productive, and even when you're an expert it's still error-prone. Turns out though, a lot of other tech doesn't require that so, like you, I moved there.
> I keep going back to Bill Joy's goal of enabling working both in the big and in the small at the same time.
Admirable goal. I try to do the same but it's not an easy thing to achieve. What language would you recommend in this area?
> I could focus more on design and less on wrestling the compiler.
Depends what you mean. I am very okay to fight with Rust's compiler because that way I know I won't have dangling pointers or references and will not inadvertently try to modify the same piece of data from multiple threads. I am also very okay with fighting with OCaml's compiler because I often found myself not thinking properly about the types of my code.
But in C and C++, yeah, there the fight is kind of just "please compile and leave me alone" and it's not that much of "it's compiled, therefore you get guarantees X and Y".
> But I wish language (and stack) designers also removed features. Cull deprecated stuff. More generalizations. Fewer primitives. Fewer classes. Etc.
Absolutely! I wish more language designers/maintainers had the courage to do this. They also don't have to do it in a breaking way; they can just extract the deprecated (and removed) functionality into an optional dependency that people can use if they are so hell-bent on not using the officially sanctioned way from version X.Y and on.
But I guess even that would catch many people by surprise and provoke negative reactions so it's probably a very strong reason on why it isn't being done.
So what's left? A linter that's invoked like this: `idiomatic-rust --check --strict`?
I guess that's the only way out for now.
I wish I knew.
For ages, I've imagined a Java do-over I code named Encore. What would "Java" look like today, given the same original goals of improving programmer productivity and reducing errors.
But now I've switched tacts almost completely.
TLDR: Code generation 2.0. Code you'd write yourself, if only you had more time.
So with SQL, for example, instead of a wrapper or model which generates SQL at runtime, start with the SQL and generate code (in your target language) at compile time.
I've done this, with varying degrees, for SQL, HTML, HTTP, HL7, DICOM. Just trying to flesh out the idea, strategy.
One consequence is the target language becomes much less important. So now I feel (hunch, as in "believe but cannot yet prove") that the smaller the language, the better. Like BASIC, Pascal, Lua (which I don't particularly like) small. Barely more than a scripting language with some objectness and modules.
And even more impactful, the contemporary libraries and frameworks become much less important, or even moot.
Thanks for replying. I'll post something if my efforts mature enough for sharing.
Oh Hell yes. I wish they have plan for depreciation. Trial, > Warning > Error > Removed. Push the whole language and ecosystem forward. That is 10 times easier then going to a new languages and making new ecosystem.
Hah, I think every business-first (as opposed to academic-first) language had this problem.
Immutables are easy to implement in every OOP language but the if standard library isn't aware of them out-of-the-box you're SOL.
I'm sad to hear that he's sad about that because to me I love Ruby/Rails for the web. It's just too strong for getting off the ground for me to ignore. The community has solved so many problems that allow me to focus on business/user issues.
Not having static typing is that double edge sword. I personally wish it had it now as well having been with Ruby for 5+ years seriously. I've played with Sorbet, but in the Rails world, it's just too weak to be useful. Too many exceptions/untyped definitions to allow everything to play nice. It's the standard problem of trying to make an un-typed project => typed.
With all his gripes, the frameworks he laid down -> human readable + everyone be nice to each other has been incredible. The 1st one is controllable, but the 2nd relies solely on other people carrying it forward. Issues, forums, meet ups, conferences. It's not perfect by any stretch, still lots of issues, but it's incredible to see that the community does try and is relatively successful at it.
IMO Rails -- and Ruby by extension -- are going through its first really mature phases: a critical look inward and trying to solve problems that the initial enthusiastic wave of adopters haven't found crippling... but many people after them did.
That's a good phenomena and I like it. And I am one of those people thinking that Ruby and Rails both benefited and suffered a lot from the huge popularity burst that they got.
Now is a good time to start making positive changes and to make the language (and the ecosystem) more long-term sustainable and I am glad that Matz is thinking about it.
That statement reminds me a lot of the conclusion I came to on a reddit post[1] a while ago, where I compared Rubys fibers¹ to Luas coroutines, more specifically, how many of them could viably be used concurrently:
> Conclusion: Ruby is awesome; just don't use it for anything serious.
¹ Note that after Ruby 2.7 was recently released with a supposedly improved coroutine implementation, I repeated the benchmark and did see a slight improvement in execution time (no change in the maximum number of coroutines), but it was still orders of magnitude slower than even the PUC Rio implementation of Lua.
[1] https://www.reddit.com/r/lua/comments/cgqfch/lua_coroutines_...
LOL! Funnily put.
This did offend some in this here mini thread but I indeed gradually -- with business and personal usage -- came to that conclusion by myself.
Nowadays I am pretty hopelessly hooked to Elixir. Parallelism and concurrency basically solved, extremely fast for a dynamic language, FP, compile-time macros (so basically code generation without the boilerplate source code), several very solid and customisable frameworks (web/API/GraphQL, DB data mapper), predictable lag even under extreme load, and I am just in love.
Now only thing left is Rust to emulate the BEAM's runtime. :)
If we were to have a vote for a language with which you replace a slightly more complex bash/zsh scripts however, I'd vote for Ruby. It's very terse, it's fast enough (without Rails I mean) and it mostly reads well. Or I dunno, maybe Tcl/Tk or OCaml.
Flowstone ( http://www.dsprobotics.com/flowstone.html ) uses Ruby for scripting, so there is a bit more to Ruby than webdev.
Not saying Crystal will be the silver bullet, as it will take at least one or two years writing a large codebase with it before we can make any decent judgement.
I don't doubt a lot of newer tech solves many lingering problems that are still present in older tech but that's the crux of the issue right there in your comment:
We work for money and we have to get stuff done in acceptable amounts of time. And our bosses want us to write with technologies they can hire for, in case we get fired or killed by a bus.
I can't speak for everyone but now, at 39, I already have a bit of a fatigue and burnout when it comes to trying new languages. I just want to sit down and fix a problem (or create a feature) without having to sift through a forest of competing tech for days or even weeks.
Please note that I am not berating Crystal in any way. I know absolutely nothing about it. I am simply unwilling to invest in learning my (I think) 9th language. Elixir and Rust do me pretty perfectly lately and this is going to be the case for a while.
My experience using C/C++ is limited, but this always feel felt rather cumbersome to me.
Do note that in OCaml explicit typing is rarely needed. The compiler is quite amazing at inferring the data types of your functions. In Ruby though, it seems the typing definitions will be the front and center of those suggested interface/header files.
I think you may be confusing RoR with just Ruby.
Rails is its own beast.
I don’t really find it magical, though if I spent much time working in Rails I probably would. But, there is Ruby without Rails. I recommend it, in fact.
I worked on 3 smaller projects with Sinatra and Sequel and it was worlds better.
Commercially speaking though, there aren't many Ruby job offers that don't require Rails.
I still occasionally use Ruby when I don't trust bash/zsh with a slightly more complex automation flow but outside of that I find no uses for it.
Elixir and Rust do it all for me these days. I know I am getting biased and I am not fighting it. I need to get jobs done and at certain point always searching for a new tool gets very unproductive, not to mention stressful and soul-draining.
Rust, AFAIK, doesn't.
But you are right of course, if you want to cover the full-stack then JS is mandatory.
Mine are:
- He regrets introducing threads. He now prefers other parallelism/concurrency paradigms and is possibly looking into introducing them in Ruby 3 (that part wasn't clear in the interview).
- He regrets adding global variables.
- He regrets not focusing on immutability primitives earlier.
- He and the maintainers team look at Python, JavaScript and Elixir for inspiration.
- He seems a bit disappointed that Ruby is mostly used for web development only and would be happy if it was used in research and AI.
- He regrets not investing even a little effort in static typing earlier but is now working on an optional typing system where you choose to describe types in a separate file. (Reminds me of C/C++ and OCaml header files.)
I hope I’m not subconsciously emulating a sensationalistic journalist here but it doesn’t seem he’s very pleased with the current state of affairs. A lot of changes, indeed inspired from other languages, seem to be on their way to Ruby 3.
---
I’m pretty indifferent to Ruby these days. I’ve worked 6 years with Rails to a moderate financial success back then but the problems were obvious almost from the start: too much magic and implied behaviour, too much global stuff changing below your feet, way too slow DB layer (it’s known that your DB will respond in 2ms and ActiveRecord will proceed to waste 100+ ms on serialisation before and after), managing bigger projects becomes huge pain, and a number of others.
People just keep buying the promise of “but you get to make an MVP really quickly!”. Yeah well, but I want to maintain it past that stage too.
Where I was doing with this is: Ruby is a very okay language and is very nice for sketching. It's readable, has libraries for a ton of stuff, and performs alright (especially without Rails). But I never found good use of it outside of small projects. Any serious business work becomes very painful to maintain and stay on top of for bigger projects. I’m aware there are practices that make it possible (Basecamp is a huge inspiration!) but I personally found them only half-working.
YMMV, of course.