Larry Walls touched o n this exact issue in an interview one time. His background is as a linguist so he approached it from the etymology of the words. Basically his conclusion is that the line between the two is more blurry than most people think (you can embed an interpreter on a chip in a device so is a scripted language interpreted then or compiled). Essentially it comes down to ease and flexibility of change. Scripts change quickly and easily whereas programs require more effort. The classic definition is it is a program if it is compiled and it is a script if it is interpreted. This is a good starting point, but not the final definition in my opinion.
If you can open the file in Notepad and it's readable then it's a script. If it's a bunch of gobbledygook with weird characters everywhere, it's probably a program. :)
The classic definition is it is a program if it is compiled and it is a script if it is interpreted
In practice a "script" is directly editable in notepad (or similar), a program is not. If you open an exe in notepad you will see little black squares. If you open a script, you will see the code.
That's the main difference...as I see it.
Now you can expand the definitions with sophisticated phylosophical theories. I'm sure Wikipedia is full of it.
Posts: 2726
Score: 46
Joined: 6/29/2006
From: Orange County, California
Status: offline
I am not a programmer and recently took a intro C++ class to see what it was like...it helped to understand things better.
One thing scripting and programming languages seem to have in common is Sequence (the order of your code), Selection (If and Select/Switch type statements), and Iteration (Loops)...so the line is very blurry in my eyes.
If VBScript could be compiled in executable then we would be programmers. I still don't undrstand why this can't be done since that's what Wscript.exe just does everytime you launch a script.
Well, programmers say, "translating to VB is very easy". I tried once, I never got even through the "Hello Wold" test. :(
I don't believe so. I think it essentially reads through the script and executes the commands that are in it. I could be wrong, but in theory if it were compiling to a binary then I should see a new binary appear using filemon and I don't think I ever have.
The VBScript engine does two passes on the source code. Evidence: a syntax error in the last line will be caught before a run time error in the first line. I can't prove but believe that the first pass will generate an intermediate form of the script to make the second - interpreting/executing - pass more efficient. One argument: the VBA interpreter has this functionality (you can choose Compile or Run from the menu). This intermediate form is not binary = native x86 code but more akin to the MIL of the .Net languages or the byte code of Java.
In my opinion, "scripting" is to "programming" what "essay writing" is to "writing a (scientific) book". The aims/goals are different: An essay should present the most important facts in an easy to read way; a script should do its job correctly but may skip some of the pedantic things necessary for a 'heavy duty' program in exchange for being easy/easier to write.
Some people believe that French is especially suited to write essays, so let's assume - for the sake of the following argument - that it is somewhat easier to write scientific books in Chinese. VBScript/Javascript/Perl ... are better suited to scripting (simple/no types, Eval/Execute, many defaults); C/C++/... are good for programming (strict type system, compile time checks, flexibility). But modern languages blurr this difference: Java or the .Net languages are compiled (to an intermediate language) but can generate/compile/ execute new code at runtime.
I think, the most important rule is:
Quidquid agis, prudenter agas et respice finem
(Whatever you do, do it carefully/wisely, and consider the end/result)
< Message edited by ehvbs -- 6/11/2007 10:23:25 PM >
(I may know some Latin, because in Gemany there was a theory, that pupils would learn all other languages better, if they were first exposed to Latin. Evidently my English is a counter example to that theory)
I don't believe so. I think it essentially reads through the script and executes the commands that are in it. I could be wrong, but in theory if it were compiling to a binary then I should see a new binary appear using filemon and I don't think I ever have.
I think that the second "interpretation" ehvbs talked about is binary and even must be binary to be executed. If Wscript had to always take a text input and return a result, like, say, your browser return a webpage when you enter an address, it would take ages to execute functions and loops. Take our examples of sorting function: functions which are run 10,000 times on a list of 10,000 words: Obviousely Wscript doesn't re-read the cod in text format everytime or you will have to wait until tomorrow. The script may not run "as an executable" but it may run as binary datas being streamed via Wscript Host to the proceessor.
That is a good read. Thanks for the post. So it looks like VBScript gets compiled to an IL, but I don't consider that the same as
"If VBScript could be compiled in executable then we would be programmers. I still don't undrstand why this can't be done since that's what Wscript.exe just does everytime you launch a script. "
Which was the initial discussion around script compilation.
Philosophy (the love of wisdom or the love of knowledge)
Programming is programming, writing code, the type of code/language is not an issue.
To me a script has an almost singular purpose a small tool to use, where an application has many purposes.
If you can write a computer program you are a programmer, no matter what kind of program it is IMHO.
I worked in COBOL on Mainframe/UNIX systems for a long time, decided to learn about PC/Servers/Networks in the process I found out they are all computers, DANG! People think networking is complex, Routers are computers with an almost single task, route packets (data) to the right place, but they are not scripts?
I've been told by programmers "I wish I knew about PC's" I know they didn't want to know about the hardware they wanted to know VB or C, another language.
Programming is knowing not just a specific language but programming constructs.
The verbs/syntax may be different but they achieve the same goal COBOL CODE
VBS CODE
Is one programming and the other scripting because one is COBOL and the other VB Script?
< Message edited by mcds99 -- 8/28/2007 7:40:38 AM >