views:

560

answers:

9

Hi,

I'm a Delphi developer on the Windows platform, recently read the PHP tutorial at W3CSchools, it looks interesting.

We all know scripting languages are very good at web site development, but I also want to utilize it to improve my productivity or get some tedious tasks done quickly, maybe some quick-and-dirty string/file processing?

What do you usually do with scripting languages apart from software development? And we need a responsive, decent IDE/editor in order to gain productivity when writing scripts for this purpose?

+17  A: 

I'll tell you how I've improved my productivity with Python on Windows. I just try to write everything in Python - every application I need, unless I know it won't scale and I'll need more efficient tools (in which case I personally use C++, but you could also use C#/Delphi).

It turns out that for most (> 95%) of the tools and utilities are need, Python (coupled with PyQt for the GUI) is good enough, and it's a much more productive language for me than C++. The key is stop thinking of Python as a "scripting language". It is no less a programming language than C++/Java/C#/Delphi/what say you. It has it strengths, and it has its limitations. As long as you're aware of them and know how to pick the appropriate tool for the job, you'll do just fine.

You don't need any special IDE. I use Scite for all my Python coding (on Windows and Linux, by the way), and it works great.

Eli Bendersky
+1 for Python is a general purpose programming language.
Michael Aaron Safyan
It is true that "scripting languages" are a less relevant notion now than 10 years ago. Python can be characterized as a *dynamic* language, with all the advantages that this brings (dynamic typing being one of them).
EOL
Thank you Eli, as opposed to other dynamic languages, I seem more like the Python (Simple and OO), and I wish I can buy ready-made code snippets from marketspace like codecanyon.net, you know, I also want to do some web-based tasks (primary for presenting a desktop app, and the related download/license management, etc)....
Edwin
@Edwin: no need to buy, google for "python recipes". there and in other places there's a lot of free python code for most purposes. chances are python has a tested module/library for what you need
Eli Bendersky
@Eli: thanks for the link, there are a lot of code snippets there, a good place to learn real-life usage of Python!
Edwin
+2  A: 

Hi,

The short answer would be, you can do many many things with scripting languages - but you can still call it programming or software development.

But, answering your questions, what i find the most helpful in my work, to increase my productivity, is lots of shell/perl/python scripts.

I think the most common use of scripts are various kinds of reports (in a broad sense), say having a logfile and wanting to retrieve certain information (or some sort of statistics), script can help you to achieve that in very short time.

Some hint keywords for you: shell scripting, regular expressions, output formatting.

Thanks

Kuba Tyszko
Kuba, thanks for sharing.
Edwin
+1  A: 

So, I have frequently been using Python to prototype solutions to various programming tasks (it's good to get the algorithm right before implementing with all the bells and whistles in some other programming language), and I have been using BASH shell scripting to automate a variety of tasks (e.g. running a program over multiple differents sets of input, saving the results, piping to grep and other utilities, etc.).

When it comes to tedium, really I would strongly recommend BASH. You can get it on Windows by installing Cygwin. For example, I frequently find myself doing things like the following for my various courses:

for i in {1..10} ; do
    ./process_data input-$i.txt | tee result-$i.transcript
done

You don't need a good editor... any text editor will do just fine. That said, if you are looking for a good Python editor, Eclipse with PyDev is pretty good. Personally, I just use Xcode as a general purpose code editor for everything... even though it doesn't really bring anything to the table for Python or BASH shell scripts... of course, you don't have Xcode on Windows. However, you can use Notepad++, Notepad, or Wordpad.

Michael Aaron Safyan
Geany's good too, and cross platform.
detly
+1 for cygwin/bash
glenn jackman
Thanks Michael, since I also want to use such a scripting/dynamic language to do some web server side works, I'd better go for a language that supports web scripting...
Edwin
@Edwin, Python is great for web scripting. It is used for code running on the Google App Engine, for example, and you can use Python with Django for your own web sites.
Michael Aaron Safyan
@Michael, Yes, I know, my reply was to BASH, sorry I didn't make it clear...
Edwin
+1  A: 

As a 50/50 windows/linux user at work, python is especially useful, since nearly everything I write is cross-platform, and also because windows doesn't really have a very useful shell language. With pyqt, I can create a pretty impressive GUI in just a few hours. I'm fairly certain than in the next few years, python will take over the world.

Brendan Abel
Does PyQT supports all QT features? QT looks interesting for desktop dev.
Edwin
@Edwin, That's their goal. And I haven't come across a Qt feature that wasn't supported in PyQt yet. It can be kind of confusing; though, because the PyQt release numbers don't necessarily follow the Qt release numbers. But the python/pyqt combo is pretty powerful
Brendan Abel
Sounds good! BTW, is there a list of nice-looking desktop apps those are developed with Python + QT?
Edwin
Most commercial software is still written in C/C++ and so uses Qt - http://qt.nokia.com/qt-in-use/target/desktop. There are some commercial applications that are written in python + Qt - http://wiki.python.org/moin/PyQt. But I imagine the overwhelming majority of PyQt apps are written as in-house tools, and are never published.
Brendan Abel
I should point out that PyQt is GPL'ed and is not an official product of Trolltech/Nokia. They are now developing PySide, which will be a Python binding for Qt that is available under the LGPL.
Michael Aaron Safyan
+1  A: 

i'm TextMate user and actively develop extensions ("bundles") for it for my own use in php, ruby and javascript.

stereofrog
Thank you, I don't use Mac, unfortunately...
Edwin
+9  A: 
  1. You can DEFINITELY help yourself by automating a lot of tasks with scripting languages.

    Please note: some of those "scripting" languages - like Perl - are actually very powerful general purpose software development languages which just happen to be labeled "scripting" because their initial niche and/or parentage was scripting (and because it is easy to do simple scripts with them).

    Personally I use Perl for both quick scripting automation (2% usage), web development (8% usage) and enterprise financial software development (remaining 90%).

  2. As for examples of what you can do - the answer is "pretty much anything" and largely depends on what your typical work that needs automating is. I use Perl for file system related stuff (file organization/cleanup/renaming) to file content manipulation (Perl's origin and one of strongest suites still being text processing) and assorted reporting ("R" in Perl stands for "Reporting"), and for assorted data crunching that is just too difficulty to do quickly in Excel.

    Please note that Perl has an extremely wide array of libraries (called modules) available via CPAN that can be used to do pretty much anything except toasting bread or time travel; as well as numerous frameworks for serious software development.

    To mirror the Python answer, Perl can also be used for GUI stuff on Windows - I won't elaborate here since SO has very comprehensive discussions on the topic should you decide to go with Perl.

  3. As a very specific example illustrating the above, the last 2 projects I did for myself were indexing systems that indexed file names, meta-data and contents and provided a way to search through the index. The first one was local code search (poor man's version of Google Code Search appliance), the second one was a file collection management system for my mp3s (I double dog dare any existing software for the purpose to allow me random regular expression search by tag keywords). Both used SQLite back-end and Perl for indexing and front-end. Second specific example was a 2-liner counting how many up-votes I had for a specific tag on StackOverflow :)

  4. You will benefit greatly from a good IDE or just programming editor for ANY programming, scripting included. On Windows you can use Notepad++ or UltraEdit or many more - SO should have a list someplace. Any editor with "intellisense" (intelligent workd completion) gets an edge.

DVK
Why the downvote?
DVK
Probably because people think that the down arrow means "I disagree/don't like this answer", not "This answer was not useful".
ΤΖΩΤΖΙΟΥ
Hi DVK,Thank you very much for sharing your real-life experience, I got it!
Edwin
@DVK, probably for recommending Perl.
Michael Aaron Safyan
You forgot about Perl's handy command line switches for getting quick tasks done in a hurry. `perl -nie 's/FNORD//g' flax_prospectus.data eschaton.conf orgone.gen` - so few characters to process 3 files through a filter and print results to STDOUT! Not to mention (-a) autosplit and print mode (-p). These are **Very Good Stuff** that makes a quick data munge as easy as pie.
daotoad
+3  A: 
Norman Ramsey
Thanks Norman, I heard go things about Lua, but it seems there are less resources about it on the web.
Edwin
@Edwin: I think you'll find everything you need at lua.org. An oddity of Lua is that they are not using web forums but are sticking with a mailing list. It's *very* active!
Norman Ramsey
@Norman, thanks for the link. Personally I like the syntax of PYthon better :)
Edwin
+2  A: 

So you probably got the picture already, you'll perform certain tasks lot quicker using scripting language (and regarding the word scripting: I just don't consider it derogatory anymore, quite the contrary). Hell, I have some friends (accidentally Delphi-only programmers) still using Delphi to perform some one-time tasks, searching in text files etc, spending hours writing Delphi classes and forms, compiling over and over again, instead of couple of minutes writing Python/Ruby/Perl one-liners.

But I think there's even more important thing to it (given the right choice): you will learn new programming concepts. You will grow as a programmer. You will outgrow that old "you got the hammer, so everything looks like a nail" point of view. You will learn how to breathe again.

BTW, when I say "given the right choice", I strongly advice choosing a properly devised language with powerful functional programming concepts. So I'd really skip PHP and go for either Python or Ruby.

Mladen Jablanović
'learn new programming concepts', that's cool! These years I developed a Windows desktop app and sell it online, I always want to get things done as quick as possible, didn't want to invest time on learning another new language....
Edwin
+1  A: 

I use scripting languages to do a lot of pre/post processing of data. Small or large.

Nearly all scripting languages have superb/fast file, text, graphic, etc. handling. And very very easy without masses of boiler plate code and the compilation step.

And as someone mentioned, you'll be flexing your muscles and learning a new world of possibilities.

I jump from one scripting language to another, sometimes mix them up, just to get what I want done faster. Makes me fearless knowing that you can do most anything you can think. If you can't then there's always stackoverflow and the more languages (the language-agnostic tag) you can accept for a solution the faster (and better usually) you'll get one.

zaf
Thank you for sharing zaf
Edwin