copyright © 2012 pearson education, inc. publishing as...

59
1 Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall

Upload: buicong

Post on 02-Apr-2018

217 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: Copyright © 2012 Pearson Education, Inc. Publishing as ...mdtpetri/CP102_files/tia8e_ch10_ppt-MP.pdf · Java (OOP) Java (OOP) vvss C (sequential) C (sequential) public class public

1Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall

Page 2: Copyright © 2012 Pearson Education, Inc. Publishing as ...mdtpetri/CP102_files/tia8e_ch10_ppt-MP.pdf · Java (OOP) Java (OOP) vvss C (sequential) C (sequential) public class public

Technology in ActionTechnology in Action

Chapter 10Chapter 10

2

Behind the Scenes: Building ApplicationsBehind the Scenes: Building Applications

Copyright © 2012 Pearson Education, Inc. Publishing as Prentice HallCopyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall

Page 3: Copyright © 2012 Pearson Education, Inc. Publishing as ...mdtpetri/CP102_files/tia8e_ch10_ppt-MP.pdf · Java (OOP) Java (OOP) vvss C (sequential) C (sequential) public class public

Chapter TopicsChapter Topics

• System development life cycle

• Life cycle of a program

• Problem statement

• Algorithms

3

• Algorithms

• Moving from algorithm to code

Copyright © 2012 Pearson Education, Inc. Publishing as Prentice HallCopyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall

Page 4: Copyright © 2012 Pearson Education, Inc. Publishing as ...mdtpetri/CP102_files/tia8e_ch10_ppt-MP.pdf · Java (OOP) Java (OOP) vvss C (sequential) C (sequential) public class public

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

• Moving from code to machine language

• Testing programs

• Completing a program

• Selecting the right programming language

4

• Selecting the right programming language

• Most popular programming languages

Copyright © 2012 Pearson Education, Inc. Publishing as Prentice HallCopyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall

Page 5: Copyright © 2012 Pearson Education, Inc. Publishing as ...mdtpetri/CP102_files/tia8e_ch10_ppt-MP.pdf · Java (OOP) Java (OOP) vvss C (sequential) C (sequential) public class public

Reasons for Reasons for Software ProgrammingSoftware Programming

• Some types of tasks are candidates for automation as a software program

– Routine

– Repetitive

5

– Repetitive

– Work with electronic data

– Follow a series of clear steps

• A new software program can be created when existing programs do not suffice

Copyright © 2012 Pearson Education, Inc. Publishing as Prentice HallCopyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall

Page 6: Copyright © 2012 Pearson Education, Inc. Publishing as ...mdtpetri/CP102_files/tia8e_ch10_ppt-MP.pdf · Java (OOP) Java (OOP) vvss C (sequential) C (sequential) public class public

Information SystemsInformation Systems

• System

– A collection of pieces working together to achieve a common goal

• An information system includes

6

• An information system includes

– Data

– People

– Procedures

– Hardware

– SoftwareCopyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall

Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall

Page 7: Copyright © 2012 Pearson Education, Inc. Publishing as ...mdtpetri/CP102_files/tia8e_ch10_ppt-MP.pdf · Java (OOP) Java (OOP) vvss C (sequential) C (sequential) public class public

System Development Life CycleSystem Development Life Cycle

7Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall

Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall

Page 8: Copyright © 2012 Pearson Education, Inc. Publishing as ...mdtpetri/CP102_files/tia8e_ch10_ppt-MP.pdf · Java (OOP) Java (OOP) vvss C (sequential) C (sequential) public class public

Problem and Opportunity Problem and Opportunity IdentificationIdentification

• The existing system is evaluated

– Problems are defined

– New proposals are reviewed

– Decisions are made to proceed with the

8

– Decisions are made to proceed with the projects

– The process is documented

– Relevant problems and opportunities are defined

Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall

Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall

Page 9: Copyright © 2012 Pearson Education, Inc. Publishing as ...mdtpetri/CP102_files/tia8e_ch10_ppt-MP.pdf · Java (OOP) Java (OOP) vvss C (sequential) C (sequential) public class public

Analysis Analysis

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

• A feasibility assessment is performed

• User requirements are defined

9

• User requirements are defined

• Analysts recommend a plan of action

Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall

Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall

