© 2009 prentice-hall, inc. 1. 2 technology in action chapter 10 behind the scenes: software...

44
© 2009 Prentice-Hall, Inc. 1

Upload: drusilla-terry

Post on 12-Jan-2016

215 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: © 2009 Prentice-Hall, Inc. 1. 2 Technology in Action Chapter 10 Behind the Scenes: Software Programming

© 2009 Prentice-Hall, Inc. 1

Page 2: © 2009 Prentice-Hall, Inc. 1. 2 Technology in Action Chapter 10 Behind the Scenes: Software Programming

© 2009 Prentice-Hall, Inc. 2

Technology in ActionTechnology in Action

Chapter 10Chapter 10

Behind the Scenes: Software ProgrammingBehind the Scenes: Software Programming

Page 3: © 2009 Prentice-Hall, Inc. 1. 2 Technology in Action Chapter 10 Behind the Scenes: Software Programming

© 2009 Prentice-Hall, Inc. 3

Chapter TopicsChapter Topics

• System development life cycleSystem development life cycle

• Life cycle of a programLife cycle of a program

• Problem statementProblem statement

• AlgorithmsAlgorithms

• Moving from algorithm to codeMoving from algorithm to code

Page 4: © 2009 Prentice-Hall, Inc. 1. 2 Technology in Action Chapter 10 Behind the Scenes: Software Programming

© 2009 Prentice-Hall, Inc. 4

Chapter Topics (cont.)Chapter Topics (cont.)

• Moving from code to machine language Moving from code to machine language

• Testing programsTesting programs

• Completing a programCompleting a program

• Selecting the right programming languageSelecting the right programming language

• Most popular programming languagesMost popular programming languages

Page 5: © 2009 Prentice-Hall, Inc. 1. 2 Technology in Action Chapter 10 Behind the Scenes: Software Programming

© 2009 Prentice-Hall, Inc. 5

Information SystemsInformation Systems

• SystemSystem– A collection of pieces working together to achieve A collection of pieces working together to achieve

a common goala common goal• An information system includesAn information system includes

– DataData– PeoplePeople– ProceduresProcedures– Hardware/SoftwareHardware/Software

• System development life cycle (SDLC)System development life cycle (SDLC)– An organized process An organized process (or set of steps) (or set of steps) used to used to

develop systems in an orderly fashiondevelop systems in an orderly fashion

Page 6: © 2009 Prentice-Hall, Inc. 1. 2 Technology in Action Chapter 10 Behind the Scenes: Software Programming

© 2009 Prentice-Hall, Inc. 6

System Development Life CycleSystem Development Life Cycle

Page 7: © 2009 Prentice-Hall, Inc. 1. 2 Technology in Action Chapter 10 Behind the Scenes: Software Programming

© 2009 Prentice-Hall, Inc. 7

Problem/Opportunity IdentificationProblem/Opportunity Identification

• The existing system is evaluated:The existing system is evaluated:– Problems are definedProblems are defined– New proposals are reviewedNew proposals are reviewed– Decisions are made to proceed with the Decisions are made to proceed with the

projects projects – Process is documentedProcess is documented– Relevant problems/opportunities are definedRelevant problems/opportunities are defined

Page 8: © 2009 Prentice-Hall, Inc. 1. 2 Technology in Action Chapter 10 Behind the Scenes: Software Programming

© 2009 Prentice-Hall, Inc. 8

Analysis Analysis

• A program specification is developed A program specification is developed (goals and objectives of the project)(goals and objectives of the project)

• Feasibility assessment is performedFeasibility assessment is performed

• User requirements are definedUser requirements are defined

• Analysts recommend a plan of actionAnalysts recommend a plan of action

Page 9: © 2009 Prentice-Hall, Inc. 1. 2 Technology in Action Chapter 10 Behind the Scenes: Software Programming

© 2009 Prentice-Hall, Inc. 9

Design Design • A detailed plan for programmers is developedA detailed plan for programmers is developed• Flowcharts and data-flow diagrams are used for Flowcharts and data-flow diagrams are used for

the current and proposed systemthe current and proposed system

Data-flow diagram Flowchart

Page 10: © 2009 Prentice-Hall, Inc. 1. 2 Technology in Action Chapter 10 Behind the Scenes: Software Programming

© 2009 Prentice-Hall, Inc. 10

Development & DocumentationDevelopment & Documentation

