CC111 Lec#5: Program Development 1 Program Development and Programming Languages Lecture 4 Reference...

39
CC111 Lec#5: Program Development 1 Program Development and Programming Languages Lecture 4 Reference :Understanding Computers Chapter 13

Transcript of CC111 Lec#5: Program Development 1 Program Development and Programming Languages Lecture 4 Reference...

Page 1: CC111 Lec#5: Program Development 1 Program Development and Programming Languages Lecture 4 Reference :Understanding Computers Chapter 13.

CC111 Lec#5: Program Development 1

Program Development and Programming Languages

Lecture 4

Reference :Understanding ComputersChapter 13

Page 2: CC111 Lec#5: Program Development 1 Program Development and Programming Languages Lecture 4 Reference :Understanding Computers Chapter 13.

CC111 Lec#5: Program Development 2

The Program Development Life Cycle

Creating new programs is called program development.

The process associated with creating successful applications programs is called the program development life cycle (PDLC).

Page 3: CC111 Lec#5: Program Development 1 Program Development and Programming Languages Lecture 4 Reference :Understanding Computers Chapter 13.

CC111 Lec#5: Program Development 3

The Program DevelopmentLife Cycle (PDLC)

• Program Development (application software development)– The process of

creating application programs

• Program Development Life Cycle (PDLC)– The five phases of

program development

3

Page 4: CC111 Lec#5: Program Development 1 Program Development and Programming Languages Lecture 4 Reference :Understanding Computers Chapter 13.

CC111 Lec#5: Program Development 4

1- Problem Analysis

• During problem analysis, a systems analyst and programmer review specifications and talk with users to fully understand what the software should do.

• Documentation consists of:– program specifications,– timetable,– which language will be used, – how the program will be tested,– and what documentation is required.

Page 5: CC111 Lec#5: Program Development 1 Program Development and Programming Languages Lecture 4 Reference :Understanding Computers Chapter 13.

CC111 Lec#5: Program Development 5

2- Program Design

• Program design: stage where program specifications are expanded into a complete design of the new program.

• Structured programming and object-oriented programming are two of the most significant approaches to the design process.

Page 6: CC111 Lec#5: Program Development 1 Program Development and Programming Languages Lecture 4 Reference :Understanding Computers Chapter 13.

CC111 Lec#5: Program Development 6

Program Design: Program Design Tools

Program design tools are planning tools.

1. Structure charts

2. Program flowcharts

3. Pseudocode

Page 7: CC111 Lec#5: Program Development 1 Program Development and Programming Languages Lecture 4 Reference :Understanding Computers Chapter 13.

CC111 Lec#5: Program Development 7

Program Design: Program Design Tools

1-Structure charts show the overall organization of a program, and how the modules of a program—logically related operations that perform a well-defined task—are defined and how they connect to each other hierarchically.

Program modules should be arranged hierarchically, in a top-down fashion, so that their relationship to each other is apparent.

Page 8: CC111 Lec#5: Program Development 1 Program Development and Programming Languages Lecture 4 Reference :Understanding Computers Chapter 13.

CC111 Lec#5: Program Development 8

Page 9: CC111 Lec#5: Program Development 1 Program Development and Programming Languages Lecture 4 Reference :Understanding Computers Chapter 13.

CC111 Lec#5: Program Development 9

2-Program flowcharts use geometric symbols and familiar relational operators to provide a graphic display of the sequence of steps involved in a program.

The steps in a flowchart follow each other in the same logical sequence as their corresponding program statements will follow in a program.

Different symbols are used to represent different actions, such as start/stop, decision, input/output, processing, and looping symbols.

Program Design: Program Design Tools

Page 10: CC111 Lec#5: Program Development 1 Program Development and Programming Languages Lecture 4 Reference :Understanding Computers Chapter 13.

CC111 Lec#5: Program Development 10

Page 11: CC111 Lec#5: Program Development 1 Program Development and Programming Languages Lecture 4 Reference :Understanding Computers Chapter 13.

CC111 Lec#5: Program Development 11

Page 12: CC111 Lec#5: Program Development 1 Program Development and Programming Languages Lecture 4 Reference :Understanding Computers Chapter 13.

CC111 Lec#5: Program Development 12 12

Flowcharts

Page 13: CC111 Lec#5: Program Development 1 Program Development and Programming Languages Lecture 4 Reference :Understanding Computers Chapter 13.

CC111 Lec#5: Program Development 13

Stop

Subtract ExpensesR <= 1000-E

E<1000?

Start

No

Yes

Input Expenses E

Print You Owe $0Print

You Owe $R

Flow chart Example

Page 14: CC111 Lec#5: Program Development 1 Program Development and Programming Languages Lecture 4 Reference :Understanding Computers Chapter 13.

CC111 Lec#5: Program Development 14

3-Pseudocode