Page 10: Copyright © 2012 Pearson Education, Inc. Publishing as ...mdtpetri/CP102_files/tia8e_ch10_ppt-MP.pdf · Java (OOP) Java (OOP) vvss C (sequential) C (sequential) public class public

Design Design

• A detailed plan for programmers is developed

• Flowcharts and data-flow diagrams are used for the current and proposed system

Data-flow diagram

10Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall

Page 11: Copyright © 2012 Pearson Education, Inc. Publishing as ...mdtpetri/CP102_files/tia8e_ch10_ppt-MP.pdf · Java (OOP) Java (OOP) vvss C (sequential) C (sequential) public class public

Development and Development and DocumentationDocumentation

• Actual programming takes place

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

11Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall

Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall

Page 12: Copyright © 2012 Pearson Education, Inc. Publishing as ...mdtpetri/CP102_files/tia8e_ch10_ppt-MP.pdf · Java (OOP) Java (OOP) vvss C (sequential) C (sequential) public class public

Testing and InstallationTesting and Installation

• Program is tested for proper operation

• Program is installed for use

• Testing and results are documented

12Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall

Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall

Page 13: Copyright © 2012 Pearson Education, Inc. Publishing as ...mdtpetri/CP102_files/tia8e_ch10_ppt-MP.pdf · Java (OOP) Java (OOP) vvss C (sequential) C (sequential) public class public

Maintenance and EvaluationMaintenance and Evaluation

• Performance of the system is monitored

• Corrections and modifications to the program are made

• Maintenance procedures and results are

13

• Maintenance procedures and results are documented

Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall

Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall

Page 14: Copyright © 2012 Pearson Education, Inc. Publishing as ...mdtpetri/CP102_files/tia8e_ch10_ppt-MP.pdf · Java (OOP) Java (OOP) vvss C (sequential) C (sequential) public class public

Mark’s “Bug” InterludeMark’s “Bug” Interlude•• 11stst computer bug (1947) really was a bug!computer bug (1947) really was a bug!

•• Most computer programs contain bugsMost computer programs contain bugs•• That’s what patches are for right?That’s what patches are for right?

Some favourites:Some favourites:

•• MilleniumMillenium Bug 1999 to 2000 changeoverBug 1999 to 2000 changeover•• MilleniumMillenium Bug 1999 to 2000 changeoverBug 1999 to 2000 changeover

•• Many US rockets and space probesMany US rockets and space probes

•• Intel Pentium CPU rounding error~0.006%Intel Pentium CPU rounding error~0.006%

•• Toyota Toyota PriusPrius –– recall 160,000 carsrecall 160,000 cars

142Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall012 Pearson Education, Inc. Publishing as Prentice Hall

Page 15: Copyright © 2012 Pearson Education, Inc. Publishing as ...mdtpetri/CP102_files/tia8e_ch10_ppt-MP.pdf · Java (OOP) Java (OOP) vvss C (sequential) C (sequential) public class public

Ethics in ITEthics in IT

• The Association of Computing Machinery (ACM) and the Institute of Electrical and Electronic Engineers (IEEE) have established eight principles for ethical established eight principles for ethical software engineering practices:

1. Public

2. Client and Employer

3. Product

4. Judgment

15Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall

Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall

Page 16: Copyright © 2012 Pearson Education, Inc. Publishing as ...mdtpetri/CP102_files/tia8e_ch10_ppt-MP.pdf · Java (OOP) Java (OOP) vvss C (sequential) C (sequential) public class public

Ethics in IT (cont.)Ethics in IT (cont.)

• Ethical software engineering practices:

5. Management

6. Profession

7. Colleagues

8. Self

16Copyright © 2012 Pearson Education, Inc. Publishing as Prentice HallCopyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall

Page 17: Copyright © 2012 Pearson Education, Inc. Publishing as ...mdtpetri/CP102_files/tia8e_ch10_ppt-MP.pdf · Java (OOP) Java (OOP) vvss C (sequential) C (sequential) public class public

More of Mark’s BabblingMore of Mark’s Babbling•• Computers and software are used in many Computers and software are used in many

applications: medical treatments, control of applications: medical treatments, control of nuclear equipment, etc.nuclear equipment, etc.

When computer’s kill!When computer’s kill!

