25
Chapter 14 Programming and Languages McGraw- Hill/ Irwin Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved .

Chapter 14 Programming and Languages McGraw-Hill/Irwin Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved

  • View
    215

  • Download
    1

Embed Size (px)

Citation preview

Page 1: Chapter 14 Programming and Languages McGraw-Hill/Irwin Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved

Chapter 14

Programming andLanguages

McGraw-Hill/Irwin Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved.

Page 2: Chapter 14 Programming and Languages McGraw-Hill/Irwin Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved

Competencies (Page 1 of 2)

 •Describe the six stepsof programming

 •Discuss design toolsincluding top-downdesign, pseudocode,

flowcharts, and logicstructures

 •Describe programtesting and the tools for

finding and removingerrors

14-2Page 4398

Page 3: Chapter 14 Programming and Languages McGraw-Hill/Irwin Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved

Competencies (Page 2 of 2)

 •Describe CASE tools and object-orientedsoftware development

 •Explain the five generations of programminglanguages

14-3Page 398

Page 4: Chapter 14 Programming and Languages McGraw-Hill/Irwin Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved

Introduction

In this chapter programming is described in twoparts...

• The steps in the programming process

• Some of the programming languages available

Programming is part of Phase 4, SystemsDevelopment, in the Systems Life Cycle.

Competent end users need to understand therelationship between systems development andprogramming.

14-4Page 399

Page 5: Chapter 14 Programming and Languages McGraw-Hill/Irwin Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved

 •

 •

 •

 •

Programs and Programming

•  What is a Program?–  A program is a list of instructions

–  Code, Application

–  Programmer, Hacker

•  A problem-solving procedure  –A list of instructions

Prewritten

Custom-written

Application software

System software

14-5Page 400

Page 6: Chapter 14 Programming and Languages McGraw-Hill/Irwin Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved

 •

 • –

 –

 –

 –

 –

What is Programming?

Programming is software development

Six step procedureProgram specification

Program design

Program code

 – Program test

Program documentation

Program maintenance

14-6Page 400

Page 7: Chapter 14 Programming and Languages McGraw-Hill/Irwin Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved

 •

 • –

 –

 –

 –

Step 1: Program Specification

Also called programs definition or programanalysis

5 Step ProcessProgram Objectives

Desired Output

 – Input Data

Processing Requirements

Document Program Specifications

14-7Page 401

Page 8: Chapter 14 Programming and Languages McGraw-Hill/Irwin Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved

Program Objectives

•  Objectives are the problems that you aretrying to solve

•  Programming requires a clear statement ofthe problem that you are looking to address

14-8Page 401

Page 9: Chapter 14 Programming and Languages McGraw-Hill/Irwin Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved

Program Specification StepsContinued

•  Desired output

•  Input Data

•  ProcessingRequirements

•  ProgramSpecifications

End user’s sketch ofdesired output

Document

Example of statement of

Page 402

hours worked 14-9

Page 10: Chapter 14 Programming and Languages McGraw-Hill/Irwin Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved

Step 2: Program Design

 •Plan a solution

•  Use structured programming techniques–  Top-down program design

–  Pseudocode

 –Flowcharts

–  Logic structures

14-10Page 403

Page 11: Chapter 14 Programming and Languages McGraw-Hill/Irwin Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved

Top-Down Program Design

14-11Page 403

Page 12: Chapter 14 Programming and Languages McGraw-Hill/Irwin Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved

PseudocodeSummarizes the logic for a program.

Informal list of instructions.

Like a program, but written in English words.

14-12Page 404

Page 13: Chapter 14 Programming and Languages McGraw-Hill/Irwin Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved

Flowchart

Flowchart symbols

Page 404

Flowchart example14-13

Page 14: Chapter 14 Programming and Languages McGraw-Hill/Irwin Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved

Logic Structures

•  Sequence structure

•  Selection structure

•  Loop structure

14-14Page 404

Page 15: Chapter 14 Programming and Languages McGraw-Hill/Irwin Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved

Step 3: Program Code

•  Writing the program or coding•  The good program

 –Reliable–  Catch input errors–  Understandable to otherprogrammers–  Structured programs best method

 –Use the most appropriatecomputer language

•  Coding

14-15Page 407

Page 16: Chapter 14 Programming and Languages McGraw-Hill/Irwin Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved

Coding

•  Formatting or presentation language

•  Programming language

14-16Page 408

Page 17: Chapter 14 Programming and Languages McGraw-Hill/Irwin Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved

 •

 •

Common ProgrammingLanguages

 •

 •

 •

C

C++

Java

Python, Perl

Visual Basic–  Basic

•  Fortran – Older, for numerical

•  Cobol – Older, for transaction processing systems (TPS)

•  Assembler ( = machine language)

14-17Page 408

Page 18: Chapter 14 Programming and Languages McGraw-Hill/Irwin Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved

Step 4: Program Test

 •Debugging  –Testing

 –Eliminating errors

 •Syntax errors

 •Logic errors

 •Testing process

14-18Page 422

Page 19: Chapter 14 Programming and Languages McGraw-Hill/Irwin Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved

Types of Testing

•  Desk checking – sit and look at it

•  Manual testing – try specific data values

•  Translation – try to “compile” i–  This catches syntax errors

•  Run the program–  Testing on sample data

•  Beta testing–  Give preliminary version to a few brave users

14-19Page 422

Page 20: Chapter 14 Programming and Languages McGraw-Hill/Irwin Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved

Step 5: Program Documentation

•  Written descriptions and procedures about aprogram

•  Important for people who will use theprogram–  Users

 –Operators

 –Programmers

14-20Page 411

Page 21: Chapter 14 Programming and Languages McGraw-Hill/Irwin Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved

 •

 •

 •

 •

Step 6: Program Maintenance

75% of total lifetime cost

Error-free operations

Effective program

Two categories–  Operations

–  Changing needs

14-21Page 412

Page 22: Chapter 14 Programming and Languages McGraw-Hill/Irwin Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved

Case Tools

 •Computer-aided software engineering(CASE)

–  Automate development process•  Designing

•  Coding

•  Testing activities

14-22Page 414

Page 23: Chapter 14 Programming and Languages McGraw-Hill/Irwin Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved

Object-Oriented SoftwareDevelopment

•  Focuses less on procedures, more on

relationship between objects

•  OOP: Object-oriented programming

•  Object contains both the data and the

processing operations

14-23Page 415

Page 24: Chapter 14 Programming and Languages McGraw-Hill/Irwin Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved

Generations of ProgrammingLanguages (Page 1 of 2)

•  Occurring in “generations” or “levels”–  Levels-Machine languages to natural languages

•  There are five generations :–  Lower level closer to machine language–  Higher level closer to human-like language

14-24Page 415

Page 25: Chapter 14 Programming and Languages McGraw-Hill/Irwin Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved

 •

 •

 •

 •

 •

Generations of ProgrammingLanguages (Page 2 of 2)

1st -- Machine languages

2nd -- Assembly languages

3rd -- High level procedural languages )3GL(

4th -- Problem-Oriented languages )4GL(

5th -- Natural Languages & Visualprogramming languages )5GL(

14-25Page 415