close

Вход

Забыли?

вход по аккаунту

?

Programming languages

код для вставкиСкачать
Computers Are
Your Future
В© 2005 Prentice Hall, Inc.
Computers Are Your Future: Chapter 12
Computers Are Your Future
Chapter 12
Programming Languages and
Program Development
В© 2005 Prentice Hall, Inc.
Slide 2
Computers Are Your Future: Chapter 12
What You Will Learn About
пѓј What a programming language is
пѓј Machine language and assembly language
пѓј High-level programming languages
пѓј The shortcomings of early languages
пѓј Popular programming languages
В© 2005 Prentice Hall, Inc.
Slide 3
Computers Are Your Future: Chapter 12
What You Will Learn About
пѓј The six phases of the program development life cycle
(PDLC)
пѓј Why top-down programming makes programs easier
to debug and maintain
пѓј The three basic types of control structures
пѓј Syntax errors and logic errors in programs
В© 2005 Prentice Hall, Inc.
Slide 4
Computers Are Your Future: Chapter 12
Programming Languages
Assembly Language
Machine Language
Fortran
Pascal
BASIC
Ada
COBOL
Visual Basic
Smalltalk
C and C++
Java
пѓј Programming languages are artificial languages
created to tell the computer what to do
пѓј They consist of vocabulary and a set of rules to
write programs
пѓј The program development life cycle (PDLC) is
an organized method of software development
В© 2005 Prentice Hall, Inc.
Slide 5
Computers Are Your Future: Chapter 12
Development of Programming Languages
пѓј Programming languages are classified by levels or
generations
пѓј Lower-level languages are the oldest
пѓј The five generations of programming languages are:
пѓ� Machine languages
пѓ� Assembly languages
пѓ� Procedural languages
пѓ� Problem-oriented languages
пѓ� Natural languages
В© 2005 Prentice Hall, Inc.
Slide 6
Computers Are Your Future: Chapter 12
First-Generation Languages
пѓј Machine language:
пѓ�Consists of binary numbers (0s
and 1s)
пѓ�Is the earliest programming
language
пѓ�Is the only language the
computer understands without
translation
пѓ�Is machine dependent
 Each family of processors has
its own machine language
В© 2005 Prentice Hall, Inc.
Slide 7
Computers Are Your Future: Chapter 12
Second-Generation Languages
пѓј Assembly language:
пѓ� Resembles machine language
пѓ� Is a low-level language
пѓ� Uses brief abbreviations for
program instructions.
 Abbreviations are called
mnemonics
пѓ� A program is written in source
code (text file) and translated
into machine language by an
assembler
В© 2005 Prentice Hall, Inc.
Slide 8
Computers Are Your Future: Chapter 12
Third-Generation Languages
пѓј Procedural languages:
пѓ�Are high-level languages that tell the computer what to
do and how to do it
пѓ�Create programs at a high level of abstraction
пѓ�Are easier to read, write, and maintain than machine
and assembly languages
пѓ�Use a compiler or interpreter to translate code
пѓј Fortran and COBOL are third-generation
languages
В© 2005 Prentice Hall, Inc.
Slide 9
Computers Are Your Future: Chapter 12
Third-Generation Languages (continued)
пѓј Spaghetti Code and the Great Software Crisis:
пѓ�GOTO statements resulted in programs that were
difficult to follow
пѓ�This problem led to the software crisis of the 1960s
 Programs were not ready on time
 Programs exceeded their budgets
 Programs contained too many errors
 Customers were not satisfied
В© 2005 Prentice Hall, Inc.
Slide 11
Computers Are Your Future: Chapter 12
Third-Generation Languages (continued)
пѓј Structured programming languages:
пѓ�Were developed to improve software development
пѓ�Include Algol and Pascal
пѓ�Forbid the use of GOTO statements
пѓ�Use control structures
 IF-THEN-ELSE
В© 2005 Prentice Hall, Inc.
Slide 12
Computers Are Your Future: Chapter 12
Third-Generation Languages (continued)
пѓј Modular programming languages:
пѓ�Were developed because of problems in structured
programming languages
пѓ�Are used to create programs that are divided into
separate modules
 Each module carries out a special function
пѓ�Require specified input to produce specified output
В© 2005 Prentice Hall, Inc.
Slide 13
Computers Are Your Future: Chapter 12
Fourth-Generation Languages
пѓј Types of fourth-generation languages include:
пѓ�Report generators
 Languages for printing database reports
пѓ�Query languages
 Languages for getting information out of databases
