lesson 1 history and the programming cycle new

35
And The Programming Cycle

Upload: christopher-olaya

Post on 09-Aug-2015

209 views

Category:

Education


0 download

TRANSCRIPT

Page 1: Lesson 1   history and the programming cycle new

And The Programming Cycle

Page 2: Lesson 1   history and the programming cycle new
Page 3: Lesson 1   history and the programming cycle new

Augusta Ada KingFirst Known Computer Programmer. Work with Charles Babbage to plan the Analytical Engine.

Page 4: Lesson 1   history and the programming cycle new

Thomas and John Knoll

Developer of Adobe Photoshop and other adobe products.

Page 5: Lesson 1   history and the programming cycle new

Willian Henry “Bill” Gates Creator / Developer of Microsoft Operating System.(OS)

Page 6: Lesson 1   history and the programming cycle new
Page 7: Lesson 1   history and the programming cycle new

ProgrammingThe Art and Science of creating programs

A program is a list of organized instructions that the computer must follow in order to process data into information.

Also called Software Engineering, a multi-step process for creating a program.

Page 8: Lesson 1   history and the programming cycle new

Types of Programming Languages Machine Language – The only language

that a computer can understand. The syntax of the language is basically made up of two symbols, 0 and 1.

Advantage: a. Efficient in terms of storage area use and

execution speed. b. Allows the programmer to fully utilize

the computer’s potential for processing data.

Page 9: Lesson 1   history and the programming cycle new

Types of Programming Languages Machine Language – The only language that

a computer can understand. The syntax of the language is basically made up of two symbols, 0 and 1.

Disadvantage: a. Extremely difficult to code and time

consuming. b. Instructions are difficult to remember and

use. c. Machine dependent, can only run on specific

machines

Page 10: Lesson 1   history and the programming cycle new

Types of Programming Languages Assembly Language – also referred to as

low level language. This language uses symbols that are easier to understand and represent with regard to its storage location. Requires a translator to convert its codes to those that the computer can understand, that is to machine codes like an Assembler.

Example:

Expression

Explanation

Add R1, R2

Add the value in R2 to the value in R1 and save it in R1

Mov R1, R2

Move the value in R2 to R1

Page 11: Lesson 1   history and the programming cycle new

Types of Programming Languages Assembly Language – also referred to as low

level language. This language uses symbols that are easier to understand and represent with regard to its storage location. Requires a translator to convert its codes to those that the computer can understand, that is to machine codes like an Assembler.

Advantage:

a. Easier to code compared to machine language.

b. Assembler is used to perform certain checking functions and generate error messages.

Page 12: Lesson 1   history and the programming cycle new

Types of Programming Languages Assembly Language Disadvantage: a. Cumbersome to use; one assembly

language instruction is translated to one machine language instruction and its takes a long preparation time and more storage space.

b. High level of skill is needed to write assembly codes

c. machine dependent.

Page 13: Lesson 1   history and the programming cycle new

Types of Programming Languages High Level Language –Easier to understand.

Needs a compiler or an interpreter to translate its code to machine language code. They are also referred to as 3GL or 3rd generation language.

Examples: a. For Business applications- Common Business0Oriented Language

(COBOL) Report Program Generator (RPG)

Page 14: Lesson 1   history and the programming cycle new

Types of Programming Languages High Level Language –Easier to understand.

Needs a compiler or an interpreter to translate its code to machine language code. They are also referred to as 3GL or 3rd generation language.

Examples: b. For Scientific applications- FORTRAN- Formula Translator ALGOL- Algorithmic Language APL – A Programming Language

Page 15: Lesson 1   history and the programming cycle new

Types of Programming Languages High Level Language Examples: c. For System applications-

BASIC- Beginners All Purpose Symbolic Instruction Code

C – used for systems and general application

C ++ - an object oriented superset and extension

of C.

Page 16: Lesson 1   history and the programming cycle new

Types of Programming Languages High Level Language Examples: d. For General applications- PL 1 – Programming Language 1, created

by IBM to replace COBOL and FORTRAN FORTH – object-oriented language

originally created to control telescopes.

Page 17: Lesson 1   history and the programming cycle new

The Computer is basically a problem-solving tool. Once it is properly provided with a valid program, the computer becomes self-operational. To use this tool effectively, the programmer usually has to perform set of well defined steps.

Page 18: Lesson 1   history and the programming cycle new

Five Steps of the Programming Cycle

Page 19: Lesson 1   history and the programming cycle new

Flowcharting Algorithm andPseudocoding

Programming Languages

Debugging and Testing

Technical Documentation Packages

Careful study of the Problem

Programming Cycle

Page 20: Lesson 1   history and the programming cycle new

1. Problem Analysis – Methodical investigation of a

problem and the separation of the problem into smaller related units for further detailed study.

STEPS a. Define the Problem and the users b. Determining the Desired Outputs c. Determining the Desired Inputs d. Determine the Desired Processing e. Double-Check the feasibility of

implementing the program. f. Document the Analysis

Go to Diagram

Page 21: Lesson 1   history and the programming cycle new

2. Program DesignSelecting the best method for solving the

problem. Involves determining the sequence of processing steps within individual programs including Flowcharting, Algorithm and Pseudocode

Determine the program logic using a top-dawn approach and modularization.

Design details using algorithm, flowchart and Pseudocode.

Do a structured walkthrough

Go to Diagram

Page 22: Lesson 1   history and the programming cycle new

2. Program DesignDetermine the program logic using a top-

down approach and modularization.

Go to Diagram

Payroll Process

Read Input

