25
CS110: PROGRAMMING LANGUAGE I Lecture 1: Introduction Computer Science Department 1

CS110: PROGRAMMING LANGUAGE I - WordPress.com · Lecture Contents Computer Science Department Course Info. Elements of a Computer system. Evolution of programming languages The code

Embed Size (px)

Citation preview

Page 1: CS110: PROGRAMMING LANGUAGE I - WordPress.com · Lecture Contents Computer Science Department Course Info. Elements of a Computer system. Evolution of programming languages The code

CS110: PROGRAMMING

LANGUAGE I

Lecture 1: Introduction Computer Science

Department

1

Page 2: CS110: PROGRAMMING LANGUAGE I - WordPress.com · Lecture Contents Computer Science Department Course Info. Elements of a Computer system. Evolution of programming languages The code

Lecture Contents

Computer Science Department

Course Info.

Elements of a Computer system.

Evolution of programming languages

The code Life Cycle

2

Page 3: CS110: PROGRAMMING LANGUAGE I - WordPress.com · Lecture Contents Computer Science Department Course Info. Elements of a Computer system. Evolution of programming languages The code

Course info

Website

cs110spr14.wordpress.com

Books

Course plan

Assessment methods and grading

Labs and practical assignments

Practical exam

3

[1]

[2]

Page 4: CS110: PROGRAMMING LANGUAGE I - WordPress.com · Lecture Contents Computer Science Department Course Info. Elements of a Computer system. Evolution of programming languages The code

Elements of a Computer System

Computer Science Department

4

Hardware

Software

Computer

Page 5: CS110: PROGRAMMING LANGUAGE I - WordPress.com · Lecture Contents Computer Science Department Course Info. Elements of a Computer system. Evolution of programming languages The code

Hardware

5

Computer Science Department

Page 6: CS110: PROGRAMMING LANGUAGE I - WordPress.com · Lecture Contents Computer Science Department Course Info. Elements of a Computer system. Evolution of programming languages The code

Memory Unit 6

Ordered sequence of cells or locations

Stores instructions and data in binary

Types of memory

Read-Only Memory (ROM)

Random Access Memory (RAM)

Page 7: CS110: PROGRAMMING LANGUAGE I - WordPress.com · Lecture Contents Computer Science Department Course Info. Elements of a Computer system. Evolution of programming languages The code

Bit: A binary digit 0 or 1.

A sequence of eight bits is called a byte.

Binary Data 7

Computer Science Department

Page 8: CS110: PROGRAMMING LANGUAGE I - WordPress.com · Lecture Contents Computer Science Department Course Info. Elements of a Computer system. Evolution of programming languages The code

ASCII Code 8