•• 1987 Therac1987 Therac--25 (p477) radiation overdose25 (p477) radiation overdose•• 1987 Therac1987 Therac--25 (p477) radiation overdose25 (p477) radiation overdose

•• 2000 National Cancer Institute2000 National Cancer Institute•• When software doesn’t do what we want we often When software doesn’t do what we want we often

find workaroundsfind workarounds

•• Physicians found a workaround but didn’t check Physicians found a workaround but didn’t check resultsresults

•• Radiation overdose Radiation overdose –– physicians indicted murder physicians indicted murder

172Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall012 Pearson Education, Inc. Publishing as Prentice Hall

Page 18: Copyright © 2012 Pearson Education, Inc. Publishing as ...mdtpetri/CP102_files/tia8e_ch10_ppt-MP.pdf · Java (OOP) Java (OOP) vvss C (sequential) C (sequential) public class public

Joint Application Development Joint Application Development (JAD)(JAD)

• Helps designers adapt to changes in program specifications

• Includes customer involvement

• No communication delays• No communication delays

• Also referred to as:

– Accelerated design

– Facilitated team technique

18Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall

Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall

Page 19: Copyright © 2012 Pearson Education, Inc. Publishing as ...mdtpetri/CP102_files/tia8e_ch10_ppt-MP.pdf · Java (OOP) Java (OOP) vvss C (sequential) C (sequential) public class public

The Life Cycle of a ProgramThe Life Cycle of a Program

• Programming is the process of translating a task into a series of commands a computer will use to perform that task

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

19

– Identifying the parts of a task the computer can perform

– Describing tasks in a specific and complete manner

– Translating the tasks into a language understood by the computer’s CPU

Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall

Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall

Page 20: Copyright © 2012 Pearson Education, Inc. Publishing as ...mdtpetri/CP102_files/tia8e_ch10_ppt-MP.pdf · Java (OOP) Java (OOP) vvss C (sequential) C (sequential) public class public

Program Development Program Development Life CycleLife Cycle

20Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall

Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall

Page 21: Copyright © 2012 Pearson Education, Inc. Publishing as ...mdtpetri/CP102_files/tia8e_ch10_ppt-MP.pdf · Java (OOP) Java (OOP) vvss C (sequential) C (sequential) public class public

Step 1: Describing the ProblemStep 1: Describing the Problem

• The problem statement:

– Starting point of programming

– Describes tasks the program is to accomplish

– Describes how the program will execute the

21

– Describes how the program will execute the tasks

– Created through interaction between the programmer and the user

– Includes error handling, a testing plan, and output values

Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall

Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall

Page 22: Copyright © 2012 Pearson Education, Inc. Publishing as ...mdtpetri/CP102_files/tia8e_ch10_ppt-MP.pdf · Java (OOP) Java (OOP) vvss C (sequential) C (sequential) public class public

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.50 per hour for the first eight hours worked each day. Any hours worked beyond the first eight are billed at $11.25 per hour.

Error Handling: The input (Number of Hours Worked) must be a positive real number. If it is a negative number or other non-acceptable character, the

Parking Garage ExampleParking Garage Example

22

program will force the user to re-enter the information.

Testing Plan: INPUT OUTPUT NOTES

8 8*7.50 Testing positive input

3 3*7.50 Testing positive input

12 8*7.50 + 4*11.25 Testing overtime input

–6 Error message/ask user to re-enter value

Handling error

Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall

Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall

Page 23: Copyright © 2012 Pearson Education, Inc. Publishing as ...mdtpetri/CP102_files/tia8e_ch10_ppt-MP.pdf · Java (OOP) Java (OOP) vvss C (sequential) C (sequential) public class public

Step 2: Developing an AlgorithmStep 2: Developing an Algorithm

• Algorithm development

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

– Complex algorithms include decision

23

– Complex algorithms include decision points

• Binary (yes/no)

• Loop (repeating actions)

– Visual tools used to track algorithm and decision points

Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall

Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall

Page 24: Copyright © 2012 Pearson Education, Inc. Publishing as ...mdtpetri/CP102_files/tia8e_ch10_ppt-MP.pdf · Java (OOP) Java (OOP) vvss C (sequential) C (sequential) public class public

Flowchart and Flowchart and PseudocodePseudocode

1. Ask the user how many hours they

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

Flowchart Pseudocode

24

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 overtimeotherwise,compute total pay with overtime pay

