Jump to content

What is the meaning of Scripting language?


alisha0512

Recommended Posts

A scripting language technically differs from a programming language in that it is interpreted at runtime instead of compiled into machine code beforehand. Is that what you wanted to know?

Link to comment
Share on other sites

A scripting language technically differs from a programming language in that it is interpreted at runtime instead of compiled into machine code beforehand.
That's just the difference between compilation and interpretation. There are a lot of interpreted languages that are not scripting languages.This is what wikipedia has to say:
A scripting language, script language or extension language, is a programming language that controls a software application. "Scripts" are often treated as distinct from "programs", which execute independently from any other application. At the same time they are distinct from the core code of the application, which is usually written in a different language, and by being accessible to the end user they enable the behavior of the application to be adapted to the user's needs. Scripts are often, but not always, interpreted from the source code or "semi-compiled" to bytecode which is interpreted, unlike the applications they are associated with, which are traditionally compiled to native machine code for the system on which they run. Scripting languages are nearly always embedded in the application with which they are associated.
One example is VBscript inside Microsoft Excel. You can write a macro using VBscript, which Excel executes. But Excel itself wasn't written in VBscript, it was written in another, more powerful language. But Excel allows you to do some things with VBscript to control how Excel works. You also can't run your VBscript macro stand-alone, you need to run it inside Excel for it to work.
Link to comment
Share on other sites

Well, frankly, I think they're wrong. An interpreted language is a language that does not need to be compiled. An interpreted language is not the same thing as a scripting language. If they were, then why would we use 2 different terms? Java is one language that you can say is an interpreted language because it runs in the JVM (even though some implementations use just-in-time compilation). Would you say that Java is a scripting language? BASIC and Lisp are interpreted languages that I don't consider scripting languages. All scripting languages are interpreted (I think..), but that doesn't mean that interpreted languages and scripting languages are the same thing. Granted, it's a fine line, but there's a line.

Link to comment
Share on other sites

I've considered this question before, but always from the other end, usually when I ask: When I write Javascript or PHP, can I call that programming? I think we're looking at shades of gray here.When we wrote BASIC back in the old days, we knew it was interpreted, but we always called it programming, not scripting. So I don't think being interpreted is a defining characteristic. But I'm unaware of a scripting language that is not interpreted. So I think we can (maybe) say that, while all interpreted languages may not be scripting languages, all scripting languages are in fact interpreted.When I learned Wordperfect Macro Language or Macromedia's Lingo for Director, I was clearly scripting. The manufacturers said so, and the languages were completely tied to their host programs. This suggests that being run "inside" another program might be a defining characteristic.Then you have a thing like Applescript, which calls itself a scripting language, but is seemingly not run inside another program (though it can be). A key feature of Applescript is its "human language" interface, which also characterizes WP Macro and Lingo. So we might call that "humanness" a defining characteristic.Javascript seems like an excellent candidate for a true scripting language. It and its parent, ECMAscript, call themselves scripting languages, and at least in its browser implementation, Javascript is being run inside another program. Javascript is also used to power Dashboard Widgets in Apple OS. On the other hand, JS has developed to the point that it no longer resembles a "human language." So, despite the above, I'm going to exclude humanness as a defining characteristic. I'm not sure it's even a typical feature. We'd have to do a broad survey.Moving on. Despite looking and behaving like languages headed for a compiler, Perl and PHP both call themselves scripting languages. And if we consider them historically, I am comfortable with that description. So what program are they (were they) being run inside? Sneaky answer: the UNIX operating system. Anyone who knows UNIX will recognize the large number of built-in Perl and PHP functions that are word-for-word copies (or near copies) of UNIX system calls. Even the original BASIC never had such a close relationship with any operating system. So, like Applescript, I'm comfortable calling both of these scripting languages. The fact that the host environment is an operating system is notable, but should not be a disqualifier. An OS is still a program. Then again, for quite some time, Perl and PHP have been ported to other OS's. This muddies the distinction I've been making.And if you think about it, the fact that old-fashioned BASIC called itself a programming language may be incidental. I don't think the concept of "scripting" language existed yet. (And what do we make of the fact that while BASIC was designed to be interpreted, BASIC compilers followed quickly.)So here's what I'm left with. "Scripting language" is a legacy term applied haphazardly to programming languages that are normally interpreted at run-time. The interpreter may be a user application, such as an Internet browser or word processor, or it may be a transparent application closely associated with the host computer's operating system. While some scripting languages closely imitate human languages (English in particular) others are difficult to distinguish from languages intended to be compiled. The fact that scripts are interpreted leads to advantages as well as disadvantages. The chief advantage is that they can be developed, maintained, and ported with with relative ease. Disadvantages include poor speed (compared to compiled programs) and automated memory management, both of which can cause large or complicated scripts to crash unpredictably. With the development of faster computer processors and more robust host applications, however, these disadvantages become less significant.W00t! That was a fun and nearly pointless exercise.