• Actual programming takes placeActual programming takes place

• First phase of the program development First phase of the program development life cycle (PDLC)life cycle (PDLC)

• Development is documentedDevelopment is documented

• User documentation is createdUser documentation is created

Page 11: © 2009 Prentice-Hall, Inc. 1. 2 Technology in Action Chapter 10 Behind the Scenes: Software Programming

© 2009 Prentice-Hall, Inc. 11

Testing & InstallationTesting & Installation

• Program tested for proper operationProgram tested for proper operation

• Program installed for useProgram installed for use

• Testing and results are documentedTesting and results are documented

Page 12: © 2009 Prentice-Hall, Inc. 1. 2 Technology in Action Chapter 10 Behind the Scenes: Software Programming

© 2009 Prentice-Hall, Inc. 12

Maintenance & EvaluationMaintenance & Evaluation

• Performance of the system is monitoredPerformance of the system is monitored

• Corrections and modifications to the Corrections and modifications to the program are madeprogram are made

• Maintenance procedures and results are Maintenance procedures and results are documenteddocumented

Page 13: © 2009 Prentice-Hall, Inc. 1. 2 Technology in Action Chapter 10 Behind the Scenes: Software Programming

© 2009 Prentice-Hall, Inc. 13

The Life Cycle of a ProgramThe Life Cycle of a Program• Programming is the process of translating Programming is the process of translating

a task into a series of commands a a task into a series of commands a computer will use to perform that taskcomputer will use to perform that task

• Programming involves:Programming involves:– Identifying the parts of a task the computer Identifying the parts of a task the computer

can performcan perform– Describing tasks in a specific and complete Describing tasks in a specific and complete

mannermanner– Translating the tasks into a language that is Translating the tasks into a language that is

understood by the computer’s CPUunderstood by the computer’s CPU

Page 14: © 2009 Prentice-Hall, Inc. 1. 2 Technology in Action Chapter 10 Behind the Scenes: Software Programming

© 2009 Prentice-Hall, Inc. 14

Program Development Life CycleProgram Development Life Cycle

Page 15: © 2009 Prentice-Hall, Inc. 1. 2 Technology in Action Chapter 10 Behind the Scenes: Software Programming

© 2009 Prentice-Hall, Inc. 15

Step 1 : Describing the ProblemStep 1 : Describing the Problem

• The problem statement is:The problem statement is:– The starting point of programmingThe starting point of programming– A description of tasks the program is to accomplishA description of tasks the program is to accomplish– A description of how the program will execute the A description of how the program will execute the

taskstasks– Created through interaction between the programmer Created through interaction between the programmer

and the userand the user

• The program statement includes error handling, The program statement includes error handling, a testing plan, and output valuesa testing plan, and output values

Page 16: © 2009 Prentice-Hall, Inc. 1. 2 Technology in Action Chapter 10 Behind the Scenes: Software Programming

© 2009 Prentice-Hall, Inc. 16

PROGRAM GOAL: To compute the total pay for a fixed number of hours worked at a parking garage.

INPUTS: Number of Hours Worked........................ a positive number

OUTPUTS: Total Pay Earned ................................... a positive number

PROCESS: The Total Pay Earned is computed as $7.32 per hour for the first eight hours worked each day. Any hours worked beyond the first eight are billed at $11.73 per hour.

ERROR HANDLING:

The input Number of Hours Worked must be a positive real number. If it is a negative number or other nonacceptable character, the program will force the user to reenter the information.

TESTING PLAN: INPUT OUTPUT NOTES

8 8*7.32 Testing positive input

3 3*7.32 Testing positive input

12 8*7.32 + 4*11.73 Testing overtime input

–6 Error message/ask user to reenter value

Handling error

Parking Garage ExampleParking Garage Example

Page 17: © 2009 Prentice-Hall, Inc. 1. 2 Technology in Action Chapter 10 Behind the Scenes: Software Programming

© 2009 Prentice-Hall, Inc. 17

Step 2: Developing an Algorithm• Algorithm development:Algorithm development:

– A set of specific, A set of specific, sequential steps that sequential steps that describe what the program describe what the program must domust do

– Complex algorithms Complex algorithms include decision points:include decision points:

• Binary (yes/no)Binary (yes/no)• Loop (repeating actions)Loop (repeating actions)

– Visual tools used to track Visual tools used to track algorithm and decision algorithm and decision pointspoints

