chapter 14web.cecs.pdx.edu/~harry/cs105/slides/chapter14.pdf · • describe the six steps of...

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

Upload: dotu

Post on 12-Mar-2018

217 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Chapter 14web.cecs.pdx.edu/~harry/cs105/slides/Chapter14.pdf · • Describe the six steps of programming ... Programming is part of Phase 4, ... • Computer-aided software engineering

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

Chapter 14

Programming and Languages

Page 2: Chapter 14web.cecs.pdx.edu/~harry/cs105/slides/Chapter14.pdf · • Describe the six steps of programming ... Programming is part of Phase 4, ... • Computer-aided software engineering

14-2

Competencies (Page 1 of 2)

•  Describe the six steps of programming

•  Discuss design tools including top-down design, pseudocode, flowcharts, and logic structures

•  Describe program testing and the tools for finding and removing errors

Page 4398

Page 3: Chapter 14web.cecs.pdx.edu/~harry/cs105/slides/Chapter14.pdf · • Describe the six steps of programming ... Programming is part of Phase 4, ... • Computer-aided software engineering

14-3

Competencies (Page 2 of 2)

•  Describe CASE tools and object-oriented software development

•  Explain the five generations of programming languages

Page 398

Page 4: Chapter 14web.cecs.pdx.edu/~harry/cs105/slides/Chapter14.pdf · • Describe the six steps of programming ... Programming is part of Phase 4, ... • Computer-aided software engineering

14-4

Introduction In this chapter programming is described in two

parts... • The steps in the programming process • Some of the programming languages available Programming is part of Phase 4, Systems

Development, in the Systems Life Cycle. Competent end users need to understand the

relationship between systems development and programming.

Page 399

Page 5: Chapter 14web.cecs.pdx.edu/~harry/cs105/slides/Chapter14.pdf · • Describe the six steps of programming ... Programming is part of Phase 4, ... • Computer-aided software engineering

14-5

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

Page 400

Page 6: Chapter 14web.cecs.pdx.edu/~harry/cs105/slides/Chapter14.pdf · • Describe the six steps of programming ... Programming is part of Phase 4, ... • Computer-aided software engineering

14-6

What is Programming?

•  Programming is software development •  Six step procedure

–  Program specification –  Program design –  Program code –  Program test –  Program documentation –  Program maintenance

Page 400

Page 7: Chapter 14web.cecs.pdx.edu/~harry/cs105/slides/Chapter14.pdf · • Describe the six steps of programming ... Programming is part of Phase 4, ... • Computer-aided software engineering

14-7

Step 1: Program Specification

Page 401

•  Also called programs definition or program analysis

•  5 Step Process –  Program Objectives –  Desired Output –  Input Data –  Processing Requirements –  Document Program Specifications

Page 8: Chapter 14web.cecs.pdx.edu/~harry/cs105/slides/Chapter14.pdf · • Describe the six steps of programming ... Programming is part of Phase 4, ... • Computer-aided software engineering

14-8

Program Objectives

•  Objectives are the problems that you are trying to solve

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

Page 401

Page 9: Chapter 14web.cecs.pdx.edu/~harry/cs105/slides/Chapter14.pdf · • Describe the six steps of programming ... Programming is part of Phase 4, ... • Computer-aided software engineering

14-9

Program Specification Steps Continued

Page 402

•  Desired output •  Input Data •  Processing

Requirements •  Program

Specifications Document

Example of statement of hours worked

End user’s sketch of desired output

Page 10: Chapter 14web.cecs.pdx.edu/~harry/cs105/slides/Chapter14.pdf · • Describe the six steps of programming ... Programming is part of Phase 4, ... • Computer-aided software engineering

14-10

Step 2: Program Design

•  Plan a solution •  Use structured programming techniques

–  Top-down program design –  Pseudocode –  Flowcharts –  Logic structures

Page 403

Page 11: Chapter 14web.cecs.pdx.edu/~harry/cs105/slides/Chapter14.pdf · • Describe the six steps of programming ... Programming is part of Phase 4, ... • Computer-aided software engineering

14-11

Top-Down Program Design

Page 403

Page 12: Chapter 14web.cecs.pdx.edu/~harry/cs105/slides/Chapter14.pdf · • Describe the six steps of programming ... Programming is part of Phase 4, ... • Computer-aided software engineering

14-12

Pseudocode Summarizes the logic for a program. Informal list of instructions. Like a program, but written in English words.

Page 404

Page 13: Chapter 14web.cecs.pdx.edu/~harry/cs105/slides/Chapter14.pdf · • Describe the six steps of programming ... Programming is part of Phase 4, ... • Computer-aided software engineering

14-13

Flowchart

Page 404

Flowchart symbols

Flowchart example

Page 14: Chapter 14web.cecs.pdx.edu/~harry/cs105/slides/Chapter14.pdf · • Describe the six steps of programming ... Programming is part of Phase 4, ... • Computer-aided software engineering

14-14

Logic Structures

•  Sequence structure

•  Selection structure

•  Loop structure

Page 404

Page 15: Chapter 14web.cecs.pdx.edu/~harry/cs105/slides/Chapter14.pdf · • Describe the six steps of programming ... Programming is part of Phase 4, ... • Computer-aided software engineering

14-15

Step 3: Program Code

•  Writing the program or coding •  The good program

–  Reliable –  Catch input errors –  Understandable to other

programmers –  Structured programs best method –  Use the most appropriate

computer language •  Coding

Page 407

Page 16: Chapter 14web.cecs.pdx.edu/~harry/cs105/slides/Chapter14.pdf · • Describe the six steps of programming ... Programming is part of Phase 4, ... • Computer-aided software engineering

14-16

Coding

•  Formatting or presentation language

•  Programming language

Page 408

