Download presentation
Presentation is loading. Please wait.
Published byLesley Potter Modified over 8 years ago
1
5.0 PROGRAMMING Duration: 10 weeks Prepared by Ong Lay Peng Copyright © 2007
2
Activity 1: Turtle Graphics move forward 3cm. rotate 135 o to the right. move forward 3.5cm. rotate 135 o to the left. move forward 3cm. **Note: Turtle graphics in one of the feature in a programming language called LOGO. WHAT IS IN YOUR DRAWING ? ? ? Hold the pencil upright. Place the pencil tip on a paper. Keep the pencil tip on the paper at all times during the drawing process. Perform a task based on the following instructions.
3
5.1 Basic Programming Concepts Learning outcomes: –Define Program and Programming Language State the definition of program. State the definition of programming language. –Identify the levels and generations Of Programming Languages Identify the generations of low-level programming languages with examples. Identify the generations of high-level programming languages with examples. Duration: 2 periods
4
Definition of Program A series of instructions Task
5
Definition of Program Private Sub cmdCalculate_Click() Dim area As Double area = Val(Text1.Text) * Val(Text2.Text) lblarea.Caption = FormatNumber(area, 2) End Sub Private Sub cmdClear_Click() Text1.Text = "" Text2.Text = "" lblarea.Caption = "" Text1.SetFocus End Sub Private Sub cmdExit_Click() End End Sub Figure B Figure A A series of instructions that directs a computer to perform task.
6
A person who writes and modifies a computer program is called ______________, sometimes called developer. A developer uses a __________________________ to write a computer program. Definition of Program
7
Definition of Programming Language A set of words, symbols, and codes that enables a programmer to communicate instructions to a computer. Several hundreds of programming languages exist today. Visual BasicJava CC++ COBOL C# J++ BASIC PASCALProlog SQLLogo
8
Each instruction causes computer to carry out one step of the task Definition of Programming Language
9
Each programming language has its own rules for writing the instructions. You cannot apply the rules of Visual Basic Programming Language in C or Java. public class HelloWorld { public static void main (String[] args) { System.out.println("Hello, world!\n"); } } Private Sub cmd_Click() Text1.Text=“Hello, World!” End Sub Java Programming Language Visual Basic 6 Programming Language Definition of Programming Language
10
Language used to instruct a computer to perform a specific task called __________. Definition of Programming Language
11
Languages often are designed for specific purposes, such as scientific applications, business solutions or web page development Logo: A programming language designed really for young kids. Prolog: A language used for the development of artificial intelligence applications. COBOL: A language designed for business application. Definition of Programming Language
12
Answer all the questions What is computer program ? Give two examples of computer programs. What is programming Language ? Explain the function of programming language. Definition of Programming Language
13
Levels and Generations Of Programming Languages 2 levels of programming languages Low-level language High-level language Low-level language –A language that is machine-dependent. –A machine-dependent language runs on only one particular type of machine. These programs are not easily portable to other types of computers. –Each language instruction in low-level language usually equates to a single machine instruction.
14
High-level language –A language that is machine-independent. –A machine-independent language runs on different types of machines and operating system. –Each language instruction in high-level language usually equates to multiple machine instructions. Levels and Generations Of Programming Languages
15
Based on the text in slide 11 & 12, complete the table below. The differences between low-level language and high-level language Low-level languageHigh-level language Levels and Generations Of Programming Languages
16
Examples Of Programming Languages
17
Low-level languages 2 types: –Machine Language –Assembly Language High-level languages 3 types: –Third-generation language (3GL) –Fourth-generation language (4GL) –Fifth-generation language (5GL) Levels and Generations Of Programming Languages
18
Machine Language –First generation programming language –The only language the computer directly recognizes. Therefore, a machine language program does not require a translator. Levels and Generations Of Programming Languages
19
Machine Language –The instructions in machine language use a series of binary digits (1s and 0s) or a combination of numbers and letters that represents binary digits. –Readily understood by computers; less intelligible by humans –Coding in machine language is tedious and time-consuming. Levels and Generations Of Programming Languages
20
Assembly Language –2 nd generation programming language Levels and Generations Of Programming Languages Example: A for addition, C for Compare, L for Load and M for multiply. Example: Use the name RATE to refer to the storage location that contains a pay rate. symbolic instruction codes (meaningful abbreviations). Symbolic address (meaningful name) to identify the storage location The instructions use :
21
Assembly Language Levels and Generations Of Programming Languages
22
Assembly Language –The assembly language is not the native language of computer. Thus, the program must be converted into machine language using a translator called assembler, before a computer can execute/run it. –Easier to code as compared to machine language. But it can still be difficult to learn. “The computer cannot directly run the assembly source program.” Low-level Programming Languages
23
Third-Generation Language –Procedural language –The instructions in 3GL use a series of English-like words. –Many 3GLs also use arithmetic operators such as * for multiplication and + for addition. High-level Programming Languages Programmers writes the instructions that tell the computer what to accomplish and how to do it. The program is based on a logical step-by-step process for solving a problem.
24
Third-Generation Language –The 3GL is not the native language of computer. Thus, the program must be converted into machine language using a translator either compiler or interpreter, before a computer can execute/run it. High-level Programming Languages –Simplify the program development process for programmers. Easier to code and maintain a program as compared to low-level language. –Examples: COBOL, Pascal, C, Fortran, BASIC, C++, Java, ALGOL, Delphi 3GL Compiler / Interpreter Machine language
25
Fourth-Generation Language –Non-procedural language –Allow people to develop program with fewer commands High-level Programming Languages Non-procedural programming languages allow users and programmers to specify the results they want without specifying how to solve the problem.
26
Fourth-Generation Language –The instructions in 4GL use English-like words or graphical environment to retrieve data from files or database. –Examples SQL,Progress 4GL, ColdFusion (web development), GEMBase, BuildProfessional, FOCUS, Informix-4GL. High-level Programming Languages
27
3GL Vs 4GL Example: In dBASE, the command List displays all the records in a data file. In second- and third-generation languages, instructions would have to be written to read each record, test for end of file, place each item of data on screen and go back and repeat the operation until there are no more records to process. dBASE 3GL use customer do while.not. eof() list name, address ? name, address skip enddo dBASE 4GL use customer list name, address High-level Programming Languages
28
Fifth-Generation Language –5GLs are designed to make the computer solve the problem for you. –The programmer only needs to worry about what problems need to be solved and what conditions need to be met, without worrying about how to implement a routine or algorithm to solve them. –mainly used in artificial intelligence research. –Examples: Prolog, Mercury, OPS5 High-level Programming Languages
29
Draw a hierarchy chart to classify the generations of each level of programming language. Programming Language Example Assessment Self - assessment
30
Programming LanguagesGeneration Low-level programming languages: More technical not portable less user-friendly Run faster Lengthy 1GL Machine Language 2GL Assembly Language High-level programming languages: Less technical Portable More user-friendly Run slower shorter than 1GL and 2GL 3GLs Procedural language 4GLs Non-procedural language 5GLs mainly used in artificial intelligence research Summary
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.