Which language do you use for "throw away" programs? By "throw away" I don't mean perl one liners, but code that is useful for a current project but may not be added to it.

+12  A: 

Generally any scripting language. Ruby is my personal favorite for desktop scripts and PHP for web scripts, but those are the two I'm most familiar with.

If it might be included, whatever language the project is in. In that case, I treat it like part of the project, and check it in and everything. I just make sure that it's commented clearly that it might not be part of the final release and it's just a development tool.

Thomas Owens
+2  A: 

C++, I know it's not the best language for it. But I've been doing C++ for over 10 years and have a lot of utility stuff already written. So I'm usually much faster than in any other language I know.

That said, my second choice is Python.

Magnus Westin
I'm the same way, but with Java. I've been coding Java for two years professionally, and have had additional experience during school, etc. If I went with Python (which I like) I'd have to look all sorts of stuff up, but with Java I know it off the top of my head. Knowledge of the libraries is key.
+5  A: 

I think Perl is inherently a throw-away language!

Steve M
+27  A: 


So easy to get quick hitters up and running.

+2  A: 

Python is currently my choice du jour.

Unless I need lots of regex, then it's Perl.

+1  A: 

It seems I'm against the flow here but I like VB/ASP for ease of use, ease in transferring to VB.NET if it's a keeper, and as a Web based technology it's easy to provide access to others for demonstrations or permanent access.

All that said, I occasionally use new (to me) languages for non-critical applications so my attempts at learning Python mean it's also an option now.

David A Gibson

If it needs a GUI, I prefer VB.NET (the express edition of course). It's quick and dirty (just like all my throw away projects)

Other than that, mostly php.

If the project gets bigger, I eventually port it in Java.

+2  A: 

Ruby, .NET(C#) in that order

+3  A: 

PowerShell or Python. PowerShell being my first choice, since I can call into the .NET framework and use assemblies I've already written (I know IronPython could do that, but PowerShell is more convenient for the moment).

Also, since the PowerShell scripting engine can be embedded in my programs, I can take embed the PS runtime in my app and try various combinations. If things work, I can convert to C# or leave it as PowerShell.

Steven Murawski
+2  A: 

Bash scripting if it's easy enough. Otherwise, generally Ruby.

James A. Rosen
+6  A: 

I used to use Perl, but started forcing myself to use Python - the main reason for that is that I tend to write better code when using Python, simply because there are so many shortcuts available in Perl.

In my experience "throw away" programs can often become more permanent, so I'd think twice before starting to hack away at something that supposedly will be thrown away.

As you write yourself, "may not be added", but it might stick, and if you don't do it properly you might end up with an unmaintainable mess - force yourself to do it right the first time and you'll be happier.

+1  A: 

I find Python makes writing throw-away programs that are still readable and maintainable rather easy. Plus, with batteries included, a bit of script can go a long way!

Daren Thomas
+1  A: 

Without a doubt... Boo. Very much like Python but targets .NET. And if you do end up keeping the "throw away" code, then it's really easy to convert to C# or VB.NET if needed (auto in #develop IDE).

Boo Language

+5  A: 

It rather depends which language is most suitable for the problem domain.

Even for throwaway programs.

Most recently, sed and xmlstarlet.

+1  A: 

Python and C# are favourites for different reasons, and for those reasons I currently am looking at BOO - the best of both worlds!

Frep D-Oronge

I'm with izb -- python for most things, but perl if I need regex or more complex string manipulation.

Graeme Perrow
+1  A: 

Actually it's still plain old Visual Basic 6.0, because usually my "throw away tools" have to work with strings a lot and I know how to handle these in VB6 ;)

Okay, start to throw rocks... NOW! (JEHOVA, JEHOVA)


I like python for my throwaway type programs and if I'm feeling a little adventurous and need to integrate it with .net IronPython

+1  A: 

Matlab, since most of what I do is data-intensive. The built in math functions make testing algorithms easy.


hmm... the same language the project is made in... usually c#

Juan Manuel
+6  A: 

It's kind of funny... but for throwaway apps I immediately turn to VB6.

I'm a fan of VB.NET for more modern development (as I mention in another post... and yes, I am a "real programmer". I choose VB.NET.), but VB.NET did lose some of it's Rapid Application Development gusto when it switched over from VB6. VB6 still lets you push out a quick app in moments.

Wow, I thought I was the only one who still had a use for VB6! I even use it for small desktop or COM apps that need to be deployed on other machines. No libraries to deal with, just compile and copy.
Cool, I'm glad I'm not alone on this either =) It's definitely handy to use in a pinch. =)
+3  A: 

