Solved

Ruby or Python

Posted on 2017-04-19
7
44 Views
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
0
Comment
Question by:Kay
7 Comments
 
LVL 27

Assisted Solution

by:dpearson
dpearson earned 83 total points
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.

Doug
1
 
LVL 71

Assisted Solution

by:Chris Dent
Chris Dent earned 83 total points
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.
0
 
LVL 29

Accepted Solution

by:
pepr earned 251 total points
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  ;)
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 26

Assisted Solution

by:wilcoxon
wilcoxon earned 83 total points
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.
0
 
LVL 27

Expert Comment

by:mrcoffee365
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.
0
 
LVL 29

Expert Comment

by:pepr
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).
0
 
LVL 26

Expert Comment

by:wilcoxon
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).
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Join & Write a Comment

This article will help you understand what HashTables are and how to use them in PowerShell.
A recent project that involved parsing Tableau Desktop and Server log files to extract reusable user queries for use in other systems. I chose to use PowerShell to gather the data, and SharePoint to present it...
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

685 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