пѓј Fourth-generation languages are nonprocedural
пѓ� They do not force programmers to follow procedures to
produce results
В© 2005 Prentice Hall, Inc.
Slide 14
Computers Are Your Future: Chapter 12
Object-Oriented Programming
пѓј Object-oriented programming (OOP):
пѓ� Relies on component reusability
 The ability to produce program modules that perform a
specific task.
пѓ� Eliminates the distinction between programs and data
пѓ� Uses objects that contain data and procedures
В© 2005 Prentice Hall, Inc.
Slide 15
Computers Are Your Future: Chapter 12
Objects
пѓј Objects are units of information
that contain data as well as
methods that process and
manipulate the data
пѓј Classes of objects:
пѓ� Hierarchy or category of objects
пѓ� Objects at the top of the
category are broader in scope
than the subclass objects
 Inheritance refers to an object’s
capacity to “pass on” its
characteristics to its subclasses
В© 2005 Prentice Hall, Inc.
Slide 16
Computers Are Your Future: Chapter 12
Common Business-Oriented Language (COBOL)
пѓј COBOL:
Sample Cobol program
пѓ�The earliest (1959)
high-level language
пѓ�The most widely used
business language
пѓ�A proven way to do
accounting, inventory,
billing, and payroll
пѓ�Requires programmers
to explain what the
program is doing at
each step
В© 2005 Prentice Hall, Inc.
Slide 17
Computers Are Your Future: Chapter 12
Formula Translator (Fortran)
пѓјFortran:
Sample Fortran program
пѓ�Began in the 1950s
пѓ�Is suited to scientific,
mathematical, and
engineering applications
пѓ�Is used to solve
complex equations
пѓ�Features simplicity,
economy, and ease of
use
В© 2005 Prentice Hall, Inc.
Slide 18
Computers Are Your Future: Chapter 12
Ada
пѓј Ada:
Sample Ada program
пѓ� Named after Augusta
Ada Byron
пѓ� Incorporates modular
programming
пѓ� The required language
for the U.S. Defense
Department
пѓ� Suitable for control of
real-time systems
(missiles)
В© 2005 Prentice Hall, Inc.
Slide 19
Computers Are Your Future: Chapter 12
Beginner’s All-Purpose Symbolic
Instruction Code (BASIC)
Sample BASIC program
пѓј BASIC:
пѓ� An easy-to-use language available on personal computers
� Widely taught in schools as a beginner’s programming
language
пѓ� Designed as an interpreted language
В© 2005 Prentice Hall, Inc.
Slide 20
Computers Are Your Future: Chapter 12
Visual Basic (VB)
Sample Visual Basic
пѓј Visual Basic:
пѓ�Is widely used in program
development packages
пѓ�Uses event-driven
programming
пѓ�Enables the programmer to
develop an application by using
on-screen graphical user
interfaces
В© 2005 Prentice Hall, Inc.
Slide 21
Computers Are Your Future: Chapter 12
Pascal
Sample Pascal program
пѓј Pascal:
пѓ� Is named after Blaise Pascal
пѓ� Encourages programmers to write well-structured programs
пѓ� Widely accepted as a teaching language
пѓ� Has been updated to reflect new approaches to programming
В© 2005 Prentice Hall, Inc.
Slide 22
Computers Are Your Future: Chapter 12
C
пѓј C:
Sample C program
пѓ� Was developed by
AT&T’s Bell Labs
in the 1970s
пѓ� Combines highlevel programming
пѓ� Difficult to learn and
language with
programming is time
assembly language
consuming
пѓ� Programmers
manipulate bits of
data within a
processing unit
В© 2005 Prentice Hall, Inc.
Slide 23
Computers Are Your Future: Chapter 12
Smalltalk
Sample Smalltalk program
пѓј Smalltalk:
пѓ� Developed in the 1970s by
Xerox Corp
� “100% pure” object-oriented
programming language
пѓ� Not often chosen for software
development
В© 2005 Prentice Hall, Inc.
Slide 24
Computers Are Your Future: Chapter 12
C++
пѓј C++:
Sample C++ program
пѓ� Incorporates objectoriented features
пѓ� Is widely used for
professional program
development
В© 2005 Prentice Hall, Inc.
Slide 25
Computers Are Your Future: Chapter 12
Java
пѓј Java:
пѓ� Developed by Sun Microsystems
пѓ� An object-oriented, high-level programming language with
a twist
пѓ� First true cross-platform programming language
пѓ� Gained acceptance faster than any other programming
language
пѓ� A simplified version of C++
В© 2005 Prentice Hall, Inc.
Slide 26
Computers Are Your Future: Chapter 12
Java
пѓј Java, continued :
пѓ� Java is designed to run on any computer platform
пѓ� Java Virtual Machine enables cross-platform use
пѓ� Java applets or small programs are downloaded to
computers through networks
пѓ� Weaknesses include:
 The security risk in downloading applets
 The speed in running the programs