Link to comment
Share on other sites

If we assume that the interpreter itself (e.g. php.exe, javaw.exe, etc) is the host program, then that would make all interpreted languages scripting languages, and since all scripting languages are interpreted languages then that would make them the same thing. If we consider that there exists at least one C interpreter, does that make C an interpreted language? So then, is C considered a scripting language? If a certain language can be interpreted or compiled, depending on the implementation (Java, ASP, etc), what does it fall under? It's definately a pedantic distinction.I like the definition as a scripting language requiring a host application in order to run, but that blurs the line between interpreted and scripting if we consider the interpreter as the host application.What if you use C to compile an interpreter that interprets C code? Does the universe collapse?

Link to comment
Share on other sites

Hmm... some ideas.

"Scripting written from scripting languages are run in the context of something else.Programs (from programming languages) are run independently, out of context."
"Scripting languages are executed line-by-line or from bytecode. If it is compiled, even JIT, into machine code, it is a programming language."
"Programming languages are run from the operating system. Scripting languages are run from another program."
From what I have been reading, scripting languages are always created to facilitate the operation of something else. A programming language is created as a general purpose language that can do anything, while scripting languages are targeted for a certain purpose.Can scripting languages be Turing-complete? PHP is, but was it at the start when it was named?Also, back to what JSG said about interpreting compiled languages - I think it depends on the initial way the code was executed. So maybe if we interpreted our C code it should be called "C scripting" - but we don't because C is traditionally a programming language.
Link to comment
Share on other sites

Holy crap... Ok first of all, the original poster hasn't responded, making me think one of two things: the poster new the effect of the question and did it out of amusement or you guys scared the poster off.Secondly, I always thought the difference was that programming languages were compiled and executed, while scripting languages weren't. And I'm not sure what is meant by interpreted languages, but it's sounding to me like (aside from a few rebel languages) interpreted languages are scripting languages, to some extent.Thirdly, before this discussion gets too much further and more confusing to those who've only learned a few languages, are you sure you're even answering the question? Because it would sound like, to me, the original poster is inexperienced and probably does not understand a word being said (especially out of Dierdre's Dad's rant, which is nice by the way :)). Then again I could easily be wrong, as could anyone.Lastly, why get so picky over subtle differences. I mean, does knowing the fine line between interpreted languages and scripting languages (assuming justsomeguy is correct, which he usually is) make a difference on how well you write them anyways? I mean, it's nice to have the knowledge, but I think I'm just fine being naive to all of the definitions and whatnot and just knowing that if I write such and such, it will do this. That being said, I think the original poster might've just wanted to see an argument.

Link to comment
Share on other sites

And I'm not sure what is meant by interpreted languages
An interpreted language is one that is interpreted instead of compiled (is that clear?). php.exe is the interpreter for PHP, you send your script to php.exe and it executes it. Your web browser's Javascript engine is the interpreter for Javascript. It interprets and executes the code. When a language gets compiled it gets turned into a format that the processor itself understands, it doesn't need a middle layer to transform the language statements into machine-executable code. That's what the interpreter does, it converts the text code into binary instructions for the processor. Compilation does that itself, which is why compiled programs are faster. The compiled code just gets loaded into memory and executed, it doesn't need to be translated. It's even possible to directly compare C and PHP, since they share common syntax. If you use something that both of them can understand (like sprintf statements in a for loop) then you can time them and see which one is faster (hint: it's C).
I mean, does knowing the fine line between interpreted languages and scripting languages make a difference on how well you write them anyways?
No. It's just an academic discussion. I refer to all executable languages as programming languages, regardless of how they are executed. If I'm talking to someone with a PhD in computer science or something about languages then I might start throwing around compiled and interpreted and scripting, or else I just say programming languages.
Link to comment
Share on other sites

