Ruby or Python

Hi All,

I have decent powershell skills, I now want to learn either Ruby or Python , which language will you recommend  and which will be the easiest for someone from a powershell background?

Also do any know if if chef configuration management support python?

thank you in advance
Kelly GarciaSenior Systems AdministratorAsked:
Who is Participating?
To add. Ruby can also be used for scripting. The decision may be partly subjective. I have looked at Ruby only for a short time, but I did not like its syntax. Python is probably more widespread.

Python is nice to use. The sshutil module (shell utilities) will help you with the shell scripting.

For the Chef, it seems to be written only in Ruby and Erlang.

Have a look at the article It points also to comparison of Chef (Ruby) vs. Ansible (Python) You can find the table with the tools here

For Python vs Ruby and shell scriptint. Python is used as the installation scripting language at least in Ubuntu Linux distribution. I do not know if Ruby is used anywhere for that kind of scripting. Searching for Ruby for that purpose and comparing the cases may help you to decide.

Definitely, Python is a nice choice. On the other hand, you can learn both  ;)
Generally Ruby is used in building web sites (think Ruby on Rails) while Python is generally used for scripting (although some do use it up to and including web site building).  That's of course a generalization, but certainly is the common usage in my experience.

So I'd say it depends on what you're looking to do.  Since you mention Chef, I'm thinking scripting - so I'd go with Python.

Chris DentPowerShell DeveloperCommented:
Ruby and Chef go well together (used to define patterns).

I'd go with whichever you find a use for. I know a little Python, I have very little use for it on the MS side of the fence. The same can be said about Ruby.
Has Powershell sent you back into the Stone Age?

If managing Active Directory using Windows Powershell® is making you feel like you stepped back in time, you are not alone.  For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why.

Personally I would recommend Ruby.  Not because I know that much Ruby or was that impressed with it but because I *HATE* Python syntax (white-space matters to be specific).  As far as I know, there is no other language that has significant white-space outside of a few very niche languages (not sure they are even still around).

Perl would be another option.  It is still used a fair bit but not nearly as widely as it was at its high point (that course could reverse if they ever get fully functional perl 6 released for JVM).  It can do anything Python can (except Stackless) and has CPAN (although, with Python's popularity, its equivalent (can't remember the name) has gone a long way to catching up).

I never learned Power Shell so can't say which would be easiest for you to learn.
Neither Ruby nor Python is similar to powershell.  Perl is closer.  As people have said, the people who learned Ruby like it for web dev -- usually they're people out of ad agencies who are learning their first scripting language.  Python is meant to be an actual language (unlike powershell, which doesn't have the richness of Perl or other more advanced scripting languages).  However, its syntax can be annoying to programmers for reasons mentioned by other posters above.

If what you want is a richer scripting language in a Windows environment, you might consider javascript.  Microsoft added the ability to write scripts in javascript to Windows starting with ... XP I think.

If you are planning to write scripts for unix and Windows, then Perl might be the way to go.
To balance the opinions... I personally consider Python indentation much less scary than it looks at first. To *hate* it seems a bit exaggerated to me. I am using Python a long time, and I can see no problem when switching from/to C++, C#, Java. Any decent editor helps to keep the indentation just OK. Anyway, I can imagine that programmers with the heart of the "artist" may be embarrassed. On the other hand, the code with artistic license is often difficult to read ;)

To compare Python and Perl--and I was using Perl a lot in the past--Perl syntax is much worse. It is really cryptic when compared with Python. You cannot see it when you use it actively. Once you switch to another language for a longer time, I can bet a lot of people have problems to read their own Perl script. And again, I did love Perl in the past.

In my opinion, Ruby syntax is similarly "addictive" as of Perl -- once being clean for a longer time, it is less readable. In other words, it is less readable for a person who can see Ruby for the first time.

Give some freshmen a non-trivial example (the same) written in Perl, Ruby, and Python and compare how much he or she understands without learning the language. Sure, Python also has some dark corners (as any language).
Nope.  I *hate* Python white-space syntax.  White space should be about coding style - not about language syntax.  Braces (C, C++, Perl, and many other languages) are much cleaner syntax (to me anyway).  Back when I was in college (almost 30 years ago), there was a programming languages course (overview of many languages and design philosophies of languages) that even talked about what a bad idea significant white-space was.

Perl is easy to write obfuscated code but it is almost as easy to write clear and easily readable code.  The sigils make it extremely quick to understand context of variables (and general type of variable - Perl is not strongly typed).

Perl was something like the 6th programming language I learned well and I knew I really liked it within a few days of being exposed to it.

Preferences probably depend a lot on what languages you knew previously.  I originally learned on basic, pascal, and C so Perl syntax wasn't that different from C (except the sigils and lack of strong typing) and may have had an influence on my like for it.  It can also depend on the individual.  I've known new programmers just learning that loved Java and others that hated it.

The one thing that always intrigued me with Python (but I never learned enough to play with it) was Stackless Python (just engineering a scripting language without a stack must have been quite a feat).  EVE Online was written entirely in Stackless (at least when I played it).
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.