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

Post on 12-Jan-2016

226 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

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?

A bit of history

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.

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”.

Computer Information System

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

• Hardware• Software• People• Data• Procedures

Hardware

Hardware

Hardware

A Motherboard

CPU Power Supply

DiskMemory

Expansion Slots

Desktop PC

Portable

Handheld

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)

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

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

Computer Networks

Software

• Operating Systems

• Application programs

• Utility programs

Software

• Operating Systems

• Application programs

• Utility programs

Operating System

Hardware

Operating System

Programming Languages

Databases

Spreadsheets Word Processors

The operating system helps the software communicate with the hardware.

People

Data

Procedures

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?

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.

Programs as directionsExample

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

Solution 1:

• Use this key.

• Start the car.

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.

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!

Programs as directions

• Not only are the programming instructions

themselves important, but so is their order!

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

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.

Programs are saved instructions.

CPU

.

.

.

RAM

DiscPrograms

Process

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

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.

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.

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.

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

CompilersForeign language book

Compiler You

Translation

Completelytranslated (compiled)

book.

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

Next Course

• Designing the program and so on..

top related