introduction to computer algorithmics and programming ceng 113 what is a program?

38
Introduction to Computer Algorithmics and Programming Ceng 113 What is a Program?

Upload: jared-miles

Post on 12-Jan-2016

221 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Introduction to Computer Algorithmics and Programming Ceng 113 What is a Program?

Introduction to Computer Algorithmics and Programming

Ceng 113

What is a Program?

Page 2: Introduction to Computer Algorithmics and Programming Ceng 113 What is a Program?

What does a computer do?

• A computer process data.• A program is a list of detailed instructions that computers carries out.• Data? Information?

Page 3: Introduction to Computer Algorithmics and Programming Ceng 113 What is a Program?

A bit of history

Page 4: Introduction to Computer Algorithmics and Programming Ceng 113 What is a Program?

Who is the programmer?

• Design and write programs that direct the computer to take raw data and transform that data into meaningful information for the end-user.

Page 5: Introduction to Computer Algorithmics and Programming Ceng 113 What is a Program?

Common Misconceptions

• Don’t fear computers. Computers are tools to help you get your job done!

• “Only math experts can program

computers”.

• “Computer makes mistakes”.

• “Computers are difficult to use”.

Page 6: Introduction to Computer Algorithmics and Programming Ceng 113 What is a Program?

Computer Information System

A system is a collection of interrelated parts that work together for a common goal.

• Hardware• Software• People• Data• Procedures

Page 7: Introduction to Computer Algorithmics and Programming Ceng 113 What is a Program?

Hardware

Page 8: Introduction to Computer Algorithmics and Programming Ceng 113 What is a Program?

Hardware

Page 9: Introduction to Computer Algorithmics and Programming Ceng 113 What is a Program?

Hardware

Page 10: Introduction to Computer Algorithmics and Programming Ceng 113 What is a Program?

A Motherboard

CPU Power Supply

DiskMemory

Expansion Slots

Page 11: Introduction to Computer Algorithmics and Programming Ceng 113 What is a Program?

Desktop PC

Page 12: Introduction to Computer Algorithmics and Programming Ceng 113 What is a Program?

Portable

Page 13: Introduction to Computer Algorithmics and Programming Ceng 113 What is a Program?

Handheld

Page 14: Introduction to Computer Algorithmics and Programming Ceng 113 What is a Program?

Midrange Servers– Minicomputer or

midrange computer: medium-sized computer used to host programs and data for a small network

– May consist of a collection of individual circuit boards called blades (blade servers)

Page 15: Introduction to Computer Algorithmics and Programming Ceng 113 What is a Program?

Mainframe Computers– Standard choice for large

organizations, hospitals, universities, large businesses, banks, government offices

– Larger, more expensive, and more powerful than midrange servers; usually operate 24 hours a day

– Also called high-endservers or enterprise-class servers

Page 16: Introduction to Computer Algorithmics and Programming Ceng 113 What is a Program?

Super Computers– Fastest, most expensive, most powerful type of

computer

– Space exploration, missile guidance, satellites, weather forecast, oil exploration, scientific research, complex Web sites, decision support systems, 3D applications

– Commonly built by connecting hundreds of smaller computers, supercomputing cluster

Page 17: Introduction to Computer Algorithmics and Programming Ceng 113 What is a Program?

Computer Networks

Page 18: Introduction to Computer Algorithmics and Programming Ceng 113 What is a Program?

Software

• Operating Systems

• Application programs

• Utility programs

Page 19: Introduction to Computer Algorithmics and Programming Ceng 113 What is a Program?

Software

• Operating Systems

• Application programs

• Utility programs

Page 20: Introduction to Computer Algorithmics and Programming Ceng 113 What is a Program?

Operating System

Hardware

Operating System

Programming Languages

Databases

Spreadsheets Word Processors

The operating system helps the software communicate with the hardware.

Page 21: Introduction to Computer Algorithmics and Programming Ceng 113 What is a Program?

People

Page 22: Introduction to Computer Algorithmics and Programming Ceng 113 What is a Program?

Data

Page 23: Introduction to Computer Algorithmics and Programming Ceng 113 What is a Program?

Procedures

Page 24: Introduction to Computer Algorithmics and Programming Ceng 113 What is a Program?

What is a Program?

• Why are the programs like directions to the computer?

• Why do programs have to be so detailed?

• Why must programs reside in memory instead of

remaining on the disk drive when you execute them?

Page 25: Introduction to Computer Algorithmics and Programming Ceng 113 What is a Program?

Programs as directions

A program is a list of detailed instructions that the computer

carries out.

Example: How you would describe starting a car to

someone from the past.

Page 26: Introduction to Computer Algorithmics and Programming Ceng 113 What is a Program?

Programs as directionsExample

Example: How you would describe starting a car to someone from the past.

Solution 1:

• Use this key.

• Start the car.

Page 27: Introduction to Computer Algorithmics and Programming Ceng 113 What is a Program?

Programs as directionsExample

Example: How you would describe starting a car to someone from the past.

Solution 2:

• Attached is the key to the car. You need it to start the car.

• With the key in hand, go to the car door that is closest to the front door of the house.

• Under the door’s handle, you will see a round silver-dollar-sized metal part in which you can insert the key.

• After sticking the key into the hole as far as it goes, turn it to the right until you hear a click.

• Turn the key back to the left until it faces the same way as it did when you inserted it and remove the key.

Page 28: Introduction to Computer Algorithmics and Programming Ceng 113 What is a Program?

Programs as directionsExample (Continued..)

Solution 2:

6. Open the door and get into the car. Be sure to sit infront of the round

wheel.

7. Close the door.

8. On the right side of the column holding the big round wheel (called a

steering wheel), you will see a slot in which you can put the key.

He hasn’t even started the car yet!

Page 29: Introduction to Computer Algorithmics and Programming Ceng 113 What is a Program?

Programs as directions

• Not only are the programming instructions

themselves important, but so is their order!

Page 30: Introduction to Computer Algorithmics and Programming Ceng 113 What is a Program?

Problem Solving

1. Identify the problem.

2.Understanding the problem.

3. Identifying alternative solutions.

4.Selecting the best solution.

5.Preparing a list of instructions to solve

problem.

6.Evaluating solution

Page 31: Introduction to Computer Algorithmics and Programming Ceng 113 What is a Program?

Examples

• Define; How can you – Make a cup of a cocoa?

• Write a solution to the problem of finding the largest number out of three numbers.– List the specific steps that would enable

another person to find the largest among.

Page 32: Introduction to Computer Algorithmics and Programming Ceng 113 What is a Program?

Programs are saved instructions.

CPU

.

.

.

RAM

DiscPrograms

Process

A program must be in memory before the CPU can execute the program’s instructions.

Page 33: Introduction to Computer Algorithmics and Programming Ceng 113 What is a Program?

Programs are saved instructions.

Instructions Of

The ProgramCPU

OUTPUT

Screen

Printer

Disk

Sound sys.

The programs comes from disk, executes, and then sends its results to any of the many output devices.

Data

Program

OperatingSystem

A typical memory layout.

Page 34: Introduction to Computer Algorithmics and Programming Ceng 113 What is a Program?

Language

• The instructions you give in your programs must be in a language the computer understand.

“10100110110011001101111101101011..”

• Computer and people are at opposite ends of the spectrum.

• Programming languages are a solution between people and computer, but they have a highly specific syntax.

Page 35: Introduction to Computer Algorithmics and Programming Ceng 113 What is a Program?

The Language Translator

Your program’s

source code.

Machine’snative

languageof 1s

and 0s.

Compiler

Interpreter

or

Both interpreters and compilers translate source code into low-level machine language that the computer can understand.

Page 36: Introduction to Computer Algorithmics and Programming Ceng 113 What is a Program?

InterpretersForeign language book

One line at a time.

Interpreter You

Translation

An interpreter acts like a human interpreter. Therefore it can be slow process.BASIC uses an interpreter; example code is;

FOR i = 1 TO 50PRINT i

NEXT i

Page 37: Introduction to Computer Algorithmics and Programming Ceng 113 What is a Program?

CompilersForeign language book

Compiler You

Translation

Completelytranslated (compiled)

book.

After compiling the book, you no longer need the translator.

Page 38: Introduction to Computer Algorithmics and Programming Ceng 113 What is a Program?

Next Course

• Designing the program and so on..