Solved

Ruby or Python

Posted on 2017-04-19
7
194 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 28

Assisted Solution

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

Doug
1
 
LVL 71

Assisted Solution

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

Accepted Solution

by:
pepr earned 251 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  ;)
0
What, When and Where - Security Threats from Q1

Join Corey Nachreiner, CTO, and Marc Laliberte, Information Security Threat Analyst, on July 26th as they explore their key findings from the first quarter of 2017.

 
LVL 26

Assisted Solution

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

Expert Comment

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

Expert Comment

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

Expert Comment

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

Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

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

In previous parts of this Nano Server deployment series, we learned how to create, deploy and configure Nano Server as a Hyper-V host. In this part, we will look for a clustering option. We will create a Hyper-V cluster of 3 Nano Server host nodes w…
Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
The viewer will learn how to count occurrences of each item in an array.
Starting up a Project

623 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