introduction to computers and programming - class 1 1 introduction to computers and programming...

24
Introduction to Com puters and Programm 1 Introduction to Computers and Programming Professor Avi Rosenfeld

Upload: dayna-mason

Post on 19-Dec-2015

233 views

Category:

Documents


1 download

TRANSCRIPT

Introduction to Computers and Programming - Class 1

1

Introduction to Computers and Programming

Professor Avi Rosenfeld

Introduction to Computers and Programming - Class 1

2

Administrative Details

Course home page is at

www.cs.nyu.edu/courses/fall01/V22.0002-001/index.htm Syllabus is accessible from the home page There will be six homeworks, two midterms and a final There will be OPTIONAL homeworks given more

frequently Office hours are on Wednesday, 8:30-9:30 A.M., room 419

CIWW, and by appointment

Introduction to Computers and Programming - Class 1

3

About Me

Email: [email protected] Yeshiva University Web Page:

http://www.yu.edu/faculty/arosnfld/

Introduction to Computers and Programming - Class 1

4

Important Information

See the syllabus for more details on homework, midterms and the final

Class participation is important and will help your final grade

To proceed with further computer science courses in the undergraduate division, you *MUST* achieve a grade of C or better-NO EXCEPTIONS CAN BE MADE

Introduction to Computers and Programming - Class 1

5

Introduction

The purpose of this course is to teach you about computing, but particularly, programming in C (a powerful, widely-used programming language see Linux).

The goal of the course is to introduce you to the world of C.S. and to give you the ability to program independently.

Introduction to Computers and Programming - Class 1

6

What is a Computer?

Device capable of performing computations and enacting logical decisions

Computers process data through sets of instructions called computer programs

Programs guide the computer through actions as specified by people called computer programmers.

Introduction to Computers and Programming - Class 1

7

Elements of a Computer

Input devices (files, keyboards, mice, etc.) Output device (files, screen, printers, etc.) Memory (video, cache, flash, etc.) Arithmetic and logic unit (ALU) data process Central Processing Unit (CPU) control Secondary Storage (e.g. hard disk, floppy)

Introduction to Computers and Programming - Class 1

8

Hardware vs. Software

Hardware – Physical Components Software – Logical Instructions Firmware – Logical Instructions imprinted

on physical Components

Introduction to Computers and Programming - Class 1

9

How Does a Computer “think”?

Transistors form switches that are in “on” or “off” states.

The Pentium 4 chip has over 42 million transistors.

Each transistor creates one bit. 8 bits create one byte

Introduction to Computers and Programming - Class 1

10

Why are Bytes Important?

ASCII (American Standard Code for Information Interchange) tables

Unicode addresses the ASCII limitations http://www.asciitable.com/

Introduction to Computers and Programming - Class 1

11

Evolution of the Computer

Early computers used batch processing – one job (program) at a time Very inefficient, sometimes days till output produced Often automation techniques still run in batch.

Terminals used – “dumb” client Operating systems (OS’s) were first developed to

handle switching between jobs Multitasking Multithreading

Introduction to Computers and Programming - Class 1

12

Personal Computing

In 1977, Steve Jobs and Steve Wozniak popularized personal computing with the Apple (proprietary equipment)

In 1981, IBM introduced the IBM Personal Computer (PC), using “off-the-shelf” components

Today’s top PC’s are as powerful as the million dollar machines of only ten years ago. Aren’t “dumb” terminals.

Introduction to Computers and Programming - Class 1

13

Programming Languages

Machine language Hardware-dependent, cumbersome manipulation of

series of numbers (1’s and 0’s)

Assembly language, e.g.LOAD BALANCE

ADD TAX

STORE TOTAL

High-level languages (compiled or interpreted) Pascal, Lisp, Ada, Java, Basic, C, C++, etc.

Introduction to Computers and Programming - Class 1

14

The C Programming Language

C was originally created in 1972 by Dennis Ritchie at Bell Labs=

C is a relatively low-level high-level language; i.e. deals with numbers, characters, and memory addresses

Introduction to Computers and Programming - Class 1

15

Functions (“verbs” to Deitel)

C programs consist of modules called functions

Functions are groups of instructions that operate on data to produce and often return results

Known in other languages as methods, procedures, subs, among others

Introduction to Computers and Programming - Class 1

16

Objects (“Nouns” to Deitel)

Object-oriented programming seeks to model the behavior of objects There are data and operations (functions) that

work on just that data Benefits

Reusability Quicker development Easier maintenance

Introduction to Computers and Programming - Class 1

17

Structured Programming

Disciplined approach to writing programs that are clear, correct and easy to maintain and modify

The goal of this course is to make you into structured programming.

Introduction to Computers and Programming - Class 1

18

Creating Programs in C

Six basic steps Edit Preprocess Compile Link Load Execute

Introduction to Computers and Programming - Class 1

19

Editor

Used to create the program and store it on disk (secondary storage)

C programs should be saved with a .c extension

Introduction to Computers and Programming - Class 1

20

Preprocessor

Handles various manipulations before compiling, including Inclusion of additional specified files (e.g.

stdio.h, stdafx.h) Text replacement

Results in more efficient, clearer and less unwieldy code

Introduction to Computers and Programming - Class 1

21

Compiler

Translates the saved program file to machine language (a/k/a object code) and saves it to a file

Introduction to Computers and Programming - Class 1

22

Linker

Links object code from any additional specified files into appropriate places in your code

Produces a file that is an executable image of the linked object code and stores it on the disk

Introduction to Computers and Programming - Class 1

23

Loader

Puts the executable image (instructions) from the disk into primary memory

Introduction to Computers and Programming - Class 1

24

Execute

CPU takes each instruction in primary memory and executes it

CPU may also store new data values as program executes