3. Print total pay

Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall

Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall

Page 25: Copyright © 2012 Pearson Education, Inc. Publishing as ...mdtpetri/CP102_files/tia8e_ch10_ppt-MP.pdf · Java (OOP) Java (OOP) vvss C (sequential) C (sequential) public class public

TopTop--Down DesignDown Design

• Problem is divided into a series of high-level tasks

• Detailed subtasks are created from high-level taskstasks

Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall 25

Page 26: Copyright © 2012 Pearson Education, Inc. Publishing as ...mdtpetri/CP102_files/tia8e_ch10_ppt-MP.pdf · Java (OOP) Java (OOP) vvss C (sequential) C (sequential) public class public

ObjectObject--Oriented AnalysisOriented Analysis

• Classes (categories of inputs) are identified

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

• Reusability is key

26Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall

Page 27: Copyright © 2012 Pearson Education, Inc. Publishing as ...mdtpetri/CP102_files/tia8e_ch10_ppt-MP.pdf · Java (OOP) Java (OOP) vvss C (sequential) C (sequential) public class public

Step 3: Coding Step 3: Coding

• Coding is translating an algorithm into a programming language

• Generations of programming languages

– 1GL: Machine

27

– 1GL: Machine

– 2GL: Assembly

– 3GL: BASIC, COBOL, C/C++/C#, Python, & Java

– 4GL: SQL, SAS, & Oracle Reports

– 5GL: PROLOG

Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall

Page 28: Copyright © 2012 Pearson Education, Inc. Publishing as ...mdtpetri/CP102_files/tia8e_ch10_ppt-MP.pdf · Java (OOP) Java (OOP) vvss C (sequential) C (sequential) public class public

Java (OOP) Java (OOP) vsvs C (sequential)C (sequential)

public class public class MyStackMyStack

{ {

private private Node topNode top;;

public public MyStackMyStack() () { top { top = null= null; }; }

public void push( Object public void push( Object objobj ) )

{ {

Node Node nodenode = new Node( = new Node( objobj, top , top ););

#define #define maxsizemaxsize 100100

intint stack[stack[maxsizemaxsize];];

intint top = 0;top = 0;

void push( void push( intint item ) {item ) {

if ( top < if ( top < maxsizemaxsize ))

stack[top++] = item;stack[top++] = item;

elseelse

printfprintf(“Stack Overflow Error(“Stack Overflow Error\\n”);n”);Node Node nodenode = new Node( = new Node( objobj, top , top ););

top = nodetop = node;;

}}

public public Object pop() Object pop()

{ {

Node Node nodenode = top; = top;

top top = = top.getNexttop.getNext(); ();

return return node.getElementnode.getElement(); ();

} }

public public booleanboolean isEmptyisEmpty() () { return { return top == nulltop == null; }; }

}}

printfprintf(“Stack Overflow Error(“Stack Overflow Error\\n”);n”);

}}

intint pop() {pop() {

if (top > 0)if (top > 0)

return stack[topreturn stack[top----];];

elseelse

printfprintf(“Stack Underflow Error(“Stack Underflow Error\\n”);n”);

}}

intint is_emptyis_empty() { return top == 0; }() { return top == 0; }

Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall28

Page 29: Copyright © 2012 Pearson Education, Inc. Publishing as ...mdtpetri/CP102_files/tia8e_ch10_ppt-MP.pdf · Java (OOP) Java (OOP) vvss C (sequential) C (sequential) public class public

Compilation Compilation

• Compilation is the process of converting code into machine language

• A compiler reads the source code and translates it into machine language

29

translates it into machine language

• After compilation, programmers have an executable program

Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall

Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall

Page 30: Copyright © 2012 Pearson Education, Inc. Publishing as ...mdtpetri/CP102_files/tia8e_ch10_ppt-MP.pdf · Java (OOP) Java (OOP) vvss C (sequential) C (sequential) public class public

InterpreterInterpreter• Some programming languages do not have

a compiler, but use an interpreter instead

– The interpreter translates source code into a line-by-line intermediate form

– Each line is executed before the next line is

30

– Each line is executed before the next line is compiled

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

– Programmers can immediately see the results of changes as they are making them

Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall

Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall

Page 31: Copyright © 2012 Pearson Education, Inc. Publishing as ...mdtpetri/CP102_files/tia8e_ch10_ppt-MP.pdf · Java (OOP) Java (OOP) vvss C (sequential) C (sequential) public class public

Coding Tools: Integrated Coding Tools: Integrated Development EnvironmentsDevelopment Environments

• Integrated development environment: Tool that helps programmers as they enter the code

31

– Highlighting keywords

– Alerting them to typos

• Once editing is complete the compilation begins

Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall

Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall

Page 32: Copyright © 2012 Pearson Education, Inc. Publishing as ...mdtpetri/CP102_files/tia8e_ch10_ppt-MP.pdf · Java (OOP) Java (OOP) vvss C (sequential) C (sequential) public class public

Coding Tools: Integrated Coding Tools: Integrated Development EnvironmentsDevelopment Environments

• Compiling identifies syntax errors and warnings

– Syntax error: Mistake in use of the language

32

– Syntax error: Mistake in use of the language

– Warning: Suggestion from compiler that the code might not work as intended

Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall

Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall

Page 33: Copyright © 2012 Pearson Education, Inc. Publishing as ...mdtpetri/CP102_files/tia8e_ch10_ppt-MP.pdf · Java (OOP) Java (OOP) vvss C (sequential) C (sequential) public class public

Step 4: Debugging Step 4: Debugging

• Running a program to find errors is known as debugging

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

• Debugger: Tool that helps programmers locate errors

33Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall

Page 34: Copyright © 2012 Pearson Education, Inc. Publishing as ...mdtpetri/CP102_files/tia8e_ch10_ppt-MP.pdf · Java (OOP) Java (OOP) vvss C (sequential) C (sequential) public class public

Step 4: Debugging (cont.)Step 4: Debugging (cont.)

• Debugging: Removal of errors in code

– Syntax error: Mistake in use of the language

– Logic error: Mistake caught only when the

34

– Logic error: Mistake caught only when the program executes

– Runtime error: Mistake in the algorithm

Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall

Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall

Page 35: Copyright © 2012 Pearson Education, Inc. Publishing as ...mdtpetri/CP102_files/tia8e_ch10_ppt-MP.pdf · Java (OOP) Java (OOP) vvss C (sequential) C (sequential) public class public

Step 5: Finishing the ProjectStep 5: Finishing the Project

• Internal testing: Group within the software company tests the program

• Beta version released– Information collected about errors before final

35

– Information collected about errors before final revision

• Software updates (service packs)– Fix problems found after commercial release

• Documentation created

Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall

Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall

Page 36: Copyright © 2012 Pearson Education, Inc. Publishing as ...mdtpetri/CP102_files/tia8e_ch10_ppt-MP.pdf · Java (OOP) Java (OOP) vvss C (sequential) C (sequential) public class public

Popularity of Popularity of Programming LanguagesProgramming Languages

• C/C++ and Java are among the

36

are among the most popular programming languages.

Copyright © 2012 Pearson Education, Inc. Publishing as Prentice HallCopyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall

Page 37: Copyright © 2012 Pearson Education, Inc. Publishing as ...mdtpetri/CP102_files/tia8e_ch10_ppt-MP.pdf · Java (OOP) Java (OOP) vvss C (sequential) C (sequential) public class public

Programming LanguagesProgramming Languages

• Selecting the right language

– Space available

– Speed required

– Organizational resources available

37

– Organizational resources available

– Type of target application

Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall

Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall

Page 38: Copyright © 2012 Pearson Education, Inc. Publishing as ...mdtpetri/CP102_files/tia8e_ch10_ppt-MP.pdf · Java (OOP) Java (OOP) vvss C (sequential) C (sequential) public class public

Windows Applications: Windows Applications: Visual Basic 2010Visual Basic 2010

• Used to build Windows applications

• Object-oriented language

• Visual Basic 2010 (VB 10.0) is the current version

38

version

Copyright © 2012 Pearson Education, Inc. Publishing as Prentice HallCopyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall

Page 39: Copyright © 2012 Pearson Education, Inc. Publishing as ...mdtpetri/CP102_files/tia8e_ch10_ppt-MP.pdf · Java (OOP) Java (OOP) vvss C (sequential) C (sequential) public class public

C and C++C and C++

• C

– Developed for system programmers

– Combines high- and low-level programming features

39

