python and ruby - for what to use it?

15,633

Solution 1

They are good for mostly for rapid prototyping, quick development, dynamic programs, web applications and scripts. They're general purpose languages, so you can use them for pretty much everything you want. You'll have smaller development times (compared to, say, Java or C++), but worse performance and less static error-checking.

You can also develop desktop apps on them, but there may be some minor complications on shipping (since you'll usually have to ship the interpreter too).

You shouldn't do critical code or heavy computations on them - if you need these things, make them on a faster language (like C) and make a binding for the code. I believe Python is better for this than Ruby, but I could be wrong. (OTOH, Ruby has a stronger metaprogramming)

Solution 2

If you want to know what people actually use them for, check out Python Package Index, RubyForge, and search SourceForge or even StackOverflow.

As shylent says, you can easily get into holy wars about what they should be used for. Both Ruby and Python are popular especially for prototyping, but you can also build production software like Ruby on Rails, Zope, and Mercurial.

What one would not use them for is code that is performance-critical (most isn't) or close to the metal.

Solution 3

They are good for everything.

Ruby has an edge for munging textfiles awk/perl style. That's slightly easier in Ruby. For the rest, I think Python has a string edge, and that it TOTALLY subjective. See What does Ruby have that Python doesn't, and vice versa? and the follow-up blogpost http://regebro.wordpress.com/2009/07/12/python-vs-ruby/ .

I use Python for every programming related thing I need to do, and will do that until there is a complete shift in programming paradigm that kicks OO development into the stoneage.

Solution 4

To avoid the holy war and maybe give another perspective I say (without requesting more information of what fun part of programming the question-ere thinks is cool to do):

Learn python first!

If you haven't done any scripting language yet I would recommend python. The core of python is somewhat cleaner than the core of ruby and if you learn the basic core of scripting with python first you will more or less as a bonus learn ruby.

You will (because you use python) write code that looks very clean and has good indentation right from the beginning.

The difficulties about what to learn is what you actually will you try to solve!

If you are looking for a new production language to solve X the answer get more complicated. Is X part of the language core? Was the language in fact invented to solve X?

If the question was: What single programming language should I Master and eventually reach Nirva with? My answer is, I don't have a clue! (CLisp, Scheme48, Erlang or Haskell should probably have been on my final list though)

PS. I know that this isn't the spot on answer to the very simplified question in the post. what can ruby do that python can't or what can python do that ruby can't.

The point is that when you set out to learn something one usually have a hidden agenda so you try to solve your favorite problem in any language again and again.

If your really are out to learn without have an agenda I think that python in it's most basic form is a clean and crisp way and you should be able to use the same style when using ruby.

DISCLAIMER: I prefer ruby in a production (commercial setup) over python. I prefer ruby over python on windows. I prefer ruby over python on the things I do at home. I do that because the things I really like to solve is more fun to solve in ruby than in python. My programming style/habit tends to fit better in ruby.

Solution 5

Ruby and Python are languages aiming at facilitating developers’ lives through their simplicity and expressiveness - you can read more in article Ruby vs Python

In the last years Ruby is on the slight decline in popularity, while Python is gaining lots of new users, especially from outside of web dev. That's because of Python's wide usage in data processing and ML/AI.

You can see it also from the conferences agendas. While Ruby conferences focus around web dev and Ruby performance, Python conferences focus more around data science and machine learning - check out my takeways from a Python conference I attended recently Python in 2019 - Takeaways from PyCon CZ

Share:
15,633
Hoaz
Author by

Hoaz

Updated on June 14, 2022

Comments

  • Hoaz
    Hoaz almost 2 years

    I'm thinking about learning ruby and python a little bit, and it occurred to me, for what ruby/python is good for? When to use ruby and when python, or for what ruby/python is not for? :)

    What should I do in these languages?

    thanks

  • rampion
    rampion almost 15 years
    Eh, binding C to ruby is pretty easy (or, at least, it is to me). Other than that, I agree with you.
  • Asela Liyanage
    Asela Liyanage almost 15 years
    In what way is Ruby stronger at metaprogramming?
  • Asela Liyanage
    Asela Liyanage almost 15 years
    You can easily package the interpreter into your application, and distribute it as a binary using some various tools like py2exe and others.
  • horseyguy
    horseyguy almost 15 years
    if you have no experience writing C extensions for Ruby do not say "I believe Python is better for this than Ruby". :)
  • m3nda
    m3nda about 9 years
    I would recommend vb syntax for new people, because will get lot of basic knowledge that is not present when you use scripting ones or those new langs. So, i've learn PHP because i like websites. Later i try to use it as desktop app with a lot of tricky app's like bambalam compiler (love them, cons are php5.2!!) but it allow me to build ~512Kb windows APP including GUI (gtk/winbuilder) all out of the box in an exe. Anyway PHP is not for desktop GUI, so i learn some vb syntax style langs to develop simple app's. (like drag and drop ftp). Think on what you wanna /need develop, then choose
  • m3nda
    m3nda about 9 years
    < no chars lefts < Otherwise choose Java :D so you can develop easier for cross SO/Devices. I don't like, but you may.