/
Introduction to Computer Programming Introduction to Computer Programming

Introduction to Computer Programming - PowerPoint Presentation

mitsue-stanley
mitsue-stanley . @mitsue-stanley
Follow
379 views
Uploaded On 2018-09-19

Introduction to Computer Programming - PPT Presentation

Overview What is programming What are computer languages and how have they evolved What is the basic process of programming including the tools involved Algorithm A stepbystep set of instructions to accomplish a task ID: 671336

program language error computer language program computer error languages programming machine hll cpu executable process instructions file software object

Share:

Link:

Embed:

Download Presentation from below link

Download Presentation The PPT/PDF document "Introduction to Computer Programming" is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.


Presentation Transcript

Slide1

Introduction to Computer ProgrammingSlide2

Overview

What is programming?

What are computer languages and how have they evolved?

What is the basic process of programming, including the tools involved?Slide3

Algorithm

A step-by-step set of instructions to accomplish a task.

Example: Make KoolAid

- Fill

jug with

water

- Add KoolAid mix

- Stir

- Pour from jug into cupsSlide4

Computer Program

A step-by-step set of instructions to accomplish a task

expressed in a Computer LanguageSlide5

Computer Languages

Machine Language

-

Consists of binary codes for very simplistic commands

Ex: 1001 (move), 1100 (add)

- Codes differ by CPU model

- Is the

only

language a CPU can

follow

- Using ML Requires

detailed

knowledge of the

CPU/hardware.Slide6

Computer Languages

Machine Language

ENIAC being programmed

Univ of Penn, 1940’s

(photo: U.S. Army)Slide7

Computer Languages

Assembly Language

-

Consists of text codes for very simplistic commands

Ex: ADD, SUB, MOVE

- Codes differ by CPU model

- 1-to-1 translation to Machine

Language

- Using Assembly requires detailed knowledge of the CPU/hardwareSlide8

Computer Languages

High Level Language

-

Consists of text codes for more complex expressions

- Codes standardized across CPU models

- 1-to-Many translation to Machine Language

- Does not require detailed knowledge of the CPU/hardware.Slide9

Computer Languages

ML vs ASSM vs HLL

Assembler: Machine Lang:

MOV @065 to CPU:R1 10010001 01000001

MOV @066 to CPU:R2 10010010 01000010

ADD 01010000

MOV CPU:REG3 to @067 10100010 01000011

High Level Language:

x = a + bSlide10

Computer Languages

Early High Level Languages

Fortran (FORMula TRANSlation)

- by IBM, 1950’s

- Number cruncher for mathematicians, scientists and engineers.

- Ex:

A

= 3.1415926 * R * R;

-

Very poor at manipulating “pretty” output and large volumes of data.Slide11

Computer Languages

Early High Level Languages

COBOL (COmmon Business Oriented Language)

-

by committee, funded by DoD, 1960

-

For business/management apps: does “pretty” and handles large volumes of data easily.

- Very English-Like. Ex:

ADD SUBTOTAL TO TAX GIVING TOTAL.Slide12

Computer Languages

High Level Languages

C

-

by Dennis Ritchie (AT&T), 1972

-

Combines ease-of-use of a HLL with the “power” of Assembly

- Used to write

efficient

systems software (Unix Operating System)Slide13

Computer Languages

Efficiency

Accomplishing a task using the least amount of resources.

In Programming, “resources” are:

- Time (number of instructions executed)

- Space (amount of memory required)Slide14

Computer Languages

High Level Languages

C++

-

By Bjarne Stroustrup (AT&T), 1983

-

Enhancement of C: major items:

- Object-Oriented Programming

- Extensibility: programmers can add new features to the language itself.

Today: one of the most common languages.Slide15

Programming Process

Tools, Files and ErrorsSlide16

Programming Process

Software Tools

Editor

– used to write the program in a HLL.

Compiler

– translates program in a HLL into Machine (or other low level) Language

Linker

– combines Object Files into an Executable.

Loader

– copies an Executable into memory and starts program execution.Slide17

Programming Process

Software Tools

Integrated Development Environment (IDE)

Combines the editor, compiler, linker, loader and often other helpful tools into one programming tool.

Example: Microsoft Visual Studio IDESlide18

Programming Process

Files

Source

– a text file containing a program written in a HLL

Object –

part

of a program translated in Machine Language

Executable

– a

complete

program in Machine LanguageSlide19

Programming Process

Errors

Syntax (aka Compiler)

– found in the Source, these are violations of the rules for writing programs in the HLL.

Link

– the linker is unable to link the object files into an executable. Typical errors indicate something is missing or the parts (objects) do not “fit” together as expected.Slide20

Programming Process

Errors

Load

– the loader is unable to copy the executable into memory and start execution. Typical errors include “not enough memory” or “not a trusted program” (virus protection).

Run-Time

– occurs during execution. Typical errors include “division by 0”, “file not found”, “memory access violation”. Execution halts when a RTE occurs; normally called a “program crash” and may not have an error message.Slide21

Programming Process

Errors

Logic (Semantic) –

when there is no error from the perspective of the computer, but rather the program does something unexpected by the user.

Example:

The program prints:

The area of a square with a length of 3m is 6m

2Slide22

Programming Process

Errors

Bug

informal name for a Logic (or Run-Time) ErrorSlide23

Conclusion

-

Programming

is writing instructions for a computer to follow.

- Various

languages

have been invented over the years to assist programmers.

- While variations exist, there is a basic

process

for writing code in a HLL and translating it into ML, including use of a basic set of

tools.Slide24

Vocabulary

Term

Definition

Algorithm

A step-by-step set of instructions to accomplish a task

Program

A step-by-step set of instructions to accomplish a task expressed in a computer language.

Machine Language

Binary computer language that differs by CPU model…the

only

language a computer can follow.

Assembly Language

Language made up of simple text codes

for simplistic instructions. It differs by CPU model and has a 1-to-1 translation of commands into Machine Language.

High

Level Language

Language made up of more

complex and human-language-like codes with a 1-to-many translation of commands into Machine Language.

FORTRAN

Early language used to

solve mathematical/scientific/engineering problems.

COBOL

Early language used for business data processing.

C

Language

combining the functionality of a HLL with that of

Asssembly

, used to write Systems Software.Slide25

Vocabulary

Term

Definition

C++

An enhancement of the C language providing support for Object-Oriented Programming and language Extensibility.

Extensibility

The ability of a programmer to extend an existing language with new features.

Editor

Software tool that allows a programmer to write a program in a HLL.

Compiler

Software tool that translates a program in a HLL into Machine Language.

Linker

Software tool that combines Object Files into a single Executable.

Loader

Software tool that copies an Executable into memory and initiates program execution.

Source File

Text file that contains a program written in a HLL.

Object File

File that contains instructions in Machine Language, but is not a complete program.

Executable File

File that contains instructions in Machine Language that is a complete program.Slide26

Vocabulary

Term

Definition

Syntax Error

Violation of a HLL rule in a Source File, discovered by the Compiler

Compiler Error

(same as Syntax Error)

Link Error

Error meaning the Linker is unable to combine Object Files into an Executable

Load Error

Error meaning the Loader is unable to copy an Executable into memory and initiate program execution.

Run-Time Error

Error that occurs while a program is executing, causing the program to halt.

Logic Error

Unexpected output/behavior of a program when there is no other type of error.

Semantic Error

(same as Logic Error)

Bug

Informal word meaning Logic (or Run-Time) Error