Groovy from the command line, usually. To verify method behavior in Java libraries.

and to script domain classes from my project. For Java types, I can't believe this answer isn't getting 50 votes. Groovy rocks.
Michael Easter
+3  A: 

The interactive Python shell is vital for occasions like this. No need to bother even creating a text file, just type it and run it! You get the whole the Python standard library to play with, which really helps reduce the amount of code you have to write for almost any task.

Andrew Wilkinson

C#, or if I'm in Linux land, Perl

+2  A: 

If its a web app then Grails allows you to create a functional app that can perform CRUD operations with 5 commands and 1 edit of code:

grails create-app BookStore
cd BookStore
grails create-domain-class Book

Then edit the generated Book.groovy, you could add:

class Book {
    String title

and then enter:

grails generate-all Book
grails run-app

and there you go one working web-app.

Rich Lawrence

I willl generally use whatever language / platform the main body of the project is implemented in. There are a couple of reasons for this:

  • It is possible that the throwaway code may be usefull for demonstrating necessities in the final implementation
  • Given that this is the language that I am currently working in it is likely to be my sharpest knife
  • If it is the language of the project then my colleagues are more likely to understand it.


Usually that code tends to be useful, so it's nice to keep around in a state that it can be used (by my project) in.


Mat Noguchi

My problem is I have too many that I turn to. It really depends on the specific task that I am doing. I do a lot of this kind of stuff and I really don't throw it away. It may be useful the next time I have to do something quick. For quick useful tasks I try to avoid compilers unless I need the speed.

Here is my current order and why:

  1. Batch file - If it's simple and JPSoft's Take Command can do it I use a Take Command batch file.
  2. PowerShell - Very powerful, but I'm still learning (I hope to make it my solution for most throw aways).
  3. VBScript - Easy, fast, and easy access to a lot of com stuff - also can be used on IIS to create web pages (ie. ASP).
  4. Python - If I'm working on XML this is what I go to.
  5. Perl - Text parsing as long as it's straight forward. I don't like creating write only scripts. If it's complicated I will switch to something like PowerBasic.
  6. PowerBasic - If I need fast small executables with zero runtime.
  7. VB 6 (if I already have code that is close to what I want to do).
  8. C++ (rarely, but again if I already have code that does what I want or I find code online that does what I want).

I have yet to use C# or VB .NET for throw away stuff. In the future that will change as I accumulate more code.


My throw-away are typically to format data or move files around.

For this a good flexable batch file will run on any Win-xxxx based machine.

For a quick reformat GAWK and SSED work great. They can also be zipped with a batch file to pass the quick fix on to others.

I had held off on powershell because it just wasn't on every desktop that I need to touch. And nothing hurts like knowing a solution and not having access to the tools. From all I hear PowerShell has too much .. Power .. to ignore for too long.

  • Josh
Josh Miller

bash, perl (under Cygwin if in Winows)

Michał Piaskowski

Python -- for text manipulation, things more complex than regexps, etc. Bash -- for file manipulations, automating various tasks, etc.


Bash for shell scripts. the way you can just start typing it straight into a terminal for testing is priceless.

And you really can't beat PHP for simple web stuff. Most web servers support it.


It depends on where I am and what I need to do