uses English-like statements in place of the graphic symbols of the flowchart.

Unlike a flowchart, pseudocode is easy to modify and can be embedded into a program as comments.

No standard set of rules exists for writing pseudocode, although a number of conventions have been developed.

Program Design: Program Design Tools

Page 15: CC111 Lec#5: Program Development 1 Program Development and Programming Languages Lecture 4 Reference :Understanding Computers Chapter 13.

CC111 Lec#5: Program Development 15

Page 16: CC111 Lec#5: Program Development 1 Program Development and Programming Languages Lecture 4 Reference :Understanding Computers Chapter 13.

CC111 Lec#5: Program Development 16

Program Design: Control Structures

• Sequence

• Selection

• Iteration

Page 17: CC111 Lec#5: Program Development 1 Program Development and Programming Languages Lecture 4 Reference :Understanding Computers Chapter 13.

CC111 Lec#5: Program Development 17

Program Design: Control Structures

Sequence

A sequence control structure is simply a series of procedures that follow one another.

Statement Statement Statement . . .

Page 18: CC111 Lec#5: Program Development 1 Program Development and Programming Languages Lecture 4 Reference :Understanding Computers Chapter 13.

CC111 Lec#5: Program Development 18

Program Design: Control Structures

Selection

 The selection (if-then-else) control structure involves a choice: if a certain condition is true, then follow one procedure; else, if false, follow another.

When more than two possible choices exist, the case control structure can be used instead.

Statement1

Statement

Statement2

Condition . . .

True

False

Page 19: CC111 Lec#5: Program Development 1 Program Development and Programming Languages Lecture 4 Reference :Understanding Computers Chapter 13.

CC111 Lec#5: Program Development 19

Program Design: Control Structures

Iteration loop is an operation that repeats until a certain condition is met. A looping (iteration) control structure can take two forms. With the do-while structure, the loop is executed as long as a condition is true; with the do-until structure, the loop continues until a certain condition becomes true.

Statement

Condition. . .

False

True

Page 20: CC111 Lec#5: Program Development 1 Program Development and Programming Languages Lecture 4 Reference :Understanding Computers Chapter 13.

CC111 Lec#5: Program Development 20

Program Design: Good Program Design

    Good program design is essential; it can save time and it produces a better end result. Some principles of good program design are:

• Be specific

• One-entry-point, one-exit-point rule

• No infinite loops

• Documentation during program design includes all the design specifications

Page 21: CC111 Lec#5: Program Development 1 Program Development and Programming Languages Lecture 4 Reference :Understanding Computers Chapter 13.

CC111 Lec#5: Program Development 21

Page 22: CC111 Lec#5: Program Development 1 Program Development and Programming Languages Lecture 4 Reference :Understanding Computers Chapter 13.

CC111 Lec#5: Program Development 22

3- Program Coding

• Coding: actual process of creating the program in a programming language. – Programming language must be chosen.– Coding standards should be adhered to.– Make use of reusable code and data dictionaries.– Translate coded programs into executable code.

• Documentation results in finished source code.

Page 23: CC111 Lec#5: Program Development 1 Program Development and Programming Languages Lecture 4 Reference :Understanding Computers Chapter 13.

CC111 Lec#5: Program Development 23

Page 24: CC111 Lec#5: Program Development 1 Program Development and Programming Languages Lecture 4 Reference :Understanding Computers Chapter 13.

CC111 Lec#5: Program Development 24

Program Coding

The coded program is referred to as source code. to be executed, the program is converted by the computer to object code using a special program.

A compiler translates the entire program into machine language before executing it. The program then doesn’t need to be recompiled until it is modified.An interpreter translates program statements one at a time. Interpreters are helpful during the debugging stage, but are slower during execution of the finished program.An assembler converts assembly-language statements into machine language.

Page 25: CC111 Lec#5: Program Development 1 Program Development and Programming Languages Lecture 4 Reference :Understanding Computers Chapter 13.

CC111 Lec#5: Program Development 25

4- Program Debugging and Testing

• Debugging: process of making sure a program is free of errors or bugs.– Preliminary bugging often finds syntax or logic

errors. – Testing can consist of alpha or beta testing.

• Documentation includes a copy of the finished program code, plus test data and results.

Page 26: CC111 Lec#5: Program Development 1 Program Development and Programming Languages Lecture 4 Reference :Understanding Computers Chapter 13.

CC111 Lec#5: Program Development 26

Program Debugging and Testing

Preliminary debugging begins after the program has been entered into the computer system. Rarely is a program error-free the first time it runs. Two common types of errors are syntax errors and logic errors.

A syntax error occurs when the programmer has not followed the rules of the language.

A logic error, or execution-time error, results when the command syntax is correct but the program is producing incorrect results.

