vote up 2 vote down star
1

Background: Standard RIT computer engineering student. Took computer science courses (Java, then C++). I spend a lot of time on tech sites, so I constantly hear about scripting languages like Python, Perl, and Ruby. Besides them being scripting languages, I basically don't know anything else about them.

I have a lot of experience in "real" programming languages, but I recently rediscovered the joy of Bash scripts on my Ubuntu computer (my main computer is a Vista laptop).

Question: For a Java/C++ programmer, which scripting language should I learn first or focus on?

Reasons:

1) I need more co-ops, so I need to flesh out my resume. Does this mean I should work on becoming familiar with all the main scripting languages (and master of none), or would that be redundant?

2) I would like like to use the power of scripting languages to enhance my regular programming. Which language is best suited for what tasks and what can I do with scripting languages?

3) Lastly, as a small hobby. I have some ideas for personal projects to make my web browsing more efficient (which I guess would require web/data scraping) and automate certain tasks. Also, Google App Engine looks interesting, but I'm lazy and I would like to avoid the hard work I associate with Java.

flag
5  
This question has been asked many times here on SO and elsewhere. Please search for many well expressed opinions! – lexu Sep 2 at 4:56
Hello fellow RITer... – Thomas Owens Sep 2 at 15:41

10 Answers

vote up 16 vote down

For automation tasks, including web scraping, all of Python, Ruby, and Perl would be suitable. For Google appengine, you should use Python (as that is actually the first languge that was supported on that platform).

I recommend that you define yourself a specific project, and then ask here what specific libraries people would use, and try two out of three languages, to see which one you like more.

link|flag
3  
+1 It's very difficult to answer this without praising your favorite scripting language. Solid and unbiased advice like this deserves many upvotes. – Chris Lutz Sep 2 at 5:02
vote up 3 vote down

Try them all (do the tutorials) and use the one you like.

link|flag
2  
While it takes a while to really grasp the nuances of any language, spending a weekend with each in turn should at least give an idea of which works better for you (as opposed to the one you think you ought to like). – Steve Gilham Sep 2 at 6:25
vote up 2 vote down

I'm biased, but I'd say Python: in my Python for Programmers talk, I point out the similarities with C, C++, AND Java that will help you get onboard. It's also currently the most popular "scripting" (hating that monicker is a different issue) language on Tiobe (below PHP, but that's not "general purpose"... above Perl, Javascript and Ruby anyway;-), for what THAT is worth;-).

link|flag
What's wrong with the term "scripting language"? – Chris Lutz Sep 2 at 5:03
@Chris, it erroneously classes general-purpose programming languages together with (e.g.) zsh or bash, somehow implying that they couldn't be used to program, oh, say, YouTube (probably the highest-traffic site entirely focused on Python), reddit.com (which switched to Python from Lisp...!), nltk, scipy, Twisted, ...!-) – Alex Martelli Sep 2 at 5:26
I disagree - I think "scripting language" just means a high-level, high-abstraction, traditionally interpreted or bytecode interpreted language, particularly where execution starts at the first statement rather than in a main() function - but I do consider there to be a difference between "scripting languages" like Perl, Python, Ruby, etc. and "shell languages" like zsh or bash. I think the term "scripting language" just has a bad rap, as when I hear the term I think of something a bit more positive. – Chris Lutz Sep 2 at 5:37
TIOBE is different from other popularity ratings, From them Perl is more popular than Python and Pyhton is more popular than Ruby. – Alexandr Ciornii Sep 2 at 8:10
Who're "them" and when updated? Tiobe now has Python #6, Perl #8, Ruby #10; 4 years ago, it had Python #8, Perl way above at #4, Ruby way below at #25. How accurate, who can know!, but the trends seem true: in 4 years, Ruby way up, Python a bit up, Perl trending down (maybe Perl 6 will change the latter trend?). – Alex Martelli Sep 2 at 14:47
show 1 more comment
vote up 2 vote down

I'll say Perl, because it has syntax most like C.

  • Python creates blocks by colons and indentation (not very C-like).
  • Ruby takes its queue from Python, but adds in some word-delimited blocks (kinda like Pascal)--although it just as often uses curly angle blocks as well.