Page 18: © 2009 Prentice-Hall, Inc. 1. 2 Technology in Action Chapter 10 Behind the Scenes: Software Programming

© 2009 Prentice-Hall, Inc. 18

Flowchart and PseudocodeFlowchart and Pseudocode

Underlined words are information items that appear repeatedly in the algorithm.

1. Ask the user how many hours they worked today2. If the number of hours worked < = 8, compute total pay without overtime otherwise, compute total pay with overtime pay3. Print total pay

Bold terms show actions that are common in programming, such as reading data, making decisions, printing, and so on.

Flowchart Pseudocode

Page 19: © 2009 Prentice-Hall, Inc. 1. 2 Technology in Action Chapter 10 Behind the Scenes: Software Programming

© 2009 Prentice-Hall, Inc. 19

Top-Down DesignTop-Down Design

• Problem is divided into a series of high-level tasksProblem is divided into a series of high-level tasks• Detailed subtasks are created from high-level tasksDetailed subtasks are created from high-level tasks

Page 20: © 2009 Prentice-Hall, Inc. 1. 2 Technology in Action Chapter 10 Behind the Scenes: Software Programming

© 2009 Prentice-Hall, Inc. 20

Object-Oriented AnalysisObject-Oriented Analysis• Object-oriented Object-oriented

analysisanalysis

• Classes (categories Classes (categories of inputs) are of inputs) are identifiedidentified

• Classes are defined Classes are defined by information (data) by information (data) and actions and actions (methods or (methods or behaviors)behaviors)

• Reusability is keyReusability is key

Page 21: © 2009 Prentice-Hall, Inc. 1. 2 Technology in Action Chapter 10 Behind the Scenes: Software Programming

© 2009 Prentice-Hall, Inc. 21

Step 3: Coding Step 3: Coding

• Coding is translating an algorithm into a Coding is translating an algorithm into a programming languageprogramming language

• Generations of programming languagesGenerations of programming languages

Page 22: © 2009 Prentice-Hall, Inc. 1. 2 Technology in Action Chapter 10 Behind the Scenes: Software Programming

© 2009 Prentice-Hall, Inc. 22

Compilation Compilation

• Compilation is the process of converting Compilation is the process of converting code into machine languagecode into machine language

• Compiler reads the source code and Compiler reads the source code and translates it into machine languagetranslates it into machine language

• After compilation, programmers have an After compilation, programmers have an executable programexecutable program

Page 23: © 2009 Prentice-Hall, Inc. 1. 2 Technology in Action Chapter 10 Behind the Scenes: Software Programming

© 2009 Prentice-Hall, Inc. 23

InterpreterInterpreter

• Interpreter translates source code into a line-by-Interpreter translates source code into a line-by-line intermediate formline intermediate form

• Each line is executed before the next line is Each line is executed before the next line is compiledcompiled

• Programmers do not have to wait for the entire Programmers do not have to wait for the entire program to be recompiled each time they make program to be recompiled each time they make a change.a change.

• Programmers can immediately see the results of Programmers can immediately see the results of changes as they are making them in the code.changes as they are making them in the code.

Page 24: © 2009 Prentice-Hall, Inc. 1. 2 Technology in Action Chapter 10 Behind the Scenes: Software Programming

© 2009 Prentice-Hall, Inc. 24

Coding Tools: Integrated Coding Tools: Integrated Development EnvironmentsDevelopment Environments

• Editor:Editor: Special tool that helps Special tool that helps programmers as they enter the codeprogrammers as they enter the code

• Debugging: TRDebugging: TRemoval of errors in codeemoval of errors in code– Syntax error: Mistake in use of the languageSyntax error: Mistake in use of the language– Logic error (run-time error): Mistake in the Logic error (run-time error): Mistake in the

algorithmalgorithm

Page 25: © 2009 Prentice-Hall, Inc. 1. 2 Technology in Action Chapter 10 Behind the Scenes: Software Programming

© 2009 Prentice-Hall, Inc. 25

Step 4: Debugging Step 4: Debugging

• Running a program to find errors is known Running a program to find errors is known as debuggingas debugging

• Sample inputs are used to determine Sample inputs are used to determine runtime (logic) errors runtime (logic) errors

• Debugger: Tool that helps programmers Debugger: Tool that helps programmers locate runtime errorslocate runtime errors

