views:

190

answers:

8

I came from a C-Java-C# world... where the parentheses were VIP citizens and types were loved by everyone : )

Sometimes I need to develop some piece of code to automatize a repetitive task, convert some complex frame, order an input file, send programatic request to a server... you know what I mean?

But sometimes I wonder how easier could be write the same in some language like Python... or these DoItSimple languages : ) -with all respect.

So which language should I use for this kind of tasks?

Thank you very much in advance!

+3  A: 

You should really investigate one of the more popular scripting languages, like Python/Ruby/Perl. Any one of those will set you in good stead for what you're trying to achieve. Which one of those you should use is a matter for heated debate around the water cooler - or more likely, the coffee machine.

That said, there's something to be said for learning tools like 'awk' and 'sed', not to mention some of the extended capabilities in 'vim' for achieving day-to-day tasks

AlBlue
Thanks AlBlue.'Scripting' how valuable is that word for the thread : D +1I'm going to take your advice to learn more about the tools to start.nonetheless which scripting language do you recommend me?thanks again : )SD
SDReyes
+2  A: 

Why don't you just take a list of the languages you find attractive and write some small pieces of code. Then you'll be able to select the one that is "yours".

Sorantis
Hey nice idea thanks : O +1
SDReyes
+3  A: 

For a long time, you will always be faster with the languages you know. However, if you just want to experience something new and eventually have another useful tool in your belt, I'd try python. It's very handy, and is not too far of a jump from the C# world (if you've ever done BASIC, it feels VERY similar).

BTW - AlBlue's suggestion about awk/sed/vim(macros/etc) is A+. I will often hop onto a Linux box at work to handle any repetitive file tasks (on Windows you can get cygwin, we just don't have it available at work).

Jess
yes I totally agree with AlBlue : )Thanks for your suggestion
SDReyes
+1: Python works well. You'll find it "slower" to develop until you finish learning Python. Also, you can directly call your C code from Python. You do a little coding to wrap your existing C libraries as Python modules.
S.Lott
+3  A: 

I love PHP and perl for these things (having grown out of sed and awk, for the most part), but if don't rule out the bash shell (I use Cygwin's on windows systems), and even the Windows scripting language (yes, batch files still exist) can do more than I once thought.

James McLeod
hahaha yep of course : ). they are here for something, aren't they? : PThank you very much James : )
SDReyes
Daniel
I was afraid someone would notice I said perl and vote me down...
James McLeod
SDReyes
+1  A: 

Google for something like "perl vs ruby vs python" or "best general purpose scripting language" ... You should find some comparisons. I personally like ruby most cause it lacks the nasty $'s in front of all variables. If you're familiar with c# and the .net framework, IronRuby and IronPython would give you access to all the classes you already know.

Petar Kabashki
Yep ruby syntax seems fine : )
SDReyes
+1  A: 

I Say Ruby or Python


My favorite is Ruby for its high-purity object model and generally awesome syntax and power.

However, Python has the same general capabilities and is about twice as popular.

Traditionally, Perl is used for sysadmin automation and other scripting tasks, plus obviously sed, awk, and sh.

But languages like Perl and PHP started as ad-hoc scripting interpreters, whereas Python and Ruby were real object-oriented languages. Perl and PHP have since grown object-oriented revisions, but now they have all the complexity of the first "nice try" coupled with the "oh we should make it a real language" extensions.

Ruby, in particular, is the product of a real language designer who combined the ultra-pure object model of Smalltalk with the populist syntax of Perl.

DigitalRoss
Thank you Ross. I've not seen that side of the comparison -some candidates as ad-hoc scripting interpreters. : )
SDReyes
+1  A: 

If you are coming from the C world, I would say Lua because not only is Lua a fine scripting language, but it also comes with a super API for binding it to C programs, which means in the long run you'll be able to use the same technology to script your C programs.

Lua also stands well on its own merits; I have written elsewhere about why I prefer Lua to Python.

Norman Ramsey
Thanks Norman : )
SDReyes
+1  A: 

I'll probably get downvoted for recommending this, but I suggest starting with "writing C in Perl", and working (or not) towards whatever level of idiomatic Perl that suits you.

My reason for suggesting this is that even if your Perl code is structured much like C, and even if you don't avail yourself of all of Perl's syntactic sugar, you'll still see an increase in productivity. Starting with C-style Perl just allows you to make use of idioms that you are already familiar with (ie C-style for loops vs Perl's foreach) while learning the language.

Joe Internet
Thanks for your suggestion Joe : )
SDReyes