Every letter, number, or special symbol (such as * or {) on your keyboard is encoded as a sequence of bits, each having a unique representation.

The most commonly used American Standard Code for Information Interchange (ASCII).

Page 9: CS110: PROGRAMMING LANGUAGE I - WordPress.com · Lecture Contents Computer Science Department Course Info. Elements of a Computer system. Evolution of programming languages The code

Computer Science Department

9

Central Processing Unit (CPU)

Executes stored instructions

Arithmetic/Logic Unit (ALU)

Performs arithmetic and logical operations

Control Unit

Controls the other components

Guarantees instructions are executed in sequence

Page 10: CS110: PROGRAMMING LANGUAGE I - WordPress.com · Lecture Contents Computer Science Department Course Info. Elements of a Computer system. Evolution of programming languages The code

Input and Output Devices 10

Interaction with humans

Gathers data (Input)

Displays results (Output)

Computer Science Department

Page 11: CS110: PROGRAMMING LANGUAGE I - WordPress.com · Lecture Contents Computer Science Department Course Info. Elements of a Computer system. Evolution of programming languages The code

Software

loads first when you turn on your PC

Also called the operating system.

The operating system monitors the overall activity of the computer and provides services, such as memory management, input/output activities, and storage management.

perform specific tasks

Examples :

Word processors

spreadsheets, and

games

11

Computer Science Department

System programs Application programs

Both operating systems and application programs are

written in programming languages.

Page 12: CS110: PROGRAMMING LANGUAGE I - WordPress.com · Lecture Contents Computer Science Department Course Info. Elements of a Computer system. Evolution of programming languages The code

12

Are Computers Intelligent?

Do we really need to be involved in programming

computers?

They have beaten world chess champions.

They help predict weather patterns.

They can perform arithmetic quickly.

So, a computer has an IQ of _____.

Computer Science Department

Page 13: CS110: PROGRAMMING LANGUAGE I - WordPress.com · Lecture Contents Computer Science Department Course Info. Elements of a Computer system. Evolution of programming languages The code

Computer Science Department

13

What is Computer Programming?

Planning or scheduling a sequence of steps for a

computer to follow to perform a task.

Basically, telling a computer what to do and how to

do it.

A program:

A sequence of steps to be performed by a computer.

Expressed in a computer language.

Page 14: CS110: PROGRAMMING LANGUAGE I - WordPress.com · Lecture Contents Computer Science Department Course Info. Elements of a Computer system. Evolution of programming languages The code

Computer Science Department

14

Computer Languages

A set of

Symbols (punctuation),

Special words or keywords (vocabulary),

And rules (grammar)

used to construct a program.

Page 15: CS110: PROGRAMMING LANGUAGE I - WordPress.com · Lecture Contents Computer Science Department Course Info. Elements of a Computer system. Evolution of programming languages The code

Evolution of Programming Languages

Computer Science Department

15

Languages differ in

Size (or complexity)

Readability

Expressivity (or writability)

"Level"

closeness to instructions for the CPU

Page 16: CS110: PROGRAMMING LANGUAGE I - WordPress.com · Lecture Contents Computer Science Department Course Info. Elements of a Computer system. Evolution of programming languages The code

Machine Language 16

Binary-coded instructions

Used directly by the CPU

Lowest level language

Every program step is ultimately

a machine language instruction

10010110

11101010

00010010

10101010

10010110

11101010

11111111

01010101

10101101

2034

2035

2036

2037

2038

2039

2040

2041

2042

Address Contents

Computer Science Department

Page 17: CS110: PROGRAMMING LANGUAGE I - WordPress.com · Lecture Contents Computer Science Department Course Info. Elements of a Computer system. Evolution of programming languages The code

Assembly Language

Computer Science Department

17

Each CPU instruction is labeled with a mnemonic.

Very-low level language

Almost 1 to 1 correspondence with machine language

Assembler: A program that translates a program written in

assembly language into an equivalent program in machine

language.

Mnemonic Instruction

ADD 10010011

MUL X,10

ADD X,Y

STO Z,20

SUB X,Z

Sample Program

Page 18: CS110: PROGRAMMING LANGUAGE I - WordPress.com · Lecture Contents Computer Science Department Course Info. Elements of a Computer system. Evolution of programming languages The code

Examples of Instructions in Assembly Language and

Machine Language 18

Computer Science Department

Page 19: CS110: PROGRAMMING LANGUAGE I - WordPress.com · Lecture Contents Computer Science Department Course Info. Elements of a Computer system. Evolution of programming languages The code

Computer Science Department

19

High-Level Languages

Closer to natural language

Each step maps to several

machine language instructions

Easier to state and solve

problems

Compiler: A program that

translates a program written

in a high-level language into

the equivalent machine

language.

Page 20: CS110: PROGRAMMING LANGUAGE I - WordPress.com · Lecture Contents Computer Science Department Course Info. Elements of a Computer system. Evolution of programming languages The code

Computer Science Department

20

Examples of High-Level Languages

Language Primary Uses

Pascal Learning to program

C++ General purpose

FORTRAN Scientific programming

PERL Web programming, text processing

Java Web programming, application

programming

COBOL Business

Page 21: CS110: PROGRAMMING LANGUAGE I - WordPress.com · Lecture Contents Computer Science Department Course Info. Elements of a Computer system. Evolution of programming languages The code

The java Language

Computer Science Department

21

source

program.

Saved in File

ClassName.ja

va

Page 22: CS110: PROGRAMMING LANGUAGE I - WordPress.com · Lecture Contents Computer Science Department Course Info. Elements of a Computer system. Evolution of programming languages The code

The Code life Cycle!!

Edit compile run

22

Page 23: CS110: PROGRAMMING LANGUAGE I - WordPress.com · Lecture Contents Computer Science Department Course Info. Elements of a Computer system. Evolution of programming languages The code

Processing a java program 23

Computer Science Department

Page 25: CS110: PROGRAMMING LANGUAGE I - WordPress.com · Lecture Contents Computer Science Department Course Info. Elements of a Computer system. Evolution of programming languages The code

Text book

[1] chapter 1 (pages 1-13)

That’s all for this week 25

Computer Science Department