Post on 17-Dec-2015
transcript
Types of Languages and Environments
There are 4 main types of language that you must be able to describe at Higher level.
At Intermediate level you do not have to be able to describe them!
They are:1. Procedural2. Declarative3. Event Driven4. Scripting
Procedural
Programs generated in procedural languages involve a sequence of operations and are often described as linear programs.
Written as an ordered sequence of steps that describe exactly what it must do at each step.
They have a distinct Start and End point and follow through these steps in order.
Procedural Example
Example of a Procedural Algorithm to ‘Make Tea’
1. Fill the kettle2. Boil Water3. Put tea bag in pot4. Fill pot with boiling water5. Pour tea in cup6. Add sugar/milk if required7. Stir8. Drink
Declarative
Completely different from procedural language!Instead of instructions telling computer what to do, declarative languages state what has to be done.
They contain a series of statements:• Hot(Tea) – Means tea is hot.• Cold(Milk) – Means milk is cold.
Which are used to describe facts:Dissolves( x , y) : sugar(x) , hot water(y)This means x dissolves in y.
Declarative
These facts and rules make up a knowledge base (used in expert systems).
When you search for the knowledge in the database the declarative language is able to offer you information and meaning behind the data.
You will not have to learn Declarative languages, merely describe them and compare them with other types!
Event Driven
You have all used one of these!
VB is Event Driven. It has a form where objects can be placed, so you can design the interface first.
It is much quicker to design the HCI as a result.
There are no definite Start and End points like a Procedural program.
Event Driven
Users can interact with the program by selecting buttons, menus or windows.
These interactions like button clicks are called events.
Event driven simply means ‘controlled through certain events’.
An operating systems like Windows isan advanced event driven program.
Scripting
There are two types.– Embedded ones within an application like MS Word or
Excel.– Non embedded ones that work with the OS.
Applications that provide scripting capability allow the user to extend the functionality of the application by programming a sequence of actions.
Making a script allows you to tailor the application to your needs.
Benefits of scripting languages
One of the main benefits of scripted languages is that they require no compilation. The language is interpreted at run-time so the instructions are executed immediately.
Scripting languages also have a simple syntax which, for the user:
– makes them easy to learn and use– assumes minimum programming knowledge or
experience– allows complex tasks to be performed in
relatively few steps– allows simple creation and editing in a variety of
text editors– allows the addition of dynamic and interactive
activities to web pages