Powered By Blogger

Thursday 2 May 2013

U20 P3

P3 - Explain the fundamentals of a scripting language

What is a Scripting Language?


A scripting language is a high-level programming langauage that allows intergration and communication with other programming languages, the most commonly used scripting language is JavaScript, but there are many others such as Perl, Ruby, VBScript etc. A scripting language is normally used alongside other programming languages such as HTML.

A scripting languages are not compiled like a programming language but it is interpreted by the browser, one command at a time. These are normally used to add and increase the functionality and interaction to a webpage, an example of one of these languages is JavaScript which was created by a company called Netscape with the intention to increase functionality as HTML alone was not capable of providing it. Without Scripting languages there would be no interactivity on the webpage, so there would be no search bars or the ability to submit forms via the website.

Nature of Scripting Languages

Scripting langages can be both object oriented and event driven programming.
 
Object oriented languages is where the code is divided in to different Objects (hense the name) where each object knows about itself and its ability, therefore it knows what it can do and what other objects it can interact with. Object orientated programming follows a series of steps which  focus on performing actions and manipulating data, that is held within objects.
 
Event Driven however is where the code is divided in to different events (hense the name) where each event is any action that has to occur. Event driven programs have threads that peform when the code is triggered  determined trigger, action or event. Event driven languages are more flexible as they allow the program to respond to many different inputs from different sources i.e. human input or timers.

Objects

A object in scripting languages is a type of data, which know the properties about itself and it knows how to do certain things. Many objects are already avaliable in scripting languages but it is possible to create new ones.

Methods

An object also knows which methods that it can carry out, it is a piece of code that is called by name and associated with an object, it basically outlines the ability of a particular object. Methods can be applied to an object in order to create an action that will occur when triggered. An example of a method is .write.

 Handling Events

Events can be triggered by the occuring of a pre determined trigger that are used in the HTML code. They can be triggered by the following; Something gaining focus known as onfocus, something losing focus known as onblur, when a mouse cursor is moves over a certain area known as onmouseover and finally when a page is loaded known as onload.

Hiding Scripts

Some browsers and some older versions of browsers fo not support scripting languages and therefore dosent understand them. In order to prevent any problems or confusion from occuring, the scripting language is hidden from them, by coding the script within the HTML. Browser that can understand and interpret script will be able to see the <script> tags however the browsers that cannot interpret the code ignore the tags so that they do not become confused when interpreting the HTML code.

Security issues

When it comes to writing and using client side scripting there are a number of security issues that can arrise. Firstly as the code is being executed on a users computer, it can open up an entry point for hackers to enter the users computer or network. As well as this, due to the fact the code is written and read from client files, make the websites and clients compiters at risk. This gives an opportunity for other websites to read the content that is stored on the clients computer, which can lead to them being able to perform operations such as data mining to access client information.

Including the script inside the HTML

Script can be coded in to any part of a webpage, dependent on what is required from them. HTML is interpretted and it is executed line by line, whereas script in the body is run when it occurs in the code. Therefore functions can be coed anywahere as they are not run untill they are called. in order for a browser to know it is interpreting a scripting language the code must be placed between <script> </script>.

References

 
 
BTEC level 3 Information Technology Book 2

No comments:

Post a Comment