by andy_adams · 7y ago · 0 comments
Can someone who is experienced in both Rails & Django explain why Python & Django are trending up so quickly, while Ruby & Rails are ranking on the "most dreaded" lists? I don't want this to become a holy war, I am just genuinely curious what I'm overlooking.
Ruby is a delightful language, but it's dominated by one niche (web development) and one framework (Rails).
Over the last 10-20 years Python has become the main teaching language in Academia. This has greatly contributed to it's ecosystem for math and science, which in turn has contributed to its rise in Data Science and Machine Learning. It also gets a lot of support from Google.
All of these things combined mean that the broad rise of Python is lifting up Python for web development, but if anything I'd say web dev in Python is lagging behind those other uses.
There's one more thing that I think is the root cause of why Rails - the framework - has faded somewhat in the minds of web devs. Rails has always been an opinionated framework, and early on they came up with "The Rails Way" to do front-end assets. The combination of Sass + CoffeeScript + Asset Pipeline with built-in concatenation, minification, and asset hashing was pretty neat compared to the old world of a bunch of es5 files loaded via script tags.
But this hit before the rise of NPM and being able to `require('foo')`.
The JS packaging wars went on for a while and none of those asset solutions are as simple and "just work" as the Rails Asset Pipeline -- but the asset pipeline doesn't hook you into NPM. Rails dragged its feet for a long time on that before adding webpack support.
So I think during that time you had a TON of the trendy hipster open source people moving into Node first on the front end, and then eventually losing interest in Rails because the framework wasn't making it easy for them play in the very latest js ecosystem.
And I think there quickly became some saltyness among Ruby devs about Javascript, that people were overdoing it and that really you only needed "sprinkles" of Javascript to make a great app.
So (1) Python has risen a ton overall, lifting Django, and (2) Rails was slow to embrace the JS craze and that held Rails back.
Those two trends pretty much tell the story as far as I can tell.
In ruby, the world isn't so great. When I was in the ruby world, I would always hit roadblocks on my side projects. There were so many times where I wanted to do something not web dev related and I couldn't find a popular and well supported ruby package. For example, I wanted to do text analysis of some sites I scraped and python's nltk was perfect (but there wasn't a perfect ruby library).
The ruby world needs to expand beyond web dev if it wants to grow.
I mentioned this in my other post. Ruby is the only language on the top list that doesn't have a major cooperate backing. Basically Ruby community are really lack of resources.
Additionally, neither Flask nor Django support ASGI, which is the future of how web frameworks will be written in Python. Quart is "Flask for ASGI", and Django has roadmap plans to start moving vaguely in that direction, though they're still a long way off.
Python has also struggled mightily with package management, and how to do it "one right way", which is one of the mantras of Python. Pipenv is a step in that right direction, but it's taking time to get people to adopt, and it's got warts of its own still (though it's getting better every day). I think it's still technically in "beta" (for whatever value that has these days, I am sure plenty of people use it in production).
Let's also not forget the python2 vs. python3 migration problem that I think we're finally now starting to get over. With python2 set to depreciate in 2020, the clouds are starting to lift on the major problems in Python, so naturally you're seeing a rise in converts.
https://asgi.readthedocs.io/en/latest/
Though having worked extensively on both and not having a particular love for either, the simple answer is this (IMO):
Python skills transfer to other industry disciplines far better. Picking Django (vs Rails) is just a good career move. Data scientists use Python heavily (scipy, numpy). Many universities teach Python as the first scripting language. Python has a much stronger foothold outside of web frameworks.
And it's a real problem when I want to do hobby signal processing or deep learning stuff.
Python has won that segment of the market and I better get with the program.
I'd contrast this with say Java, my other mainstay and Scala which I'm picking up in pieces right now. Java is quite explicit and has quite a bit less built-in so you don't feel very capable or productive for quite a bit longer. Scala has so many syntactic variants and features that the volume of stuff I have to learn is relatively vast. Every third block of code I read uses a new unheard of language feature or concept. ... and I have some functional programming background.
A sibling comment here mentioned that Rails' power came from other gems, but that's not really true. Rails is still actively developed, and just Rails, by itself, gives you more functionality out of the box than whole 1000+package Node stacks.
While Rails has an inclination to apply code generation and convention, Django tends to use introspection and monkey patching to get the same results. Both are amazing on similar ways, but horrible on their own different ways. Maybe Django developers just go into a different framework when they get some project that isn't a good fit, so they see less of the bad.
Personally as an infrastructure engineer, I'd be incredibly happy to drop Python, and almost everyone on my team agrees. When you're building complex data processing pipelines that have to support the hundreds of features that scientists ask for, having static types (especially ones that differentiate between different dimensions of tensors) is a huge win over having to write a unit test for all the possible combinations of things that can happen.
Unfortunately from a solid infrastructure perspective, Ruby is even messier than Python due to the rampant metaprogramming culture. This doesn't matter so much in web dev where the layers of complexity are not that thick, but in other types of development it becomes a real burden very quickly. That might be one reason why Python is preferred over Ruby.
As someone who has done a decade of Rails development and works in a Ruby + Python shop, I'd say you haven't overlooked anything.
Ruby and Python are so similar in style and tradeoffs that it's quite difficult to make a case for one _language_ over the other for any particular task.
So then it comes down to (1) ecosystem and (2) personal preference.
For a long-time Ruby has had a better web ecosystem. I'd argue this is still true, but I don't know if it will last. The reason is that Python's overall ecosystem has developed a lot more than Ruby's and the overall larger community is really valuable.
RoR is ridiculously opinionated. If you don't know The Ruby Way then you'll be fighting the framework for every inch of productivity. It also has a lot more magic than any other framework I've ever used. It hides so much of what it does behind abstractions on top of abstractions that it's hard to do a simple thing and understand what's happening. (This ignores the fact that Ruby is Perl in better clothes, both a huge strength and weakness, depending on your past experience.)
Django is better in that it's slightly more obvious what's happening and why. It still has some magic to it, but not to the same extent. You can also do whatever you want, and it'll be a little harder or a little easier, but it doesn't fight you nearly as hard if you're not doing things The Django Way.
I think if you're a RoR dev and know RoR and like how it works then you're golden - stick with it and be productive. If you don't drink the kool-aid then you're not going to be happy.
I've found that after doing that, people (1) get it easily, (2) don't feel it's "magical", and (3) enjoy the environment.
Conversely, SENIOR engineers on other teams who did not go through this process often express sentiments like you did. At this point I can pretty much guarantee the people who are salty about Rails are people who don't normally need to read the manual. They didn't read the Rails manual, and they're confused, and they're not used to being confused, and so they get grumpy and bitter about that over time.
Personally, I like Rails. But I do think that the "convention over configuration" approach has this major tradeoff - you really shouldn't just dive in and figure it out, you should read the manual first. And I get it why some people don't like that and don't think it should be necessary.
So yeah, it's opinionated, and thus it's polarizing.
Python popularity is rised thanks to academic . But it is not the better programming langage so far.
But if I had to pick one thing to point at to explain its rising popularity, it would be data science, as others have mentioned. I wonder if Travis had any idea the impact he would have when he made numpy.
Python's creator, on the other hand, worked at Google for a while, and like Sun, Oracle, IBM, and Microsoft before them, schools and beginners are naturally drawn to things used by the big companies.
Explicit imports, no magic file locations or configurations...
Python is just a great confluence of all of the things that other languages lack, and the Python language is adapting to include more and more of the things people actually want. I don't think the Ruby language has been nearly as responsive (some would even say that Python has been too responsive, and certain language features are going too far outside of what the core of the language should do).
Also, Python is notorious for its excellent documentation (Django follows in those footsteps) and gigantic helpful community. I don't know how comprehensive Ruby's docs are, however.
Python hits all the notes, from "I want to write a random script to do a thing" to "I want to develop enterprise level software with hundreds of thousands of lines of code". You can probably pick Python as a default for nearly any baseline business-method problem and be in pretty good shape.
Generally it is true that learning a new language, will give one new tools to reason about problems. I find Kotlin and Python amongst the languages I have used, to offer the least new insights and ideas to the student.
Likewise here (except Rebol instead of Clojure). I've never been able to explain it well, but something about Python feels really limited in a very similar way as Java (like, 1.6ish) does.
Adding functional features would make Python materially worse.
I am not saying python should grow these features, but merely that for any new work for which python is being considered there could be a strong case made for choosing a more modern, more safer, more functional language instead.
Most everything else you said could also be said of Ruby - docs, helpful community, flexibility from scripting up to massive webapps. That's what perplexes me - what are the "more of the things people actually want" specifically that drive Python's growth?
Go look at the releases up from 3.4 of Python. The features that have been added since then are pretty specifically what the community has been asking for. asyncio being integrated into the language, type hinting, f strings, just to name a few.
But yeah, it's not about "does it check the box" at this point with language like Python and Ruby, it's about how they check the box, and to what degree. Simply having a feature isn't enough.
Django basically does what Ruby on Rails does, not exactly but close enough. Flask does what Node.JS does, to the extend that we’re talking about building quick prototypes, not running Netflix. So you have most of your web-based needs covered. Python also does data though, and is to ML and BI what NPM is to web-development, and lastly Python does systems scripting. Basically Python does most things, well enough. By comparison, ifyou’re a .NET house like we have been, you’ll use C#, Microsoft SSIS/SSRS, Powershell and probably Python to do what you could do with all Python.
So I think that’s a big part of it. The other big factor is that Python has replaced JAVA in most of Academia. JAVA was great and all, but being something a very high percentages of CS majors learned surely helped it.
Flask is better at Netflix scales. You don't want opinionated frameworks making decisions for you in the endgame. That's only good in the beginning to get off the ground
The other half is ruby/rails got a reputation of being a language where some write-only code was encouraged. Djanjo and python have long encouraged writing maintainable code. This is a culture thing - there is no reason you cannot write unmaintainable code in python or maintainable code in ruby, but the reality is people didn't. This is part culture, part rails encouraged getting something working fast even if it wasn't maintainable while Django has also said take a little time to get it right in the first place and it will pay off.
Not really. I would take SO survey results with a grain of salt. The respondents always skew towards the younger, less experienced crowd (68% had less than 10 years experience in this last round). It's not representative of the industry.
Or maybe great engineers just pick whatever that suits their job, and create amazing things. After all, Guido uses Python, Katz uses Ruby, Linus uses C, Odersky uses Scala, Jeff Dean uses C++, and the list goes on.
Recently, I had a moment to code in MQL4 language and boy, I needed a break for just fighting against the language. Not even associative arrays and no proper NULL with magic variables that changes behind the code all over.
I'm liking React more now since you get the full power (and clusterfuck) of npm.