58
Introduction to Programming

Introduction to Programming

  • Upload
    delu

  • View
    33

  • Download
    2

Embed Size (px)

DESCRIPTION

Introduction to Programming. Objectives. Look at why we write programs Describe some things it takes to learn to be a programmer Discuss some important programming tools Investigate how the computer works as it executes a program Describe the steps involved in creating and running a program . - PowerPoint PPT Presentation

Citation preview

Page 1: Introduction to Programming

Introduction to Programming

Page 2: Introduction to Programming

From code.org

Page 3: Introduction to Programming

Always code as if the guy who ends up maintaining your code is a violent

psychopath who knows where you live.

-- John Woods

Page 4: Introduction to Programming

“The computer programmer is a creator ofuniverses for which he alone is the lawgiver.No playwright, no stage director, no emperor,however powerful, has ever exercised suchabsolute authority to arrange a stage orfield of battle and to command such unswervinglydutiful actors or troops.”

--Joseph Weizenbaum

Page 5: Introduction to Programming

Programming is the art of doing onething at a time.

-- Michael C. Feathers

Page 6: Introduction to Programming

Our greatest glory is not in never falling,but in rising very time we fall.

-- Confucius

Page 7: Introduction to Programming

“This course will seem overwhelming the firstweek or two. But taken one step at a time,with careful study and attention to detail, youwill do well.”

-- me

Page 8: Introduction to Programming

Why would you want to learn to program?

• The sheer joy of making things – being creative • The pride in making something that is useful to other

people• The fascination of solving complex problems• Figuring out how to do something you’ve never done

before• Making a dumb machine do smart things• Earning a lot of money• This class is required …

Page 9: Introduction to Programming

Comment from a student …

“I want a career, not just a degree”

Page 10: Introduction to Programming

“I love those moments, often wee quiet hours of the morning, when you begin to see what is forming... It is like being there at the wheel with the clay in your hands. It is the joy of creating something beautiful, something purposeful, something delightful, something to share... Sharing in the joy of creation, software development can be a means of self-expression where we give substance to our abstract thoughts, ideas, and feelings.”

Page 11: Introduction to Programming
Page 12: Introduction to Programming

$70/hr * 40 hrs/week * 52 weeks/yr = $145,600/year

Page 13: Introduction to Programming

From the United Stated Department of Labor, 2012

Page 14: Introduction to Programming

What fields do programmers work in?

Page 15: Introduction to Programming

Robotics

Page 17: Introduction to Programming

Computer Graphics/Animation

Page 21: Introduction to Programming

Business/Finance

Page 22: Introduction to Programming

Engineering

Page 23: Introduction to Programming

Learning to program requires• Time• Patience• Good language skills• The ability to think abstractly• Good math skills• The ability to solve problems• Practice – Program, program, program• A sense of curiosity

Page 24: Introduction to Programming

Learning to Program Takes Time

Researchers have shown that learning to do anything well(playing the piano, painting, playing tennis, etc) takes about 10 years. Learning to be a good programmer is nodifferent.

To become proficient at programming Practice Practice Practice …

Page 25: Introduction to Programming

The rise of mathematics is heating up the job market for luminary quant's, especially at the Internet powerhouses where new math grads land six-figure salaries and rich stock deals. Tom Leighton, an entrepreneur and applied math professor at Massachusetts Institute of Technology, says: "All of my students have standing offers at Yahoo! and Google. Top mathematicians are becoming a new global elite. It's a force of barely 5,000, by some guesstimates, but every bit as powerful as the armies of Harvard University MBAs who shook up corner suites a generation ago.

Math Skills are Important

Business Week Cover StoryJanuary 23, 2006

Page 26: Introduction to Programming
Page 27: Introduction to Programming

What do Programmers Do?

They talk to their customers They talk to their peersThey discuss problemsThey think a lotThey write a lotThey design solutions to problemsThey write codeThey debug codeThey refactor codeThey test codeThey document codeThey fix code. . .

Page 28: Introduction to Programming
Page 29: Introduction to Programming
Page 30: Introduction to Programming

Google Offices

Page 31: Introduction to Programming

Programming ToolsThe computerThe operating systemThe code editorThe compilerThe debugger

IntegratedDevelopmentEnvironment

Problem solving skillsLanguage skills

Page 32: Introduction to Programming

The Computer

DataSegment

CodeSegment

Stack

Heap

Memory

Program Counter

Instruction Register

General Purpose Registers

Status Registers

Arithmetic andLogic Unit

CPU

Page 33: Introduction to Programming
Page 34: Introduction to Programming

The Computer

DataSegment

CodeSegment

Stack

Heap

Program Counter

Instruction Register

General Purpose Register

Status Registers

Arithmetic andLogic Unit

Page 35: Introduction to Programming

The Computer

DataSegment

CodeSegment

Stack

Heap

Program Counter

Instruction Register

General Purpose Register

Status Registers

Arithmetic andLogic Unit

Watch how the computer adds two numbers together …

Page 36: Introduction to Programming

The Computer

DataSegment

CodeSegment

Stack

Heap

Program Counter

Instruction Register

Register r1

Arithmetic andLogic Unit

ld r1, 24ld r2, 28add r1, r2sto r1, 32

Register r2

1012--

242832

60646872

60

addressThe program to be executed isstored in the code segment.The data is stored in the datasegment. The program counterpoints to the next instructionto be executed.

Page 37: Introduction to Programming

The Computer

