Title: Computers: Understanding Technology, 3e
1Chapter 12
Programming Concepts and Languages
2Presentation Overview
- Programming Concepts
- Problem-Solving Techniques
- The Evolution of Programming Approaches
- Programming Development and Documentation Tools
- Programming Errors
- The Software Development Life Cycle
- Major Programming Languages
3Programming Concepts
- What makes up a programming language?
4Programming Concepts
- What makes up a programming language?
- Program instructions telling a computer how to
perform tasks
5Programming Concepts
- What makes up a programming language?
- Program instructions telling a computer how to
perform tasks - Programming languages languages that
communicate with the computer to create programs
6Programming Concepts
- What makes up a programming language?
- Program instructions telling a computer how to
perform tasks - Programming languages languages that
communicate with the computer to create programs - Source code text files that make up a
programming language
7Programming Concepts
- What makes up a programming language?
- Program instructions telling a computer how to
perform tasks - Programming languages languages that
communicate with the computer to create programs - Source code text files that make up a
programming language - Four main computer language programming elements
are variables, executable statements, looping,
and decision statements.
8Programming Concepts
- High-Level versus Low-Level Languages
9Programming Concepts
- High-Level versus Low-Level Languages
- Low-level language (machine code) is a binary
language consisting of 1s and 0s runs faster
and takes up less disk space.
10Programming Concepts
- High-Level versus Low-Level Languages
- Low-level language (machine code) is a binary
language consisting of 1s and 0s runs faster
and takes up less disk space. - High-level language is similar to natural
languages, making it easier to learn and use.
11Programming Concepts
- Each generation of programs builds on the
contributions of the group of languages that
preceded it.
12Programming Concepts
- Classic Programming Elements
13Programming Concepts
- Classic Programming Elements
- Variable data value stored in computer memory
14Programming Concepts
- Classic Programming Elements
- Variable data value stored in computer memory
- Executable statement performs an action and then
proceeds to the next statement in sequence
15Programming Concepts
- Classic Programming Elements
- Variable data value stored in computer memory
- Executable statement performs an action and then
proceeds to the next statement in sequence - Looping allows a program to return to a
previously executed instruction and repeat it
16Programming Concepts
- Classic Programming Elements
- Variable data value stored in computer memory
- Executable statement performs an action and then
proceeds to the next statement in sequence - Looping allows a program to return to a
previously executed instruction and repeat it - Decision statement point in a program where
different actions may be performed depending on
specific conditions
17Programming Concepts
- Looping allows a computer program to
continuously repeat the same steps, such as a
program designed to direct a traffic light to
display yellow, red, and green lights at a
consistent rate.
18Programming Concepts
- Using an if-then statement based on a particular
action, such as pushing the crosswalk button, a
program can interrupt the looping pattern, making
the program more useful.
19Problem-Solving Techniques
- Top-down design approach helps programmers break
a large project into manageable parts. Breakdown
process continues until there are no more steps.
20Problem-Solving Techniques
21Problem-Solving Techniques
- Problem-Solving Steps
- Identify the problem.
22Problem-Solving Techniques
- Problem-Solving Steps
- Identify the problem.
- Analyze the problem.
23Problem-Solving Techniques
- Problem-Solving Steps
- Identify the problem.
- Analyze the problem.
- Brainstorm solutions and choose the best one.
24Problem-Solving Techniques
- Problem-Solving Steps
- Identify the problem.
- Analyze the problem.
- Brainstorm solutions and choose the best one.
- Write the algorithm.
25Problem-Solving Techniques
- Problem-Solving Steps
- Identify the problem.
- Analyze the problem.
- Brainstorm solutions and choose the best one.
- Write the algorithm.
- Prototype the solution.
26Problem-Solving Techniques
- Problem-Solving Steps
- Identify the problem.
- Analyze the problem.
- Brainstorm solutions and choose the best one.
- Write the algorithm.
- Prototype the solution.
- Implement and test the solution.
27Problem-Solving Techniques
- Step-by-step pseudocode algorithm for changing a
lightbulb.
28The Evolution of Programming Approaches
29The Evolution of Programming Approaches
- Structured Programming
- Creates groups of instructions as independent
elements.
30The Evolution of Programming Approaches
- Structured Programming
- Creates groups of instructions as independent
elements. - Structured groups of instructions are built on a
routine, which is a section of a program to
handle a function.
31The Evolution of Programming Approaches
- Structured Programming
- Creates groups of instructions as independent
elements. - Structured groups of instructions are built on a
routine, which is a section of a program to
handle a function. - A routine is broken down into steps to accomplish
the function.
32The Evolution of Programming Approaches
33The Evolution of Programming Approaches
- Modules
- Code modules handle separate components of a
program.
34The Evolution of Programming Approaches
- Modules
- Code modules handle separate components of a
program. - Each module is a solid portion of a larger
structure.
35The Evolution of Programming Approaches
- Modules
- Code modules handle separate components of a
program. - Each module is a solid portion of a larger
structure. - Modules are reusable, and modularity helps in
tracking down errors.
36The Evolution of Programming Approaches
- Modules
- Code modules handle separate components of a
program. - Each module is a solid portion of a larger
structure. - Modules are reusable, and modularity helps in
tracking down errors. - A macro is a recording of steps to perform a
repetitive task.
37The Evolution of Programming Approaches
- Object-Oriented Programming
38The Evolution of Programming Approaches
- Object-Oriented Programming
- Object-oriented programming (OOP) defines each
module (object) with definite rules for
interfacing and a protected set of variables.
39The Evolution of Programming Approaches
- Object-Oriented Programming
- Object-oriented programming (OOP) defines each
module (object) with definite rules for
interfacing and a protected set of variables. - Protected variables allow a programmer to prevent
data from being altered during program execution.
40The Evolution of Programming Approaches
- Rapid Application Development
41The Evolution of Programming Approaches
- Rapid Application Development
- Rapid application development (RAD) reduces cost
by decreasing time needed to develop a project.
42The Evolution of Programming Approaches
- Rapid Application Development
- Rapid application development (RAD) reduces cost
by decreasing time needed to develop a project. - Programmers using RAD follow guidelines
- Use visual development (4GL) tools when
possible - Rapidly prototype new projects
- Approach coding with these priorities
- Use existing code first.
- Buy someone elses code second.
- Write new code last.
43Programming Development and Documentation Tools
- Compilers and Interpreters
44Programming Development and Documentation Tools
- Compilers and Interpreters
- Compiler program that translates programming
language source code into machine code
45Programming Development and Documentation Tools
- Compilers and Interpreters
- Compiler program that translates programming
language source code into machine code - Interpreter translates instructions one-by-one
as source code is being executed identifies
errors as they are encountered, including the
line containing the error
46Programming Development and Documentation Tools
47Programming Development and Documentation Tools
- Debuggers
- Debugger a software tool that helps programmers
find errors quickly.
48Programming Development and Documentation Tools
- Debuggers
- Debugger a software tool that helps programmers
find errors quickly. - Allows programmers to examine closely what is
happening when a program runs.
49Programming Development and Documentation Tools
- Debuggers
- Debugger a software tool that helps programmers
find errors quickly. - Allows programmers to examine closely what is
happening when a program runs. - Usually an integral component of compilers and
interpreters.
50Programming Development and Documentation Tools
51Programming Development and Documentation Tools
- Document Tools
- Flowchart provides a visual diagram of an
algorithm
52Programming Development and Documentation Tools
- Document Tools
- Flowchart provides a visual diagram of an
algorithm - CASE tools help programming team schedule and
coordinate its operations
53Programming Development and Documentation Tools
- Document Tools
- Flowchart provides a visual diagram of an
algorithm - CASE tools help programming team schedule and
coordinate its operations - Comment informal message inserted into a
program usually to explain source code to later
users
54Programming Development and Documentation
Tools
- These symbols are used in flowcharts to represent
the logic of a program.
55Programming Development and Documentation
Tools
- Flowcharts help programmers visualize the steps
in a software program.
56Programming Development and Documentation Tools
- Flowcharts help programmers visualize the steps
in a software program.
57Programming Errors
- What programming errors are in programs?
58Programming Errors
- What programming errors are in programs?
- Syntax errors typing errors or misunderstanding
of rules of the language
59Programming Errors
- What programming errors are in programs?
- Syntax errors typing errors or misunderstanding
of rules of the language - Logic errors program instructs computer to
perform an action incorrectly
60Programming Errors
- What programming errors are in programs?
- Syntax errors typing errors or misunderstanding
of rules of the language - Logic errors program instructs computer to
perform an action incorrectly - Run-time errors mistakes that occur when an
application is running (crash or infinite loop)
61Programming Errors
- What programming errors are in programs?
- Syntax errors typing errors or misunderstanding
of rules of the language - Logic errors program instructs computer to
perform an action incorrectly - Run-time errors mistakes that occur when an
application is running (crash or infinite loop) - Style errors poorly written programming code
that may cause dissatisfaction with program
62The Software Development Life Cycle
- What are the steps in the software development
life cycle? - The software development life cycle involves
planning, designing, implementing, testing, and
release of application software.
63Major Programming Languages
- Commonly used programming languages
64Major Programming Languages
65Major Programming Languages
- Machine Code
- programming language that computers actually read
and interpret
66Major Programming Languages
- Machine Code
- programming language that computers actually read
and interpret - machine code written in a binary string of 1s and
0s
67Major Programming Languages
- Machine Code
- programming language that computers actually read
and interpret - machine code written in a binary string of 1s and
0s - difficult to memorize the long binary strings
that comprise the machine code
68Major Programming Languages
69Major Programming Languages
- Assembly Language
- uses symbols and words to represent elements of
machine code
70Major Programming Languages
- Assembly Language
- uses symbols and words to represent elements of
machine code - must be converted to machine code by a compiler
71Major Programming Languages
- Assembly Language
- uses symbols and words to represent elements of
machine code - must be converted to machine code by a compiler
- runs fastest and uses least memory
72Major Programming Languages
- Assembly Language
- uses symbols and words to represent elements of
machine code - must be converted to machine code by a compiler
- runs fastest and uses least memory
- programs are difficult to write and development
times are lengthened
73Major Programming Languages
74Major Programming Languages
- COBOL
- used chiefly for business applications by large
institutions and companies
75Major Programming Languages
- COBOL
- used chiefly for business applications by large
institutions and companies - is slow and cumbersome language, but has large
body of existing code and many programmers know
the language
76Major Programming Languages
77Major Programming Languages
- RPG
- commonly used in business environments
78Major Programming Languages
- RPG
- commonly used in business environments
- inefficient, but simplifies coding of database
applications
79Major Programming Languages
- RPG
- commonly used in business environments
- inefficient, but simplifies coding of database
applications - is familiar to many programmers
80Major Programming Languages
- RPG
- commonly used in business environments
- inefficient, but simplifies coding of database
applications - is familiar to many programmers
- often used on midrange and mainframe computers
81Major Programming Languages
82Major Programming Languages
- FORTRAN
- for many years, the language of choice for
math, science, and engineering projects
83Major Programming Languages
- FORTRAN
- for many years, the language of choice for
math, science, and engineering projects - still in use today in factories and laboratories
84Major Programming Languages
85Major Programming Languages
- BASIC
- high-level language that is friendlier and more
natural than COBOL or FORTRAN
86Major Programming Languages
- BASIC
- high-level language that is friendlier and more
natural than COBOL or FORTRAN - runs slowly, but faster to develop for programmers
87Major Programming Languages
- BASIC
- high-level language that is friendlier and more
natural than COBOL or FORTRAN. - runs slowly, but faster to develop for
programmers. - This sequence of code will print the numbers 1 to
10.
88Major Programming Languages
89Major Programming Languages
- Visual Basic (VB)
- language of choice for developing software
prototypes or for developing interfaces for
Windows platforms
90Major Programming Languages
- Visual Basic (VB)
- language of choice for developing software
prototypes or for developing interfaces for
Windows platforms - quick and easy to develop, but run slowly and is
demanding of RAM and disk space
91Major Programming Languages
- Visual Basic (VB)
- language of choice for developing software
prototypes or for developing interfaces for
Windows platforms - quick and easy to develop, but run slowly and is
demanding of RAM and disk space - supports graphic interfaces
92Major Programming Languages
93Major Programming Languages
- C
- compromise between high-level and low-level
languages, containing components of BASIC and
assembly language
94Major Programming Languages
- C
- compromise between high-level and low-level
languages, containing components of BASIC and
assembly language - not as easy to read as BASIC, but runs
considerably faster and uses less space
95Major Programming Languages
96Major Programming Languages
- C
- superset of C any C program should run in C
97Major Programming Languages
- C
- superset of C any C program should run in C
- added features such as object-oriented programming
98Major Programming Languages
- C
- superset of C any C program should run in C.
- added features such as object-oriented
programming. - This sequence of code will print the numbers 1 to
10.
99Major Programming Languages
100Major Programming Languages
- C
- modern object-oriented language derived from C
and Java
101Major Programming Languages
- C
- modern object-oriented language derived from C
and Java - combines productivity of Visual Basic with power
of C
102Major Programming Languages
- C
- modern object-oriented language derived from C
and Java - combines productivity of Visual Basic with power
of C - allows use of features in Microsoft.NET
framework, C, and Microsofts Component Object
Model (COM)
103Major Programming Languages
104Major Programming Languages
- Scripting Languages
- interpreted language that is relatively easy to
learn and use
105Major Programming Languages
- Scripting Languages
- interpreted language that is relatively easy to
learn and use - explains what a computer should do in
English-like terms but not precisely how the
computer should do it
106Major Programming Languages
- Scripting Languages
- interpreted language that is relatively easy to
learn and use - explains what a computer should do in
English-like terms but not precisely how the
computer should do it - Hypertext Markup Language (HTML), JavaScript,
VBScript, and perl are scripting languages
107Major Program-ming Languages
- This sequence of code directs a browser to
display buttons users can click to change the
background color within the Web browser window.
108Major Programming Languages
109Major Programming Languages
- DHTML
- allows Web page designers to alter contents of
Web page screen dynamically
110Major Programming Languages
- DHTML
- allows Web page designers to alter contents of
Web page screen dynamically - allows viewer actions to change contents of a Web
page
111Major Programming Languages
- DHTML
- allows Web page designers to alter contents of
Web page screen dynamically - allows viewer actions to change contents of a Web
page - displays faster than HTML
112Major Programming Languages
- DHTML
- allows Web page designers to alter contents of
Web page screen dynamically - allows viewer actions to change contents of a Web
page - displays faster than HTML
- higher quality appearance and more graphically
responsive to user actions
113Major Programming Languages
114Major Programming Languages
- XHTML
- allows Web pages to separate their content from
the format supported by a Web page
115Major Programming Languages
- XHTML
- allows Web pages to separate their content from
the format supported by a Web page - screens with different sizes and resolutions can
display the same Web page content without the Web
designer having to write specialized versions for
each
116Major Programming Languages
- Wireless Markup Language (WML)
117Major Programming Languages
- Wireless Markup Language (WML)
- created specifically for small systems such as
cell phones and handheld computers
118Major Programming Languages
- Wireless Markup Language (WML)
- created specifically for small systems such as
cell phones and handheld computers - allows designers to build pages that work for
small screens with limited display and input
capabilities
119On the Horizon
- Based on the information presented in this
chapter and your own experience, what do you
think is on the horizon?