  • Work: batch files and perl
  • Home: tcsh and perl
+1  A: 

Ruby. Pure object oriented, I don't have to worry about casting issues, and the classes that it provides allows to do proof of concepts real quick.

+1  A: 

Ruby and Rails

Terry Lorber

Lately, for simple scripts or throw away code, I've been digging on PHP from the command line. For me you can't beat a C-like syntax and the plethora of PHP functions you get out of the box is a winner.

If not PHP it would have to be C/C++.


Flash: I've been mostly doing interactive game-or-toy-like projects. Flash comes in very handy for me to do quick simulations or game prototypes.

Python: The interactive prompt is awesome.. where you can write programs and test/interact at the same time, on the fly

Haven't ever touched Ruby. Just my gut feeling that I will love it more when it comes to projects more complex and complicated then a command prompt can handle.


When scanning text files (and need quick-n-dirty regexps), perl. Otherwise, lisp.


Excel for one-time use reports (unless the report would require VBA)

Python (with the interactive shell) for other throw-away (or semi throw-away) needs


Usually Lua, unless there's a large need for some complicated library function that isn't included. Typically the string matching, input/output, and data structures in Lua suffice for anything I need to do.

John Calsbeek
+1  A: 

80x86 assembly language.

Naah, just kidding: I use Python. It's the only language in which I can always read my code a year later. On that metric, I'd rate sh second. I never managed to read my own Perl code, even if it was from yesterday. Genetic flaw, I'm sure.

Throw-away scripts are never as throw-away as you might like. If you don't want to have to re-write them from scratch next time, pick a language for its readability. If you find Perl easier to read than Python — MUTANT! — stick with Perl for your quick scripts.

Corollary: keep learning new languages.

Garth T Kidd
try perltidy and Perl::Critic for Perl
Alexandr Ciornii

Perl scripts that don't fit onto one-liners. Seriously.

A one-liner (in any language) is cool, but sometimes it's just a bit much to type something in and get a syntax error. So the test code goes into its own file in ~/dev where I add a few comments and explain to my future self to object of this mess. Sure, I that know right now, but I won't remember in a few weeks time.


Perl, because of CPAN, regexps and compact code.

Alexandr Ciornii

It really depends on what I'm doing and what platform I'm on.


  • bash
  • Ruby
  • F-Script
  • Nu

On Windows

  • PowerShell
  • Ruby
Gregory Higley

AWK is my scripting hammer of choice for the types of throw away code that I typically need to do. It falls well in to the 80-90% spot of the things I need to do. There are certainly times when it doesn't quite work, like when I need to do some system stuff. AWK has a 'system' call, but it's not quite granular enough for me.

For example, if I had a list of files and I wanted to know which files weren't, say, writable, AWK can't do that. But I can use it to quickly hammer out a shell script that CAN do that (and simply echo the results to another file). It can get a bit Goldbergian, but it works.

In theory I should switch over to Perl or Python or something. But it's kind of the baby duck syndrome. I've been using it for 20 years, and I LOVE the free "line reader loop", free line/field splitting, and the free regex matching.

It's a classic example of the language affecting your thinking, or perhaps using the language that works the way you think. AWK and I are so ingrained, I don't know who influenced who. I just remember have some weird problem at a client site and thinking AWK could solve it, so I dredged through the manual page to make it work.

AWK is small, its approachable, focused, yet powerful and that makes it a handy hammer in any Unix system. I've written everything from powerful code generators and data analysis tools to lowly simple conversion tasks.

Will Hartung
AWK is great for processing all sorts or records/log files. I've started looking at using Ragel for this sort of work.
Michael McCarty
+2  A: 

PowerShell is designed to provide a very wide range of formalism. Bruce Payette once noted that the lifespan of 99% of programs begins at the prompt and ends at the carriage return. We certainly support that very well.

We also support very simple BASH-style scripting where you use $args.

From there, you can optionally name your parameters, give them types, give them validation constraints, provide initializers, set up multiple parametersets, etc.

If it turns out to be code you want to put into a product, you can add HELP, you can localize the strings, etc.

All the while, you have access to a great scripting environment with man-style help documentation, high-level task-oriented abstractions, type adaptors that make it easy to work with XML, ADO, ADSI, WMI, etc and the ability to natively access the entirety of the .NET framework.

Experiment! Enjoy! Engage!

Jeffrey Snover [MSFT] Windows Management Partner Architect

Jeffrey Snover - MSFT
+2  A: 

Python is my first choice, simply because I can whip out a decent piece of code in a short time, that still is readable and possible to read the next time I need it, which is usually in a couple months time.

My disks are littered with small Python scripts written for a one-off, which might be needed again later.


In the order of decreasing likelihood:

  1. C++ (I have a special "sandbox" workspace where I play with things)
  2. Perl (If I am in a hurry to do something involving string processing)
  3. Windows Scripting language (It just amuses me).
  4. Python (If I also want to learn a trick or two)
Boris Liberman

For me, Perl. I can never understand what I've done in it after two weeks anyway :-)