Presentation is loading. Please wait.

Presentation is loading. Please wait.

Higher Grade Computing Studies 2. Languages and Environments Higher Computing Software Development S. McCrossan 1 Classification of Languages 1. Procedural.

Similar presentations


Presentation on theme: "Higher Grade Computing Studies 2. Languages and Environments Higher Computing Software Development S. McCrossan 1 Classification of Languages 1. Procedural."— Presentation transcript:

1 Higher Grade Computing Studies 2. Languages and Environments Higher Computing Software Development S. McCrossan 1 Classification of Languages 1. Procedural 2. Declarative 3. Event-driven 4. Scripting

2 Higher Grade Computing Studies 2. Languages and Environments Higher Computing Software Development S. McCrossan 2 Procedural Languages Procedural languages are the most common to programmers. They are high level languages (contain English words) that use commands and keywords to give instructions to the computer. They have a start and end point and give instructions in sequence. Examples of procedural languages are: Pascaldesigned to teach students programming C++can be used for scientific and business purposes JAVAused to create dynamic webpages

3 Higher Grade Computing Studies 2. Languages and Environments Higher Computing Software Development S. McCrossan 3 Declarative Languages Declarative languages use a collection of facts and rules to describe a problem. The user would then type in a query and the program compares what it knows to see if it can return an answer. An example of a declarative language is Prolog.

4 Higher Grade Computing Studies 2. Languages and Environments Higher Computing Software Development S. McCrossan 4 Event-driven Languages Event-driven languages creates programs that wait for some form of user input (normally clicking a button) before it performs some action. An example of an event-driven language is Visual Basic. Pressing a button is an event, resulting in a piece of code running.

5 Higher Grade Computing Studies 2. Languages and Environments Higher Computing Software Development S. McCrossan 5 Scripting Languages Scripting languages are used to create small programs in applications (scripts). These programs might be macro (a recorded set of actions) or an applet (a small application). Advantages of scripts; These extend the functionality of the program (it can do more things specific to your job!) These can be assigned to a key press (this is much quicker than going through many menus/windows, etc)

6 Higher Grade Computing Studies 2. Languages and Environments Higher Computing Software Development S. McCrossan 6 Macros A macro is a stored set of actions recorded directly from user actions. Code is created from this in a scripting language. It is therefore a sequence of commands to carry out a task. Often a macro is a recording of key presses and menu choices Macros are often used for tasks which are frequently done e.g. sorting a database on the same field every time, or to simplify a series of complex tasks for a non-expert user.

7 Higher Grade Computing Studies 2. Languages and Environments Higher Computing Software Development S. McCrossan 7 Translators A special program called a translator is required to convert the high level language program into a machine code program, which the computer will then understand.

8 Higher Grade Computing Studies 2. Languages and Environments Higher Computing Software Development S. McCrossan 8 Compilers Compilers take the whole program file (the source code) and translate it, producing a new file (the object code). The object code is now in binary, and this will run very fast. The new file is in executable form (ready to run) by the operating system. Advantage: Once the code is translated there is no need for any further translation – this will allow faster execution of the program. Disadvantage: Any mistakes in the program e.g. syntax (grammar) errors means it will not run.

9 Higher Grade Computing Studies 2. Languages and Environments Higher Computing Software Development S. McCrossan 9 Interpreters Interpreters, on the other hand, take the whole program file and translate and execute each line in turn. The translator needs to be running in RAM every time the program is run. Advantage: The interpreter will highlight mistakes as soon as they are typed in. Disadvantage: The translator has to run at the same time as the program is running and each line of the program needs to be translated, so it is slower.

10 Higher Grade Computing Studies 2. Languages and Environments Higher Computing Software Development S. McCrossan 10 Example This example helps show the difference between how an interpreter and a compiler translate. A compiler will translate lines 1010 to 1030 once and run these 100 times. An interpreter will translate lines 1010 to 1030 one hundred times and then run these 100 times! 1000PROC test_procedure 1010FOR counter := 1 TO 100 DO 1020PRINT "Hello there" 1030ENDFOR counter 1040ENDPROC test_procedure

11 Higher Grade Computing Studies 2. Languages and Environments Higher Computing Software Development S. McCrossan 11 Module Library Module libraries contain pre-written and pre-tested sections, or modules, of code. The modules may be a single routine or a group of linked routines performing similar tasks. Advantages You do not have to write code for tasks that are already solved The code will have already been checked for errors The modules will be well documented


Download ppt "Higher Grade Computing Studies 2. Languages and Environments Higher Computing Software Development S. McCrossan 1 Classification of Languages 1. Procedural."

Similar presentations


Ads by Google