– Modern operating systems are written in C

• C++

– Uses the same features as C

– Includes object-oriented design

Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall

Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall

Page 40: Copyright © 2012 Pearson Education, Inc. Publishing as ...mdtpetri/CP102_files/tia8e_ch10_ppt-MP.pdf · Java (OOP) Java (OOP) vvss C (sequential) C (sequential) public class public

JavaJava• Object-oriented features• Large set of existing classes• Architecture neutral• Java applets: Small Java-based programs

40Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall

Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall

Page 41: Copyright © 2012 Pearson Education, Inc. Publishing as ...mdtpetri/CP102_files/tia8e_ch10_ppt-MP.pdf · Java (OOP) Java (OOP) vvss C (sequential) C (sequential) public class public

Web ApplicationsWeb Applications

• HTML/XHTML

– HyperText Markup Language/eXtensibleHyperText Markup Language

– Not a true programming language

41

– Not a true programming language

– Uses special symbols (tags) to control how Web pages are viewed

Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall

Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall

Page 42: Copyright © 2012 Pearson Education, Inc. Publishing as ...mdtpetri/CP102_files/tia8e_ch10_ppt-MP.pdf · Java (OOP) Java (OOP) vvss C (sequential) C (sequential) public class public

Web Applications (cont.)Web Applications (cont.)

• Scripting 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

42

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

– PHP: Another scripting language gaining in popularity

• Dynamic decision making– Web page can display content based on user

choicesCopyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall

Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall

Page 43: Copyright © 2012 Pearson Education, Inc. Publishing as ...mdtpetri/CP102_files/tia8e_ch10_ppt-MP.pdf · Java (OOP) Java (OOP) vvss C (sequential) C (sequential) public class public

Web Applications (cont.)Web Applications (cont.)

• Active Server Pages (ASP), Java Server Pages (JSP), and PHP

– Add interactivity to Web pages

– Translate user information into a request for

43

– Translate user information into a request for more information from a company’s computer

Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall

Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall

Page 44: Copyright © 2012 Pearson Education, Inc. Publishing as ...mdtpetri/CP102_files/tia8e_ch10_ppt-MP.pdf · Java (OOP) Java (OOP) vvss C (sequential) C (sequential) public class public

Adobe Flash and XMLAdobe Flash and XML

• Flash

– Used to develop Web-based multimedia

– Includes its own scripting language, ActionScriptActionScript

• SilverLight

– Supports development of multimedia and interactive Web applications

44Copyright © 2012 Pearson Education, Inc. Publishing as Prentice HallCopyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall

Page 45: Copyright © 2012 Pearson Education, Inc. Publishing as ...mdtpetri/CP102_files/tia8e_ch10_ppt-MP.pdf · Java (OOP) Java (OOP) vvss C (sequential) C (sequential) public class public

AJAXAJAX

• AJAX (Asynchronous JavaScript And XML)

– Uses a combination of existing technologies like JavaScript, CSS, and XMLlike JavaScript, CSS, and XML

– Allows for information updates without a page refresh

– Allows for a more responsive user experience

45Copyright © 2012 Pearson Education, Inc. Publishing as Prentice HallCopyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall

Page 46: Copyright © 2012 Pearson Education, Inc. Publishing as ...mdtpetri/CP102_files/tia8e_ch10_ppt-MP.pdf · Java (OOP) Java (OOP) vvss C (sequential) C (sequential) public class public

XMLXML

• XML (eXtensible Markup Language)

– Enables designers to define data-based tags

– Groups can agree on standard systems of tagstags

46Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall

Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall

Page 47: Copyright © 2012 Pearson Education, Inc. Publishing as ...mdtpetri/CP102_files/tia8e_ch10_ppt-MP.pdf · Java (OOP) Java (OOP) vvss C (sequential) C (sequential) public class public

BlenderBlender

• Video game development tool

• Open source

• Built-in game engine• Built-in game engine

• Built-in physics engine

• Uses logic bricks to simplify programming

47Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall

Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall

Page 48: Copyright © 2012 Pearson Education, Inc. Publishing as ...mdtpetri/CP102_files/tia8e_ch10_ppt-MP.pdf · Java (OOP) Java (OOP) vvss C (sequential) C (sequential) public class public

The Next Great LanguageThe Next Great Language

• Large projects may take 30 minutes to compile