Calculate Pay

Generate Output

Read Employee

master record

Read Employee time card

Calculate Grosspay

Calculate net pay

Generate payroll report

Generate paycheck

s

Calculate regular pay

Calculate overtime

pay

Calculate taxes

Calculate deductions

Page 23: Lesson 1   history and the programming cycle new

2. Program DesignDesign details using algorithm,

flowchart and Pseudocode Algorithm - A list of instructions for

carrying out some process step by step. Flowchart – A visual outline of an

algorithm in which the steps and processes to be followed are represented by symbols.

Pseudocode – An algorithm written in normal human-language statements to describe the logic and processing flow of the program.

Go to Diagram

Page 24: Lesson 1   history and the programming cycle new

2. Program DesignDesign details using algorithm, flowchart and

Pseudocode Sample of Algorithm

1. Get the following data from the user: employee’s name, hourly rate, number of hours worked and deductions.

2. Calculate the employee’s gross pay and net pay 3. Display the employee’s name, gross pay and net pay

Sample Pseudocode 1. Read name, hourly rate, hours worked, deductions 2. Calculate: Gross pay=hourly rate multiplied by number of hours

worked Calculate: Net pay= Gross pay minus deductions 3. Write name, Gross Pay, Net pay

Go to Diagram

Page 25: Lesson 1   history and the programming cycle new

2. Program DesignDo a structured walkthrough This is a method for examining a computer

system, including its design and implementation in a systematic way.

In the structured walkthrough, the programmers (as well as fellow programmers, systems analyst and perhaps users) working on different aspects of a software development, systematically reviewed in order to minimize the error rate of the software.

Go to Diagram

Page 26: Lesson 1   history and the programming cycle new

Programmer converts the steps depicted in the program flow chart into readable instructions that make up the actual program. Can be written at Machine or High Level programming Languages.

- Select the Appropriate Programming Language.(Basic, C++, Visual Basic, Java)

- Follow the Syntax (Syntax is the grammar of the programming language. It contains rules governing the structure and content of the statements.)

3. Program Coding

Go to Diagram

Page 27: Lesson 1   history and the programming cycle new

4. Program Testing & DebuggingProgram testing involves running various tests,

such as desk-checking and debugging (These two are called alpha testing) and then running actual or real data to make sure the program works.

Steps- Perform desk checking – this is simply reading

through (proofreading) or manually testing, the solution design to make sure that it is free of errors and that the logic works.

- Debug the Program- Run Real Data

Go to Diagram

Page 28: Lesson 1   history and the programming cycle new

4. Program Testing & DebuggingProgram testing involves running various tests, such

as desk-checking and debugging (These two are called alpha testing) and then running actual or real data to make sure the program works.

Steps- Debug the Program – After desk-checking, the

programmer needs to compile the source code to convert it into an object code.

A source code refers to the instructions in a programming language.

An object code refers to the instructions in a machine language, which is the language of the computer.

Go to Diagram

Page 29: Lesson 1   history and the programming cycle new

4. Program Testing & DebuggingSteps- Debug the Program – After desk-checking, the

programmer needs to compile the source code to convert it into an object code.

A source code refers to the instructions in a programming language.

An object code refers to the instructions in a machine language, which is the language of the computer.

The process of converting a source code into an object code is called compilation.

Go to Diagram

Source Code(programming

language)

Object Code(machine language)Compile

Page 30: Lesson 1   history and the programming cycle new

4. Program Testing & DebuggingDuring compilation, some errors (called bugs) may

be encountered, causing the program’s failure to produce the desired output.

The programmer needs to go through the process of detecting, locating and removing these errors (the process is called debugging) in order for the program to be able to solve the problem at hand.

There are three types of error:1. Syntax error – the most common error the

programmer may encounter. Caused by typographical error or failure to strictly follow the syntax.

Go to Diagram

Page 31: Lesson 1   history and the programming cycle new

4. Program Testing & DebuggingThere are three types of error:1.Syntax error – the most common error the programmer may

encounter. Caused by typographical error or failure to strictly follow the syntax.

2.Run-time error- a software error that occurs while a program is being executed, as detected by a compiler or other supervisory program. Mostly occurs in numeric calculations.

3.Logic errors – caused by incorrect use of control structures. These errors are much more difficult to detect than syntax error because the computer cannot tell an error in logic in a program.

2.

Go to Diagram

Page 32: Lesson 1   history and the programming cycle new

5. Program DocumentationMaintenanceIn this step, the programmer makes a detailed

description on how the program was created. It contains a brief narrative process undergone by the program.

Steps- Prepare user documentation (printed or online

manuals)- Prepare operator documentation (used for computer

operators who need information on what to do when the program malfunctions.

- Prepare program documentation- Maintain the Program Go to Diagram

Page 33: Lesson 1   history and the programming cycle new

5. Program DocumentationMaintenance- Prepare program documentation (consists of

written, graphic and electronic descriptions of what a program is and how to use it)

- Maintain the Program (maintenance is any activity designed to keep the program error-free, up-to-date and in good working condition.)

Go to Diagram

Page 34: Lesson 1   history and the programming cycle new

Flowcharting Algorithm andPseudocoding

Programming Languages

Debugging and Testing

Technical Documentation Packages

Careful study of the Problem

Programming Cycle

Page 35: Lesson 1   history and the programming cycle new

Group activity:Perform the steps in problem analysis and Program Design in the following problem:

The quarterly grades of Mary in Computer education class are: 90, 85, 91, 94. Solve for her final grade, then output her name, the 4 quarterly grades and final grades.