Page 26: © 2009 Prentice-Hall, Inc. 1. 2 Technology in Action Chapter 10 Behind the Scenes: Software Programming

© 2009 Prentice-Hall, Inc. 26

Step 5: Finishing the ProjectStep 5: Finishing the Project

• Users test the program (internal testing)Users test the program (internal testing)• Beta version releasedBeta version released

– Information collected about errors before final Information collected about errors before final revisionrevision

• Software updates (service packs)Software updates (service packs)– Problems found after commercial releaseProblems found after commercial release

• Documentation createdDocumentation created– User manualsUser manuals– User trainingUser training

Page 27: © 2009 Prentice-Hall, Inc. 1. 2 Technology in Action Chapter 10 Behind the Scenes: Software Programming

© 2009 Prentice-Hall, Inc. 27

Programming LanguagesProgramming Languages

• Selecting the right language:Selecting the right language:– Space availableSpace available– Speed requiredSpeed required– Organizational resources availableOrganizational resources available– Type of target applicationType of target application

Visual Basic

C / C++Java HTML

JavaScriptVBScript

ASP / JSP

Flash / XML

Page 28: © 2009 Prentice-Hall, Inc. 1. 2 Technology in Action Chapter 10 Behind the Scenes: Software Programming

© 2009 Prentice-Hall, Inc. 28

Windows Applications: Windows Applications: Visual Basic Visual Basic

• Used to build Used to build Windows Windows applicationsapplications

• Object-Object-oriented oriented languagelanguage

• Visual Basic Visual Basic 2005 is the 2005 is the current current versionversion

Sample Visual Basic

Page 29: © 2009 Prentice-Hall, Inc. 1. 2 Technology in Action Chapter 10 Behind the Scenes: Software Programming

© 2009 Prentice-Hall, Inc. 29

Windows Applications: Windows Applications: C and C++C and C++

• CC– Developed for system Developed for system

programmersprogrammers– Combines high and low Combines high and low

level programming level programming featuresfeatures

– Modern operating Modern operating systems written in Csystems written in C

• C++C++– Uses the same features Uses the same features

as Cas C– Includes object-oriented Includes object-oriented

designdesign

Sample C

Sample C++

Page 30: © 2009 Prentice-Hall, Inc. 1. 2 Technology in Action Chapter 10 Behind the Scenes: Software Programming

© 2009 Prentice-Hall, Inc. 30

Windows Applications: JavaWindows Applications: Java• Object-oriented featuresObject-oriented features• Large set of existing classesLarge set of existing classes• Architecture neutralArchitecture neutral• Java applets: Small Java-based programsJava applets: Small Java-based programs

Page 31: © 2009 Prentice-Hall, Inc. 1. 2 Technology in Action Chapter 10 Behind the Scenes: Software Programming

© 2009 Prentice-Hall, Inc. 31

Web ApplicationsWeb Applications

• HTML/XHTML HTML/XHTML – Hypertext Markup Language/Extensible Hypertext Markup Language/Extensible

Hypertext Markup LanguageHypertext Markup Language– Not a true programming languageNot a true programming language– Uses special symbols (tags) to control how Uses special symbols (tags) to control how

Web pages are viewedWeb pages are viewed

• Extensible Markup Language (XML)Extensible Markup Language (XML)– Enables computers to efficiently transfer Enables computers to efficiently transfer

information between Web sitesinformation between Web sites

Page 32: © 2009 Prentice-Hall, Inc. 1. 2 Technology in Action Chapter 10 Behind the Scenes: Software Programming

© 2009 Prentice-Hall, Inc. 32

Web ApplicationsWeb Applications

• Scripting languages: Languages limited to performing a specific set of specialized tasks

• JavaScript– Used to make Web pages more visually appealing

and interactive

• VBScript– Subset of VB used to add interactivity to Web pages

• PHP– Another scripting language gaining popularity

• Dynamic Decision Making– Web page can display content based on user choices

Page 33: © 2009 Prentice-Hall, Inc. 1. 2 Technology in Action Chapter 10 Behind the Scenes: Software Programming

© 2009 Prentice-Hall, Inc. 33

Web ApplicationsWeb Applications

• Active Server Pages (ASP) and Java Server Active Server Pages (ASP) and Java Server Pages (JSP)Pages (JSP)– Adds interactivity capabilities to Web pagesAdds interactivity capabilities to Web pages– Translates user information into a request for more Translates user information into a request for more

