Chapter 14 Programming and Languages Mc GrawHill Copyright

  • Slides: 28
Download presentation
Chapter 14: Programming and Languages Mc. Graw-Hill Copyright © 2012 The Mc. Graw-Hill Companies,

Chapter 14: Programming and Languages Mc. Graw-Hill Copyright © 2012 The Mc. Graw-Hill Companies, Inc. All rights reserved.

Computing Essentials 2012: Making IT Work for You Introduction • In this chapter, you

Computing Essentials 2012: Making IT Work for You Introduction • In this chapter, you focus on Phase 4, Systems Development, of the systems life cycle and learn about the programming process and some of the programming languages that are available • Competent end users need to understand the relationship between systems development and programming Mc. Graw-Hill Copyright © 2012 The Mc. Graw-Hill Companies, Inc. All rights reserved. 14 -2

Computing Essentials 2012: Making IT Work for You Programs and Programming • What is

Computing Essentials 2012: Making IT Work for You Programs and Programming • What is a program? • A problem-solving procedure – A list of instructions Mc. Graw-Hill • Prewritten • Custom-written • Application software • System software Copyright © 2012 The Mc. Graw-Hill Companies, Inc. All rights reserved. 14 -3

Computing Essentials 2012: Making IT Work for You What is Programming? • Programming is

Computing Essentials 2012: Making IT Work for You What is Programming? • Programming is software development • Six step procedure 1. 2. 3. 4. 5. 6. Mc. Graw-Hill Program specification Program design Program code Program test Program documentation Program maintenance Copyright © 2012 The Mc. Graw-Hill Companies, Inc. All rights reserved. 14 -4

Computing Essentials 2012: Making IT Work for You Step 1: Program Specification • Also

Computing Essentials 2012: Making IT Work for You Step 1: Program Specification • Also called program definition or program analysis • Five steps to complete in the process Mc. Graw-Hill Copyright © 2012 The Mc. Graw-Hill Companies, Inc. All rights reserved. 14 -5

Computing Essentials 2012: Making IT Work for You Program Objectives in Step 1 •

Computing Essentials 2012: Making IT Work for You Program Objectives in Step 1 • Objectives are the problems that you are trying to solve • Programming requires a clear statement of the problem that you are looking to address Mc. Graw-Hill Copyright © 2012 The Mc. Graw-Hill Companies, Inc. All rights reserved. 14 -6

Computing Essentials 2012: Making IT Work for You Program Specification in Step 1 •

Computing Essentials 2012: Making IT Work for You Program Specification in Step 1 • • Desired output Needed input data Required processing Documentation of program specifications Mc. Graw-Hill End user’s sketch of desired output Example of input data Copyright © 2012 The Mc. Graw-Hill Companies, Inc. All rights reserved. 14 -7

Computing Essentials 2012: Making IT Work for You Step 2: Program Design • Plan

Computing Essentials 2012: Making IT Work for You Step 2: Program Design • Plan a solution using structured programming techniques – – Mc. Graw-Hill Top-down design Algorithm Flowcharts Logic structures Copyright © 2012 The Mc. Graw-Hill Companies, Inc. All rights reserved. 14 -8

Computing Essentials 2012: Making IT Work for You Top-Down Program Design • Identify the

Computing Essentials 2012: Making IT Work for You Top-Down Program Design • Identify the program modules required Mc. Graw-Hill Return Copyright © 2012 The Mc. Graw-Hill Companies, Inc. All rights reserved. 14 -9

Computing Essentials 2012: Making IT Work for You Algorithm & Flowchart • Algorithm –

Computing Essentials 2012: Making IT Work for You Algorithm & Flowchart • Algorithm – Step by step method to solve a problem is algorithm • Flow Chart – Diagrammatic representation of algorithm Mc. Graw-Hill Return Copyright © 2012 The Mc. Graw-Hill Companies, Inc. All rights reserved. 14 -10

Computing Essentials 2012: Making IT Work for You Real World Examples. Problem: How to

Computing Essentials 2012: Making IT Work for You Real World Examples. Problem: How to make a tea • • Step 1: Start Step 2: Add water to kettle Step 3: Take tea bag Step 4: Add Sugar Step 5: Add Milk Step 6: Drink Tea Step 7: Stop Mc. Graw-Hill Copyright © 2012 The Mc. Graw-Hill Companies, Inc. All rights reserved. 14 -11

Computing Essentials 2012: Making IT Work for You Problem: Add two numbers Mc. Graw-Hill

Computing Essentials 2012: Making IT Work for You Problem: Add two numbers Mc. Graw-Hill Step 1: Step 2: Step 3: Step 4: Step 5: Start Read A, B C=A+B Print C Stop Copyright © 2012 The Mc. Graw-Hill Companies, Inc. All rights reserved. 14 -12

Computing Essentials 2012: Making IT Work for You Algorithm Problem: Multiply 2 numbers Step

Computing Essentials 2012: Making IT Work for You Algorithm Problem: Multiply 2 numbers Step 1: Start Step 2: Read A, B Step 3: C=A*B Step 4: Print C Step 5: Stop Mc. Graw-Hill Problem: Subtract 2 numbers Step 1: Step 2: Step 3: Step 4: Step 5: Start Read A, B C=A-B Print C Stop Copyright © 2012 The Mc. Graw-Hill Companies, Inc. All rights reserved. 14 -13

Computing Essentials 2012: Making IT Work for You Algorithm Problem: Average of 3 numbers

Computing Essentials 2012: Making IT Work for You Algorithm Problem: Average of 3 numbers Mc. Graw-Hill Step 1: Start Step 2: Read A, B, C Step 3: Avg=(A+B+C)/3 Step 4: Print Avg Step 5: Stop Copyright © 2012 The Mc. Graw-Hill Companies, Inc. All rights reserved. 14 -14

