Intro to programming

advertisement
Chapter 1
INTRODUCTION TO COMPUTERS
AND
PROGRAMMING PARADIGMS
Chapter Objectives
 After you have read and studied this chapter, you
should be able to
 State briefly a history of computers.
 Name and describe five major components of the
computer.
 State the difference between the low-level and
high-level programming languages.
 Describe how a Java program is processed
 Differentiate structured and object-oriented
programming design methodologies
A History of
Computers
 In 1819, Joseph Jacquard, a
French weaver, discovered
that the weaving
instructions for his looms
could be stored on cards
with holes punched in
them.
A History of Computers
 Charles Babbage is credited as
the father of computer.
Although never actually built, he
proposed the computing
machines called Difference
Engine and Analytical Engine
that possessed the core
characteristics of today’s
computers.
 Ada Lovelace, who wrote
demonstration programs for
Analytical Engine, is credited as
the first programmer.
Java
5 Programming: From Problem Analysis to Program Design, 5e
A History of Computers
 The first modern computer was built
by Atanasoff of Iowa State University
in the late 1930s.
 An electromechanical computer
MARK I was built by Howard Aiken of
Harvard.
 Built in 1944
 Used punched cards to feed data into
the machine
 52 feet long, weighed 50 tons, and had
750,000 parts
 The first completely electronic
computer ENIAC I was built by
Mauchly and Eckert of the University
of Pennsylvania.
 Built in 1946
 Electronic Numerical Integrator and
Calculator
A History of Computers (continued)
 In 1956, the invention of the transistors resulted in smaller,
faster, more reliable, and more energy-efficient computers
 This era also saw the emergence of the software
development industry with the introduction of FORTRAN and
COBOL, two early programming languages
 In 1970, the microprocessor, an entire CPU on a single chip,
was invented
A History of Computers (continued)
 In 1977, Stephen Wozniak and Steven Jobs designed
and built the first Apple computer in their garage
 In 1981, IBM introduced its personal computer (PC)
 Modern-day computers are very powerful, reliable,
and easy to use
 Can accept spoken-word instructions and imitate
human reasoning through artificial intelligence
Computer Architecture
Output
Devices
RAM
Communication
Devices
Input
Devices
CPU
Storage
Devices
Progress of CPU Speed
For more information on Intel CPUs, click
Intel Museum or Quick Reference Chart.
Software
 programs written to perform specific tasks
 Two types of programs
 System programs

Also known as operating system (OS)

Essential programs that control the computer

Example: boot up, memory allocator, clock, how characters are displayed,
threading process, file manager, etc.
 Application programs

Written using programming languages

Perform a specific task

Run by the OS

Example: Word processors, Spreadsheets, Games
Programming Languages
 Three levels of programming languages:
 Machine Languages
˗
Machine language instructions are binary coded and very low
level.
 Assembly Languages
˗
Assembly language allows symbolic programming. Requires an
assembler to translate assembly programs into machine programs.
 High-level Languages
˗
High-level language provides a very high conceptual model of
computing. Requires a compiler to translate high-level programs
into assembly programs.
Example:
Same task in 3 different languages
Compute the average of two numbers
and store the result in a variable.
Machine code
10110011 00011001
01111010 11010001 10010100
10011111 00011001
01011100 11010001 10010000
10111011 11010001 10010110
Assembly code
MV
MV
ADD
STO
0, SUM
NUM, AC
SUM, AC
SUM, TOT
High-level code
X = (Y + Z) / 2
Java
 Java is a high-level object-oriented language
developed by Sun Microsystems.
 Two types of Java programs:
 An applet runs within a web browser
 An application is a complete stand-alone
program that does not require a web
browser.
 Java’s clean design and wide availability make it an
ideal language for teaching the fundamentals of
computer programming.
Processing a Java Program
 Source program: written in a high-level language
 Compiler: a program that translates a program
written in a high-level language into the equivalent
machine language
 Loader: transfers the compiled code (bytecode) into
main memory
 Interpreter: reads and translates each bytecode
instruction into machine language and then executes
it
 Java Virtual Machine (JVM): hypothetical computer
developed to make Java programs machine
independent
Processing a Java Program (continued)
Figure 1: Concept
Figure 2: Implementation
Programming Methodologies
 Two basic approaches to programming design
 Structured design
 Object-oriented design
 INTRODUCTION TO OOP.pptx
Java
20 Programming: From Problem Analysis to Program Design, 5e
Structured Design
1. A problem is divided into smaller subproblems
2. Each subproblem is solved
3. The solutions of all subproblems are then
combined to solve the problem
Java
21 Programming: From Problem Analysis to Program Design, 5e
Object-Oriented Design (OOD)
 In OOD, a program is a collection of interacting
objects
 An object consists of data and operations
 Steps in OOD
1. Identify objects
2. Form the basis of the solution
3. Determine how these objects interact
Download
Related flashcards
Create Flashcards