160 likes | 256 Views
BTEC IT Unit 06 - Lesson 01 Introduction to Computer Programming. Mr C Johnston ICT Teacher www.computechedu.co.uk. 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,
E N D
BTEC IT Unit 06 - Lesson 01Introduction to Computer Programming Mr C Johnston ICT Teacher www.computechedu.co.uk
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.
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.
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 11001011 High level code: Profit = Sales - expenses
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.
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.
Data procedure procedure procedure 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 Object Object Data Data Data
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.
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
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.
Procedural Programming Languages Likely disadvantages and what not used for Definition of paradigm Likely advantages and use
Object Orientated Programming Languages Likely disadvantages and what not used for Definition of paradigm Likely advantages and use
Event Driven Programming Languages Likely disadvantages and what not used for Definition of paradigm Likely advantages and use
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. P1 – describe the application and limits of procedural, object orientated and event driven programming paradigms • 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.