Ah, I see. Well, I guess this is something I should start becoming familiar with since I'm going to try to get a Ph. D. in Computer Science. I really enjoy web programming (not so much designing stuff and whatnot, but doing the PHP coding and JavaScript coding, that's the stuff I enjoy). I've been looking for as many learning resources as I can get, but I don't find very many good ones. I want to start saving money for books that will help me develop all my web building skills (even the HTML and CSS stuff, because I'm sure there's things I still don't know yet) but I don't even know what books are good. I'm really interested in developing my PHP and JavaScript skills a lot more, and also I want to understand AJAX much more. I barely know anything about how to use AJAX.

Link to comment
Share on other sites

AJAX is actually pretty simple. It's pretty much the same thing as typing a URL into your browser and hitting go, except you can control what you do with the response from the server. You create the AJAX object (XMLHttpRequest object, or XHR object), and have it send a request to a page on a server, like a PHP page. You assign a function to the XHR object's response handler, so that when the response comes back from the server it calls your Javascript function, and you can get the response from the server and do whatever you want with it. It's really easy if the server returns JSON data, which is a Javascript object in simple notation, like this:{"fname":"John","lname":"Doe","age":30}That's the same thing as this:

obj = new Object;obj.fname = "John";obj.lname = "Doe";obj.age = 30;

So if the server returns a JSON string as the response then it's really easy to use that in Javascript, you don't have to convert it or anything. Arrays are the same way. Instead of doing this:

ar = new Array;ar[0] = "John";ar[1] = "Doe";ar[2] = 30;

You can do this:["John", "Doe", 30]These are also the same:

obj = new Object;obj.fname = "John";obj.lname = "Doe";obj.nums = Array(10, 20, 30);obj = {"fname":"John", "lname":"Doe", "nums":[10,20,30]}

Link to comment
Share on other sites

Ok I think I understand. I never really got the hang of building arrays before. Most of my array experience is the PHP mysql_fetch_array() function. But I know the basic principal of how they work and whatnot, just not extremely complex ones :). I think the reason for that is is because I learn by applying stuff right away, and the tutorials don't really give you applications for the stuff, so I didn't retain much besides the simple things. Do you know any resources that would help me, or books I should invest in?

Link to comment
Share on other sites

OK, the topic is officially hijacked, so let me get on the gang wagon...The best way to learn is to try to use what you already know into an application of yours (i.e something you or a client of yours want), and learning things on a "need to know" basis.For example, decide that you want to make an application where people can enter one or more things of the same type (eg. enter one or more phone numbers). You need to do the same thing(s) for each item (eg. translate each phone number to a specific format and enter it in a DB). Ask yourself "How do I do the same thing for an arbitary number of these?", and the answer (in this case, placing each phone number in a numeric array and looping over it) will come right at you.The same goes for anything else any language has to offer - need it (for a new or existing application), research it (in the language's manual), try it (in an isolated environment, just to check out how the feature works), use it (to fulfil the need), improve it (i.e. is there a better way?).

Link to comment
Share on other sites

That's what I've basically been doing. Here's the site I've been building. You can see the stuff I've been learning and everything, but I hit a lot of blocks where I want to build something but I have no idea where to begin. If I ask I usually get a response to use a certain language and read up on it, and that's where I hit the block. For example, AJAX. The w3schools tutorial shows you a decent way to use AJAX. But from there I don't really know how to transform what they give into what I want it to do. I supposed I could try digging again but I somehow think that's not going to work >_<.

Link to comment
Share on other sites

(Rant?) When I buy books, I'm looking for one of two things. 1., a language reference with a complete list of functions, data types, syntax, concepts, etc. I use this mostly to study when I'm not at my desk. 2., a source of basic code snippets that show me how concepts are implemented. I might use this at my desk or away from my desk.I learn the most by googling concepts and studying other people's code online, and then imitating it in my projects. Monkey see, monkey do. That's what led me here.Solving other people's problems is also an excellent way to learn, though maybe I like that one because I am a teacher by profession. I learn the most from questions I almost know the answer to. I'll write a script or try something out in my error console first, and if I get something working I'll post right away. If not, my curiosity gets piqued and I'll do some research. Then some coding, some research, etc., till the thing gets solved.I think between w3schools and the fact that you can download every javascript in the universe, you can easily get by without buying a book. Seriously. You're on someone's site and you wonder how something works, so you just reverse engineer it. PHP is harder, since it's hard to tell what it's doing just by looking at the completed page. But the online PHP manual is a Godsend. I'm always a little disgusted when people ask questions on this forum and I know the answer is 2 clicks away on the manual. (Now, that's ranting. But just a little.)

