Two Laptop Bag
The moose likes Other Languages and the fly likes Why Scripting ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Languages » Other Languages
Bookmark "Why Scripting ?" Watch "Why Scripting ?" New topic

Why Scripting ?

Cecil Phillip
Ranch Hand

Joined: Nov 05, 2001
Posts: 40
I'm a newbie to programming and I was wondering why have scripting languages embedded in or interface with "higher" languages like Java and C++ ? What are the advantages of using a tool of this sort ? I'm sure they carry more or the same functionality as other languages.
Joe Ess

Joined: Oct 29, 2001
Posts: 9188

There's an old adage "when the only tool you have is a hammer, all your problems look like nails". It is a Good Idea to use different programming languages where their strengths are greatest. Sometimes that means we use different languages for different parts of a program. Programming languages like Java and C++ do certain things well: Fine-grained control of data access, handling complex logic and exceptions, networking, and so on. Scripting languages like Python are very useful for writing quick programs to handle repetitive tasks. We can use Java to implement a program which handles intricate network logic, then provide a Python API via Jython to allow people to quickly code up scripts to test a web site. For example, The Grinder load testing framework does exactly that.

[How To Ask Questions On JavaRanch]
M Beck
Ranch Hand

Joined: Jan 14, 2005
Posts: 323
technically, you only need one single programming language. technically, anything that can be done with a computer can be done with a Turing machine. technically, it's possible to push peas uphill with your nose.

the holy grail in language design is to make the programming language that's equally good at any task. it's never been done, except maybe in the case of assembly, which tends to be equally not very good at just about everything... every language in common use, and countless more that aren't, each have their strengths and weaknesses. ideally, you want to work on a project where each task or subproject can be written in the language best suited for it; except that that would introduce costs and overheads all of its own, which is why most projects only involve a very few languages at most.

compiled languages like C and C++ can give you great performance at the cost of being harder to write, read and modify. "scripting" languages like Perl and Python can give you very rapid development and (possibly) great maintainability at the cost of runtime performance. Java has the promise of run-anywhere platform independence with decent to great performance. dot-net is in the wings with its own advantages and backdraws, although that platform is still immature by the standards of C++ or Java. really unusual languages like OCaml, Haskell, Scheme, and others have (among other things) the great advantage of being fun to learn and to use.

if anything, i see the future holding more different languages in common use and more projects being written in more than one language. there's less and less reason not to go that way.
I agree. Here's the link:
subject: Why Scripting ?
It's not a secret anymore!