Technically speaking, a script is interpreted whereas a program is compiled, but this is actually not their main difference. There is another small yet more important difference between them!

The main purpose of a script written in a scripting language such as PHP, JavaScript, or VBA (Visual Basic for Applications) is to control another application. So you can say that, in some ways, PHP controls the web server, JavaScript controls the web browser, and VBA controls a Microsoft Office application such as MS Word or MS Excel.

On the other hand, a program written in a programming language such as Java, C++, or Visual Basic.NET executes independently of any other application. A program is compiled into a separate set of machine language instructions that can then be executed as stand-alone any time the user wishes.

Notice: Macros of Microsoft Office are scripts written in VBA. Their purpose is to automate certain functions within Microsoft Office.

Remember! A script requires a hosting application in order to execute. A script cannot be executed as stand-alone.

One Response to What is the Difference Between a Script and a Program?

Leave a Reply

Your email address will not be published. Required fields are marked *

This article is taken from a book of mine. If you enjoyed it, please visit my author's page inand check out all of my books!