В© 2005 Prentice Hall, Inc.
Slide 27
Computers Are Your Future: Chapter 12
Sample Java Program
В© 2005 Prentice Hall, Inc.
Slide 28
Computers Are Your Future: Chapter 12
Web-Based Languages
пѓј Markup languages:
пѓ� Hypertext markup language (HTML) sets the attributes
of text and objects within a Web page
пѓ� Extensible markup language (XML) is used for sharing
data and objects in a Web environment
пѓј Scripting languages:
пѓ� VBScript is used to write short programs (scripts) that are
embedded in Web pages
пѓ� JavaScript is used to write scripts on Web pages
пѓј Visual Studio .NET:
пѓ� Used for the development of scripts and programs that are
accessible from the Web
В© 2005 Prentice Hall, Inc.
Slide 29
Computers Are Your Future: Chapter 12
The Program Development Life Cycle (PDLC)
пѓј The PDLC was introduced in the 1970s to address
problems in creating programs
пѓј It provides an organized plan for breaking down the task
of program development into manageable parts
пѓј Six phases of the PDLC:
1.
2.
3.
4.
5.
6.
Defining the problem
Designing the program
Coding the program
Testing and debugging the program
Formalizing the solution
Implementing and maintaining the program
В© 2005 Prentice Hall, Inc.
Slide 30
Computers Are Your Future: Chapter 12
Phase 1: Defining the Problem
пѓј The first step in program development
пѓј Systems analysts provide program specifications (specs)
to programmers
пѓј Specs define:
пѓ� Input data
пѓ� Processing
пѓ� Output
пѓ� Appearance of user interface
В© 2005 Prentice Hall, Inc.
Slide 31
Computers Are Your Future: Chapter 12
Phase 2: Designing the Program
 Programmers create the program’s design
� Top-down design focuses on the program’s main goal
(main routine), then breaks the program into manageable
components (subroutines/modules)
пѓ� Control structures are used to see how each subroutine will
do its job
пѓј Developing an algorithm is a step-by-step description of
how to arrive at a solution
пѓј Program design tools:
� Structure charts – show the top-down design
� Flow charts – show the logic of program
� Pseudo code – alternative to flow charts
В© 2005 Prentice Hall, Inc.
Slide 32
Computers Are Your Future: Chapter 12
Phase 3: Coding the Program
пѓј Coding requires the translation of the algorithm into
specific program instructions
пѓј An appropriate programming language is chosen, and the
code is typed according to its syntax rules
В© 2005 Prentice Hall, Inc.
Slide 35
Computers Are Your Future: Chapter 12
Phase 4: Testing and Debugging the Program
пѓј Testing and debugging eliminate all errors
пѓј Syntax and logic errors are corrected
пѓј Debugging is the process of eliminating errors
В© 2005 Prentice Hall, Inc.
Slide 36
Computers Are Your Future: Chapter 12
Phase 5: Formalizing the Solution
пѓј Documentation is created for future use
пѓј The variable names and definitions, a description of the
files needed, and the layout of the output are produced
пѓј A user manual is developed to explain how the program
works
В© 2005 Prentice Hall, Inc.
Slide 37
Computers Are Your Future: Chapter 12
Phase 6: Implementing and Maintaining
the Program
пѓј The program is:
пѓ�Tested by users
пѓ�Thoroughly documented
пѓ�Maintained and evaluated regularly
В© 2005 Prentice Hall, Inc.
Slide 38
Computers Are Your Future: Chapter 12
Chapter 12 Summary
•
A programming language is an artificial language consisting
of a vocabulary and a set of rules
•
Machine language is the lowest-level programming
language
•
Assembly language contains symbols for programming
instructions
•
Third-generation (high-level) languages require
programmers to specify the procedures to be followed
Object-oriented languages combine procedures and data
•
В© 2005 Prentice Hall, Inc.
Slide 39
Computers Are Your Future: Chapter 12
Chapter 12 Summary, continued
•
The PDLC’s six phases are:
• Defining the program
• Designing the program
• Coding the program
• Testing and debugging the program
• Formalizing the solution
• Implementing and maintaining the program
•
Top-down programming makes programs easier to debug
and maintain
•
Debugging requires finding and correcting syntax errors and
logic errors
В© 2005 Prentice Hall, Inc.
Slide 40
Документ
Категория
Презентации
Просмотров
7
Размер файла
1 671 Кб
Теги
1/--страниц
Пожаловаться на содержимое документа