Of course, this might also be the reason you don't want to learn Perl, because you want a totally different type of syntax. But Perl has the following similarities.

  • All blocks are delimited with { ... }.
  • Statements are separated with ; (Ruby uses ':')
  • C logic operators ==, !=, ...
  • C ternary operator:
      my $result = $test ? $true_value : $false_value
  • OO Perl uses -> for method dispatch:
      $my_object->do_method()
  • Classes are named This::That::TheOther and methods This::That:do_that
  • Printf format specifiers (as well as plain old printf)
      printf "Your string is=\"%s\"\n", $your_string
link|flag
2  
As one Perl fan to another, syntax is a rather poor reason to pick a language. Learning a new language syntax or three is easy, but writing idiomatic code in multiple languages is difficult. I would suggest trying to sell some nice features of Perl that you like, like syntax-level support for regular expressions, variable sigils ($var, @var, etc.) allow variables to be easily nested inside strings, the defined-or operator (//) for defaults, or other things. Of course, all of these are subjective, but no more subjective than the relative aesthetic appeal of syntax. – Chris Lutz Sep 2 at 6:13
@Chris Lutz: I wasn't trying to "sell Perl". He asked "as a C++/Java Programmer" and somebody said Python has "similarities", and on that basis, I think Perl has more. There are other threads for "Neat Things about Perl". I'm not sure of what besides similarity would be the issue as a C/Java Programmer. – Axeman Sep 2 at 16:49
vote up 1 vote down

Given that you are already familiar with Java, I would suggest learning Groovy first. Groovy is a dynamic language (the less pejorative term for scripting language) that targets the JVM. Because it targets the JVM, you have complete access to call of Java classes you are familiar with, but without the pain you associate with Java. This should smooth the learning curve a little.

Once you are feeling comfortable with Groovy, I would suggest Scala. Scala also targets the JVM. It will likely break your brain, as it is a functional language and up to this point you have only used imperative languages. Note, breaking your brain is a good thing. When you put the pieces back together you wind up with a better brain.

link|flag
vote up 0 vote down

It all depends on what you want to accomplish.

For simple (or advanced!) day-to-day sysadmining/automation etc. I use bash.

For application development, I'm very partial to ruby (and ruby on rails for web-applications). But wouldn't mind python either. My view on perl is that it tends to be a write-once-hopefully-never-touch-again language. Don't get me wrong, it really is a nice language, but I find that it is way to easy to produce unreadable code in perl.

A different allround, nice language is lua. It is ridiculously simple to embed in C/C++ applications. It has a lot of nice libraries and is still very light-weight. I've used lua as the logic layer in a distributed C++/java-based 3D application (yes, 3 languages in a single product!?), and my xmpp-server of choice is currently prosody which is lua all the way.

Both ruby and lua (and presumably python and perl) behave nicely on windows as well as linux/unix. Bash is most definitively more at home in the linux/unix-world.

link|flag
"I find that it is way to easy to produce unreadable code in perl." I agree. Perl relies a lot on "magic" which makes it harder to read. For example, the uninitiated person to perl would have no idea what the shift in "my $blah = shift;" is doing. – R. Bemrose Sep 2 at 15:47
vote up 0 vote down

You may try playing with ruby, python, they are both great languages and very close to each other. Perl is just another thing. If your coming from a C background you won't be spending too much time understanding its syntax and once you map the similitudes between the two language you'll find yourself doing C almost all the time.

In addition, Perl community, packages, resources, .... is just immense !

Remeber that the main goal behind Perl creation, is to achieve a lot while writing less.

link|flag
vote up 0 vote down

Since you go to RIT, you might be interested in the fact that the computer science department is switching Computer Science I and II from Java to Python and Computer Science IV from C++ to C. This means that there are going to be more Python resources on campus - more people are going to have some knowledge in it, meaning it will be easier for you to get face-to-face help if you need it.

In reality, all of the different scripting languages have some things in common, and some things that they excel at. I'm learning Python now - it's not that bad, coming from a mostly Java background. Ruby was my first scripting language, and I liked how I could make things happen quickly with it (and with Rails, for web-based development).

The best advice I have is to look at the major scripting languages and see which one you like the best. It shouldn't be that hard to take what you learn in one and quickly pick up another. And as you learn more languages, it will be easier to pick up other languages.

link|flag
vote up -1 vote down

Groovy - right at home coming from Java, Ruby sounds line fun - would be easy to deal with performance critical code needed to be written in C

link|flag
vote up -2 vote down

PYTHON...or may be Groovy...?

link|flag

Your Answer

Get an OpenID
or

Not the answer you're looking for? Browse other questions tagged or ask your own question.