Link to comment
Share on other sites

That's what I've basically been doing. Here's the site I've been building. You can see the stuff I've been learning and everything, but I hit a lot of blocks where I want to build something but I have no idea where to begin. If I ask I usually get a response to use a certain language and read up on it, and that's where I hit the block. For example, AJAX. The w3schools tutorial shows you a decent way to use AJAX. But from there I don't really know how to transform what they give into what I want it to do. I supposed I could try digging again but I somehow think that's not going to work >_<.
No no. You're talking about too broad picutres."I want to make a registration form" or "I want to make a forum" is not the type of thing I'm reffering to. I mean simple tasks. After you understand how these simple tasks work, you'd get onto with the complex ones.For example, you'd first ask yourself "How do I process any data from a form?", leading you to PHP. Then, you should ask yourself "How do I make sure that I allow only this data in?", leading you to regular expressions and the such. Later, going on to "How do I store arbitary amounts of this data" (regardless of what the data is - a user name, a password, a phone, a text, etc.), which would lead you to databases, etc. etc. etc.You'd stop hitting roadblocks if you make your tasks simple. Start with a plain, single <input type="text"/> type of form, adding various fields and controls as you feel they are completed.The way you seem to be doing things is by trying to swallow the sandwitch without even knowing what was in it. Stop doing this! It's not healthy (in both the metaphor's sence and in programming/scripting/whatever sence).
Link to comment
Share on other sites

Well I've already made complex forms and whatnot> But I get what you mean, instead of thinking in terms of what I want to make, I should instead look at what I need to make it, then build simpler things out of that until I get enough grasp to apply it to what I actually want to build, right?That would make the most sense to me I guess. But the things we need to add to the site right now, I kind of already know how to make, just haven't made them yet. But at the same time I still want to learn.I suppose I should probably wait until the features are added, then worry about what I can learn by expanding on them and everything. Hmmm, I don't like waiting >_<.

Link to comment
Share on other sites

The best way to learn is to try to use what you already know into an application of yours (i.e something you or a client of yours want), and learning things on a "need to know" basis.
I disagree a little with that. It's easy for someone who already knows how things work to look at a certain problem and see the solution, but if you don't even know what an array is you aren't going to spontaneously think that you need a random-access data structure to hold your data. If the only thing you know about is a scalar variable then you're going to try to make a solution that only uses scalar variables. I think it's best if you read a book that covers the language and at least tells you which tools you have available to use, examples are fine and all but they don't help if the technique you need to use doesn't appear in the example. If you've read a book that covers what an array is and how it works then when you get to a point where you need to use one you're more likely to remember that you have it available to use. You don't necessarily need to memorize everything about it, but if you can recognize that your situation calls for an array then you can do some research (or look at a reference) to figure out how to use arrays.
Link to comment
Share on other sites

I hear read a book a lot. I would love to read a book, but I don't know what book to read. I have seen plenty of books, but I don't exactly have the money to buy a book just to find out I should have bought a different one. Can I have some examples of what books would be good to buy for different languages? So I know what to save for. I mean, I have only just turned 17 and I live in a small town where you have to be 18 to get a job at any none-family run business. So I like to make sure when I buy, it's what I actually want. So some titles would be great.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...