Computing Essentials 2012: Making IT Work for You Algorithm Problem: Area of Circle Mc.

Computing Essentials 2012: Making IT Work for You Algorithm Problem: Area of Circle Mc. Graw-Hill Step 1: Step 2: Step 3: Step 4: Step 5: Start Read Radius Area=3. 14*Radius Print Area Stop Copyright © 2012 The Mc. Graw-Hill Companies, Inc. All rights reserved. 14 -15

Computing Essentials 2012: Making IT Work for You Algorithm Problem: Find Pass or Fail

Computing Essentials 2012: Making IT Work for You Algorithm Problem: Find Pass or Fail • Detailed Algorithm Step 1: Start Step 2: Read Mark Step 3: Is (Mark>=60) then Print “PASS” else Print “FAIL” Step 4: Stop Mc. Graw-Hill Copyright © 2012 The Mc. Graw-Hill Companies, Inc. All rights reserved. 14 -16

Computing Essentials 2012: Making IT Work for You Flowchart Symbols Mc. Graw-Hill General Used

Computing Essentials 2012: Making IT Work for You Flowchart Symbols Mc. Graw-Hill General Used Symbols Copyright © 2012 The Mc. Graw-Hill Companies, Inc. All rights reserved. 14 -17

Computing Essentials 2012: Making IT Work for You Flow Chart: Add Two Numbers Algorithm

Computing Essentials 2012: Making IT Work for You Flow Chart: Add Two Numbers Algorithm Mc. Graw-Hill Start Flowchart Read A, B C=A+B Print C Stop Copyright © 2012 The Mc. Graw-Hill Companies, Inc. All rights reserved. 14 -18

Computing Essentials 2012: Making IT Work for You Flow Chart: Area of Circle Mc.

Computing Essentials 2012: Making IT Work for You Flow Chart: Area of Circle Mc. Graw-Hill Copyright © 2012 The Mc. Graw-Hill Companies, Inc. All rights reserved. 14 -19

Computing Essentials 2012: Making IT Work for You Flowchart-Pass or Fail Mc. Graw-Hill Copyright

Computing Essentials 2012: Making IT Work for You Flowchart-Pass or Fail Mc. Graw-Hill Copyright © 2012 The Mc. Graw-Hill Companies, Inc. All rights reserved. 14 -20

Computing Essentials 2012: Making IT Work for You Flowchart -Biggest of two numbers Mc.

Computing Essentials 2012: Making IT Work for You Flowchart -Biggest of two numbers Mc. Graw-Hill Copyright © 2012 The Mc. Graw-Hill Companies, Inc. All rights reserved. 14 -21

Computing Essentials 2012: Making IT Work for You Step 3: Program Code • Writing

Computing Essentials 2012: Making IT Work for You Step 3: Program Code • Writing the program or coding • Characteristics of a good program – Works reliably – Produces the correct output – Catches common input errors – Code is well-documented and understandable – Uses an appropriate computer language Mc. Graw-Hill Copyright © 2012 The Mc. Graw-Hill Companies, Inc. All rights reserved. 14 -22

Computing Essentials 2012: Making IT Work for You Coding in Step 3 • Content-markup

Computing Essentials 2012: Making IT Work for You Coding in Step 3 • Content-markup languages • Programming languages Mc. Graw-Hill Copyright © 2012 The Mc. Graw-Hill Companies, Inc. All rights reserved. 14 -23

Computing Essentials 2012: Making IT Work for You Step 4: Program Test • Debugging

Computing Essentials 2012: Making IT Work for You Step 4: Program Test • Debugging to test code and eliminate errors – – – Mc. Graw-Hill Syntax errors Logic errors Testing process Copyright © 2012 The Mc. Graw-Hill Companies, Inc. All rights reserved. 14 -24

Computing Essentials 2012: Making IT Work for You Step 5: Program Documentation • Written

Computing Essentials 2012: Making IT Work for You Step 5: Program Documentation • Written descriptions about a program • Important for people who will use and/or support the program – Users – Operators – Programmers Mc. Graw-Hill Copyright © 2012 The Mc. Graw-Hill Companies, Inc. All rights reserved. 14 -25

Computing Essentials 2012: Making IT Work for You Step 6: Program Maintenance • 75%

Computing Essentials 2012: Making IT Work for You Step 6: Program Maintenance • 75% of total lifetime cost • Ensures program is – Error-free – Effective – Efficient • Two activity categories – Operations – Changing needs Mc. Graw-Hill Copyright © 2012 The Mc. Graw-Hill Companies, Inc. All rights reserved. 14 -26

Computing Essentials 2012: Making IT Work for You Generations of Programming Languages (Page 1

Computing Essentials 2012: Making IT Work for You Generations of Programming Languages (Page 1 of 2) • Occurring in “generations” or “levels” – Coding from machine languages to human or natural languages • There are five distinct generations – Lower level is closer to machine language – Higher level is closer to human-like language Mc. Graw-Hill Copyright © 2012 The Mc. Graw-Hill Companies, Inc. All rights reserved. 14 -27

Computing Essentials 2012: Making IT Work for You Generations of Programming Languages (Page 2

Computing Essentials 2012: Making IT Work for You Generations of Programming Languages (Page 2 of 2) • • • 1 st Gen: Machine languages 2 nd Gen: Assembly languages 3 rd Gen: High level procedural languages (3 GLs) 4 th Gen: Task-oriented languages (4 GLs) 5 th Gen: Problem and Constraint languages (5 GL) Mc. Graw-Hill Copyright © 2012 The Mc. Graw-Hill Companies, Inc. All rights reserved. 14 -28