• Interpreted languages might become more important because they have minimal

48

important because they have minimal compile times

– Python

– Ruby

– Smalltalk

Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall

Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall

Page 49: Copyright © 2012 Pearson Education, Inc. Publishing as ...mdtpetri/CP102_files/tia8e_ch10_ppt-MP.pdf · Java (OOP) Java (OOP) vvss C (sequential) C (sequential) public class public

Chapter 10 Summary QuestionsChapter 10 Summary Questions

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

49Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall

Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall

Page 50: Copyright © 2012 Pearson Education, Inc. Publishing as ...mdtpetri/CP102_files/tia8e_ch10_ppt-MP.pdf · Java (OOP) Java (OOP) vvss C (sequential) C (sequential) public class public

Chapter 10 Summary QuestionsChapter 10 Summary Questions

• What is the life cycle of a program?

50Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall

Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall

Page 51: Copyright © 2012 Pearson Education, Inc. Publishing as ...mdtpetri/CP102_files/tia8e_ch10_ppt-MP.pdf · Java (OOP) Java (OOP) vvss C (sequential) C (sequential) public class public

Chapter 10 Summary QuestionsChapter 10 Summary Questions

• What role does a problem statement play in programming?

51Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall

Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall

Page 52: Copyright © 2012 Pearson Education, Inc. Publishing as ...mdtpetri/CP102_files/tia8e_ch10_ppt-MP.pdf · Java (OOP) Java (OOP) vvss C (sequential) C (sequential) public class public

Chapter 10 Summary QuestionsChapter 10 Summary Questions

• How do programmers create algorithms?

52Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall

Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall

Page 53: Copyright © 2012 Pearson Education, Inc. Publishing as ...mdtpetri/CP102_files/tia8e_ch10_ppt-MP.pdf · Java (OOP) Java (OOP) vvss C (sequential) C (sequential) public class public

Chapter 10 Summary QuestionsChapter 10 Summary Questions

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

53Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall

Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall

Page 54: Copyright © 2012 Pearson Education, Inc. Publishing as ...mdtpetri/CP102_files/tia8e_ch10_ppt-MP.pdf · Java (OOP) Java (OOP) vvss C (sequential) C (sequential) public class public

Chapter 10 Summary QuestionsChapter 10 Summary Questions

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

54Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall

Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall

Page 55: Copyright © 2012 Pearson Education, Inc. Publishing as ...mdtpetri/CP102_files/tia8e_ch10_ppt-MP.pdf · Java (OOP) Java (OOP) vvss C (sequential) C (sequential) public class public

Chapter 10 Summary QuestionsChapter 10 Summary Questions

• How is a program tested?

55Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall

Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall

Page 56: Copyright © 2012 Pearson Education, Inc. Publishing as ...mdtpetri/CP102_files/tia8e_ch10_ppt-MP.pdf · Java (OOP) Java (OOP) vvss C (sequential) C (sequential) public class public

Chapter 10 Summary QuestionsChapter 10 Summary Questions

• What steps are involved in completing the program?

56Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall

Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall

Page 57: Copyright © 2012 Pearson Education, Inc. Publishing as ...mdtpetri/CP102_files/tia8e_ch10_ppt-MP.pdf · Java (OOP) Java (OOP) vvss C (sequential) C (sequential) public class public

Chapter 10 Summary QuestionsChapter 10 Summary Questions

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

57Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall

Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall

Page 58: Copyright © 2012 Pearson Education, Inc. Publishing as ...mdtpetri/CP102_files/tia8e_ch10_ppt-MP.pdf · Java (OOP) Java (OOP) vvss C (sequential) C (sequential) public class public

Chapter 10 Summary QuestionsChapter 10 Summary Questions

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

58Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall

Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall

Page 59: Copyright © 2012 Pearson Education, Inc. Publishing as ...mdtpetri/CP102_files/tia8e_ch10_ppt-MP.pdf · Java (OOP) Java (OOP) vvss C (sequential) C (sequential) public class public

Chapter 10 5959

All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by any means, electronic,

mechanical, photocopying, recording, or otherwise, without the prior written permission of the publisher. Printed in the United States of America.

Copyright © Copyright © 2012 Pearson 2012 Pearson Education, Inc. Education, Inc. Publishing as Prentice HallPublishing as Prentice Hall

5959