260 likes | 385 Views
Nairobi school presentation. Principles of programming. Introduction. Computer programming is the process of writing Debugging maintaining the source code of computer programs .
E N D
Introduction Computer programming is the process of • writing • Debugging • maintaining the source code of computer programs. • This source code is written in a programming language. The purpose of programming is to create a program that exhibits a certain desired behavior (customization). The process of writing source code often requires expertise in many different subjects, including knowledge of the application domain, specialized algorithms and formal logic.
History of programming • The first programmable computer was actually built in Germany by Konrad Zuse in 1941. • In the US, a team of Harvard and IBM scientists led by Howard Aiken were also working on a programmable computer. This computer, called Mark I, was completed in 1944. The person who is credited with fully harnessing the power of this programmable computer is Captain Grace Murray Hopper. She was one of the first to recognize the value of reusable libraries of subroutines, is credited with inventing the term 'debug' (when she removed a dead moth stuck in a relay) and having written the first high level compiler (A-0). She also led the effort to develop COBOL : a programming language not identified with a particular manufacturer.
GEORGE BOOLE As the inventor of Boolean logic—the basis of modern digital computer logic
Objectives • To be able to define key terms in elementary programming. • Understand the levels of programming languages. • Familiarize oneself with key programming principles.
Definition of terms A compiler Converts source code written in some high-level language into executable machine code (also called binary code or object code). The resulting machine code can only be understood by a specific processor, such as a Pentium or PowerPC. An interpreter Translates either source code or tokens into machine code, one instruction at a time, as the program is run. An interpreter does not generate machine code from a source program.
Assembler translate between lower-level representations of computer programs (source code to machine language) Algorithm A number of logical steps that a program follows in order to solve a problem Pseudo code A set of statements written in human language but expressing the logic of a program
PROGRAMMING LANGUAGES An artificial language used to write instructions that can be translated into machine language and then executed by a computer.
Examples of programming languages. • Low level programming languages. These can be easily understood by the computer directly, requiring less efforts to translate into machine form. Examples include: Machine language Assembly language
High level languages. These aremachine independent and easily understood by those who are not experts in the field of programming. Examples include: 1. Third generation languages 2. Fourth generation languages 3. Fifth generation languages 4. Object oriented languages (OOP) 5. Web scripting languages
PROGRAM DEVELOPMENT CYCLE It is the process of coming up with a program to perform certain tasks. It includes: 1. Problem recognition 2. Problem definition 3. Program design 4. Program coding 5. Program testing and debugging 6. Implementation and maintenance 7. Documentation
PROGRAM CONTROL STRUCTURES These are blocks of statement that determine how statements are to be executed.
START INPUT “l”, “w”, “h” PRINT ”V” TYPES OF PROGRAM CONTROL STRUCTURES • Sequence The computer reads instructions from a program file starting from the first top line and proceeding downwards to the end V=l*w*h STOP
INPUT “MARKS” PRINT ‘’FAIL’’ PRINT ‘’PASS’’ 2. Selection Execution of statements depends on a condition that returns a true or false START AVERAGE = Marks/8 AVERAGE>=50? true false STOP
3. Iteration / looping Execution of the same block again and again until a certain condition is fulfilled START INPUT, “ID”, “Name” ,salary add salary Update employee account Is salary=5000? no yes stop
NAME SHAPE USE IN FLOWCHART Circle Connector: used as a connecting point or interface for arrows coming from different directions Arrow Arrow: Used for indicating the direction of flow of the program logic
Case study: an example of a flow chart Question: Draw a flowchart to calculate the volume of a cylinder
Marks the beginning of the program Input the radius and the height The values are processed The output of the processed data Marks the end of the data flow (program) Solution START INPUT “r”, ”h” π=22/7 V= π*r*r*h PRINT “V” STOP
CONCLUSION Programming helps in various fields. This include: • Education • Career opportunities • Commerce • Security • entertainment
REFERENCE MATERIALS • LONGHORN secondary computer studies • High flyer KCSE computer revision • googleimages.com • brainybetty.com • lingoshop.com • wikipedia.com • webopedia.com • bing.com