4 ms·
Is it just me or are Ruby and Python cousins. I really really didn't like Ruby when I tried to learn it at work , but Python just clicked. I imagine many Ruby
by 41209 5y ago
Is it just me or are Ruby and Python cousins.
I really really didn't like Ruby when I tried to learn it at work , but Python just clicked. I imagine many Ruby programers migrated to Python.
Then again, Nodejs started to take off when Ruby declined. I strongly suspect this is due to all the "full stack" positions. Hey Billy, you write all that nice js on the front end, now you can write it on the back end too.
- throw_m239339 5y ago> Is it just me or are Ruby and Python cousins. Not at all, they used to be competitors in the web space but Python won the academia space. Python is taught at university in Europe, Ruby far less. Node.js is a mess, not because of javascript but all these layers of complexity imposed by professional front-end development, and on the server because Node.js standard library is pretty poor. I shouldn't have to use a third party library just to parse a multipart http request or work with cookies... Go in that domain is just examplary. The std lib even comes with a Go parser, which is just invaluable for implementing code analysis tools, and it's very easy to do so.
- wil421 5y agoPersonally I like Python much more than JavaScript but at work I almost exclusively use JS. Recently I’ve been doing stuff in node.js and it does make it much easier to flip back and forth. Still like Python more and I can’t help but put ;, (), and {} all over the place.
- petercooper 5y agoI imagine many Ruby programers migrated to Python. Not my experience being involved with the community. Indeed, there seems to be rather less migration between the two communities than than other languages (e.g. Python + Go, or Ruby + Elixir) probably by virtue of their similar problem spaces and approaches. I'm a Rubyist who also knows some Python and while I admire Python, I certainly prefer Ruby. Python is flexible and fantastic in many ways, but is a far less consistent language in terms of organization (e.g. you use methods for some things, functions for others) which didn't click with me. If you want to do something with an array/list in Ruby, say, 95% of the time it's "arr.method" whereas in Python it might be len(arr) or arr.method, a comprehension, etc.
- burlesona 5y agoRuby and Python are close cousins in many ways, and if I'm being totally honest it's hard to justify why they both need to exist when they serve such similar "general purpose scripting language" use cases with similar performance profiles. But when you get beneath the surface they have fairly different aesthetics and ergonomics, and that's the biggest thing that shifts developers toward or away from one or the other. As you described one just "clicked" for you, I think many developers feel that way about one of the two languages, but not both. The coolest thing about Ruby is that the language paradigm is very internally consistent - everything, absolutely everything, is just objects and methods. The language has very few core constructs, but they can be composed together very fluidly to create all kinds of rich abstractions. People who dislike Ruby generally dislike this specific aspect -- it tempts programmers sitting atop mount stupid to go nuts with meta programming and try to make "magical" code when it isn't called for, and that's annoying to deal with on a team. By comparison, in Python there are multiple paradigms and you need to learn where they apply. Why are things like `map` and `len` global functions, and why shouldn't we just call `__len__` on that object ourselves? Why do some functions for list processing take a list first and then a lambda, and some do it the other way? Why do you have to define self as the first argument for methods but you then just ignore that argument when calling the method? Why is it so hard to perform a relative import? Python is less consistent. The other nice thing about Ruby is the elegance of it's closures and block passing - I miss that a lot when it's not present in other languages, and am always excited to see new(ish) languages like Kotlin embrace that paradigm. That, combined with the enumerable interface, make for great functional programming and list processing in Ruby. The alternatives in Python are certainly functional, but feel clunky to me. On the other hand, Python has better semantics around named versus positional arguments, better type annotations, and decorators, each of which I would love to see in Ruby but for many reasons don't expect to. Python's import system allows more control over the global namespace, which is very nice. And lastly, Python has become the de-facto academic language which has led to it's fantastic ecosystem growth. Python is everywhere and there's a python driver or library for everything. Ruby has a good ecosystem, but not near as good as Python. As for the bit about Node, the rise of Node and relative decline of Ruby are the same phenomenon, it was the full-stack web hipsters that had powered the rapid rise of Ruby moving onto Node that helped Node rise quickly as well. There were valid reasons, specifically 99% of Ruby developers also need to be proficient in Javascript, but the two languages are quite different, and many engineers felt (reasonably) that it would be nice to just pick one and have it work across the stack. Well, the browser doesn't run Ruby. Also, Node's evented model is a good fit for precisely the kind of IO-bound stuff that's a bit harder in Ruby. But mostly, the hot-new-thing wave follows a pattern of enthusiastic adoption and evangelism, then over-adoption, followed by cynicism when the things that were built in hotlang don't scale up as well as their enthusiastic early adopters hoped, followed by the embrace of next hotlang and the trashing of *previous hotlang. So Ruby had to ride that out and calm back down into just being a normal programming language again. Meanwhile here comes Deno... ;)
- G3rn0ti 5y agoRuby used to be considered a more beautiful Perl. With Perl it shares powerful meta programming facilities, good package management and a high degree of flexibility when it comes to implement something. Ruby added a MOP and prettier syntax. Many early Ruby devs migrated from Perl. Pythonistas always were a community of its own and tended to frown upon any other language users.
- jerf 5y agoIn the grand space of programming languages, Ruby and Python are twins with slightly different birthmarks. I exaggerate maybe a little, but not much. A lot of their differences are cultural rather than technical.
- setpatchaddress 5y agoYou may not be completely familiar with them? The object model is fundamentally different. The syntax is vastly different. The runtime capabilities are different. Performance characteristics are different. (Ruby has less startup-time overhead.) Subjectively, I’ve been using Python since version 1.5? on classic Mac OS — but I’ve never liked it much. Always feels like a struggle to do basic flow control. Ruby really clicked for me. The ‘_why the lucky stiff’ quote really resonates: it’s the language Buddha would have programmed in.
- jerf 5y agoYou're using the perspective where you sit them right down next to each other and compare them directly. In that case, every little small difference leaps out and they look very different. I'm using the perspective of the whole programming language landscape. Take Python and Ruby and sit them next to Haskell, or SQL, or Prolog, or best yet, all of them at once. Even within just the "dynamically typed languages" they are the most similar to each other. Syntax is one of their greater differences when sat next to each other, but much less impressively different when considered in the whole landscape. Syntax glosses on virtually identical semantics.
- pravus 5y agoAs I recall there is a loose connection between them due to history. When Perl added an object system in version 5 it was heavily influence from Python and Ruby's designer was inspired by Perl. You can see a lot of similarities between the three beyond their dynamic nature.
- jrochkind1 5y agoRuby's influences are sometimes described as being both Perl and smalltalk, but I'd say Ruby's OO comes more from Smalltalk than Perl OO. Things that came more from Perl to ruby include: Ruby's syntax; first-class regex support; some rarely used features like the Perl-ish global variables and command-line options; just the idea of being an interpreted unix-friendly language executed like `ruby file.rb`. I do think Python and ruby are very similar languages, in the whole universe of languages. I think that's not really because either influenced each other, but instead because both were invented at approximately the same time, to meet similar needs -- both as interpreted-not-compiled, edit-with-a-text-editor, with C-like syntax, etc. Them both being so similar, I wonder what's behind things like "ruby just didn't click for me but then I loved Python" -- but then, I'm the same just opposite. I don't know if I'd say it didn't "click", but I much prefer ruby to python, hugely (and sadly at this point, I feel like a betamax enthusiast), despite knowing that they are basically similar languages.
- 41209 5y agoRuby has some what hostile rules imo. Such as end and lower casing variables. Another factor to mention, Python has some specific use cases, like machine learning which I can only effectively learn by using Python. I actually managed to secure a 30k pay raise by learning Python in my spare time. Anything I can do in Ruby, I can already do in NodeJS. If I ever run across an employer who would offer 30k or 40k more for me to learn Ruby, I would definitely jump at the opportunity.
- jrochkind1 5y agoOf course I understand why people use python if that's where the jobs or better pay are, I have no confusion there! Or for that matter, if that's where the libraries for doing certain kinds of work, like machine learning as you mention, are. None of that is a mystery, as reasons to use python.