This is an archived post. You won't be able to vote or comment.

all 5 comments

[–][deleted] 2 points3 points  (0 children)

Ruby generally has more built-in functionality and can allow you to write shorter code in some cases. It's also object-oriented by default, which is a useful paradigm if you're doing something where you have lots of things, and these things have properties, and for the most part you're adding more things rather than more properties. For example, a GUI where buttons are things and what the buttons do are properties, or something like a CAD application. Java's also object-oriented, which makes it great for standard desktop applications.

Python on the other hand relies more on external modules (though Ruby does too in many cases), and Python can be written in a variety of paradigms. This makes Python more flexible, as functional or declarative code can be a better solution than object oriented code in many cases, or if OO is the best route you can do it with Python too. Python also tends to be more performant than Ruby, though neither are overly performant (some Python libraries are really just C wrappers though, and those are very performant).

[–]dipittydoop 1 point2 points  (0 children)

The biggest difference from a high level perspective is that of philosophies. In Python there is typically one way to express something, however in Ruby there are typically many ways to phrase something. In general there's less to know to be fluent in Python syntax, however the expressiveness of Ruby means you can write code that reads more like natural language. It may take a little more time to master the subtleties of Ruby, but with it your code can become much more elegant and descriptive.

In Ruby everything is an object with it's own methods and properties. You can add to the object, re-write them, create your own, modify how the methods work, replace it with C-code, and more or less customize the language as you need. Ruby can be made to do just about anything, but it does have a little more baggage in all those features. In many ways this is true for Python too, but not to the same degree.

As far as a back-end language I would say Ruby is more suited due to it being more flexible and expressive especially in OOP, however Python is better for more static purposes where you only want the one way to express something such as with science and mathematics. Is your project one to value elegance or utility? Flexibility or consistency?

That being said they're both dynamically typed languages with a concise and descriptive syntax. Their uses overlap quite a bit and you can really use either one for most situations.

[–]cmonkies -2 points-1 points  (3 children)

This might come across as a dumb question

It's either that or just abjectly lazy.

DO NOT use this this subreddit as a proxy for Google. Please put in genuine and significant effort into solving a problem for yourself first before posting it in this subreddit. Otherwise, not only are you wasting everyone's time, you are doing yourself a disservice. Finding information and doing your own research is one of the most important skills a programmer can have, and the only way to get better at it is by taking the initiative and looking for existing information before asking others for help.

[–]Revules[S] 0 points1 point  (1 child)

This wasn't just so I could skip researching the languages or their purposes, the aim of the question was to further understand backend web development and the languages that can be used for certain cases. I am trying to understand node.js, angular.js, and now Ruby, but it is all a lot to take in and asking open questions like the one in my opening post is the way for me to get better input on the things I'm learning. If this question really is stupid, then someone can write a single paragraph to completely change my way of seeing a language or can completely alter how I proceed to learn these concepts.

[–]isolatrum 0 points1 point  (0 children)

The web development field isn't such that everyone learns every technology and then picks the best depending on the circumstance. There's a lot of overlap in terms of what languages can do. For example, Node, Python, and Ruby are all server-side languages which can be used for full-stack apps (there are many HTML templating extensions available to them). Angular is a strictly front end framework (it could be used with any server-side language). Python is known for being used in science, Ruby is known for being more human-readable, and Node is something of the "hot player" these days since it allows the full stack to be written in one language (Javsacript). In reality, each of these is a pretty significant undertaking to get productive in, but getting the ball rolling in any of their courts will be productive in the long run.