Twelfth Edition Chapter 11 Programming Languages and Program Development Copyright 2012 Pearson Education Inc Publishing as Prentice Hall 1 Programming Languages and Program Development ID: 731292
Download Presentation The PPT/PDF document "Computers Are Your Future" is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.
Slide1
Computers Are Your FutureTwelfth Edition
Chapter 11: Programming Languages and Program Development
Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall
1Slide2
Programming Languages and Program Development
Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall2Slide3
Objectives
Explain what a programming language is and how it works.Explain the development of programming languages over the years and the benefits and drawbacks of high-level programming languages.Explain how object-oriented languages attempt to remedy the shortcomings of earlier languages.
Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall
3Slide4
Objectives
List several popular object-oriented languages and explain their advantage over older languages.List the six phases of the program development life cycle (PDLC) and explain why the PDLC is needed.Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall
4Slide5
Objectives
Explain why defining the problem in a top-down design manner leads to programs that are easier to debug and maintain.Differentiate between problems that can arise in the testing and debugging phase as syntax and logic errors.Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall
5Slide6
Programming Languages and How They Work
ProgrammingProcess used to create software programsProgrammers
People who use programming languages to create software applications
Programming languages
C
onsist of a vocabulary and a set of rules called
syntax
Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall
6Slide7
Programming Languages and How They Work
InterfacePoint of interaction between components, such as the interaction between a user’s screen and the computer code, which results when running a program
Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall
7Slide8
Development of Programming Languages
Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall8Slide9
Development of Programming Languages
Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall9
Compilers and interpreters
Source code—programming
instructions in
the
original
form needed
to
translate a
form that the computer can
understand
Code
—programming
instructions created by the
programmers
High-level language
—language that mimics English; does not require a programmer to understand the intimate details of how hardware, especially the processor, handles dataSlide10
Development of Programming Languages
Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall10Slide11
Development of Programming Languages
Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall11
Compilers and interpreters
Compiler—utility program translates source code into
object code
Executable program
—code transformed from object code ready to run programs that do not need to be altered
Interpreter
—translation program that does not produce object code—translates one line of source code at a time; executes the translated instructionSlide12
Development of Programming Languages
Five generations of programming languagesMachineAssembly
Procedural
NonproceduralNatural
Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall
12Slide13
Development of Programming Languages
First-generation languages
Machine language
Based on binary numbers
Only programming language that a computer understands directly
Machine dependent
Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall
13Slide14
Development of Programming Languages
Second-generation languageAssembly language
Low-level languagePrograms use:
Mnemonics
—brief abbreviations for program instructions make assembly language easier to use
Base-10 (decimal) numbers
Must be translated into machine language by an
assembler
Occasionally used to create
device drivers
Programs to control devices attached to a computer and game console programs
Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall
14Slide15
Development of Programming Languages
Third-generation languages
High-level languages—do not require programmers to know details relating to the processing of data
Easier to read, write, and maintain than assembly and machine languages
Source code must be translated by a language translator
Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall
15Slide16
Development of Programming Languages
Third-generation languages (con’t
.)
Spaghetti code—difficult to follow, messy in design, prone to errors due to numerous
GOTO
statements
Structured programming
—set of quality standards; programs more verbose but more readable, reliable, and maintainable
GOTO statements forbidden
Examples:
Ada
Algol
Pascal
Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall
16Slide17
Development of Programming Languages
Third-generation languages (con’t
.)
Modular programming—dividing larger programs into separate modules, each takes care of a specific function
Information hiding
—also known as
encapsulation
, modular programming makes it possible to hide details in sensitive applications
Programming languages include:
Fortran
C
Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall
17Slide18
Development of Programming Languages
Procedural languagesP
rovide detailed instructions that are designed to carry out a specific action such as printing a formatted report
Nonprocedural languages
D
o not require programmers to use step-by-step instructions
Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall
18Slide19
Development of Programming Languages
Fourth-generation languagesNonprocedural languages
Do not require step-by-step proceduresExamples
Report generators
(database reports)
Query languages
SQL (Structured query language)
—enables users to phrase simple or complex requests for data
Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall
19Slide20
Development of Programming Languages
Fifth-generation languages Natural language
Still being perfectedNonprocedural
Use everyday language to program
Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall
20Slide21
Development of Programming Languages
Object-oriented programming (OOP) Programming technique based on data being conceptualized as objectsObject
—unit of computer information that defines a data
element that is used to model real-world objects
Attributes
define the data
Procedures or operations are called
methods
Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall
21Slide22
Development of Programming Languages
Object-oriented programming (OOP) (con’t.)
Class
—blueprint or prototype from which objects are
made
Inheritance
—ability to pass on characteristics from a class to subclasses
Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall
22Slide23
Development of Programming Languages
Program development methodsRapid application development (RAD)Reuses prebuilt objects
Possible because of OOP
Joint application development (JAD)
Uses a team approach
Involves end users throughout development
Agile
software development
techniques—use collaboration between teams to develop solutions to meet customer needs and company goals
Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall
23Slide24
Development of Programming Languages
MiddlewareM
akes connections between applications on multiple networks
Integral to modern information technology based on XML, Web services, and service-oriented architecture
Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall
24Slide25
A Guide to Programming Languages: One
Size Doesn’t Fit AllEarly high-level languagesCOBOL (Common Business-Oriented Language)
Used for business applications
Current focus is on editing aged code on mainframe computers
Fortran (formula translator)
Used for scientific/math/engineering applications
Being replaced by object-oriented and formula-solving programs
Mathematica
Used to handle all aspects of technical computing in a coherent and unified way
Can manipulate a wide range of objects, using only a small number of basic elements
Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall
25Slide26
A Guide to Programming Languages: One
Size Doesn’t Fit AllStructured and modular languagesRequired for large-scale program development
Languages in widespread use:
AdaBASIC
Visual Basic
Event-driven programming language that executes only in response to user actions
C
Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall
26Slide27
A Guide to Programming Languages: One
Size Doesn’t Fit AllObject-oriented languagesVisual Studio.NET
—Microsoft’s answer to Java and JavaScript
Visual Basic.Net
Visual C++
Visual C#
F#—language that combines object-oriented features with the assets of a functional language
Functional language
reflects the way people think mathematically—useful in programs that express findings in mathematical form
Integrated development environment (IDE)
Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall
27Slide28
A Guide to Programming Languages:One
Size Doesn’t Fit AllWeb-based languagesNot considered programming languages
Tell the browser how to display text and objects
Language typesMarkup
Scripting
Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall
28Slide29
A Guide to Programming Languages: One Size Doesn’t Fit All
Markup languages Composed of a set of codes, or
elements
, that uses tags
to define how text and objects display
Tags
—markers that usually come in pairs
Content
—text that displays, lies between the opening and closing tags
Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall
29Slide30
A Guide to Programming Languages: One Size Doesn’t Fit All
Markup languages HTML (Hypertext Markup Language)Used by Web programmers Supports links to other documents, graphics, and audio and video files.XML (Extensible Markup Language)
Enables programmers to capture specific types of data by creating their own elementsNot a replacement for HTMLXHTML (Extensible Hypertext Markup Language
Newer version of HTML that uses XML to produce Web pages that are easily accessible by newer portable devices.
Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall
30Slide31
A Guide to Programming Languages: One Size Doesn’t Fit All
Markup languages (con’t.)
WML (Wireless Markup Language)
enables developers to create pages for wireless devices
CSS (Cascading Style Sheets)
defines the look and formatting of a Web page
World Wide Web Consortium (W3C)
International group—develops Web standards
Develops protocols and guidelines that ensure long-term growth for the Web
Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall
31Slide32
A Guide to Programming Languages:One
Size Doesn’t Fit AllScripting languages
C
reate scripts
—programs that control Web page actions or responses
VBScript
ActiveX controls
JavaScript
ECMAScript
AJAX
JSON
Used for
serialization
and transmitting structured data over a network
PHP
Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall
32Slide33
The Program Development Life Cycle
Program development life cycle (PDLC)Organized plan for managing the development of softwareConsists of six phases, from problem definition through program implementation and maintenance
Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall
33Slide34
The Program Development Life Cycle
Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall
34Slide35
The Program Development Life Cycle
Phase 1: Defining the problemDefine the problem the program will solveDefine the
program specifications
, including decisions regarding data input, required processing, output, and the user interface
Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall
35Slide36
The Program Development Life Cycle
Phase 2: Designing the programProgram design—identifies components of the program
Top-down program design
—breaks program into small, manageable, highly focused routines
Procedures, functions, or subroutines
Structured design
uses
control structures
—logical elements assembled in blocks of code that determine how subroutines will be programmed
Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall
36Slide37
The Program Development Life Cycle
Phase 2: Designing the program (con’t.)
Basic control structures categories
Sequence control structure
—code performed in line-by-line order
Selection control structure
—also
called a conditional or branch
structure, this is a portion of code that leads to a block of code based on conditions being met
Case control structure
—portion of code that branches to extensive conditional coding
Repetition control structure
—also known as looping or iteration, this is a portion of code that repeats
Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall
37Slide38
The Program Development Life Cycle
Phase 2: Designing the program (con’t.)
Algorithm
Combination of control structures Step-by-step description of how to arrive at a solution
Nesting
Process of embedding control structures within one another
Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall
38Slide39
The Program Development Life Cycle
Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall39Slide40
The Program Development Life Cycle
Phase 2: Designing the program (con’t.)
Program design tools
Structured charts—also called
hierarchy charts
,
show top-down design of programs
Flowcharts
—use diagrams to show the logic of a program
Unified Modeling Language (
UML
)
—variation of flowcharting used to illustrate and document object-oriented systems during development
Pseudocode
—uses a stylized form of writing to describe logic
Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall
40Slide41
The Program Development Life Cycle
Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall41Slide42
The Program Development Life Cycle
Phase 3: Coding the programProgrammers convert algorithms into programming codeSyntax errors
Mistakes in the construction of the programming commands
Must be corrected for the program to run appropriately
Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall
42Slide43
The Program Development Life Cycle
Phase 4: Testing and debugging the programAll errors, not just syntax errors, must be removedLogic errors
Relate to problems in the solution’s design
Cause incorrect output
Program still runs despite logic errors
Syntax errors and logic errors—
bugs
Debugging
—process of eliminating errors
Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall
43Slide44
The Program Development Life Cycle
Phase 5: Documenting the programDocumentation includes:
Overview of program functionality
TutorialsThorough explanation of main features
Reference documentation of program commands
Description of error messages
Program design work, including structure
charts,
pseudocode
,
and
flowcharts
Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall
44Slide45
The Program Development Life Cycle
Phase 6: Implementing and maintaining the programTest the programHave users work with the software
Correct errors
Program maintenance
Fix program errors discovered by users
Conduct periodic evaluations on a regular basis
Make modifications as needed to update the program or add features
Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall
45Slide46
Summary
Explain what a programming language is and how it works.Explain the development of programming languages over the years and the benefits and drawbacks of high-level programming languages.Explain how object-oriented languages attempt to remedy the shortcomings of earlier languages.
Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall
46Slide47
Summary
List several popular object-oriented languages and explain their advantage over older languages.List the six phases of the program development life cycle (PDLC) and explain why the PDLC is needed.
Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall
47Slide48
Summary
Explain why defining the problem in a top-down design manner leads to programs that are easier to debug and maintain.Differentiate between problems that can arise in the testing and debugging phase as syntax and
logic errors.
Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall
48Slide49
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 ©
2012
Pearson Education, Inc.
Publishing as Prentice Hall
49
Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall