Programming For A2 Comp
-
Upload
david-halliday -
Category
Technology
-
view
215 -
download
2
description
Transcript of Programming For A2 Comp
![Page 1: Programming For A2 Comp](https://reader036.fdocuments.in/reader036/viewer/2022082603/54995e53b47959e77f8b497c/html5/thumbnails/1.jpg)
Programming for A2 Computing
High Level Languages
By David Halliday
Module 4
![Page 2: Programming For A2 Comp](https://reader036.fdocuments.in/reader036/viewer/2022082603/54995e53b47959e77f8b497c/html5/thumbnails/2.jpg)
High and Low Level languages• High Level languages• Examples:
– C, C++
– Pascal
– BASIC
• Portable (can be compiled on different systems)
• Problem oriented (designed around solving different types of problem)
• Statements resemble English language (formalised)
• Low level Languages• Examples
– Assembly
• Machine Oriented: designed for individual machine or processor architectures
• Each statement translates into one machine instruction
• Statements resemble machine instructions in mnemonics
![Page 3: Programming For A2 Comp](https://reader036.fdocuments.in/reader036/viewer/2022082603/54995e53b47959e77f8b497c/html5/thumbnails/3.jpg)
High Level Language Facilities
• Selection statements:– If, Then, Else, Case
• Iteration (repetition) statements:– While...EndWhile, Repeat...Until, For… EndFor
• Built in/Library routines, functions and enumerated data types to simplify I/O– Readln, writeln– Sqr, log– String, Array, Record
![Page 4: Programming For A2 Comp](https://reader036.fdocuments.in/reader036/viewer/2022082603/54995e53b47959e77f8b497c/html5/thumbnails/4.jpg)
High Level Language Paradigms• High level languages often fit into one of 3 categories
– Imperative (procedural)• Imperative programs explicitly specify an algorithm to achieve a goal• Examples include:
– C, C++– Pascal– Fortran
– Declarative• Declarative programs explicitly specify the goal and leave the
implementation of the algorithm to the support software • Examples include:
– Prolog
– Functional• Emphasizes the application of functions, unlike imperative programming,
which emphasizes changes in state and the execution of sequential commands.
• Examples include:– Haskell
![Page 5: Programming For A2 Comp](https://reader036.fdocuments.in/reader036/viewer/2022082603/54995e53b47959e77f8b497c/html5/thumbnails/5.jpg)
Imperative (procedural) Languages• Imperative programs explicitly specify an algorithm to achieve a goal• They are concerned with changing of states of variables in memory• The closest paradigm to assembly/machine code• Problem Oriented… They are developed to solve particular types of
problem:– FORTRAN (FORmula TRANslation)
• dev'd in 1950s for use in scientific and engineering
– COBOL (COmmon Business Oriented Language)• dev'd in 1950s for data processing (first to use records)
– 'C‘• developed in 1972 by Dennis Ritchie at the Bell Telephone Laboratories for
use with the Unix operating system.
– Pascal• dev'd in 1970s to teach structured programming• Extended by Boreland with Delphi making a useful RAD tool
![Page 6: Programming For A2 Comp](https://reader036.fdocuments.in/reader036/viewer/2022082603/54995e53b47959e77f8b497c/html5/thumbnails/6.jpg)
Embedded systems
• Computer is component in a larger system.• Examples include:
– microprocessor-controlled washing machine or video recorder;– a modern jet aircraft;– a system for controlling traffic lights;– a process control system for controlling the flow of water along a
pipe by means of a valve;– a robot used in a car assembly plant.– Modern mobile phones
![Page 7: Programming For A2 Comp](https://reader036.fdocuments.in/reader036/viewer/2022082603/54995e53b47959e77f8b497c/html5/thumbnails/7.jpg)
Criteria for Selecting a Language
• The nature of the application;• The availability of facilities within the language for
implementing the software design;• The availability of a suitable compiler/interpreter for the
hardware; • The expertise of the programmers.
![Page 8: Programming For A2 Comp](https://reader036.fdocuments.in/reader036/viewer/2022082603/54995e53b47959e77f8b497c/html5/thumbnails/8.jpg)
Homework
• Heathcote Chapter 35 Page 219 All Questions