mr c johnston ict teacher btec it unit 06 - lesson 01 introduction to computer programming

17
Mr C Johnston ICT Teacher www.computechedu.co.uk BTEC IT Unit 06 - Lesson 01 Introduction to Computer Programming

Upload: nathan-allison

Post on 12-Jan-2016

219 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: Mr C Johnston ICT Teacher  BTEC IT Unit 06 - Lesson 01 Introduction to Computer Programming

Mr C JohnstonICT Teacher

www.computechedu.co.uk

BTEC IT Unit 06 - Lesson 01

Introduction to Computer Programming

Page 2: Mr C Johnston ICT Teacher  BTEC IT Unit 06 - Lesson 01 Introduction to Computer Programming

Session Objectives

Be able to describe what a computer program is, Have an understanding of some of the information

required to produce a program for a client, Discuss different programming paradigms and some of

the associated advantages and disadvantages.

Page 3: Mr C Johnston ICT Teacher  BTEC IT Unit 06 - Lesson 01 Introduction to Computer Programming
Page 4: Mr C Johnston ICT Teacher  BTEC IT Unit 06 - Lesson 01 Introduction to Computer Programming
Page 5: Mr C Johnston ICT Teacher  BTEC IT Unit 06 - Lesson 01 Introduction to Computer Programming

What is a Program?

A computer is a ‘dumb’ machine. Everything the computer does is in response to program instructions.

Its processor can obey a fixed set of instructions (e.g. add two numbers together).

Called the instruction set. A program tells the processor what to do.

Page 6: Mr C Johnston ICT Teacher  BTEC IT Unit 06 - Lesson 01 Introduction to Computer Programming

Programs… Low and High Level

Processor instructions are in binary codes Binary code is very hard for humans to read Therefore almost all programs are written in ‘High level’ languages These have ‘English like’ instructions rather than binary codes e.g.

Binary Code: 00100110 11001011High level code: Profit = Sales - expenses

Page 7: Mr C Johnston ICT Teacher  BTEC IT Unit 06 - Lesson 01 Introduction to Computer Programming

Procedural Approach Most approaches to dealing with the complexity of modern

programs involve splitting programs into different sections. These are called modules or procedures. The procedural approach to programming involves dividing

the overall system into different procedures which work together to provide all the required functionality.

Page 8: Mr C Johnston ICT Teacher  BTEC IT Unit 06 - Lesson 01 Introduction to Computer Programming

Object Orientated Approach

One problem with the procedural approach is the interaction between the procedures can create too much complexity itself.

To try to resolve this problem the Object Orientated (OO) approach was developed.

The OO approach splits a system into objects. Objects interact with each other in a different way to procedures.

Page 9: Mr C Johnston ICT Teacher  BTEC IT Unit 06 - Lesson 01 Introduction to Computer Programming

OO vs Procedural Programs consist of instructions and data. In the procedural approach the procedures in a

system share data. In the OO approach the data is ‘hidden’ inside the

object.

Object

Data

Object

DataObject

Dataprocedure

procedure

procedure

Data

Page 10: Mr C Johnston ICT Teacher  BTEC IT Unit 06 - Lesson 01 Introduction to Computer Programming

OO / Procedural Comparison

The procedural approach is good for writing relatively simple programs. Its also conceptually simpler so its often used when first learning to write

programs. However its not such a good approach for developing complex systems. The OO approach, while conceptually more difficult to understand is often

used for very complex systems. The OO approach can be difficult to understand for first time programmers.

Page 11: Mr C Johnston ICT Teacher  BTEC IT Unit 06 - Lesson 01 Introduction to Computer Programming

BTEC Book – Unit 06 p4/5

Page 12: Mr C Johnston ICT Teacher  BTEC IT Unit 06 - Lesson 01 Introduction to Computer Programming

Event Driven The Event driven approach to programming is used in

Windows software environments. Event driven programs can be written using either the

procedural or the OO approach. With the event driven approach a program responds to user

events such as clicking a menu or button

Page 13: Mr C Johnston ICT Teacher  BTEC IT Unit 06 - Lesson 01 Introduction to Computer Programming

Event Driven Programming The Event driven approach to programming is used when creating programs which use the Windows

user interface or other GUI Event driven programs can be written using either the procedural or the OO approach. With the event driven approach a program responds to user events such as clicking a menu or button In an event driven system there are two main parts to the program:

An event handler which waits for an event to occur. When it does it asks the appropriate event procedure to deal with it. Event procedures. These must be created to deal with each event that the program responds to.

It is not suitable for writing programs which don’t use the windows user interface.

Page 14: Mr C Johnston ICT Teacher  BTEC IT Unit 06 - Lesson 01 Introduction to Computer Programming

Procedural Programming

Languages

Definition ofparadigm

Likely advantagesand use

Likely disadvantagesand what not used for

Page 15: Mr C Johnston ICT Teacher  BTEC IT Unit 06 - Lesson 01 Introduction to Computer Programming

Definition ofparadigm

Likely advantagesand use

Likely disadvantagesand what not used for

Object Orientated Programming

Languages

Page 16: Mr C Johnston ICT Teacher  BTEC IT Unit 06 - Lesson 01 Introduction to Computer Programming

Definition ofparadigm

Likely advantagesand use

Likely disadvantagesand what not used for

Event Driven Programming

Languages

Page 17: Mr C Johnston ICT Teacher  BTEC IT Unit 06 - Lesson 01 Introduction to Computer Programming

P1Evidence For P1 you need to produced some PowerPoint slides

on the applications and limitations of procedural, object orientated and event driven programming approaches,

Ensure your slides conform to standard practices – i.e. not too much text on slides and explanation in speaker notes.

• When considering the different program paradigms you should give some examples of the type of program these approaches should be used for,

• When covering limitations you should explain the likely disadvantages of each approach and what sort of applications they would not be normally used for,

• You are expected to reference all three paradigms within your work.

P1 – describe the application and limits of procedural, object orientated and event driven programming paradigmsP1 – describe the application and limits of procedural, object orientated and event driven programming paradigms