Page 17: Chapter 14web.cecs.pdx.edu/~harry/cs105/slides/Chapter14.pdf · • Describe the six steps of programming ... Programming is part of Phase 4, ... • Computer-aided software engineering

14-17

Common Programming Languages

•  C •  C++ •  Java •  Python, Perl •  Visual Basic

–  Basic

•  Fortran – Older, for numerical •  Cobol – Older, for transaction processing systems (TPS) •  Assembler ( = machine language)

Page 408

Page 18: Chapter 14web.cecs.pdx.edu/~harry/cs105/slides/Chapter14.pdf · • Describe the six steps of programming ... Programming is part of Phase 4, ... • Computer-aided software engineering

14-18

Step 4: Program Test

•  Debugging –  Testing –  Eliminating errors

•  Syntax errors •  Logic errors •  Testing process

Page 422

Page 19: Chapter 14web.cecs.pdx.edu/~harry/cs105/slides/Chapter14.pdf · • Describe the six steps of programming ... Programming is part of Phase 4, ... • Computer-aided software engineering

14-19

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

Page 422

Page 20: Chapter 14web.cecs.pdx.edu/~harry/cs105/slides/Chapter14.pdf · • Describe the six steps of programming ... Programming is part of Phase 4, ... • Computer-aided software engineering

14-20

Step 5: Program Documentation

•  Written descriptions and procedures about a program

•  Important for people who will use the program –  Users –  Operators –  Programmers

Page 411

Page 21: Chapter 14web.cecs.pdx.edu/~harry/cs105/slides/Chapter14.pdf · • Describe the six steps of programming ... Programming is part of Phase 4, ... • Computer-aided software engineering

14-21

Step 6: Program Maintenance

•  75% of total lifetime cost •  Error-free operations •  Effective program •  Two categories

–  Operations –  Changing needs

Page 412

Page 22: Chapter 14web.cecs.pdx.edu/~harry/cs105/slides/Chapter14.pdf · • Describe the six steps of programming ... Programming is part of Phase 4, ... • Computer-aided software engineering

14-22

Case Tools

•  Computer-aided software engineering (CASE) –  Automate development process

•  Designing •  Coding •  Testing activities

Page 414

Page 23: Chapter 14web.cecs.pdx.edu/~harry/cs105/slides/Chapter14.pdf · • Describe the six steps of programming ... Programming is part of Phase 4, ... • Computer-aided software engineering

14-23

Object-Oriented Software Development

•  Focuses less on procedures, more on relationship between objects

•  OOP: Object-oriented programming

•  Object contains both the data and the processing operations

Page 415

Page 24: Chapter 14web.cecs.pdx.edu/~harry/cs105/slides/Chapter14.pdf · • Describe the six steps of programming ... Programming is part of Phase 4, ... • Computer-aided software engineering

14-24

Generations of Programming Languages (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

Page 415

Page 25: Chapter 14web.cecs.pdx.edu/~harry/cs105/slides/Chapter14.pdf · • Describe the six steps of programming ... Programming is part of Phase 4, ... • Computer-aided software engineering

14-25

•  1st -- Machine languages •  2nd -- Assembly languages •  3rd -- High level procedural languages (3GL) •  4th -- Problem-Oriented languages (4GL) •  5th -- Natural Languages & Visual

programming languages (5GL)

Page 415

Generations of Programming Languages (Page 2 of 2)

Page 26: Chapter 14web.cecs.pdx.edu/~harry/cs105/slides/Chapter14.pdf · • Describe the six steps of programming ... Programming is part of Phase 4, ... • Computer-aided software engineering

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

Chapter 15

Your Future and Information Technology

Page 27: Chapter 14web.cecs.pdx.edu/~harry/cs105/slides/Chapter14.pdf · • Describe the six steps of programming ... Programming is part of Phase 4, ... • Computer-aided software engineering

15-27

CH15: Technology and People

•  Cynicism •  Naiveté •  Frustration

•  Proactivity

Page 436

Page 28: Chapter 14web.cecs.pdx.edu/~harry/cs105/slides/Chapter14.pdf · • Describe the six steps of programming ... Programming is part of Phase 4, ... • Computer-aided software engineering

14-28

Careers In IT

•  Computer programmers create, test, and troubleshoot programs

•  Responsibility may also include updating and repairing existing programs

•  Employers seek individuals with a bachelors degree in computer science or information systems but there are positions available for those with a two-year degree

•  Desired traits include patience, logical thinking, and attention to detail

•  Computer Programmers can expect to earn $48K - $81K annually

Page 418

Page 29: Chapter 14web.cecs.pdx.edu/~harry/cs105/slides/Chapter14.pdf · • Describe the six steps of programming ... Programming is part of Phase 4, ... • Computer-aided software engineering

14-29

A Look to the Future MI-Tech

•  Synapse Solutions has created a system called MI-tech

•  Understands word order and meaning •  Computer translates "wish list" into machine

language

Page 419

Page 30: Chapter 14web.cecs.pdx.edu/~harry/cs105/slides/Chapter14.pdf · • Describe the six steps of programming ... Programming is part of Phase 4, ... • Computer-aided software engineering

14-30

Discussion Questions (Page 1 of 2)

•  Identify and discuss each of the six steps of programming.

•  Describe CASE tools and OOP. How does CASE assist programmers?

•  What is meant by “generation” in reference to programming languages? What is the difference between low-level and high-level languages?

Page 428

Page 31: Chapter 14web.cecs.pdx.edu/~harry/cs105/slides/Chapter14.pdf · • Describe the six steps of programming ... Programming is part of Phase 4, ... • Computer-aided software engineering

14-31

Discussion Questions (Page 2 of 2)

•  What is the difference between a compiler and an interpreter?

•  What are logic structures? Describe the differences between the three logic types.

Page 428