DataSegment

CodeSegment

Stack

Heap

Program Counter

Instruction Register

Register r1

Arithmetic andLogic Unit

ld r1, 24ld r2, 28add r1, r2sto r1, 32

Register r2

1012--

242832

60646872

60

address

Page 38: Introduction to Programming

The Computer

DataSegment

CodeSegment

Stack

Heap

Program Counter

Instruction Register

Register r1

Arithmetic andLogic Unit

ld r1, 24ld r2, 28add r1, r2sto r1, 32

Register r2

1012--

242832

60646872

60

address

ld r1, 24

Page 39: Introduction to Programming

The Computer

DataSegment

CodeSegment

Stack

Heap

Program Counter

Instruction Register

Register r1

Arithmetic andLogic Unit

ld r1, 24ld r2, 28add r1, r2sto r1, 32

Register r2

1012--

242832

60646872

60

address

10

ld r1, 24

Page 40: Introduction to Programming

The Computer

DataSegment

CodeSegment

Stack

Heap

Program Counter

Instruction Register

Register r1

Arithmetic andLogic Unit

ld r1, 24ld r2, 28add r1, r2sto r1, 32

Register r2

1012--

242832

60646872

64

address

10

ld r1, 24

10

Page 41: Introduction to Programming

The Computer

DataSegment

CodeSegment

Stack

Heap

Program Counter

Instruction Register

Register r1

Arithmetic andLogic Unit

ld r1, 24ld r2, 28add r1, r2sto r1, 32

Register r2

1012--

242832

60646872

64

address

10

ld r1, 24

10

ld r2, 28

Page 42: Introduction to Programming

The Computer

DataSegment

CodeSegment

Stack

Heap

Program Counter

Instruction Register

Register r1

Arithmetic andLogic Unit

ld r1, 24ld r2, 28add r1, r2sto r1, 32

Register r2

1012--

242832

60646872

64

address

10

ld r2, 28

10

12

Page 43: Introduction to Programming

The Computer

DataSegment

CodeSegment

Stack

Heap

Program Counter

Instruction Register

Register r1

Arithmetic andLogic Unit

ld r1, 24ld r2, 28add r1, r2sto r1, 32

Register r2

1012--

242832

60646872

68

address

10

ld r2, 28

10

12

Page 44: Introduction to Programming

The Computer

DataSegment

CodeSegment

Stack

Heap

Program Counter

Instruction Register

Register r1

Arithmetic andLogic Unit

ld r1, 24ld r2, 28add r1, r2sto r1, 32

Register r2

1012--

242832

60646872

68

address

10

ld r2, 28

10

12

add r1, r2

Page 45: Introduction to Programming

The Computer

DataSegment

CodeSegment

Stack

Heap

Program Counter

Instruction Register

Register r1

Arithmetic andLogic Unit

ld r1, 24ld r2, 28add r1, r2sto r1, 32

Register r2

1012--

242832

60646872

68

address

10

add r1, r2

10

12

10

12

22

Page 46: Introduction to Programming

The Computer

DataSegment

CodeSegment

Stack

Heap

Program Counter

Instruction Register

Register r1

Arithmetic andLogic Unit

ld r1, 24ld r2, 28add r1, r2sto r1, 32

Register r2

1012--

242832

60646872

68

address

10

add r1, r2

10

12

22

Page 47: Introduction to Programming

The Computer

DataSegment

CodeSegment

Stack

Heap

Program Counter

Instruction Register

Register r1

Arithmetic andLogic Unit

ld r1, 24ld r2, 28add r1, r2sto r1, 32

Register r2

1012--

242832

60646872

72

address

10

ld r1, 24

22

12

sto r1, 32

Page 48: Introduction to Programming

The Computer

DataSegment

CodeSegment

Stack

Heap

Program Counter

Instruction Register

Register r1

Arithmetic andLogic Unit

ld r1, 24ld r2, 28add r1, r2sto r1, 32

Register r2

1012

242832

60646872

72

address

10

sto r1, 32

22

12

22

Page 49: Introduction to Programming

The Operating System

Manages the memory in the computerManages how and when programs are executedManages the devices attached to the computer and lots of other stuff …

Page 50: Introduction to Programming

The code editor provides a way forThe programmer to create and edit thesource code text for his or her program.

Editors provide tools to cut and paste sourceCode text, move between source code files,and do many other editing tasks.

Page 51: Introduction to Programming
Page 52: Introduction to Programming

static void Main( ){ int a = 5; int b = 27; . . .

source codecompiler

The Compiler

Page 53: Introduction to Programming

XvnvyiLklilHjfkkfol98Op09kijPlollkEtc…

IntermediateLanguage

source codecompiler

Page 54: Introduction to Programming

XvnvyiLklilHjfkkfol98Op09kijPlollkEtc…

IntermediateLanguage

Interpreter

compilersource code

code segment

data segment

stack segment

.exe

Page 55: Introduction to Programming

reserved foroperating

system

program A

program B

the heapthe heap is left overmemory, not being usedby any program. It ismanaged by the O/S.

code segment

data segment

stack segment

loader

program C

Page 56: Introduction to Programming

Visual Studio is an

Integrated Development Environment (IDE).It includes

* a code editor * a compiler * a debugger * and other development tools

Page 57: Introduction to Programming

If you have not completed lab #1,be sure to complete it and turn it inbefore 11:59pm on the due date.

Page 58: Introduction to Programming

Questions?