Page 27: CC111 Lec#5: Program Development 1 Program Development and Programming Languages Lecture 4 Reference :Understanding Computers Chapter 13.

CC111 Lec#5: Program Development 27

Program Debugging and Testing

At some point in the preliminary debugging process, the program will appear to be correct. At this point, the programmer, or preferably someone else, will run the original program with extensive test data.

Good test data will subject the program to all the conditions it might conceivably encounter when finally implemented.

Most companies run on-site alpha tests to test programs; companies in the business of selling software also commonly run beta tests by distributing preliminary versions of the program to outside users.

Page 28: CC111 Lec#5: Program Development 1 Program Development and Programming Languages Lecture 4 Reference :Understanding Computers Chapter 13.

CC111 Lec#5: Program Development 28

5- Program Maintenance

• Program maintenance: process of updating software so that it continues to be useful. – A costly process, but can be used to extend the life of

a program.

• Documentation consists of amended program package reflecting what problems occurred and what program changes were made.

Page 29: CC111 Lec#5: Program Development 1 Program Development and Programming Languages Lecture 4 Reference :Understanding Computers Chapter 13.

CC111 Lec#5: Program Development 29

What Is a Programming Language?

A programming language is a set of rules used to write instructions to the

computer.

Page 30: CC111 Lec#5: Program Development 1 Program Development and Programming Languages Lecture 4 Reference :Understanding Computers Chapter 13.

CC111 Lec#5: Program Development 30

Categories of Programming Languages

• Low-level languages

• High-level languages

• Fourth-generation languages (4GLs)

• Natural and visual languages

Page 31: CC111 Lec#5: Program Development 1 Program Development and Programming Languages Lecture 4 Reference :Understanding Computers Chapter 13.

CC111 Lec#5: Program Development 31

Categories of Programming Languages

Machine and assembly languages are called low-level languages, because programmers who code in them must write instructions at the finest level of detail, the base level of the hardware.

Although virtually no one writes machine-language programs anymore, all programs must be translated by a language translator into machine language before they are executed.

Assembly languages are fast and consume little storage when compared with higher-level languages, but take longer to write and maintain.

Page 32: CC111 Lec#5: Program Development 1 Program Development and Programming Languages Lecture 4 Reference :Understanding Computers Chapter 13.

CC111 Lec#5: Program Development 32

Categories of Programming Languages

 High-level languages differ from their low-level predecessors in that they require less coding detail and make programs easier to write.

Programs written in a high-level language (BASIC, COBOL, Pascal, C, etc.) need to be translated into machine language before they can be executed.

Page 33: CC111 Lec#5: Program Development 1 Program Development and Programming Languages Lecture 4 Reference :Understanding Computers Chapter 13.

CC111 Lec#5: Program Development 33

Categories of Programming Languages

 Very-high-level languages, also known as fourth-generation languages (4GLs), are much easier to use than the high-level languages that preceded them, because they are declarative rather than procedural languages. For instance, to draw a bar chart in a procedural language, you must tell the computer how to draw bars and where to place them. In a declarative language, you may be able to just point to the data you want graphed, click several menu choices, and you’re in business. Fourth-generation languages are commonly used to access databases (query languages).

Page 34: CC111 Lec#5: Program Development 1 Program Development and Programming Languages Lecture 4 Reference :Understanding Computers Chapter 13.

CC111 Lec#5: Program Development 34

Popular Programming Languages

• FORTRAN

• COBOL

• Pascal

BASIC and Visual Basic

C, C++, and C#

Java

Page 35: CC111 Lec#5: Program Development 1 Program Development and Programming Languages Lecture 4 Reference :Understanding Computers Chapter 13.

CC111 Lec#5: Program Development 35

Page 36: CC111 Lec#5: Program Development 1 Program Development and Programming Languages Lecture 4 Reference :Understanding Computers Chapter 13.

CC111 Lec#5: Program Development 36

Markup Languages

• Markup languages use symbols or tags to describe what a document should look like when displayed.

– HTML (Hypertext Markup Language)– Dynamic HTML– XML (extensible markup language) – XHTML (extensible Hypertext Markup Language) – WML (Wireless Markup Language )

Page 37: CC111 Lec#5: Program Development 1 Program Development and Programming Languages Lecture 4 Reference :Understanding Computers Chapter 13.

CC111 Lec#5: Program Development 37

Page 38: CC111 Lec#5: Program Development 1 Program Development and Programming Languages Lecture 4 Reference :Understanding Computers Chapter 13.

CC111 Lec#5: Program Development 38

Scripting Languages

• Scripting languages are used to build program instructions into Web pages, usually to add dynamic content.

– JavaScript

– VBScript

– Perl

Page 39: CC111 Lec#5: Program Development 1 Program Development and Programming Languages Lecture 4 Reference :Understanding Computers Chapter 13.

CC111 Lec#5: Program Development 39