3. Procedural Languages
Early programs used these inc. Windows DOS
The program controls what happens not the
user although they will accept input
Procedural languages work on the basis of
explicitly telling the computer ‘how to do
something’ by using a sequence of commands
called imperatives e.g. do this, then do that etc
Examples are C, Fortran, Pascal, and Basic
3
4. Procedural Languages
Tasks are broken into a number of stages
known as procedures or subroutines
Each procedure carries out a specific task
An example procedure (using Pascal) which calculates the average
of two numbers inputted by the user and displays the result
readln(Num1) read first number from keyboard
and put value in variable Num1
readln(Num2) read second number from
keyboard and put value in variable
Num2
Average:=(Num1+Num2)/2 calculate average of Num1 and
Num2 and place the result in
variable Average
writln(Average) Display the value of variable
Average on the screen
4
5. Object-orientated programming (OOP)
Is relatively new and not used until the 1990’s
when programs got more complex
The program is broken down into objects, not
lists of instructions
Each object can perform tasks and
communicate with other objects
An object contains related data and procedures
(or methods) which together define the
behaviour of that object (i.e. how it respond to
events)
5
6. Object-orientated programming (OOP)
The object can be thought of as a small
machine with a set job
An objects provides services in response to
messages (events) triggered by other objects
or end-users who request these services
Event
Method
request
Method Method
Object Data Client
service
Method Method
Messages
Encapsulation / information hiding
6
7. Object-orientated programming (OOP)
Unlike procedural programming, the
programmer does not need to know the code
which is ‘behind’ each object making it work
They only need to know the attributes and
methods of each object and how to make it
interact with other objects
They then use the objects as ‘building blocks’
to make the program do what they want it to
Example OO languages are Java, C# and VB.NET
7
8. Event Driven Programming
These are used to create software which has a
graphical user interface (GUI), such as
Windows programs
ED languages have procedural features but
also have OO capabilities
Examples of Event Driven languages are
VB.NET, C# and C++
8
9. Event Driven Programming
Event driven design has 2
stages
First the programmer designs
the GUI, placing objects such
as textboxes, buttons and
labels onto a form
Then they write the code
which gives the functionality
to the program
9
10. Markup Languages
A markup language is not a true programming
language as they do not contain instructions to
control the flow of the program.
markup languages give instructions to control
the format and layout of a file
This information is in the form of tags for
structure or presentation
The programmer can insert tables for
structure, images, hyperlinks and text using
tags
10
11. Markup Languages
The best-known markup example is Hypertext
Markup Language (HTML), used on the World
Wide Web
Example:
<title>Home Page</title>
<style type="text/css" media="screen">
@import "stylesheets/public.css";
body { background-color: white };
</style>
Another example is XML (Extensible Markup
Language) which allows users to write their
own tags
11
12. Scripting languages
Where web pages need to carry out
programming functions the code for this has
to be included within the HTML using a
scripting language.
An example of this is JavaScript or vbscript
Scripting languages can be typed in directly
from a keyboard and the language used will
be specific to each application
12
13. Scripting languages
Some are used to execute a series of
commands that would otherwise have to be
typed in via a keyboard / mouse
These can be used to control the operating
system and are known as a shell script
language
e.g. Windows Powershell
Others allow users to write
short, simple, programs or add functionality to
applications
e.g. macros in Access or Excel
13
14. Which language to use depends on:
Organisational policy – your company may be
‘tied’ to Microsoft or Macintosh
Will it work on the hardware already used?
Does it do what we need it to?
Are current staff trained in its use?
Is it reliable? Important for safety-critical
systems!
Costs of developing and maintaining programs
Will it be expandable in future?
14