Go Premium for a chance to win a PS4. Enter to Win


Ruby or Python

Posted on 2017-04-19
Medium Priority
Last Modified: 2017-04-21
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
Question by:Kay
LVL 28

Assisted Solution

dpearson earned 332 total points
ID: 42100119
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.

LVL 71

Assisted Solution

by:Chris Dent
Chris Dent earned 332 total points
ID: 42100203
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.
LVL 29

Accepted Solution

pepr earned 1004 total points
ID: 42100346
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 https://www.fullstackpython.com/configuration-management.html. It points also to comparison of Chef (Ruby) vs. Ansible (Python) http://tjheeta.github.io/2015/04/15/ansible-vs-chef/. You can find the table with the tools here https://en.wikipedia.org/wiki/Comparison_of_open-source_configuration_management_software.

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  ;)
New Tabletop Appliances Blow Competitors Away!

WatchGuard’s new T15, T35 and T55 tabletop UTMs provide the highest-performing security inspection in their class, allowing users at small offices, home offices and distributed enterprises to experience blazing-fast Internet speeds without sacrificing enterprise-grade security.

LVL 27

Assisted Solution

wilcoxon earned 332 total points
ID: 42100937
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.
LVL 27

Expert Comment

ID: 42103265
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.
LVL 29

Expert Comment

ID: 42103401
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).
LVL 27

Expert Comment

ID: 42103524
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).

Featured Post

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In real business world data are crucial and sometimes data are shared among different information systems. Hence, an agreeable file transfer protocol need to be established.
Measuring Server's processing rate with a simple powershell command. The differences in processing rate also was recorded in different use-cases, when a server in free and busy states.
Introduction to Processes
Loops Section Overview
Suggested Courses

877 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question