information from a company’s computerinformation from a company’s computer

• FlashFlash– Enables elaborate animations to be created for Web Enables elaborate animations to be created for Web

pagespages

• XMLXML– Enables Enables designers to define their own data-based designers to define their own data-based

tagstags

Page 34: © 2009 Prentice-Hall, Inc. 1. 2 Technology in Action Chapter 10 Behind the Scenes: Software Programming

© 2009 Prentice-Hall, Inc. 34

The Next Great LanguageThe Next Great Language

• Large projects may take 30 minutes to Large projects may take 30 minutes to compilecompile

• Interpreted languages may become more Interpreted languages may become more importantimportant– PythonPython– RubyRuby– SmalltalkSmalltalk

Page 35: © 2009 Prentice-Hall, Inc. 1. 2 Technology in Action Chapter 10 Behind the Scenes: Software Programming

© 2009 Prentice-Hall, Inc. 35

Chapter 10 Summary QuestionsChapter 10 Summary Questions

• What is a system development life cycle, What is a system development life cycle, and what are the phases in the cycle?and what are the phases in the cycle?

Page 36: © 2009 Prentice-Hall, Inc. 1. 2 Technology in Action Chapter 10 Behind the Scenes: Software Programming

© 2009 Prentice-Hall, Inc. 36

Chapter 10 Summary QuestionsChapter 10 Summary Questions

• What is the life cycle of a program?What is the life cycle of a program?

Page 37: © 2009 Prentice-Hall, Inc. 1. 2 Technology in Action Chapter 10 Behind the Scenes: Software Programming

© 2009 Prentice-Hall, Inc. 37

Chapter 10 Summary QuestionsChapter 10 Summary Questions

• What role does a problem statement play What role does a problem statement play in programming?in programming?

Page 38: © 2009 Prentice-Hall, Inc. 1. 2 Technology in Action Chapter 10 Behind the Scenes: Software Programming

© 2009 Prentice-Hall, Inc. 38

Chapter 10 Summary QuestionsChapter 10 Summary Questions

• How do programmers create algorithms?How do programmers create algorithms?

Page 39: © 2009 Prentice-Hall, Inc. 1. 2 Technology in Action Chapter 10 Behind the Scenes: Software Programming

© 2009 Prentice-Hall, Inc. 39

Chapter 10 Summary QuestionsChapter 10 Summary Questions

• How do programmers move from How do programmers move from algorithm to codealgorithm to code, , and what categories of and what categories of language might they code inlanguage might they code in??

Page 40: © 2009 Prentice-Hall, Inc. 1. 2 Technology in Action Chapter 10 Behind the Scenes: Software Programming

© 2009 Prentice-Hall, Inc. 40

Chapter 10 Summary QuestionsChapter 10 Summary Questions

• How does a programmer move from code How does a programmer move from code in a programming language to the 1s and in a programming language to the 1s and 0s the CPU can understand? 0s the CPU can understand?

Page 41: © 2009 Prentice-Hall, Inc. 1. 2 Technology in Action Chapter 10 Behind the Scenes: Software Programming

© 2009 Prentice-Hall, Inc. 41

Chapter 10 Summary QuestionsChapter 10 Summary Questions

• How is a program tested?How is a program tested?

Page 42: © 2009 Prentice-Hall, Inc. 1. 2 Technology in Action Chapter 10 Behind the Scenes: Software Programming

© 2009 Prentice-Hall, Inc. 42

Chapter 10 Summary QuestionsChapter 10 Summary Questions

• What steps are involved in completing the What steps are involved in completing the program?program?

Page 43: © 2009 Prentice-Hall, Inc. 1. 2 Technology in Action Chapter 10 Behind the Scenes: Software Programming

© 2009 Prentice-Hall, Inc. 43

Chapter 10 Summary QuestionsChapter 10 Summary Questions

• How do programmers select the right How do programmers select the right programming language for a specific task?programming language for a specific task?

Page 44: © 2009 Prentice-Hall, Inc. 1. 2 Technology in Action Chapter 10 Behind the Scenes: Software Programming

© 2009 Prentice-Hall, Inc. 44

Chapter 10 Summary QuestionsChapter 10 Summary Questions

• What are the most popular programming What are the most popular programming languages for Windows and Web languages for Windows and Web applications? applications?